ChannelMapper.xml 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.yami.shop.dao.ChannelMapper">
  4. <select id="selectByName" resultType="com.yami.shop.bean.model.Channel">
  5. select *
  6. from tz_channel
  7. where channel_name = #{channelName}
  8. </select>
  9. <select id="statisticsPage" resultType="com.yami.shop.bean.vo.ChannelVO">
  10. select
  11. c.id AS id,
  12. c.channel_no AS channelNo,
  13. c.channel_name AS channelName,
  14. c.type AS type,
  15. c.status AS status,
  16. c.create_time AS createTime,
  17. count(tu.user_id) AS staffCount,
  18. count(if(tu.status = 1, tu.user_id, null)) AS normalCount
  19. from tz_channel c left join tz_user tu on c.id = tu.channel_id
  20. <where>
  21. <if test="channel.channelName != null">
  22. and c.channel_name like concat('%',#{channel.channelName},'%')
  23. </if>
  24. <if test="channel.status != null">
  25. and c.status = #{channel.status}
  26. </if>
  27. </where>
  28. group by c.id
  29. </select>
  30. </mapper>