代码优化

This commit is contained in:
TL
2025-07-02 09:54:43 +08:00
parent b45099f816
commit c8e1a1463f
35 changed files with 334 additions and 81 deletions

View File

@ -98,8 +98,8 @@ spring:
redis:
sentinel:
master: eshop-redis
nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
password: Unicom#135
nodes: 10.0.0.125:6379
password:
# 天宫Eureka配置
eureka:
@ -118,7 +118,7 @@ mybatis-plus:
map-underscore-to-camel-case: true
auto-mapping-behavior: full
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath*:com/chinaunicom/**/mapper/*Mapper.xml
global-config:
# 逻辑删除配置
@ -127,6 +127,12 @@ mybatis-plus:
logic-not-delete-value: normal # 逻辑删除标记:正常数据
logic-delete-value: deleted # 逻辑删除标记:已删除的数据
type-aliases-package: com.chinaunicom.mall.ebtp.project
logging:
level:
com.your.mapper.package: trace # 改为TRACE级别可以看到更详细参数
org.apache.ibatis: debug
com.baomidou.mybatisplus: debug
jdbc.sqlonly: debug # 如果需要JDBC级别的日志
hystrix:
command:
@ -184,4 +190,4 @@ management:
include: "*"
cors:
allowed-origins: "*"
allowed-methods: "*"
allowed-methods: "*"

View File

@ -37,24 +37,43 @@
left join cosco_category ca on c.category_id = ca.id and ca.del_flag = 'normal'
</sql>
<select id="selectPageList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoAccessSupplierCategory" resultMap="CoscoAccessSupplierCategoryResult">
<include refid="selectCoscoAccessSupplierCategoryVo"/>
<where>
c.del_flag = 'normal'
<if test="vo.accessWorkId != null and vo.accessWorkId != ''">
and c.access_work_id = #{vo.accessWorkId}
</if>
<if test="vo.supplierId != null and vo.supplierId != ''">
and c.supplier_id = #{vo.supplierId}
</if>
<if test="vo.categoryId != null and vo.categoryId != ''">
and c.category_id = #{vo.categoryId}
</if>
<if test="vo.lastUpdateTime != null ">
and c.last_update_time = #{vo.lastUpdateTime}
</if>
</where>
order by c.create_time desc
<select id="selectPageList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.AdmissionDetailsVo" resultType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.AdmissionDetailsVo">
SELECT
caw.update_time as updateTime,
cas.dept_id as deptId,
cas.supplierexit_id as supplierexitId,
cse.exit_time as exitTime,
cse.exit_reason as exitReason,
GROUP_CONCAT(casc.category_id) AS categoryIds,
GROUP_CONCAT(
(
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
)
) AS categoryNames,
max(cb.update_time) as blackTime
FROM
cosco_access_supplier cas
LEFT JOIN cosco_access_supplier_category casc ON cas.supplier_id = casc.supplier_id AND casc.del_flag = 'normal' AND cas.access_status != 2
LEFT JOIN cosco_supplierexit cse ON cse.id = cas.supplierexit_id
LEFT JOIN cosco_access_work caw ON caw.id = cas.access_work_id
left join cosco_blacklist_supplier cbs on cas.supplier_id = cbs.supplier_id
left join cosco_blacklist cb on cbs.blacklist_id = cb.id and cas.dept_id = cb.dept_id and cb.approve_status = 1 and cb.restore_approve_status != 1
WHERE
cas.supplier_id = #{vo.supplierId}
AND cas.access_status IN (1,2)
GROUP BY
caw.update_time,
cas.dept_id,
cas.supplierexit_id,
cse.exit_time,
cse.exit_reason
ORDER BY caw.update_time desc
</select>
<select id="selectCoscoAccessSupplierCategoryList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoAccessSupplierCategory" resultMap="CoscoAccessSupplierCategoryResult">
@ -88,6 +107,19 @@
</if>
</select>
<select id="selectCategoryByDeptIdList" parameterType="java.util.List" resultType="String">
select cssc.category_id,cs.dept_id,cs.approve_status from cosco_supplierexit_supplier_category cssc
left join cosco_supplierexit cs on cs.id = cssc.supplierexit_id
where cs.approve_status in (0) and cs.del_flag = 'normal'
and cs.dept_id in (
<foreach item="item" index="index" collection="list" separator=",">
#{item}
</foreach>
)
</select>
<select id="selectExitCategoryList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoAccessSupplierCategory" resultMap="CoscoAccessSupplierCategoryResult">
SELECT
s.`name` as supplierName,
@ -122,7 +154,14 @@
and c.category_id = #{vo.categoryId}
</if>
<if test="vo.reviewResult != null and vo.reviewResult != ''">
and review_result = #{vo.reviewResult}
and es.review_result = #{vo.reviewResult}
</if>
<!-- 假设参数是 List<String> list -->
<if test="vo.categoryList != null and vo.categoryList.size() > 0">
AND c.category_id NOT IN
<foreach collection="vo.categoryList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>

View File

@ -8,6 +8,8 @@
<result property="accessWorkId" column="access_work_id"/>
<result property="supplierId" column="supplier_id"/>
<result property="deptId" column="dept_id"/>
<result property="supplierexitId" column="supplierexit_id"/>
</resultMap>
<sql id="selectCoscoAccessSupplierVo">
@ -37,6 +39,23 @@
</select>
<select id="selectSupplierIdByDeptIdList" parameterType="java.util.List" resultType="String">
SELECT
cas.supplier_id
FROM
cosco_access_work caw
LEFT JOIN cosco_access_supplier cas ON caw.id = cas.access_work_id
WHERE (caw.approve_status IS NULL OR caw.approve_status = 0 or (caw.approve_status = 1 and cas.access_status = 1))
AND cas.dept_id in (
<foreach item="item" index="index" collection="list" separator=",">
#{item}
</foreach>
)
</select>
<select id="selectSupplierPageList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoAccessSupplier" resultMap="CoscoAccessSupplierResult">
SELECT
GROUP_CONCAT( DISTINCT d.category_name SEPARATOR ', ' ) AS categoryName,
@ -147,6 +166,9 @@
<if test="accessStatus != null">access_status =
#{accessStatus},
</if>
<if test="supplierexitId != null">supplierexit_id =
#{supplierexitId},
</if>
</trim>
where id = #{id}
</update>
@ -158,9 +180,12 @@
<if test="accessStatus != null">access_status =
#{accessStatus},
</if>
<if test="supplierexitId != null">supplierexit_id =
#{supplierexitId},
</if>
</trim>
where supplier_id = #{supplierId}
<if test="deptId != null">dept_id =
<if test="deptId != null">
and dept_id = #{deptId}
</if>

View File

@ -102,7 +102,7 @@
#{updateTime},
</if>
</trim>
where receiver_id = #{receiverId}
where id = #{id}
</update>
<update id="deleteCoscoMessageById" parameterType="String">

View File

@ -139,7 +139,13 @@
cas.access_work_id,
cas.supplier_id,
csb.`name`,
caw.update_time
caw.update_time,
cas.access_status,
CASE cas.access_status
WHEN '0' THEN '未准入'
WHEN '1' THEN '已准入'
WHEN '2' THEN '退出'
END AS access_status_cn
FROM
cosco_access_supplier cas
LEFT JOIN cosco_access_work caw ON cas.access_work_id = caw.id
@ -152,21 +158,15 @@
<select id="selectWzrPageList" parameterType="com.chinaunicom.zyhy.ebtp.supplier.coscosupplier.entity.CoscoSupplierBase" resultMap="CoscoSupplierBaseResult">
<include refid="selectCoscoSupplierBaseVo"/>
WHERE
id NOT IN (
SELECT
cas.supplier_id
FROM
cosco_access_work caw
LEFT JOIN cosco_access_supplier cas ON caw.id = cas.access_work_id
WHERE
(
caw.approve_status IS NULL
OR caw.approve_status IN ( 0, 1 ))
<if test="vo.deptId != null and vo.deptId != ''">
AND cas.dept_id IN (#{vo.deptId})
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=")">
#{item}
</foreach>
</if>
)
<if test="vo.supplierType != null and vo.supplierType != ''">
and supplier_type = #{vo.supplierType}
</if>

View File

@ -180,12 +180,15 @@
</select>
<select id="selectBySupplierId" parameterType="String"
resultMap="CoscoSupplierChangeApplyResult">
<include refid="selectCoscoSupplierChangeApplyVo"/>
WHERE c.supplier_id = #{supplierId}
resultType="integer">
SELECT
count(0)
FROM
cosco_supplier_change_apply c
WHERE c.supplier_id = #{supplierId} and c.approve_status = 0
AND c.del_flag = 'normal'
ORDER BY c.change_time DESC
LIMIT 1 OFFSET 1;
LIMIT 1;
</select>

View File

@ -17,6 +17,9 @@
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="lastUpdateTime" column="last_update_time"/>
<result property="exitTime" column="exit_time"/>
</resultMap>
<sql id="selectCoscoSupplierexitVo">
@ -33,7 +36,8 @@
END AS approveStatusText,
work_flow_id,
create_by,
create_time
create_time,
exit_time
FROM
cosco_supplierexit
</sql>
@ -175,6 +179,9 @@
<if test="lastUpdateTime != null">last_update_time =
#{lastUpdateTime},
</if>
<if test="exitTime != null">exit_time =
#{exitTime},
</if>
</trim>
where id = #{id}
</update>