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.

171 lines
9.8 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.BmsSupplierMapper">
<resultMap id="bmsSupplierMap" type="com.qs.serve.modules.bms.entity.BmsSupplier" >
<result property="id" column="id"/>
<result property="regionFirst" column="region_first"/>
<result property="regionSecond" column="region_second"/>
<result property="regionThird" column="region_third"/>
<result property="regionLast" column="region_last"/>
<result property="region2First" column="region2_first"/>
<result property="region2Second" column="region2_second"/>
<result property="region2Third" column="region2_third"/>
<result property="region2Last" column="region2_last"/>
<result property="address" column="address"/>
<result property="name" column="name"/>
<result property="code" column="code"/>
<result property="pid" column="pid"/>
<result property="parentCode" column="parent_code"/>
<result property="userId" column="user_id"/>
<result property="userCode" column="user_code"/>
<result property="userName" column="user_name"/>
<result property="stopFlag" column="stop_flag"/>
<result property="belong" column="belong"/>
<result property="otherUserIds" column="other_user_ids" typeHandler="com.qs.serve.common.framework.mybatis.handler.meta.SplitStringTypeHandler"/>
<result property="otherUserNames" column="other_user_names"/>
<result property="otherUserCodes" column="other_user_codes"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="tenantId" column="tenant_id"/>
<result property="costFlag" column="cost_flag"/>
<result property="delFlag" column="del_flag"/>
<result property="supplierFlag" column="supplier_flag"/>
</resultMap>
<sql id="bmsSupplierSql">
bms_supplier.`id`,
bms_supplier.`region_first`,
bms_supplier.`region_second`,
bms_supplier.`region_third`,
bms_supplier.`region_last`,
bms_supplier.`region2_first`,
bms_supplier.`region2_second`,
bms_supplier.`region2_third`,
bms_supplier.`region2_last`,
bms_supplier.`address`,
bms_supplier.`name`,
bms_supplier.`code`,
bms_supplier.`pid`,
bms_supplier.`parent_code`,
bms_supplier.`user_id`,
bms_supplier.`user_code`,
bms_supplier.`user_name`,
bms_supplier.`other_user_ids`,
bms_supplier.`other_user_names`,
bms_supplier.`other_user_codes`,
bms_supplier.`stop_flag`,
bms_supplier.`belong`,
bms_supplier.`create_time`,
bms_supplier.`create_by`,
bms_supplier.`update_time`,
bms_supplier.`update_by`,
bms_supplier.`tenant_id`,
bms_supplier.`cost_flag`,
bms_supplier.`supplier_flag`,
bms_supplier.`del_flag` </sql>
<select id="selectSupplierList" parameterType="com.qs.serve.modules.bms.entity.BmsSupplier" resultMap="bmsSupplierMap">
SELECT <include refid="bmsSupplierSql"/> FROM `bms_supplier` `bms_supplier`
<where>
<if test="query.id != null"> and `bms_supplier`.`id` = #{query.id}</if>
<if test="query.regionFirst != null"> and `bms_supplier`.`region_first` = #{query.regionFirst}</if>
<if test="query.regionSecond != null"> and `bms_supplier`.`region_second` = #{query.regionSecond}</if>
<if test="query.regionThird != null"> and `bms_supplier`.`region_third` = #{query.regionThird}</if>
<if test="query.supplierFlag != null"> and `bms_supplier`.`supplier_flag` = #{query.supplierFlag}</if>
<if test="query.address != null and query.address != ''"> and `bms_supplier`.`address` = #{query.address}</if>
<if test="query.name != null and query.name != ''"> and `bms_supplier`.`name` like concat('%',#{query.name},'%') </if>
<if test="query.code != null and query.code != ''"> and `bms_supplier`.`code` like concat('%',#{query.code},'%') </if>
<if test="query.pid != null"> and `bms_supplier`.`pid` = #{query.pid}</if>
<if test="query.parentCode != null and query.parentCode != ''"> and `bms_supplier`.`parent_code` = #{query.parentCode}</if>
<if test="query.stopFlag != null"> and `bms_supplier`.`stop_flag` = #{query.stopFlag}</if>
<if test="query.belong != null and query.belong != ''"> and `bms_supplier`.`belong` = #{query.belong}</if>
<if test="query.createTime != null"> and `bms_supplier`.`create_time` = #{query.createTime}</if>
<if test="query.createBy != null and query.createBy != ''"> and `bms_supplier`.`create_by` = #{query.createBy}</if>
<if test="query.updateTime != null"> and `bms_supplier`.`update_time` = #{query.updateTime}</if>
<if test="query.updateBy != null and query.updateBy != ''"> and `bms_supplier`.`update_by` = #{query.updateBy}</if>
<if test="query.tenantId != null and query.tenantId != ''"> and `bms_supplier`.`tenant_id` = #{query.tenantId}</if>
<if test="query.supplierFlag != null and query.supplierFlag != ''"> and `bms_supplier`.`supplier_flag` = #{query.supplierFlag}</if>
<if test="query.delFlag != null"> and `bms_supplier`.`del_flag` = #{query.delFlag}</if>
<if test="query.delFlag == null"> and `bms_supplier`.`del_flag` = '0'</if>
<if test="query.currUserId!=null and query.currUserId != ''">
and (`bms_supplier`.`user_id` = #{query.currUserId} or FIND_IN_SET(#{query.currUserId},`bms_supplier`.`other_user_ids`) )
</if>
<if test="query.searchUserName!=null and query.searchUserName != ''">
and (`bms_supplier`.`user_name` LIKE CONCAT('%',#{query.searchUserName},'%') or `bms_supplier`.`other_user_names` LIKE CONCAT('%',#{query.searchUserName},'%') )
</if>
<if test="query.searchUserCode!=null and query.searchUserCode != ''">
and (`bms_supplier`.`user_code` LIKE CONCAT('%',#{query.searchUserCode},'%') or `bms_supplier`.`other_user_codes` LIKE CONCAT('%',#{query.searchUserCode},'%') )
</if>
<if test="query.searchInIds!=null and query.searchInIds.size > 0">
and bms_supplier.id in
<foreach collection="query.searchInIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.regionIds!=null and query.regionIds.size > 0">
and bms_supplier.region_last in
<foreach collection="query.regionIds" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.searchRegionFirst!=null and query.searchRegionFirst.size > 0">
and bms_supplier.region_first in
<foreach collection="query.searchRegionFirst" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.searchRegionSecond!=null and query.searchRegionSecond.size > 0">
and bms_supplier.region_second in
<foreach collection="query.searchRegionSecond" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.region2Ids!=null and query.region2Ids.size > 0">
and bms_supplier.region2_last in
<foreach collection="query.region2Ids" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.searchRegion2First!=null and query.searchRegion2First.size > 0">
and bms_supplier.region2_first in
<foreach collection="query.searchRegion2First" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.searchRegion2Second!=null and query.searchRegion2Second.size > 0">
and bms_supplier.region2_second in
<foreach collection="query.searchRegion2Second" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test="query.searchRegion2Third!=null and query.searchRegion2Third.size > 0">
and bms_supplier.region2_third in
<foreach collection="query.searchRegion2Third" item ="selectId" index="i" open="(" close=")" separator=",">
#{selectId}
</foreach>
</if>
<if test='query.isRegionNull != null '>
<if test=' query.isRegionNull == "1"'>
and (`bms_supplier`.`region_last` is null or TRIM(`bms_supplier`.`region_last`) = ''
or `bms_supplier`.`region2_last` is null or TRIM(`bms_supplier`.`region2_last`) = ''
)
</if>
<if test=' query.isRegionNull != "1"'>
and `bms_supplier`.`region_last` is not null and `bms_supplier`.`region2_last` is not null
and TRIM(`bms_supplier`.`region_last`) != '' and TRIM(`bms_supplier`.`region2_last`) != ''
</if>
</if>
</where>
ORDER BY `bms_supplier`.`update_time` DESC
</select>
</mapper>