zoukankan      html  css  js  c++  java
  • @select 添加判断

    添加两个 使用例子, 供参考:
    @Select({"<script>",
    "select",
    " seatName,SUM(profit) as profit",
    "from td_seat_single_code_profit",
    "where code = #{queryType,jdbcType=VARCHAR} ",
    "<![CDATA[ and tradeDate >= #{startDate,jdbcType=INTEGER} and tradeDate <= #{endDate,jdbcType=INTEGER} ]]>",
    "GROUP BY seatName ",
    "<if test='!flag'>ORDER BY profit </if> ",
    "<if test='flag'>ORDER BY profit desc</if> ",
    "LIMIT #{rankSize,jdbcType=INTEGER}",
    "</script> "})
    List<TdSeadeProfit> getSeatProfitListByParam(@Param("rankSize") int rankSize, @Param("startDate") int startDate, @Param("endDate") int endDate, @Param("queryType") String queryType, @Param("flag") boolean flag);

    @Select({"<script>",
    "SELECT seatName,SUM(profit) as profit FROM td_seat_code_chain_profit where ",
    " type = #{queryFlag,jdbcType=INTEGER}",
    " <if test='queryFlag ==1'>and tradingCode =#{queryType,jdbcType=VARCHAR} </if>",
    " <if test='queryFlag ==2'>and industrialChain =#{queryType,jdbcType=VARCHAR} </if>",
    "<![CDATA[ and tradeDate >= #{startDate,jdbcType=INTEGER} and tradeDate <= #{endDate,jdbcType=INTEGER} ]]>",
    "GROUP BY seatName ",
    "<if test='!flag'>ORDER BY profit </if> ",
    "<if test='flag'>ORDER BY profit desc</if> ",
    "LIMIT #{rankSize,jdbcType=INTEGER}",
    "</script> "})
    List<TdSeatCinProfit> getSeatProfitListByParam(@Param("rankSize") int rankSize, @Param("startDate") int startDate, @Param("endDate") int endDate, @Param("queryFlag") int queryFlag, @Param("queryType")String queryType,@Param("flag") boolean flag);

    注意大于小于的转义或者使用 <![CDATA[ ]]>包裹表达式
  • 相关阅读:
    [tip]build x86+x64 parrelly for your VS solution
    float double的内存表示及比较大小的方法
    [Problem 13]欧拉
    Interface Project
    [复习]内存对齐
    [tip]VS online Gallery in Extention Manager
    [Problem 14]欧拉
    “火柴棍式”程序员面试题打破惯性思维
    [复习]时间复杂度及计算
    ModuleCatalog配置文件
  • 原文地址:https://www.cnblogs.com/redBack/p/11804772.html
Copyright © 2011-2022 走看看