mybatis动态标签

xiaoxiao2021-02-28  96

 <delete id="delete" parameterType="***">         delete from ${dmlItem.tableName}         <choose>             <when test="dmlItem.id != null">                 where ***             </when>             <otherwise>                 where ***             </otherwise>         </choose>

    </delete>

  <select id="getOne" resultType="java.util.Map">         select         ${queryItem.fields}         <choose>             <when test   =   "queryItem.addRanking">                             from (

                                    select a.*, (@rownum:=@rownum+1) as ranking from ${queryItem.tableName} a, 

                                    (select  @rownum:=0) b                 <if  test  =  'queryItem.orders != null    and   !"".equals(queryItem.orders)'>                                    order by ${queryItem.orders}                 </if>                 

                ) c

            </when>             <otherwise>                            from ${queryItem.tableName}             </otherwise>         </choose>                           where 1 = 1                          ${queryItem.whereCondition}         <if test='queryItem.group != null and !"".equals(queryItem.group)'>                          group by ${queryItem.group}         </if>         <if test='queryItem.orders != null and !"".equals(queryItem.orders)'>                          order by ${queryItem.orders}         </if>         ${queryItem.pageFooter}     </select>

   <insert id="insertRateInfoList" useGeneratedKeys="true" parameterType="java.util.List">           insert into loan_rate(loan_id,loan_name,period_from,period_to)  values        <foreach collection="list"      item="item"      index="index"       separator="," >           (#{item.loan_id},#{item.loan_name},#{item.period_from},#{item.period_to})       </foreach>     </insert>

转载请注明原文地址: https://www.6miu.com/read-84619.html

最新回复(0)