ChannelMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. <update id="updateSplitRule">
  5. update tz_channel
  6. set split_rule = 0
  7. where split_rule = #{splitRule}
  8. </update>
  9. <select id="selectByName" resultType="com.yami.shop.bean.model.Channel">
  10. select *
  11. from tz_channel
  12. where channel_name = #{channelName}
  13. </select>
  14. <select id="statisticsPage" resultType="com.yami.shop.bean.vo.ChannelVO">
  15. select
  16. c.id AS id,
  17. c.channel_no AS channelNo,
  18. c.channel_name AS channelName,
  19. c.type AS type,
  20. c.status AS status,
  21. c.create_time AS createTime,
  22. count(tu.user_id) AS staffCount,
  23. count(if(tu.status = 1, tu.user_id, null)) AS normalCount
  24. from tz_channel c left join tz_user tu on c.id = tu.channel_id
  25. <where>
  26. <if test="channel.channelName != null">
  27. and c.channel_name like concat('%',#{channel.channelName},'%')
  28. </if>
  29. <if test="channel.status != null">
  30. and c.status = #{channel.status}
  31. </if>
  32. <if test="channel.channelIdList != null and !channel.channelIdList.isEmpty()">
  33. and c.id in
  34. <foreach collection="channel.channelIdList" item="channelId" open="(" close=")" separator=",">
  35. #{channelId}
  36. </foreach>
  37. </if>
  38. <if test="channel.userAttrType != null and channel.userAttrType != '' and channel.userAttrType != 0">
  39. AND tu.user_attr_type = #{channel.userAttrType}
  40. </if>
  41. </where>
  42. group by c.id
  43. </select>
  44. <select id="queryMyChannel" resultType="com.yami.shop.bean.vo.IdNameVo">
  45. SELECT b.id,b.channel_name name FROM tz_sys_user_channel a
  46. LEFT JOIN tz_channel b on a.channel_id=b.id
  47. WHERE a.user_id=#{userId}
  48. </select>
  49. </mapper>