You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
183 lines
7.8 KiB
XML
183 lines
7.8 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.glxp.api.admin.dao.purchase.SupCompanyDao">
|
|
|
|
|
|
<select id="findCompany" parameterType="java.lang.String"
|
|
resultType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
SELECT *
|
|
FROM sup_company
|
|
where customerId = #{CustomerId}
|
|
</select>
|
|
|
|
|
|
<select id="filterCompany" parameterType="com.glxp.api.admin.req.purchase.FilterSupCompanyRequest"
|
|
resultType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
SELECT * FROM sup_company
|
|
<where>
|
|
<if test="customerId != null and customerId != ''">
|
|
and parentIdFk = #{customerId}
|
|
</if>
|
|
<if test="companyName != null and companyName != ''">
|
|
and companyName like concat('%',#{companyName},'%')
|
|
</if>
|
|
<if test="creditNum != null and creditNum != ''">
|
|
and creditNum like concat('%',#{creditNum},'%')
|
|
</if>
|
|
<if test="auditStatus != null and auditStatus !=20 and auditStatus !=21 and auditStatus !=22">
|
|
and auditStatus = #{auditStatus}
|
|
</if>
|
|
|
|
<if test="auditStatus ==20">
|
|
and (auditStatus = 0 or auditStatus=5 or auditStatus=2)
|
|
</if>
|
|
|
|
<if test="auditStatus ==21">
|
|
and <![CDATA[ auditStatus <> 0 ]]>
|
|
</if>
|
|
|
|
<if test="auditStatus ==22">
|
|
and (auditStatus = 1 or auditStatus=4 )
|
|
</if>
|
|
|
|
<if test="unitIdFk != null and unitIdFk != ''">
|
|
and unitIdFk = #{unitIdFk}
|
|
</if>
|
|
<if test="lastUpdateTime!=null and lastUpdateTime!=''">
|
|
<![CDATA[ and DATE_FORMAT(updateTime, '%Y-%m-%d %H:%i:%S')>= DATE_FORMAT(#{lastUpdateTime}, '%Y-%m-%d %H:%i:%S') ]]>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<delete id="deleteCompany" parameterType="java.lang.Long">
|
|
delete
|
|
from sup_company
|
|
where customerId = #{customerId}
|
|
</delete>
|
|
|
|
<select id="findCompanyByName" parameterType="java.lang.String"
|
|
resultType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
|
|
SELECT *
|
|
FROM sup_company
|
|
where companyName = #{companyName}
|
|
</select>
|
|
|
|
<select id="getSubCompany" parameterType="com.glxp.api.admin.req.purchase.FilterSupCompanyRequest"
|
|
resultType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
SELECT * FROM sup_company
|
|
<where>
|
|
<if test="customerId != null and customerId != ''">
|
|
and parentIdFk = #{customerId}
|
|
</if>
|
|
<if test="companyName != null and companyName != ''">
|
|
and companyName like concat('%',#{companyName},'%')
|
|
</if>
|
|
<if test="creditNum != null and creditNum != ''">
|
|
and creditNum like concat('%',#{creditNum},'%')
|
|
</if>
|
|
<if test="auditStatus != null and auditStatus != ''">
|
|
and auditStatus = #{auditStatus}
|
|
</if>
|
|
<if test="unitIdFk != null and unitIdFk != ''">
|
|
and unitIdFk = #{unitIdFk}
|
|
</if>
|
|
<if test="(auditStatus == null or auditStatus == '') and auditStatusList != null and auditStatusList.size() >0">
|
|
<foreach collection="auditStatusList" item="auditStatus" open="AND (" separator="OR" close=")">
|
|
auditStatus = #{auditStatus,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getSubCompany2" parameterType="com.glxp.api.admin.req.purchase.FilterSupCompanyRequest"
|
|
resultType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
SELECT *
|
|
FROM (company
|
|
inner JOIN company_product_relevance
|
|
ON company.customerId = company_product_relevance.customerId)
|
|
inner JOIN company_salesman
|
|
ON company.customerId = company_salesman.customerId
|
|
<where>
|
|
<if test="customerId != null and customerId != ''">
|
|
and parentIdFk = #{customerId}
|
|
</if>
|
|
<if test="companyName != null and companyName != ''">
|
|
and companyName like concat('%',#{companyName},'%')
|
|
</if>
|
|
<if test="creditNum != null and creditNum != ''">
|
|
and creditNum like concat('%',#{creditNum},'%')
|
|
</if>
|
|
<if test="auditStatus != null and auditStatus != ''">
|
|
and (company.auditStatus = #{auditStatus}
|
|
or company_product_relevance.auditStatus = #{auditStatus}
|
|
or company_salesman.auditStatus = #{auditStatus})
|
|
</if>
|
|
<if test="(auditStatus == null or auditStatus == '') and auditStatusList != null and auditStatusList.size() >0">
|
|
<foreach collection="auditStatusList" item="auditStatus" open="AND (" separator="OR" close=")">
|
|
auditStatus = #{auditStatus,jdbcType=VARCHAR}
|
|
</foreach>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<update id="modifyCompany" parameterType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
|
|
UPDATE sup_company
|
|
<trim prefix="set" suffixOverrides=",">
|
|
<if test="companyName != null">companyName=#{companyName},</if>
|
|
<if test="bussinessStatus != null">bussinessStatus=#{bussinessStatus},</if>
|
|
<if test="creditNum != null">creditNum=#{creditNum},</if>
|
|
<if test="classes != null">classes=#{classes},</if>
|
|
<if test="area != null">area=#{area},</if>
|
|
<if test="detailAddr != null">detailAddr=#{detailAddr},</if>
|
|
<if test="appId != null">appId=#{appId},</if>
|
|
<if test="appSecret != null">appSecret=#{appSecret},</if>
|
|
<if test="contacts != null">contacts=#{contacts},</if>
|
|
<if test="mobile != null">mobile=#{mobile},</if>
|
|
<if test="tel != null">tel=#{tel},</if>
|
|
<if test="email != null">email=#{email},</if>
|
|
<if test="areaCode != null">areaCode=#{areaCode},</if>
|
|
<if test="auditStatus != null">auditStatus=#{auditStatus},</if>
|
|
<if test="createTime != null">createTime=#{createTime},</if>
|
|
<if test="createBy != null">createBy=#{createBy},</if>
|
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
|
<if test="auditTime != null">auditTime=#{auditTime},</if>
|
|
<if test="auditComment != null">auditComment=#{auditComment},</if>
|
|
<if test="editStatus != null">editStatus=#{editStatus},</if>
|
|
|
|
</trim>
|
|
WHERE customerId=#{customerId}
|
|
|
|
|
|
</update>
|
|
|
|
<insert id="insertCompany" parameterType="com.glxp.api.admin.entity.purchase.SupCompanyEntity">
|
|
replace INTO sup_company(companyName, bussinessStatus, creditNum, classes, area,
|
|
detailAddr, appId, appSecret, contacts, mobile, tel, email, customerId, areaCode,
|
|
auditStatus, unitIdFk, createTime, createBy, updateTime, auditTime, auditComment,
|
|
editStatus)
|
|
values (#{companyName},
|
|
#{bussinessStatus},
|
|
#{creditNum},
|
|
#{classes},
|
|
#{area},
|
|
#{detailAddr},
|
|
#{appId},
|
|
#{appSecret},
|
|
#{contacts},
|
|
#{mobile},
|
|
#{tel},
|
|
#{email},
|
|
#{customerId},
|
|
#{areaCode},
|
|
#{auditStatus},
|
|
#{unitIdFk},
|
|
#{createTime},
|
|
#{createBy},
|
|
#{updateTime},
|
|
#{auditTime}, #{auditComment}, #{editStatus})
|
|
</insert>
|
|
|
|
|
|
</mapper> |