使用Mybatis plus xml 记录过程


 <select id="selectByConditions"
    resultType="com.springboot.domain.DemoQueryModel">

        select
        create_date ,
        identity ,
        user_count ,
        concat(sum(sd.xxxcount)) xxxcount
        from  user u
    <where>
      <if test="demoQueryModel.startDate != null ">
        AND u.create_date &gt;=  #{demoQueryModel.startDate}
      </if>
      <if test="demoQueryModel.endDate != null   ">
        AND u.create_date  &lt;=  #{demoQueryModel.endDate}
      </if>
      <if test="demoQueryModel.identity != null and demoQueryModel.identity.size>0">
        AND u.identity in
        <foreach collection="demoQueryModel.identity" item="demoQueryModel.identity" open="(" separator="," close=")">
          #{demoQueryModel.identity}
        </foreach>
      </if>
    </where>
        GROUP BY u.user_id 
  </select>

posted @ 2022-01-26 20:18  烫手的山芋  阅读(68)  评论(0编辑  收藏  举报