You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
4.2 KiB

<?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.qs.serve.modules.bms.mapper.BmsChannelMapper">
<resultMap id="bmsChannelMap" type="com.qs.serve.modules.bms.entity.BmsChannel" >
<result property="id" column="id"/>
<result property="channelCode" column="channel_code"/>
<result property="channelName" column="channel_name"/>
<result property="channelType" column="channel_type"/>
<result property="headChannel" column="head_channel"/>
<result property="headChannelCode" column="head_channel_code"/>
<result property="headChannelId" column="head_channel_id"/>
<result property="remark" column="remark"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="tenantId" column="tenant_id"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
<result property="costFlag" column="cost_flag"/>
</resultMap>
<sql id="bmsChannelSql">
bms_channel.`id`,
bms_channel.`channel_code`,
bms_channel.`channel_name`,
bms_channel.`channel_type`,
bms_channel.`head_channel`,
bms_channel.`head_channel_code`,
bms_channel.`head_channel_id`,
bms_channel.`remark`,
bms_channel.`create_time`,
bms_channel.`update_time`,
bms_channel.`tenant_id`,
bms_channel.`del_flag`,
bms_channel.`create_by`,
bms_channel.`update_by`,
bms_channel.`cost_flag` </sql>
<select id="selectChannelList" parameterType="com.qs.serve.modules.bms.entity.BmsChannel" resultMap="bmsChannelMap">
SELECT <include refid="bmsChannelSql"/> FROM
( SELECT channel_id FROM `bms_supplier_channel`
LEFT JOIN `his_user_supplier` ON `his_user_supplier`.supplier_id = bms_supplier_channel.supplier_id
where his_user_supplier.user_id in
<foreach collection="userIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
<if test="supplierId != null and supplierId != ''"> and bms_supplier_channel.supplier_id = #{supplierId}</if>
and `bms_supplier_channel`.`del_flag` = 0
GROUP BY channel_id
) tmp
left join `bms_channel` `bms_channel` ON `tmp`.channel_id = bms_channel.`id`
<where>
and `bms_channel`.`del_flag` = 0
<if test="query.id != null"> and `bms_channel`.`id` = #{query.id}</if>
<if test="query.channelCode != null and query.channelCode != ''"> and `bms_channel`.`channel_code` like concat('%',#{query.channelCode},'%')</if>
<if test="query.channelName != null and query.channelName != ''"> and `bms_channel`.`channel_name` like concat('%',#{query.channelName},'%') </if>
<if test="query.channelType != null and query.channelType != ''"> and `bms_channel`.`channel_type` = #{query.channelType}</if>
<if test="query.remark != null and query.remark != ''"> and `bms_channel`.`remark` = #{query.remark}</if>
<if test="query.createTime != null"> and `bms_channel`.`create_time` = #{query.createTime}</if>
<if test="query.updateTime != null"> and `bms_channel`.`update_time` = #{query.updateTime}</if>
<if test="query.tenantId != null and query.tenantId != ''"> and `bms_channel`.`tenant_id` = #{query.tenantId}</if>
<if test="query.delFlag != null and query.delFlag != ''"> and `bms_channel`.`del_flag` = #{query.delFlag}</if>
<if test="query.createBy != null and query.createBy != ''"> and `bms_channel`.`create_by` = #{query.createBy}</if>
<if test="query.updateBy != null and query.updateBy != ''"> and `bms_channel`.`update_by` = #{query.updateBy}</if>
<if test="query.costFlag != null"> and `bms_channel`.`cost_flag` = #{query.costFlag}</if>
</where>
order by bms_channel.id desc
</select>
</mapper>