Mybatis语法笔记


  <
sql id="queryColumn"> id, name name, mobile mobile, </sql> <select id="findList" resultType="hk.com.easypay.bf.modules.p2p.modules.finance.entity.FinanceDto"> SELECT <include refid="queryColumn"></include> FROM T_FINANCE A WHERE 1 = 1 <if test="name != null and name != '' "> AND (A.NAME like '%${name}' or A.NAME like '${name}%' or A.NAME like '%${name}%') </if> <if test="mobile != null and mobile != '' "> AND A.MOBILE = #{mobile, jdbcType=VARCHAR} </if> ORDER BY A.CREATE_TIME DESC </select>
  <select id="queryAreaData" resultType="hk.com.easypay.bf.modules.yhb.app.basic.entity.AreaDataDto">
        SELECT A.ID code,A.NAME,
        (SELECT group_concat(CONCAT('{"code":"',t.id,'",'),CONCAT('"name":"',t.NAME,'"}') SEPARATOR '/') 
          FROM (SELECT b.PARENT_ID,b.id,b.NAME FROM ADS_ADDRESS b where b.level_type =3 GROUP BY b.id,b.NAME)t where t.PARENT_ID=a.id) chird FROM ADS_ADDRESS A WHERE A.LEVEL_TYPE =2 GROUP BY A.ID,A.NAME
</select>
  <select id="exportBounce" resultType="hk.com.easypay.bf.modules.email.entity.StatisBounceDto">
        SELECT 
            ID id,
            EPAPER_ID epaperId,
            EMAIL email,
            NAME name,
            TYPE type,
            CREATE_DATE createDate 
        FROM 
            user_bounce_old 
        WHERE epaper_id IN
        <foreach item="item" index="index" collection="array" open="(" separator="," close=")">  
            #{item}  
        </foreach>
    </select>
  <insert id="insertBounce">
        INSERT INTO user_bounce_old(
            EPAPER_ID, 
            EMAIL, 
            NAME, 
            TYPE
        )VALUES
        <foreach collection="list" item="item" index="index" open="(" separator="),(" close=")">
            #{item.epaperId},
            #{item.email},
            #{item.name},
            #{item.type}
         </foreach>
    </insert>

 

<select id="queryBouncePage" parameterType="java.util.Map" resultType="JavaBean">
        SELECT 
            * 
        FROM 
            USER_BOUNCE 
        WHERE EPAPER_ID IN
        <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">  
            #{item}  
        </foreach>
        <if test="_parameter.containsKey('pageNo') and _parameter.containsKey('pageSize')">
            limit #{pageNo}, #{pageSize}
        </if>
    </select>

 

你可能感兴趣的:(Mybatis语法笔记)