2026-01-08 09:09:47 +08:00
|
|
|
<?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.zcloud.certificate.persistence.mapper.UserCertificateMapper">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectPageWithUser" resultType="com.zcloud.certificate.persistence.dataobject.UserCertificateDO">
|
|
|
|
|
SELECT
|
|
|
|
|
uc.*,
|
2026-01-19 17:17:14 +08:00
|
|
|
u.name AS userName,
|
2026-01-08 09:09:47 +08:00
|
|
|
u.employment_flag AS employmentStatus,
|
|
|
|
|
d.name AS departmentName,
|
|
|
|
|
p.corpinfo_name AS corpinfoName,
|
|
|
|
|
p.post_name AS postName
|
|
|
|
|
FROM
|
|
|
|
|
user_certificate uc
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
user u ON u.id = uc.user_id
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
department d ON d.id = u.department_id
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
post p ON p.id = u.post_id
|
|
|
|
|
WHERE 1=1
|
2026-01-08 17:40:46 +08:00
|
|
|
AND uc.delete_enum = 'false'
|
2026-01-08 09:09:47 +08:00
|
|
|
<if test="params.tenantId != null">
|
|
|
|
|
AND uc.tenant_id = #{params.tenantId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.orgId != null">
|
|
|
|
|
AND uc.org_id = #{params.orgId}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.likeUserName != null and params.likeUserName != ''">
|
2026-01-27 09:09:42 +08:00
|
|
|
AND u.name LIKE CONCAT('%', #{params.likeUserName}, '%')
|
2026-01-08 09:09:47 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="params.eqIndustryCategoryCode != null and params.eqIndustryCategoryCode != ''">
|
|
|
|
|
AND uc.industry_category_code = #{params.eqIndustryCategoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqIndustryOperatingItemsCode != null and params.eqIndustryOperatingItemsCode != ''">
|
|
|
|
|
AND uc.industry_operating_items_code = #{params.eqIndustryOperatingItemsCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqType != null and params.eqType != ''">
|
|
|
|
|
AND uc.type = #{params.eqType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqCorpinfoId != null and params.eqCorpinfoId != ''">
|
|
|
|
|
AND uc.corpinfo_id = #{params.eqCorpinfoId}
|
|
|
|
|
</if>
|
2026-01-08 11:50:49 +08:00
|
|
|
<if test="params.likePostName != null and params.likePostName != ''">
|
|
|
|
|
AND uc.post_name LIKE CONCAT('%', #{params.likePostName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqUserId != null and params.eqUserId != ''">
|
|
|
|
|
AND uc.user_id = #{params.eqUserId}
|
|
|
|
|
</if>
|
2026-01-08 09:09:47 +08:00
|
|
|
|
|
|
|
|
ORDER BY uc.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
2026-01-14 09:21:21 +08:00
|
|
|
<select id="selectPageUser" resultType="com.zcloud.certificate.persistence.dataobject.UserCertificateDO">
|
|
|
|
|
SELECT
|
|
|
|
|
uc.*,
|
2026-01-20 09:26:56 +08:00
|
|
|
u.username AS userName,
|
|
|
|
|
u.name AS name,
|
2026-01-14 09:21:21 +08:00
|
|
|
u.employment_flag AS employmentStatus,
|
|
|
|
|
d.name AS departmentName,
|
|
|
|
|
p.corpinfo_name AS corpinfoName,
|
|
|
|
|
p.post_name AS postName
|
|
|
|
|
FROM
|
|
|
|
|
user_certificate uc
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
user u ON u.id = uc.user_id
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
department d ON d.id = u.department_id
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
post p ON p.id = u.post_id
|
|
|
|
|
WHERE 1=1
|
|
|
|
|
AND uc.delete_enum = 'false'
|
|
|
|
|
<if test="params.tenantId != null">
|
|
|
|
|
AND uc.tenant_id = #{params.tenantId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.orgId != null">
|
|
|
|
|
AND uc.org_id = #{params.orgId}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.likeUserName != null and params.likeUserName != ''">
|
2026-01-27 09:09:42 +08:00
|
|
|
AND u.name LIKE CONCAT('%', #{params.likeUserName}, '%')
|
2026-01-14 09:21:21 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="params.eqIndustryCategoryCode != null and params.eqIndustryCategoryCode != ''">
|
|
|
|
|
AND uc.industry_category_code = #{params.eqIndustryCategoryCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqIndustryOperatingItemsCode != null and params.eqIndustryOperatingItemsCode != ''">
|
|
|
|
|
AND uc.industry_operating_items_code = #{params.eqIndustryOperatingItemsCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqType != null and params.eqType != ''">
|
|
|
|
|
AND uc.type = #{params.eqType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqCorpinfoId != null and params.eqCorpinfoId != ''">
|
|
|
|
|
AND uc.corpinfo_id = #{params.eqCorpinfoId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.likePostName != null and params.likePostName != ''">
|
|
|
|
|
AND uc.post_name LIKE CONCAT('%', #{params.likePostName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.eqUserId != null and params.eqUserId != ''">
|
|
|
|
|
AND uc.user_id = #{params.eqUserId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.inType != null and params.inType.size() > 0">
|
|
|
|
|
AND uc.type IN
|
|
|
|
|
<foreach collection="params.inType" item="type" open="(" separator="," close=")">
|
|
|
|
|
#{type}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
ORDER BY uc.create_time DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
2026-01-08 09:09:47 +08:00
|
|
|
|
2026-01-08 11:50:49 +08:00
|
|
|
<select id="selectUserNamesByUserIds" resultType="com.zcloud.certificate.domain.model.UserBasicInfo">
|
2026-01-08 09:09:47 +08:00
|
|
|
SELECT
|
|
|
|
|
u.id AS userId,
|
2026-01-20 09:26:56 +08:00
|
|
|
u.name AS userName,
|
|
|
|
|
u.name AS name,
|
2026-01-08 09:09:47 +08:00
|
|
|
d.name AS departmentName,
|
|
|
|
|
p.corpinfo_name AS corpinfoName,
|
|
|
|
|
p.post_name AS postName,
|
|
|
|
|
u.employment_flag AS employmentStatus
|
|
|
|
|
FROM
|
|
|
|
|
user u
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
department d ON d.id = u.department_id
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
post p ON p.id = u.post_id
|
|
|
|
|
WHERE
|
|
|
|
|
u.id IN
|
|
|
|
|
<foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
|
|
|
|
|
#{userId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectCorpCertificateStatPage"
|
|
|
|
|
resultType="com.zcloud.certificate.persistence.dataobject.UserCertificateStatDO">
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
ci.id AS corpinfoId,
|
|
|
|
|
ci.corp_name AS corpName,
|
2026-01-15 15:32:37 +08:00
|
|
|
COALESCE(SUM(CASE WHEN uc.type = 'tezhongzuoye' THEN 1 ELSE 0 END), 0) AS specialWorkCertCount,
|
|
|
|
|
COALESCE(SUM(CASE WHEN uc.type = 'tzsbczry' THEN 1 ELSE 0 END), 0) AS specialEquipmentCertCount,
|
|
|
|
|
COALESCE(SUM(CASE WHEN uc.type = 'zyfzr' THEN 1 ELSE 0 END), 0) AS principalCertCount,
|
|
|
|
|
COALESCE(SUM(CASE WHEN uc.type = 'aqscglry' THEN 1 ELSE 0 END), 0) AS safetyManagerCertCount
|
2026-01-08 09:09:47 +08:00
|
|
|
FROM
|
|
|
|
|
corp_info ci
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
user_certificate uc
|
|
|
|
|
ON
|
|
|
|
|
uc.corpinfo_id = ci.id
|
|
|
|
|
AND
|
|
|
|
|
uc.delete_enum = 'false'
|
|
|
|
|
<if test="params.tenantId != null">
|
|
|
|
|
AND uc.tenant_id = #{params.tenantId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.orgId != null">
|
|
|
|
|
AND uc.org_id = #{params.orgId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.env != null and params.env != ''">
|
|
|
|
|
AND uc.env = #{params.env}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
WHERE 1 = 1
|
|
|
|
|
AND ci.delete_enum = 'false'
|
|
|
|
|
|
|
|
|
|
<if test="params.tenantId != null">
|
|
|
|
|
AND ci.tenant_id = #{params.tenantId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.orgId != null">
|
|
|
|
|
AND ci.org_id = #{params.orgId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.env != null and params.env != ''">
|
|
|
|
|
AND ci.env = #{params.env}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.useFlag != null">
|
|
|
|
|
AND ci.use_flag = #{params.useFlag}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.corpType != null">
|
|
|
|
|
AND (
|
|
|
|
|
(#{params.corpType} = 0 AND ci.type IN (0,1))
|
|
|
|
|
OR (#{params.corpType} = 1 AND ci.type IN (3,4,5))
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
<if test="params.corpName != null and params.corpName != ''">
|
|
|
|
|
AND ci.corp_name LIKE CONCAT('%', #{params.corpName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
GROUP BY ci.id, ci.corp_name
|
|
|
|
|
ORDER BY ci.corp_order ASC, ci.id ASC
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|
|
|
|
|
|