292 lines
17 KiB
XML
292 lines
17 KiB
XML
<?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.xdadan.erp.emis.mapper.EmisSupplierMapper">
|
|
|
|
<resultMap type="EmisSupplier" id="EmisSupplierResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
|
|
<result property="id" column="id" />
|
|
<result property="code" column="code" />
|
|
<result property="name" column="name" />
|
|
<result property="nameEn" column="name_en" />
|
|
<result property="settledType" column="settled_type" />
|
|
<result property="transType" column="trans_type" />
|
|
<result property="bizSite" column="biz_site" />
|
|
<result property="bizSiteName" column="biz_site_name" />
|
|
<result property="companyName" column="company_name" />
|
|
<result property="companyType" column="company_type" />
|
|
<result property="licenceNo" column="licence_no" />
|
|
<result property="country" column="country" />
|
|
<result property="province" column="province" />
|
|
<result property="city" column="city" />
|
|
<result property="district" column="district" />
|
|
<result property="address" column="address" />
|
|
<result property="feeItemRel" column="fee_item_rel" />
|
|
<result property="tel" column="tel" />
|
|
<result property="email" column="email" />
|
|
<result property="contact" column="contact" />
|
|
<result property="phone" column="phone" />
|
|
<result property="status" column="status" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmisSupplierVo">
|
|
select id, code, name, name_en, settled_type, trans_type, biz_site, biz_site_name, company_name, company_type, licence_no, country, province, city, district, address, fee_item_rel, tel, email, contact, phone, status, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_supplier
|
|
</sql>
|
|
|
|
<select id="selectEmisSupplierList" parameterType="EmisSupplier" resultMap="EmisSupplierResult">
|
|
<include refid="selectEmisSupplierVo"/>
|
|
<where>
|
|
del_flag='0'
|
|
<if test="id != null "> and id = #{id}</if>
|
|
<if test="code != null and code != ''"> and FIND_IN_SET(code,#{code})</if>
|
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
<if test="nameEn != null and nameEn != ''"> and name_en like concat('%', #{nameEn}, '%')</if>
|
|
<if test="settledType != null and settledType != ''"> and settled_type=#{settledType}</if>
|
|
<if test="transType != null and transType != ''"> and trans_type=#{transType}</if>
|
|
|
|
<if test="bizSite != null and bizSite != ''"> and FIND_IN_SET(#{bizSite},biz_site) </if>
|
|
|
|
<if test="bizSiteName != null and bizSiteName != ''"> and biz_site_name like concat('%', #{bizSiteName}, '%')</if>
|
|
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
|
<if test="companyType != null and companyType != ''"> and company_type like concat('%', #{companyType}, '%')</if>
|
|
<if test="licenceNo != null and licenceNo != ''"> and licence_no like concat('%', #{licenceNo}, '%')</if>
|
|
<if test="country != null and country != ''"> and country like concat('%', #{country}, '%')</if>
|
|
<if test="province != null and province != ''"> and province like concat('%', #{province}, '%')</if>
|
|
<if test="city != null and city != ''"> and city like concat('%', #{city}, '%')</if>
|
|
<if test="district != null and district != ''"> and district like concat('%', #{district}, '%')</if>
|
|
<if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
|
|
<if test="tel != null and tel != ''"> and tel like concat('%', #{tel}, '%')</if>
|
|
<if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
|
|
<if test="contact != null and contact != ''"> and contact like concat('%', #{contact}, '%')</if>
|
|
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
|
|
<if test="status != null "> and status = #{status}</if>
|
|
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
|
|
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
|
|
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
|
|
<if test="createTime != null "> and create_time = #{createTime}</if>
|
|
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
|
|
<if test="updateTime != null "> and update_time = #{updateTime}</if>
|
|
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
|
|
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
|
|
|
|
<if test="feeItemRel != null and feeItemRel != ''">
|
|
and FIND_IN_SET(#{feeItemRel},fee_item_rel)
|
|
</if>
|
|
|
|
|
|
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
|
and FIND_IN_SET(#{params.privSiteCode},biz_site)
|
|
</if>
|
|
|
|
</where>
|
|
|
|
<if test="params.codeSortList != null ">
|
|
ORDER BY FIELD
|
|
<foreach collection="params.codeSortList" item="item" open="(code," separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="params.codeSortList == null ">
|
|
ORDER BY create_time desc
|
|
</if>
|
|
|
|
</select>
|
|
|
|
<select id="checkUnique" parameterType="EmisSupplier" resultType="int">
|
|
select count(1) from emis_supplier
|
|
where del_flag='0'
|
|
and id = #{id}
|
|
and code = #{code}
|
|
and name = #{name}
|
|
and name_en = #{nameEn}
|
|
and settled_type = #{settledType}
|
|
and trans_type = #{transType}
|
|
and biz_site = #{bizSite}
|
|
and biz_site_name = #{bizSiteName}
|
|
and company_name = #{companyName}
|
|
and company_type = #{companyType}
|
|
and licence_no = #{licenceNo}
|
|
and country = #{country}
|
|
and province = #{province}
|
|
and city = #{city}
|
|
and district = #{district}
|
|
and address = #{address}
|
|
and tel = #{tel}
|
|
and email = #{email}
|
|
and contact = #{contact}
|
|
and phone = #{phone}
|
|
and status = #{status}
|
|
and remark = #{remark}
|
|
and del_flag = #{delFlag}
|
|
and create_by = #{createBy}
|
|
and create_time = #{createTime}
|
|
and update_by = #{updateBy}
|
|
and update_time = #{updateTime}
|
|
and create_site = #{createSite}
|
|
and update_site = #{updateSite}
|
|
limit 1
|
|
</select>
|
|
|
|
<select id="selectEmisSupplierById" parameterType="Long" resultMap="EmisSupplierResult">
|
|
select id, code, name, name_en, settled_type, trans_type, biz_site, biz_site_name, company_name, company_type, licence_no, country, province, city, district, address, fee_item_rel, tel, email, contact, phone, status, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_supplier a
|
|
where a.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectEmisSupplierByName" parameterType="String" resultMap="EmisSupplierResult">
|
|
select id, code, name, name_en, settled_type, trans_type, biz_site, biz_site_name, company_name, company_type, licence_no, country, province, city, district, address, fee_item_rel, tel, email, contact, phone, status, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
|
from emis_supplier a
|
|
where a.del_flag='0' and a.name = #{name}
|
|
</select>
|
|
|
|
<insert id="insertEmisSupplier" parameterType="EmisSupplier" useGeneratedKeys="true" keyProperty="id">
|
|
insert into emis_supplier
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="code != null and code != ''">code,</if>
|
|
<if test="name != null and name != ''">name,</if>
|
|
<if test="nameEn != null and nameEn != ''">name_en,</if>
|
|
<if test="settledType != null and settledType != ''">settled_type,</if>
|
|
<if test="transType != null and transType != ''">trans_type,</if>
|
|
<if test="bizSite != null and bizSite != ''">biz_site,</if>
|
|
<if test="bizSiteName != null and bizSiteName != ''">biz_site_name,</if>
|
|
<if test="companyName != null and companyName != ''">company_name,</if>
|
|
<if test="companyType != null and companyType != ''">company_type,</if>
|
|
<if test="licenceNo != null and licenceNo != ''">licence_no,</if>
|
|
<if test="country != null and country != ''">country,</if>
|
|
<if test="province != null and province != ''">province,</if>
|
|
<if test="city != null and city != ''">city,</if>
|
|
<if test="district != null and district != ''">district,</if>
|
|
<if test="address != null and address != ''">address,</if>
|
|
<if test="feeItemRel != null and feeItemRel != ''">fee_item_rel,</if>
|
|
<if test="tel != null and tel != ''">tel,</if>
|
|
<if test="email != null and email != ''">email,</if>
|
|
<if test="contact != null and contact != ''">contact,</if>
|
|
<if test="phone != null and phone != ''">phone,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="remark != null and remark != ''">remark,</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="createSite != null and createSite != ''">create_site,</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="code != null and code != ''">#{code},</if>
|
|
<if test="name != null and name != ''">#{name},</if>
|
|
<if test="nameEn != null and nameEn != ''">#{nameEn},</if>
|
|
<if test="settledType != null and settledType != ''">#{settledType},</if>
|
|
<if test="transType != null and transType != ''">#{transType},</if>
|
|
<if test="bizSite != null and bizSite != ''">#{bizSite},</if>
|
|
<if test="bizSiteName != null and bizSiteName != ''">#{bizSiteName},</if>
|
|
<if test="companyName != null and companyName != ''">#{companyName},</if>
|
|
<if test="companyType != null and companyType != ''">#{companyType},</if>
|
|
<if test="licenceNo != null and licenceNo != ''">#{licenceNo},</if>
|
|
<if test="country != null and country != ''">#{country},</if>
|
|
<if test="province != null and province != ''">#{province},</if>
|
|
<if test="city != null and city != ''">#{city},</if>
|
|
<if test="district != null and district != ''">#{district},</if>
|
|
<if test="address != null and address != ''">#{address},</if>
|
|
<if test="feeItemRel != null and feeItemRel != ''">#{feeItemRel},</if>
|
|
<if test="tel != null and tel != ''">#{tel},</if>
|
|
<if test="email != null and email != ''">#{email},</if>
|
|
<if test="contact != null and contact != ''">#{contact},</if>
|
|
<if test="phone != null and phone != ''">#{phone},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
|
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">#{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmisSupplier" parameterType="EmisSupplier">
|
|
update emis_supplier
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="code != null and code != ''">code = #{code},</if>
|
|
<if test="name != null and name != ''">name = #{name},</if>
|
|
<if test="nameEn != null and nameEn != ''">name_en = #{nameEn},</if>
|
|
<if test="settledType != null and settledType != ''">settled_type = #{settledType},</if>
|
|
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
|
|
<if test="bizSite != null and bizSite != ''">biz_site = #{bizSite},</if>
|
|
<if test="bizSiteName != null and bizSiteName != ''">biz_site_name = #{bizSiteName},</if>
|
|
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
|
|
<if test="companyType != null and companyType != ''">company_type = #{companyType},</if>
|
|
<if test="licenceNo != null and licenceNo != ''">licence_no = #{licenceNo},</if>
|
|
<if test="country != null and country != ''">country = #{country},</if>
|
|
<if test="province != null and province != ''">province = #{province},</if>
|
|
<if test="city != null and city != ''">city = #{city},</if>
|
|
<if test="district != null and district != ''">district = #{district},</if>
|
|
<if test="address != null and address != ''">address = #{address},</if>
|
|
<if test="feeItemRel != null and feeItemRel != ''">fee_item_rel = #{feeItemRel},</if>
|
|
<if test="tel != null and tel != ''">tel = #{tel},</if>
|
|
<if test="email != null and email != ''">email = #{email},</if>
|
|
<if test="contact != null and contact != ''">contact = #{contact},</if>
|
|
<if test="phone != null and phone != ''">phone = #{phone},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
|
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
|
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
|
|
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<select id="selectMaxSupplierCode" parameterType="String" resultType="Long">
|
|
select CONCAT(CONVERT(max(code),SIGNED)+1,'') as code
|
|
from emis_supplier
|
|
</select>
|
|
|
|
<delete id="deleteEmisSupplierById" parameterType="Long">
|
|
update emis_supplier set del_flag='1' where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmisSupplierByIds" parameterType="String">
|
|
update emis_supplier set del_flag='1' where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectSupplierInfoByConditions" parameterType="emisSupplier" resultMap="EmisSupplierResult">
|
|
select distinct r.supplier_code as code,
|
|
(SELECT GROUP_CONCAT(s.name ORDER BY FIND_IN_SET(s.code, r.supplier_code))
|
|
FROM emis_supplier s
|
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
|
AND s.del_flag = '0') as name,
|
|
(SELECT GROUP_CONCAT(s.name_en ORDER BY FIND_IN_SET(s.code, r.supplier_code))
|
|
FROM emis_supplier s
|
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
|
AND s.del_flag = '0') as name_en
|
|
from emis_trans_plan_rule r
|
|
<where>
|
|
r.del_flag = '0'
|
|
<if test="params.startSiteCode != null and params.startSiteCode != ''"> and r.start_site_code = #{params.startSiteCode}</if>
|
|
<if test="params.nextSiteCode != null and params.nextSiteCode != ''"> and r.next_site_code = #{params.nextSiteCode}</if>
|
|
<if test="code != null and code != ''"> and ( FIND_IN_SET(#{code},r.supplier_code) )</if>
|
|
<if test="name != null and name != ''">
|
|
and EXISTS (
|
|
SELECT 1 FROM emis_supplier s
|
|
WHERE FIND_IN_SET(s.code, r.supplier_code)
|
|
AND s.del_flag = '0'
|
|
AND s.name LIKE CONCAT('%', #{name}, '%')
|
|
)
|
|
</if>
|
|
</where>
|
|
order by id desc
|
|
</select>
|
|
|
|
<select id="selectSupplierNameByCode" parameterType="String" resultType="String">
|
|
SELECT name FROM emis_supplier WHERE code = #{code} LIMIT 1
|
|
</select>
|
|
</mapper> |