BrandEvolveMapper.xml 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.demo.mapper.BrandEvolveDao">
  6. <select id="selectByMulti" resultType="com.ruoyi.demo.entity.vo.BrandEvolveVo">
  7. SELECT
  8. brand_id,
  9. brand_name,
  10. SUM(count) total,
  11. DATE_FORMAT(stat_time, '%Y-%m') time
  12. FROM
  13. `bl_brand_evolve_statistics`
  14. <where>
  15. brand_id = #{brandId}
  16. <if test="addrCodes != null">
  17. <foreach collection="addrCodes" item="code" open="AND addr_code IN (" separator="," close=")">
  18. #{code,jdbcType=VARCHAR}
  19. </foreach>
  20. </if>
  21. <if test="typeCodes != null">
  22. <foreach collection="typeCodes" item="code" open="AND type_code_by IN (" separator="," close=")">
  23. #{code,jdbcType=VARCHAR}
  24. </foreach>
  25. </if>
  26. </where>
  27. GROUP BY
  28. brand_id,
  29. brand_name,
  30. time
  31. ORDER BY
  32. time;
  33. </select>
  34. </mapper>