2025-01-16 16:16:53 +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.bonus.project.mapper.SupervisionUnitMapper">
|
|
|
|
|
<insert id="insertPersonEnterInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into pt_sup_person(sup_name,id_card,sex,age,phone,post,face_path,is_active)
|
|
|
|
|
values(#{name},#{idCard},#{sex},#{age},#{phone},#{postName},#{faceUrl},'1')
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertUserInfo" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into
|
|
|
|
|
sys_user(parent_uuid,dept_id,user_name,nick_name,password,id_card,user_type,phonenumber,status,del_flag,login_type,create_by,sex)
|
|
|
|
|
values(#{supUuid},#{deptId},#{phone},#{name},#{password},#{idCard},'05',#{phone},'1','0','1,2,3',#{createUserId},#{sex})
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addLinkRelation">
|
|
|
|
|
INSERT INTO lk_sup_person (pro_id, uuid, sup_uuid,sup_persion_id, status)
|
|
|
|
|
VALUES (#{proId}, #{uuid}, #{supUuid},#{id}, '0')
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="addFileInfo">
|
|
|
|
|
insert into pt_cons_information(pro_id, uuid, from_type, information_type, information_path, information_name,
|
|
|
|
|
information_size, information_user_id, information_user_name, is_active)
|
|
|
|
|
values(#{proId}, #{uuid}, #{fromType}, #{informationType}, #{filePath}, #{fileName}, #{fileSize},
|
|
|
|
|
#{createUserId}, #{createUser}, '1')
|
|
|
|
|
</insert>
|
|
|
|
|
<insert id="insertRoleLink">
|
|
|
|
|
insert into sys_user_role(user_id, role_id)
|
|
|
|
|
values(#{id}, #{roleId})
|
|
|
|
|
</insert>
|
|
|
|
|
<update id="updateSupervisionUnit">
|
2025-02-10 18:18:55 +08:00
|
|
|
update pt_sup_info_data
|
2025-01-16 16:16:53 +08:00
|
|
|
set sup_name = #{unitName},
|
|
|
|
|
sup_address = #{unitAddress},
|
|
|
|
|
legal_name = #{corporateName},
|
|
|
|
|
legal_phone = #{corporatePhone},
|
|
|
|
|
sup_code = #{socialUnifiedCreditCode}
|
2025-02-10 18:18:55 +08:00
|
|
|
where id = #{supId}
|
2025-01-16 16:16:53 +08:00
|
|
|
</update>
|
|
|
|
|
<update id="updateLinkRelation">
|
|
|
|
|
update lk_pro_sup
|
|
|
|
|
set status = #{status}
|
|
|
|
|
where pro_id = #{proId} and sup_uuid = #{supUuid}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updatePersonEnterInfo">
|
|
|
|
|
update pt_sup_person
|
|
|
|
|
<set>
|
|
|
|
|
<if test="name != null and name != ''">
|
|
|
|
|
sup_name = #{name},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="idCard != null and idCard != ''">
|
|
|
|
|
id_card = #{idCard},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sex != null and sex != ''">
|
|
|
|
|
sex = #{sex},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="age != null">
|
|
|
|
|
age = #{age},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="phone != null and phone != ''">
|
|
|
|
|
phone = #{phone},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="postName != null and postName != ''">
|
|
|
|
|
post = #{postName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="faceUrl != null and faceUrl != ''">
|
|
|
|
|
face_path = #{faceUrl},
|
|
|
|
|
</if>
|
|
|
|
|
</set>
|
|
|
|
|
where sup_user_id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateSupIsExist">
|
|
|
|
|
update lk_sup_person
|
|
|
|
|
set is_exist_file = '1'
|
|
|
|
|
where uuid = #{uuid}
|
|
|
|
|
</update>
|
2025-02-10 18:18:55 +08:00
|
|
|
<update id="updateUnitUser">
|
|
|
|
|
update pt_sup_info
|
|
|
|
|
set comm_user_name=#{directorsName}
|
|
|
|
|
where sup_id=#{supId}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateUserInfo">
|
|
|
|
|
update sys_user
|
|
|
|
|
set nick_name=#{directorsName}
|
|
|
|
|
where user_id=#{commUserId}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="updateProUserInfo">
|
|
|
|
|
update pt_project_info
|
|
|
|
|
set sup_user_name=#{directorsName}
|
|
|
|
|
where sup_user_id=#{supId}
|
|
|
|
|
|
|
|
|
|
</update>
|
2025-01-16 16:16:53 +08:00
|
|
|
<delete id="deleteSupervisionUnitById">
|
2025-02-10 18:18:55 +08:00
|
|
|
update pt_sup_info_data set is_active = '0' where id in
|
|
|
|
|
<foreach item="addressId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{addressId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
<delete id="delSupervisionUnitUser">
|
2025-01-16 16:16:53 +08:00
|
|
|
update pt_sup_info set is_active = '0' where sup_id in
|
|
|
|
|
<foreach item="addressId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{addressId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2025-02-13 16:36:47 +08:00
|
|
|
<delete id="delUser">
|
|
|
|
|
delete from sys_user where id_card = #{idCard} and phonenumber = #{phone} and del_flag = '0'
|
|
|
|
|
</delete>
|
|
|
|
|
<delete id="delPtSupPerson">
|
|
|
|
|
delete from pt_sup_person where id_card = #{idCard} and phonen = #{phone} and is_active = '1'
|
|
|
|
|
</delete>
|
2025-01-16 16:16:53 +08:00
|
|
|
|
|
|
|
|
<select id="listSupervisionUnit" resultType="com.bonus.project.domain.SupervisionUnit">
|
|
|
|
|
select (@rowNum := @rowNum + 1) as exportId,
|
2025-02-10 18:18:55 +08:00
|
|
|
psi.id as supId,
|
2025-01-16 16:16:53 +08:00
|
|
|
psi.uuid as supUuid,
|
|
|
|
|
psi.sup_name as unitName,
|
|
|
|
|
psi.sup_address as unitAddress,
|
|
|
|
|
psi.legal_name as corporateName,
|
|
|
|
|
psi.legal_phone as corporatePhone,
|
|
|
|
|
psi.sup_code as socialUnifiedCreditCode,
|
2025-02-10 18:18:55 +08:00
|
|
|
IFNULL(us.num ,0) userNum,
|
|
|
|
|
IFNULL(pro.num ,0) status
|
|
|
|
|
from (select @rowNum := 0) r,
|
|
|
|
|
pt_sup_info_data psi
|
2025-01-16 16:16:53 +08:00
|
|
|
left join (
|
2025-02-10 18:18:55 +08:00
|
|
|
select count(1) num , sup_unit_id
|
|
|
|
|
from pt_project_info
|
|
|
|
|
where sup_unit_id is not null and sup_unit_id!=''
|
|
|
|
|
GROUP BY sup_unit_id
|
|
|
|
|
)pro on pro.sup_unit_id=psi.id
|
|
|
|
|
left join(
|
|
|
|
|
select count(1) num ,unit_id
|
|
|
|
|
FROM pt_sup_info
|
|
|
|
|
GROUP BY unit_id
|
|
|
|
|
)us on us.unit_id=psi.id
|
2025-01-16 16:16:53 +08:00
|
|
|
where psi.is_active = 1
|
|
|
|
|
<if test="unitName != null and unitName != ''">
|
|
|
|
|
and psi.sup_name like concat('%',#{unitName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2025-02-10 18:18:55 +08:00
|
|
|
<select id="listSupervisionUnitUser" resultType="com.bonus.project.domain.SupervisionUnit">
|
|
|
|
|
select (@rowNum := @rowNum + 1) as exportId,
|
|
|
|
|
sup_id supId,
|
|
|
|
|
comm_user_id commUserId,
|
|
|
|
|
comm_user_name directorsName,
|
|
|
|
|
comm_user_phone directorsPhone,
|
|
|
|
|
comm_user_code commUserCode
|
|
|
|
|
from (select @rowNum := 0) r,
|
|
|
|
|
pt_sup_info
|
|
|
|
|
where is_active=1 and unit_id=#{unitId}
|
|
|
|
|
<if test="directorsName != null and directorsName != ''">
|
|
|
|
|
and comm_user_phone like concat('%',#{directorsName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2025-01-16 16:16:53 +08:00
|
|
|
<select id="listSupEntry" resultType="com.bonus.project.domain.SupervisionOfAdmission">
|
|
|
|
|
SELECT
|
|
|
|
|
psi.sup_id as supId,
|
|
|
|
|
psi.uuid as supUuid,
|
|
|
|
|
ppi.pro_name as proName,
|
|
|
|
|
psi.sup_name as supName,
|
|
|
|
|
psi.sup_code as supCode,
|
|
|
|
|
psi.legal_name as legalName,
|
|
|
|
|
psi.legal_phone as legalPhone,
|
|
|
|
|
'0' as status,
|
|
|
|
|
lps.status as intoStatus,
|
|
|
|
|
lps.task_id as taskId,
|
|
|
|
|
lps.proc_inst_id as procInsId,
|
|
|
|
|
ppi.pro_id as proId
|
|
|
|
|
FROM lk_pro_sup lps
|
|
|
|
|
LEFT JOIN pt_sup_info psi ON lps.sup_uuid = psi.uuid AND psi.is_active = '1'
|
|
|
|
|
LEFT JOIN pt_project_info ppi ON lps.pro_id = ppi.pro_id AND ppi.is_active = '1'
|
|
|
|
|
WHERE lps.status != '0'
|
|
|
|
|
<if test="status != null and status != '' and status != 1 and status != '1' and status != '2' and status != 2 ">
|
|
|
|
|
AND lps.status = #{status}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proName != null and proName != ''">
|
|
|
|
|
AND ppi.pro_name = #{proName}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supName != null and supName != ''">
|
|
|
|
|
AND psi.sup_name = #{supName}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="proId != null and proId != ''">
|
|
|
|
|
AND ppi.pro_id = #{proId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
<select id="isExistUser" resultType="java.lang.Integer">
|
|
|
|
|
select count(1) from sys_user where phonenumber = #{phone} and del_flag = '0'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeptId" resultType="java.lang.String">
|
|
|
|
|
select dept_id from sys_dept where type = '1' and del_flag = '0'
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getRoleId" resultType="java.lang.String">
|
|
|
|
|
select role_id from sys_role where role_key = 'sup_person' and del_flag = '0'
|
|
|
|
|
</select>
|
2025-02-10 18:18:55 +08:00
|
|
|
<select id="getUnitNameById" resultType="java.lang.Integer">
|
|
|
|
|
select count(1)
|
|
|
|
|
from pt_sup_info_data
|
|
|
|
|
where is_active=1 and id!=#{supId} and sup_name=#{supName}
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSupProNum" resultType="com.bonus.project.domain.Project">
|
|
|
|
|
select pro_id proId,sup_unit_name supervisorUnit
|
|
|
|
|
from pt_project_info
|
|
|
|
|
where is_active=1 and sup_unit_id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getSupProUserNum" resultType="com.bonus.project.domain.Project">
|
|
|
|
|
select pro_id proId,sup_user_name supervisorUnit
|
|
|
|
|
from pt_project_info
|
|
|
|
|
where is_active=1 and sup_user_id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getUserMapper" resultType="java.lang.Integer">
|
|
|
|
|
select count(1)
|
|
|
|
|
from pt_sup_info
|
|
|
|
|
where is_active=1 and unit_id=#{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-01-16 16:16:53 +08:00
|
|
|
</mapper>
|