YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/manage/ProProjectInfoSubdeptsUsers...

331 lines
20 KiB
XML
Raw Normal View History

2024-08-25 13:31:15 +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.yanzhu.manage.mapper.ProProjectInfoSubdeptsUsersMapper">
<resultMap type="ProProjectInfoSubdeptsUsers" id="ProProjectInfoSubdeptsUsersResult">
<result property="id" column="id" />
2024-12-20 20:24:08 +08:00
<result property="parId" column="par_id" />
2024-09-09 23:58:23 +08:00
<result property="comId" column="com_id" />
2024-10-14 00:01:52 +08:00
<result property="comName" column="comName"/>
2024-08-25 13:31:15 +08:00
<result property="projectId" column="project_id" />
2024-10-13 23:18:53 +08:00
<result property="projectName" column="project_name" />
2024-08-25 13:31:15 +08:00
<result property="subDeptId" column="sub_dept_id" />
2024-09-09 23:58:23 +08:00
<result property="subDeptType" column="sub_dept_type" />
2024-12-22 19:55:21 +08:00
<result property="subDeptTypeName" column="sub_dept_type_name" />
2024-08-25 13:31:15 +08:00
<result property="subDeptName" column="sub_dept_name" />
2024-12-17 20:25:21 +08:00
<result property="subDeptPowerPath" column="sub_dept_power_path" />
2024-08-25 13:31:15 +08:00
<result property="userId" column="user_id" />
2024-10-01 16:35:07 +08:00
<result property="subDeptGroup" column="sub_dept_group" />
2024-10-08 01:07:33 +08:00
<result property="subDeptGroupName" column="sub_dept_group_name" />
2024-12-20 20:24:08 +08:00
<result property="userPost" column="user_post" />
2024-08-25 13:31:15 +08:00
<result property="craftType" column="craft_type" />
<result property="craftPost" column="craft_post" />
<result property="eduStatus" column="edu_status" />
<result property="eduFilePath" column="edu_file_path" />
<result property="eduSignPath" column="edu_sign_path" />
<result property="eduDate" column="edu_date" />
<result property="approveStatus" column="approve_status" />
<result property="useStatus" column="use_status" />
2024-12-20 20:24:08 +08:00
<result property="qrCode" column="qr_code" />
2024-08-25 13:31:15 +08:00
<result property="subStep" column="sub_step" />
<result property="illnessStatus" column="illness_status" />
<result property="supIllnessStatus" column="sup_illness_status" />
<result property="isDel" column="is_del" />
2024-10-13 23:18:53 +08:00
<result property="enterState" column="enter_state" />
<result property="craftTypeName" column="craft_type_name" />
<result property="craftPostName" column="craft_post_name" />
2024-08-25 13:31:15 +08:00
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
2024-10-13 15:10:30 +08:00
<result property="admitGuid" column="admitGuid"/>
2024-08-25 13:31:15 +08:00
<result property="remark" column="remark" />
2024-12-17 20:25:21 +08:00
<result property="degreeGrade" column="degree_grade" />
2024-12-22 19:55:21 +08:00
<result property="degreeGradeName" column="degree_grade_name" />
2024-10-08 23:39:19 +08:00
<association property="user" javaType="com.yanzhu.system.api.domain.SysUser" resultMap="ProSysUserResult"></association>
</resultMap>
2024-12-17 20:25:21 +08:00
2024-10-08 23:39:19 +08:00
<resultMap id="ProSysUserResult" type="com.yanzhu.system.api.domain.SysUser">
<result property="userName" column="user_name" />
<result property="nickName" column="nick_name" />
<result property="userType" column="user_type" />
<result property="cardType" column="card_type" />
<result property="cardCode" column="card_code" />
2024-10-13 15:10:30 +08:00
<result property="admitGuid" column="usAdmitGuid"/>
2024-10-08 23:39:19 +08:00
<result property="userPicture" column="user_picture" />
<result property="cardImgPos" column="card_img_pos" />
<result property="cardImgInv" column="card_img_inv" />
<result property="userInfos" column="user_infos" />
<result property="email" column="email" />
<result property="phonenumber" column="phonenumber" />
<result property="sex" column="sex" />
<result property="avatar" column="avatar" />
<result property="password" column="password" />
<result property="status" column="status" />
<result property="delFlag" column="del_flag" />
<result property="loginIp" column="login_ip" />
<result property="loginDate" column="login_date" />
2024-08-25 13:31:15 +08:00
</resultMap>
2024-12-29 11:46:50 +08:00
2024-08-25 13:31:15 +08:00
<sql id="selectProProjectInfoSubdeptsUsersVo">
2024-12-22 19:55:21 +08:00
SELECT psu.id, psu.par_id, psu.com_id, psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_type, dic3.dict_label as sub_dept_type_name, psu.sub_dept_name, psu.sub_dept_power_path, psu.user_id, psu.sub_dept_group,
2024-12-20 20:24:08 +08:00
psu.sub_dept_group_name, psu.user_post, psu.craft_type, psu.craft_post, psu.edu_status, psu.edu_file_path, psu.edu_sign_path, psu.edu_date, psu.approve_status,
psu.use_status, psu.qr_code, psu.sub_step, psu.illness_status, psu.sup_illness_status, psu.is_del, psu.create_by, psu.create_time, psu.update_by, psu.update_time,
2024-12-22 19:55:21 +08:00
psu.remark, psu.degree_grade, dic4.dict_label as degree_grade_name, su.`user_name`,su.`nick_name`,su.`user_type`,su.`card_type`,su.`card_code`,su.admitGuid,su.admitGuid usAdmitGuid,
2024-10-14 00:01:52 +08:00
dic1.dict_label craft_type_name,dic2.dict_label craft_post_name,psu.enter_state,sd.dept_name comName,
2024-10-08 23:39:19 +08:00
su.`user_picture`, su.`card_img_inv`,su.`card_img_pos`,su.`user_infos`,su.`email`,su.`phonenumber`,su.`sex`,su.`avatar`,su.`login_ip`,su.`login_date`
FROM pro_project_info_subdepts_users psu
LEFT JOIN sys_user su ON psu.user_id=su.user_id
2024-12-17 20:25:21 +08:00
LEFT JOIN pro_project_info pi ON pi.id = psu.project_id
2024-10-08 23:39:19 +08:00
LEFT JOIN sys_dept sd ON sd.dept_id = pi.com_id
2024-10-13 23:18:53 +08:00
LEFT JOIN sys_dict_data dic1 ON psu.`craft_type`=dic1.`dict_value` AND dic1.`dict_type`='pro_craft_type'
LEFT JOIN sys_dict_data dic2 ON psu.`craft_post`=dic2.`dict_value` AND dic2.`dict_type`='pro_craft_post'
2024-12-22 19:55:21 +08:00
LEFT JOIN sys_dict_data dic3 ON psu.`sub_dept_type`=dic3.`dict_value` AND dic3.`dict_type`='sub_dept_type'
LEFT JOIN sys_dict_data dic4 ON psu.`degree_grade`=dic4.`dict_value` AND dic4.`dict_type`='educational_type'
2024-08-25 13:31:15 +08:00
</sql>
<select id="selectProProjectInfoSubdeptsUsersList" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
2024-08-25 21:25:51 +08:00
<where>
2024-10-08 23:39:19 +08:00
<if test="comId != null "> and psu.com_id = #{comId}</if>
2024-12-20 20:24:08 +08:00
<if test="parId != null "> and psu.par_id = #{parId}</if>
2024-10-08 23:39:19 +08:00
<if test="projectId != null "> and psu.project_id = #{projectId}</if>
<if test="subDeptId != null "> and psu.sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and psu.sub_dept_type = #{subDeptType}</if>
<if test="subDeptName != null and subDeptName != ''"> and psu.sub_dept_name like concat('%', #{subDeptName}, '%')</if>
<if test="userId != null "> and psu.user_id = #{userId}</if>
<if test="subDeptGroup != null "> and psu.sub_dept_group = #{subDeptGroup}</if>
<if test="subDeptGroupName != null and subDeptGroupName != ''"> and psu.sub_dept_group_name like concat('%', #{subDeptGroupName}, '%')</if>
2024-12-20 20:24:08 +08:00
<if test="userPost != null and userPost != ''"> and psu.user_post = #{userPost}</if>
2024-10-08 23:39:19 +08:00
<if test="craftType != null and craftType != ''"> and psu.craft_type = #{craftType}</if>
<if test="craftPost != null and craftPost != ''"> and psu.craft_post = #{craftPost}</if>
<if test="eduStatus != null and eduStatus != ''"> and psu.edu_status = #{eduStatus}</if>
2024-10-13 23:18:53 +08:00
<if test="enterState != null and enterState != ''"> and psu.enter_state = #{enterState}</if>
2024-10-08 23:39:19 +08:00
<if test="eduFilePath != null and eduFilePath != ''"> and psu.edu_file_path = #{eduFilePath}</if>
<if test="eduSignPath != null and eduSignPath != ''"> and psu.edu_sign_path = #{eduSignPath}</if>
<if test="eduDate != null "> and psu.edu_date = #{eduDate}</if>
2024-10-13 11:26:52 +08:00
<if test="admitGuid!=null and admitGuid!=''">and su.admitGuid=#{admitGuid}</if>
2024-10-08 23:39:19 +08:00
<if test="approveStatus != null "> and psu.approve_status = #{approveStatus}</if>
<if test="useStatus != null and useStatus != ''"> and psu.use_status = #{useStatus}</if>
<if test="subStep != null "> and psu.sub_step = #{subStep}</if>
<if test="illnessStatus != null "> and psu.illness_status = #{illnessStatus}</if>
<if test="supIllnessStatus != null "> and psu.sup_illness_status = #{supIllnessStatus}</if>
2024-12-17 20:25:21 +08:00
<if test="phoneNumber != null and phoneNumber != ''"> and su.phonenumber = #{phoneNumber}</if>
<if test="degreeGrade != null and degreeGrade != ''"> and su.degree_grade = #{degreeGrade}</if>
2024-10-08 23:39:19 +08:00
<if test="isDel != null "> and psu.is_del = #{isDel}</if>
2024-08-25 13:31:15 +08:00
</where>
</select>
2024-10-08 01:07:33 +08:00
2024-08-25 13:31:15 +08:00
<select id="selectProProjectInfoSubdeptsUsersById" parameterType="Long" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
2024-10-08 23:39:19 +08:00
where psu.id = #{id}
2024-08-25 13:31:15 +08:00
</select>
2024-10-08 01:07:33 +08:00
2024-12-17 20:25:21 +08:00
<select id="selectProProjectInfoSubdeptsUsersByParamId" resultMap="ProProjectInfoSubdeptsUsersResult">
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
where psu.project_id = #{proId} and psu.user_id = #{userId}
</select>
2024-08-25 13:31:15 +08:00
<insert id="insertProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers" useGeneratedKeys="true" keyProperty="id">
insert into pro_project_info_subdepts_users
<trim prefix="(" suffix=")" suffixOverrides=",">
2024-12-20 20:24:08 +08:00
<if test="parId != null">par_id,</if>
2024-09-09 23:58:23 +08:00
<if test="comId != null">com_id,</if>
2024-08-25 13:31:15 +08:00
<if test="projectId != null">project_id,</if>
<if test="subDeptId != null">sub_dept_id,</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptType != null">sub_dept_type,</if>
2024-08-25 13:31:15 +08:00
<if test="subDeptName != null">sub_dept_name,</if>
2024-12-17 20:25:21 +08:00
<if test="subDeptPowerPath != null">sub_dept_power_path,</if>
2024-08-25 13:31:15 +08:00
<if test="userId != null">user_id,</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptGroup != null">sub_dept_group,</if>
<if test="subDeptGroupName != null">sub_dept_group_name,</if>
2024-12-20 20:24:08 +08:00
<if test="userPost != null">user_post,</if>
2024-08-25 13:31:15 +08:00
<if test="craftType != null">craft_type,</if>
<if test="craftPost != null">craft_post,</if>
<if test="eduStatus != null">edu_status,</if>
<if test="eduFilePath != null">edu_file_path,</if>
<if test="eduSignPath != null">edu_sign_path,</if>
<if test="eduDate != null">edu_date,</if>
<if test="approveStatus != null">approve_status,</if>
<if test="useStatus != null">use_status,</if>
2024-12-20 20:24:08 +08:00
<if test="qrCode != null">qr_code,</if>
2024-08-25 13:31:15 +08:00
<if test="subStep != null">sub_step,</if>
<if test="illnessStatus != null">illness_status,</if>
<if test="supIllnessStatus != null">sup_illness_status,</if>
<if test="isDel != null">is_del,</if>
2024-10-13 23:18:53 +08:00
<if test="enterState != null">enter_state,</if>
2024-08-25 13:31:15 +08:00
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
2024-12-17 20:25:21 +08:00
<if test="degreeGrade != null">degree_grade,</if>
2024-10-08 01:07:33 +08:00
</trim>
2024-08-25 13:31:15 +08:00
<trim prefix="values (" suffix=")" suffixOverrides=",">
2024-12-20 20:24:08 +08:00
<if test="parId != null">#{parId},</if>
2024-09-09 23:58:23 +08:00
<if test="comId != null">#{comId},</if>
2024-08-25 13:31:15 +08:00
<if test="projectId != null">#{projectId},</if>
<if test="subDeptId != null">#{subDeptId},</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptType != null">#{subDeptType},</if>
2024-08-25 13:31:15 +08:00
<if test="subDeptName != null">#{subDeptName},</if>
2024-12-17 20:25:21 +08:00
<if test="subDeptPowerPath != null">#{subDeptPowerPath},</if>
2024-08-25 13:31:15 +08:00
<if test="userId != null">#{userId},</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptGroup != null">#{subDeptGroup},</if>
<if test="subDeptGroupName != null">#{subDeptGroupName},</if>
2024-12-20 20:24:08 +08:00
<if test="userPost != null">#{userPost},</if>
2024-08-25 13:31:15 +08:00
<if test="craftType != null">#{craftType},</if>
<if test="craftPost != null">#{craftPost},</if>
<if test="eduStatus != null">#{eduStatus},</if>
<if test="eduFilePath != null">#{eduFilePath},</if>
<if test="eduSignPath != null">#{eduSignPath},</if>
<if test="eduDate != null">#{eduDate},</if>
<if test="approveStatus != null">#{approveStatus},</if>
<if test="useStatus != null">#{useStatus},</if>
2024-12-20 20:24:08 +08:00
<if test="qrCode != null">#{qrCode},</if>
2024-08-25 13:31:15 +08:00
<if test="subStep != null">#{subStep},</if>
<if test="illnessStatus != null">#{illnessStatus},</if>
<if test="supIllnessStatus != null">#{supIllnessStatus},</if>
<if test="isDel != null">#{isDel},</if>
2024-10-13 23:18:53 +08:00
<if test="enterState != null">#{enterState},</if>
2024-08-25 13:31:15 +08:00
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
2024-12-17 20:25:21 +08:00
<if test="degreeGrade != null">#{degreeGrade},</if>
2024-10-08 01:07:33 +08:00
</trim>
2024-08-25 13:31:15 +08:00
</insert>
<update id="updateProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers">
update pro_project_info_subdepts_users
<trim prefix="SET" suffixOverrides=",">
2024-12-20 20:24:08 +08:00
<if test="parId != null">par_id = #{parId},</if>
2024-09-09 23:58:23 +08:00
<if test="comId != null">com_id = #{comId},</if>
2024-08-25 13:31:15 +08:00
<if test="projectId != null">project_id = #{projectId},</if>
<if test="subDeptId != null">sub_dept_id = #{subDeptId},</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptType != null">sub_dept_type = #{subDeptType},</if>
2024-08-25 13:31:15 +08:00
<if test="subDeptName != null">sub_dept_name = #{subDeptName},</if>
2024-12-17 20:25:21 +08:00
<if test="subDeptPowerPath != null">sub_dept_power_path = #{subDeptPowerPath},</if>
2024-08-25 13:31:15 +08:00
<if test="userId != null">user_id = #{userId},</if>
2024-10-01 16:35:07 +08:00
<if test="subDeptGroup != null">sub_dept_group = #{subDeptGroup},</if>
<if test="subDeptGroupName != null">sub_dept_group_name = #{subDeptGroupName},</if>
2024-12-20 20:24:08 +08:00
<if test="userPost != null">user_post = #{userPost},</if>
2024-08-25 13:31:15 +08:00
<if test="craftType != null">craft_type = #{craftType},</if>
<if test="craftPost != null">craft_post = #{craftPost},</if>
<if test="eduStatus != null">edu_status = #{eduStatus},</if>
<if test="eduFilePath != null">edu_file_path = #{eduFilePath},</if>
<if test="eduSignPath != null">edu_sign_path = #{eduSignPath},</if>
<if test="eduDate != null">edu_date = #{eduDate},</if>
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
2024-12-20 20:24:08 +08:00
<if test="qrCode != null">qr_code = #{qrCode},</if>
2024-08-25 13:31:15 +08:00
<if test="subStep != null">sub_step = #{subStep},</if>
<if test="illnessStatus != null">illness_status = #{illnessStatus},</if>
<if test="supIllnessStatus != null">sup_illness_status = #{supIllnessStatus},</if>
<if test="isDel != null">is_del = #{isDel},</if>
2024-10-13 23:18:53 +08:00
<if test="enterState != null">enter_state = #{enterState},</if>
2024-08-25 13:31:15 +08:00
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
2024-12-17 20:25:21 +08:00
<if test="degreeGrade != null">degree_grade = #{degreeGrade},</if>
2024-08-25 13:31:15 +08:00
</trim>
where id = #{id}
</update>
<delete id="deleteProProjectInfoSubdeptsUsersById" parameterType="Long">
delete from pro_project_info_subdepts_users where id = #{id}
</delete>
<delete id="deleteProProjectInfoSubdeptsUsersByIds" parameterType="String">
delete from pro_project_info_subdepts_users where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2024-09-22 21:18:11 +08:00
<select id="findUserByUserPhone" parameterType="String" resultType="int">
select count(1) from sys_user where phonenumber=#{phonenumber}
</select>
2024-12-07 12:49:34 +08:00
<select id="groupByCraftType" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
SELECT
dic.dict_value craft_type,
dic.dict_label create_by,
u.id
FROM
sys_dict_data dic
LEFT JOIN (
SELECT
craft_type,
COUNT(1) AS id
FROM
pro_project_info_subdepts_users
WHERE
enter_state =0
<if test="comId != null">and com_id = #{comId}</if>
<if test="projectId != null">and project_id = #{projectId}</if>
GROUP BY
craft_type
) u
ON u.craft_type = dic.dict_value
WHERE
dic.dict_type = 'pro_craft_type';
</select>
<select id="groupByCraftTypeByAttendance" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
SELECT
dic.dict_value craft_type,
dic.dict_label create_by,
u.id
FROM
sys_dict_data dic
LEFT JOIN (
SELECT
craft_type,
COUNT(1) AS id
FROM
pro_project_info_subdepts_users
WHERE
user_id in (select userId
from attendance_ubi_data
<where>
<if test="comId != null">and com_id = #{comId}</if>
<if test="projectId != null">and project_id = #{projectId}</if>
<if test="createTime != null">
and (date(inTime)= date( #{createTime}) or date(outTime)=date( #{createTime})))</if>
</where>
GROUP BY
craft_type
) u
ON u.craft_type = dic.dict_value
WHERE
dic.dict_type = 'pro_craft_type'
</select>
2024-12-18 22:34:51 +08:00
<select id="findActReProcdefDept" resultType="Map">
2024-12-22 19:55:21 +08:00
select * from act_re_procdef rp
left join act_re_procdef_dept rpd on rpd.PROCDEF_ID_ = rp.ID_
where rp.SUSPENSION_STATE_ = 1 and PROJ_ID_ = #{proId} and TYPE_ = #{defType} order by SORT_ desc
2024-12-18 22:34:51 +08:00
</select>
2024-12-29 11:46:50 +08:00
<select id="statsSubDeptsUsersByProId" parameterType="ProProjectInfoSubdeptsUsers" resultType="Map">
select u.craft_type as craftType, u.use_status as useStatus,count(1) as total
from pro_project_info_subdepts_users u
where u.approve_status <![CDATA[ >= ]]> 100
<if test="comId != null "> and u.com_id = #{comId}</if>
<if test="parId != null "> and u.par_id = #{parId}</if>
<if test="projectId != null "> and u.project_id = #{projectId}</if>
<if test="subDeptId != null "> and u.sub_dept_id = #{subDeptId}</if>
<if test="subDeptType != null and subDeptType != ''"> and u.sub_dept_type = #{subDeptType}</if>
<if test="subDeptGroup != null "> and u.sub_dept_group = #{subDeptGroup}</if>
group by u.craft_type,u.use_status
</select>
2024-08-25 13:31:15 +08:00
</mapper>