代码优化
This commit is contained in:
@ -67,6 +67,17 @@
|
||||
WHERE
|
||||
cas.supplier_id = #{vo.supplierId}
|
||||
AND cas.access_status IN (1,2)
|
||||
<if test="vo.categoryNames != null and vo.categoryNames != ''">
|
||||
AND (
|
||||
SELECT
|
||||
(SELECT GROUP_CONCAT(category_name ORDER BY FIND_IN_SET(id, c.ancestors) SEPARATOR '-')
|
||||
FROM cosco_category
|
||||
WHERE FIND_IN_SET(id, c.ancestors)
|
||||
) AS ancestor_names
|
||||
FROM cosco_category c
|
||||
WHERE id = casc.category_id
|
||||
) like concat('%', #{vo.categoryNames}, '%')
|
||||
</if>
|
||||
GROUP BY
|
||||
caw.update_time,
|
||||
cas.dept_id,
|
||||
|
@ -21,10 +21,12 @@
|
||||
m.content,
|
||||
m.`read`,
|
||||
m.type,
|
||||
dp.dic_name as typeCn,
|
||||
m.create_time,
|
||||
m.update_time
|
||||
FROM
|
||||
cosco_message m
|
||||
left join dict_project dp on m.type = dp.`code` and dp.parent_code = 'message_type'
|
||||
</sql>
|
||||
|
||||
<select id="selectCoscoMessageList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoMessage" resultMap="CoscoMessageResult">
|
||||
|
@ -130,10 +130,10 @@
|
||||
</insert>
|
||||
<insert id="batchCoscoSupplierBank" parameterType="java.util.List">
|
||||
insert into cosco_supplier_bank
|
||||
( id, supplier_id, interbank_number, bank, swift_code, account_name, account, currency, nation, province, city, del_flag, create_by, create_time, update_by, update_time, last_update_time)
|
||||
( id, supplier_id, interbank_number, bank, swift_code, account_name, account, currency, nation, province, city, create_by, create_time, update_by, update_time, last_update_time)
|
||||
values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.supplierId}, #{item.interbankNumber}, #{item.bank}, #{item.swiftCode}, #{item.accountName}, #{item.account}, #{item.currency}, #{item.nation}, #{item.province}, #{item.city}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
( #{item.id}, #{item.supplierId}, #{item.interbankNumber}, #{item.bank}, #{item.swiftCode}, #{item.accountName}, #{item.account}, #{item.currency}, #{item.nation}, #{item.province}, #{item.city}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateCoscoSupplierBank" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierBank">
|
||||
|
@ -48,13 +48,15 @@
|
||||
<result property="lastUpdateTime" column="last_update_time"/>
|
||||
<result property="supplierTypeCn" column="supplier_type_cn"/>
|
||||
<result property="accessStatusCn" column="access_status_cn"/>
|
||||
<result property="enterpriseTypeCn" column="enterprise_type_cn"/>
|
||||
<result property="currencyCn" column="currency_cn"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCoscoSupplierBaseVo">
|
||||
SELECT
|
||||
id,
|
||||
csb.id,
|
||||
dept_id,
|
||||
supplier_type,
|
||||
CASE supplier_type
|
||||
@ -66,6 +68,7 @@
|
||||
licence_accessory,
|
||||
licence_date,
|
||||
enterprise_type,
|
||||
dp.dic_name as enterprise_type_cn,
|
||||
name,
|
||||
name_en,
|
||||
social_credit_code,
|
||||
@ -85,6 +88,7 @@
|
||||
vat,
|
||||
taxpayer_id,
|
||||
currency,
|
||||
dpbz.dic_name as currency_cn,
|
||||
person_name,
|
||||
person_phone,
|
||||
person_bank,
|
||||
@ -122,7 +126,9 @@
|
||||
update_time,
|
||||
last_update_time
|
||||
FROM
|
||||
cosco_supplier_base
|
||||
cosco_supplier_base csb
|
||||
left join dict_project dp on csb.enterprise_type = dp.`code` and dp.parent_code = 'enterprise_type'
|
||||
left join dict_project dpbz on csb.currency = dpbz.`code` and dpbz.parent_code = 'currency'
|
||||
</sql>
|
||||
|
||||
|
||||
@ -135,6 +141,7 @@
|
||||
WHEN 'pe' THEN '个人'
|
||||
END AS supplier_type_cn,
|
||||
csb.enterprise_type,
|
||||
dp.dic_name as enterprise_type_cn,
|
||||
cas.id,
|
||||
cas.access_work_id,
|
||||
cas.supplier_id,
|
||||
@ -152,6 +159,7 @@
|
||||
LEFT JOIN cosco_supplier_base csb ON cas.supplier_id = csb.id
|
||||
left join cosco_access_supplier_category casc on csb.id = casc.supplier_id and casc.del_flag = 'normal'
|
||||
left join cosco_category cc on casc.category_id = cc.id and cc.del_flag = 'normal'
|
||||
left join dict_project dp on csb.enterprise_type = dp.`code` and dp.parent_code = 'enterprise_type'
|
||||
</sql>
|
||||
|
||||
|
||||
@ -161,9 +169,9 @@
|
||||
WHERE 1=1
|
||||
|
||||
<!-- 假设参数是 List<String> list -->
|
||||
<if test="vo.deptList != null and vo.deptList.size() > 0">
|
||||
AND id NOT IN
|
||||
<foreach collection="vo.deptList" item="item" open="(" separator="," close=")">
|
||||
<if test="vo.supplierBaseList != null and vo.supplierBaseList.size() > 0">
|
||||
AND csb.id NOT IN
|
||||
<foreach collection="vo.supplierBaseList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
@ -420,7 +428,7 @@
|
||||
and csb.social_credit_code = #{vo.socialCreditCode}
|
||||
</if>
|
||||
<if test="vo.accessStatus != null ">
|
||||
and csb.access_status = #{vo.accessStatus}
|
||||
and cas.access_status = #{vo.accessStatus}
|
||||
</if>
|
||||
<if test="vo.blacklistStatus != null ">
|
||||
and csb.blacklist_status = #{vo.blacklistStatus}
|
||||
@ -447,7 +455,8 @@
|
||||
cas.supplier_id,
|
||||
csb.`name`,
|
||||
caw.update_time ,
|
||||
csb.enterprise_type
|
||||
csb.enterprise_type,
|
||||
dp.dic_name
|
||||
order by csb.create_time desc
|
||||
</select>
|
||||
|
||||
@ -507,7 +516,8 @@
|
||||
cas.supplier_id,
|
||||
csb.`name`,
|
||||
caw.update_time ,
|
||||
csb.enterprise_type
|
||||
csb.enterprise_type,
|
||||
dp.dic_name
|
||||
order by csb.create_time desc
|
||||
</select>
|
||||
|
||||
@ -627,7 +637,7 @@
|
||||
<select id="selectCoscoSupplierBaseById" parameterType="String"
|
||||
resultMap="CoscoSupplierBaseResult">
|
||||
<include refid="selectCoscoSupplierBaseVo"/>
|
||||
where id = #{id}
|
||||
where csb.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCoscoSupplierBase"
|
||||
|
@ -24,6 +24,9 @@
|
||||
<result property="enterpriseType" column="enterprise_type"/>
|
||||
<result property="title" column="title"/>
|
||||
<result property="changeDesc" column="change_desc"/>
|
||||
<result property="enterpriseTypeCn" column="enterprise_type_cn"/>
|
||||
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCoscoSupplierChangeApplyVo">
|
||||
@ -97,13 +100,14 @@
|
||||
END AS supplier_type,
|
||||
sb.`name` AS supplierName,
|
||||
sb.enterprise_type,
|
||||
dp.dic_name as enterprise_type_cn,
|
||||
c.change_by,
|
||||
c.change_time,
|
||||
c.approve_status,
|
||||
CASE
|
||||
|
||||
WHEN c.approve_status = 0 THEN
|
||||
'审批中'
|
||||
'待审批'
|
||||
WHEN c.approve_status = 1 THEN
|
||||
'通过'
|
||||
WHEN c.approve_status = 2 THEN
|
||||
@ -116,6 +120,7 @@
|
||||
FROM
|
||||
cosco_supplier_change_apply c
|
||||
LEFT JOIN cosco_supplier_base sb ON c.supplier_id = sb.id
|
||||
left join dict_project dp on sb.enterprise_type = dp.`code` and dp.parent_code = 'enterprise_type'
|
||||
left join (
|
||||
SELECT
|
||||
cas.supplier_id,
|
||||
|
@ -21,11 +21,31 @@
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="lastUpdateTime" column="last_update_time"/>
|
||||
<result property="taxpayerTypeCn" column="taxpayer_type_cn"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectCoscoSupplierInvoiceVo">
|
||||
select id, supplier_id, taxpayer_type, taxpayer_code, phone, account, head, address, bank, qualification_certificate, del_flag, create_by, create_time, update_by, update_time, last_update_time
|
||||
from cosco_supplier_invoice
|
||||
SELECT
|
||||
csi.id,
|
||||
supplier_id,
|
||||
taxpayer_type,
|
||||
dp.dic_name as taxpayer_type_cn,
|
||||
taxpayer_code,
|
||||
phone,
|
||||
account,
|
||||
head,
|
||||
address,
|
||||
bank,
|
||||
qualification_certificate,
|
||||
del_flag,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
last_update_time
|
||||
FROM
|
||||
cosco_supplier_invoice csi
|
||||
left join dict_project dp on csi.taxpayer_type = dp.`code` and dp.parent_code = 'taxpayer_type'
|
||||
</sql>
|
||||
|
||||
|
||||
@ -107,7 +127,7 @@
|
||||
<select id="selectCoscoSupplierInvoiceById" parameterType="String"
|
||||
resultMap="CoscoSupplierInvoiceResult">
|
||||
<include refid="selectCoscoSupplierInvoiceVo"/>
|
||||
where id = #{id}
|
||||
where csi.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertCoscoSupplierInvoice" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierInvoice">
|
||||
|
@ -152,10 +152,10 @@
|
||||
</insert>
|
||||
<insert id="batchCoscoSupplierQualifications" parameterType="java.util.List">
|
||||
insert into cosco_supplier_qualifications
|
||||
( id, supplier_id, certificate_type, name, code, type_level, authority, date_time, term_of_validity, accessory, del_flag, create_by, create_time, update_by, update_time, last_update_time)
|
||||
( id, supplier_id, certificate_type, name, code, type_level, authority, date_time, term_of_validity, accessory, create_by, create_time, update_by, update_time, last_update_time)
|
||||
values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.supplierId}, #{item.certificateType}, #{item.name}, #{item.code}, #{item.typeLevel}, #{item.authority}, #{item.dateTime}, #{item.termOfValidity}, #{item.accessory}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
( #{item.id}, #{item.supplierId}, #{item.certificateType}, #{item.name}, #{item.code}, #{item.typeLevel}, #{item.authority}, #{item.dateTime}, #{item.termOfValidity}, #{item.accessory}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateCoscoSupplierQualifications" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierQualifications">
|
||||
|
@ -155,10 +155,10 @@
|
||||
</insert>
|
||||
<insert id="batchCoscoSupplierSurveyAttachments" parameterType="java.util.List">
|
||||
insert into cosco_supplier_survey_attachments
|
||||
( id, supplier_id, attachments_type, file_name, file_type, file_size, file_path, file_url, del_flag, create_by, create_time, update_by, update_time, last_update_time)
|
||||
( id, supplier_id, attachments_type, file_name, file_type, file_size, file_path, file_url, create_by, create_time, update_by, update_time, last_update_time)
|
||||
values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.supplierId}, #{item.attachmentsType}, #{item.fileName}, #{item.fileType}, #{item.fileSize}, #{item.filePath}, #{item.fileUrl}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
( #{item.id}, #{item.supplierId}, #{item.attachmentsType}, #{item.fileName}, #{item.fileType}, #{item.fileSize}, #{item.filePath}, #{item.fileUrl}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateCoscoSupplierSurveyAttachments" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierSurveyAttachments">
|
||||
|
@ -75,10 +75,10 @@
|
||||
</insert>
|
||||
<insert id="batchCoscoSupplierSurveyQuestionReply" parameterType="java.util.List">
|
||||
insert into cosco_supplier_survey_question_reply
|
||||
( id, supplier_id, survey_question_id, reply_value, del_flag, create_by, create_time, update_by, update_time, last_update_time)
|
||||
( id, supplier_id, survey_question_id, reply_value, create_by, create_time, update_by, update_time, last_update_time)
|
||||
values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.id}, #{item.supplierId}, #{item.surveyQuestionId}, #{item.replyValue}, #{item.delFlag}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
( #{item.id}, #{item.supplierId}, #{item.surveyQuestionId}, #{item.replyValue}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.lastUpdateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateCoscoSupplierSurveyQuestionReply" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierSurveyQuestionReply">
|
||||
|
Reference in New Issue
Block a user