| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.yami.shop.dao.ChannelMapper">
- <update id="updateSplitRule">
- update tz_channel
- set split_rule = 0
- where split_rule = #{splitRule}
- </update>
- <select id="selectByName" resultType="com.yami.shop.bean.model.Channel">
- select *
- from tz_channel
- where channel_name = #{channelName}
- </select>
- <select id="statisticsPage" resultType="com.yami.shop.bean.vo.ChannelVO">
- select
- c.id AS id,
- c.channel_no AS channelNo,
- c.channel_name AS channelName,
- c.type AS type,
- c.status AS status,
- c.create_time AS createTime,
- count(tu.user_id) AS staffCount,
- count(if(tu.status = 1, tu.user_id, null)) AS normalCount
- from tz_channel c left join tz_user tu on c.id = tu.channel_id
- <where>
- <if test="channel.channelName != null">
- and c.channel_name like concat('%',#{channel.channelName},'%')
- </if>
- <if test="channel.status != null">
- and c.status = #{channel.status}
- </if>
- <if test="channel.channelIdList != null and !channel.channelIdList.isEmpty()">
- and c.id in
- <foreach collection="channel.channelIdList" item="channelId" open="(" close=")" separator=",">
- #{channelId}
- </foreach>
- </if>
- <if test="channel.userAttrType != null and channel.userAttrType != '' and channel.userAttrType != 0">
- AND tu.user_attr_type = #{channel.userAttrType}
- </if>
- </where>
- group by c.id
- </select>
- <select id="queryMyChannel" resultType="com.yami.shop.bean.vo.IdNameVo">
- SELECT b.id,b.channel_name name FROM tz_sys_user_channel a
- LEFT JOIN tz_channel b on a.channel_id=b.id
- WHERE a.user_id=#{userId}
- </select>
- </mapper>
|