459 lines
27 KiB
XML
459 lines
27 KiB
XML
<?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" />
|
|
<result property="parId" column="par_id" />
|
|
<result property="comId" column="com_id" />
|
|
<result property="comName" column="com_name"/>
|
|
<result property="projectId" column="project_id" />
|
|
<result property="projectName" column="project_name" />
|
|
<result property="subDeptId" column="sub_dept_id" />
|
|
<result property="subDeptType" column="sub_dept_type" />
|
|
<result property="subDeptTypeName" column="sub_dept_type_name" />
|
|
<result property="subDeptName" column="sub_dept_name" />
|
|
<result property="subDeptPowerPath" column="sub_dept_power_path" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="userPost" column="user_post" />
|
|
<result property="subDeptGroup" column="sub_dept_group" />
|
|
<result property="subDeptGroupName" column="sub_dept_group_name" />
|
|
<result property="userName" column="user_name" />
|
|
<result property="cardType" column="card_type" />
|
|
<result property="workType" column="work_type" />
|
|
<result property="cardCode" column="card_code" />
|
|
<result property="userSex" column="user_sex" />
|
|
<result property="userPicture" column="user_picture" />
|
|
<result property="userPhone" column="user_phone" />
|
|
<result property="degreeGrade" column="degree_grade" />
|
|
<result property="degreeGradeName" column="degree_grade_name" />
|
|
<result property="userInfos" column="user_infos" />
|
|
<result property="craftType" column="craft_type" />
|
|
<result property="craftTypeName" column="craft_type_name" />
|
|
<result property="craftPost" column="craft_post" />
|
|
<result property="craftPostName" column="craft_post_name" />
|
|
<result property="eduStatus" column="edu_status" />
|
|
<result property="eduFilePath" column="edu_file_path" />
|
|
<result property="eduDate" column="edu_date" />
|
|
<result property="approveStatus" column="approve_status" />
|
|
<result property="useDate" column="use_date" />
|
|
<result property="useStatus" column="use_status" />
|
|
<result property="admitGuid" column="admit_guid" />
|
|
<result property="faceGuid" column="face_guid" />
|
|
<result property="qrCode" column="qr_code" />
|
|
<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" />
|
|
<result property="createBy" column="create_by" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateBy" column="update_by" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
<result property="source" column="source" />
|
|
</resultMap>
|
|
|
|
<sql id="selectProProjectInfoSubdeptsUsersVo">
|
|
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, pdept.sub_dept_name, psu.sub_dept_power_path, psu.user_id, psu.user_post, psu.sub_dept_group,
|
|
psu.sub_dept_group_name, psu.user_name, psu.card_type, psu.card_code, psu.user_sex, psu.user_picture, psu.user_phone, psu.degree_grade, dic4.dict_label as degree_grade_name, psu.user_infos, psu.craft_type, dic1.dict_label as craft_type_name, psu.craft_post, dic2.dict_label as craft_post_name, psu.edu_status, psu.edu_file_path, psu.edu_date, psu.approve_status,
|
|
psu.use_date, psu.use_status, psu.admit_guid, 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,
|
|
psu.remark, psu.source, psu.face_guid,sd.dept_name com_name,psu.work_type
|
|
from pro_project_info_subdepts_users psu
|
|
left join pro_project_info pi on pi.id = psu.project_id
|
|
left join pro_project_info_subdepts pdept on psu.sub_dept_id=pdept.id
|
|
left join sys_dept sd on sd.dept_id = psu.com_id
|
|
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'
|
|
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'
|
|
</sql>
|
|
|
|
<select id="selectProProjectInfoSubdeptsUsersList" parameterType="ProProjectInfoSubdeptsUsers" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
|
|
<where>
|
|
<if test="comId != null "> and psu.com_id = #{comId}</if>
|
|
<if test="parId != null "> and psu.par_id = #{parId}</if>
|
|
<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="userPost != null "> and psu.user_post = #{userPost}</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>
|
|
<if test="workType != null and workType != 0"> and psu.work_type = #{workType}</if>
|
|
<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>
|
|
<if test="eduDate != null "> and psu.edu_date = #{eduDate}</if>
|
|
<if test="approveStatus != null "> and psu.approve_status = #{approveStatus}</if>
|
|
<if test="useStatus != null and useStatus != ''"> and psu.use_status = #{useStatus}</if>
|
|
<if test="admitGuid!=null and admitGuid!=''">and psu.admit_guid = #{admitGuid}</if>
|
|
<if test="faceGuid!=null and faceGuid!=''">and psu.face_guid = #{faceGuid}</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>
|
|
<if test="userPhone != null and userPhone != ''"> and psu.user_phone = #{userPhone}</if>
|
|
<if test='activeTags == "finished"'> and psu.approve_status <![CDATA[ >= ]]> 100 </if>
|
|
<if test="isDel != null "> and psu.is_del = #{isDel}</if>
|
|
<if test='searchValue == "subUsers"'> and psu.user_post != '66' </if>
|
|
<if test='searchValue == "magUsers"'> and psu.user_post = '66' </if>
|
|
<if test='searchValue == "sedUsers"'> and psu.sub_dept_type in ('1','4','5') and psu.user_post not in ('4','5') </if>
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(psu.use_date) between #{params.beginTime} and #{params.endTime}</if>
|
|
and psu.is_del != 2
|
|
</where>
|
|
order by psu.id desc
|
|
</select>
|
|
|
|
<select id="findProProjectInfoSubdeptsUsersCount" parameterType="ProProjectInfoSubdeptsUsers" resultType="Map">
|
|
select psu.use_status as useStatus, count(1) as total from pro_project_info_subdepts_users psu
|
|
<where>
|
|
<if test="comId != null "> and psu.com_id = #{comId}</if>
|
|
<if test="parId != null "> and psu.par_id = #{parId}</if>
|
|
<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="userPost != null "> and psu.user_post = #{userPost}</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>
|
|
<if test="workType != null and workType != 0"> and psu.work_type = #{workType}</if>
|
|
<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>
|
|
<if test="eduDate != null "> and psu.edu_date = #{eduDate}</if>
|
|
<if test="approveStatus != null "> and psu.approve_status = #{approveStatus}</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>
|
|
<if test="userPhone != null and userPhone != ''"> and psu.user_phone = #{userPhone}</if>
|
|
<if test='activeTags == "finished"'> and psu.approve_status <![CDATA[ >= ]]> 100 and psu.use_status in (0,1)</if>
|
|
<if test="isDel != null "> and psu.is_del = #{isDel}</if>
|
|
<if test='searchValue == "subUsers"'> and psu.user_post != '66' </if>
|
|
<if test='searchValue == "magUsers"'> and psu.user_post = '66' </if>
|
|
<if test='searchValue == "sedUsers"'> and psu.sub_dept_type in ('1','4','5') and psu.user_post not in ('4','5') </if>
|
|
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(psu.use_date) between #{params.beginTime} and #{params.endTime}</if>
|
|
and psu.is_del != 2
|
|
</where>
|
|
group by psu.use_status
|
|
</select>
|
|
|
|
<select id="selectProProjectInfoSubdeptsUsersById" parameterType="Long" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
|
|
where psu.id = #{id}
|
|
</select>
|
|
|
|
<select id="selectProProjectInfoSubdeptsUsersByParamId" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
<include refid="selectProProjectInfoSubdeptsUsersVo"/>
|
|
where psu.project_id = #{proId} and psu.user_id = #{userId}
|
|
</select>
|
|
|
|
<insert id="insertProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers" useGeneratedKeys="true" keyProperty="id">
|
|
insert into pro_project_info_subdepts_users
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="parId != null">par_id,</if>
|
|
<if test="comId != null">com_id,</if>
|
|
<if test="projectId != null">project_id,</if>
|
|
<if test="subDeptId != null">sub_dept_id,</if>
|
|
<if test="subDeptType != null">sub_dept_type,</if>
|
|
<if test="subDeptName != null">sub_dept_name,</if>
|
|
<if test="subDeptPowerPath != null">sub_dept_power_path,</if>
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="userPost != null">user_post,</if>
|
|
<if test="subDeptGroup != null">sub_dept_group,</if>
|
|
<if test="subDeptGroupName != null">sub_dept_group_name,</if>
|
|
<if test="userName != null">user_name,</if>
|
|
<if test="cardType != null">card_type,</if>
|
|
<if test="workType != null">work_type,</if>
|
|
<if test="cardCode != null">card_code,</if>
|
|
<if test="userSex != null">user_sex,</if>
|
|
<if test="userPicture != null">user_picture,</if>
|
|
<if test="userPhone != null">user_phone,</if>
|
|
<if test="degreeGrade != null">degree_grade,</if>
|
|
<if test="userInfos != null">user_infos,</if>
|
|
<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="eduDate != null">edu_date,</if>
|
|
<if test="approveStatus != null">approve_status,</if>
|
|
<if test="useDate != null">use_date,</if>
|
|
<if test="useStatus != null">use_status,</if>
|
|
<if test="admitGuid != null">admit_guid,</if>
|
|
<if test="faceGuid != null">face_guid,</if>
|
|
<if test="qrCode != null">qr_code,</if>
|
|
<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>
|
|
<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>
|
|
<if test="source != null">source,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="parId != null">#{parId},</if>
|
|
<if test="comId != null">#{comId},</if>
|
|
<if test="projectId != null">#{projectId},</if>
|
|
<if test="subDeptId != null">#{subDeptId},</if>
|
|
<if test="subDeptType != null">#{subDeptType},</if>
|
|
<if test="subDeptName != null">#{subDeptName},</if>
|
|
<if test="subDeptPowerPath != null">#{subDeptPowerPath},</if>
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="userPost != null">#{userPost},</if>
|
|
<if test="subDeptGroup != null">#{subDeptGroup},</if>
|
|
<if test="subDeptGroupName != null">#{subDeptGroupName},</if>
|
|
<if test="userName != null">#{userName},</if>
|
|
<if test="cardType != null">#{cardType},</if>
|
|
<if test="workType != null">#{workType},</if>
|
|
<if test="cardCode != null">#{cardCode},</if>
|
|
<if test="userSex != null">#{userSex},</if>
|
|
<if test="userPicture != null">#{userPicture},</if>
|
|
<if test="userPhone != null">#{userPhone},</if>
|
|
<if test="degreeGrade != null">#{degreeGrade},</if>
|
|
<if test="userInfos != null">#{userInfos},</if>
|
|
<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="eduDate != null">#{eduDate},</if>
|
|
<if test="approveStatus != null">#{approveStatus},</if>
|
|
<if test="useDate != null">#{useDate},</if>
|
|
<if test="useStatus != null">#{useStatus},</if>
|
|
<if test="admitGuid != null">#{admitGuid},</if>
|
|
<if test="faceGuid != null">#{faceGuid},</if>
|
|
<if test="qrCode != null">#{qrCode},</if>
|
|
<if test="subStep != null">#{subStep},</if>
|
|
<if test="illnessStatus != null">#{illnessStatus},</if>
|
|
<if test="supIllnessStatus != null">#{supIllnessStatus},</if>
|
|
<if test="isDel != null">#{isDel},</if>
|
|
<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>
|
|
<if test="source != null">#{source},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateProProjectInfoSubdeptsUsers" parameterType="ProProjectInfoSubdeptsUsers">
|
|
update pro_project_info_subdepts_users
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="parId != null">par_id = #{parId},</if>
|
|
<if test="comId != null">com_id = #{comId},</if>
|
|
<if test="projectId != null">project_id = #{projectId},</if>
|
|
<if test="subDeptId != null">sub_dept_id = #{subDeptId},</if>
|
|
<if test="subDeptType != null">sub_dept_type = #{subDeptType},</if>
|
|
<if test="subDeptName != null">sub_dept_name = #{subDeptName},</if>
|
|
<if test="subDeptPowerPath != null">sub_dept_power_path = #{subDeptPowerPath},</if>
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="userPost != null">user_post = #{userPost},</if>
|
|
<if test="subDeptGroup != null">sub_dept_group = #{subDeptGroup},</if>
|
|
<if test="subDeptGroupName != null">sub_dept_group_name = #{subDeptGroupName},</if>
|
|
<if test="userName != null">user_name = #{userName},</if>
|
|
<if test="cardType != null">card_type = #{cardType},</if>
|
|
<if test="workType != null">work_type = #{workType},</if>
|
|
<if test="cardCode != null">card_code = #{cardCode},</if>
|
|
<if test="userSex != null">user_sex = #{userSex},</if>
|
|
<if test="userPicture != null">user_picture = #{userPicture},</if>
|
|
<if test="userPhone != null">user_phone = #{userPhone},</if>
|
|
<if test="degreeGrade != null">degree_grade = #{degreeGrade},</if>
|
|
<if test="userInfos != null">user_infos = #{userInfos},</if>
|
|
<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="eduDate != null">edu_date = #{eduDate},</if>
|
|
<if test="approveStatus != null">approve_status = #{approveStatus},</if>
|
|
<if test="useDate != null">use_date = #{useDate},</if>
|
|
<if test="useStatus != null">use_status = #{useStatus},</if>
|
|
<if test="admitGuid != null">admit_guid = #{admitGuid},</if>
|
|
<if test="faceGuid != null">face_guid = #{faceGuid},</if>
|
|
<if test="qrCode != null">qr_code = #{qrCode},</if>
|
|
<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="sortBy != null">sort_by = #{sortBy},</if>
|
|
<if test="isDel != null">is_del = #{isDel},</if>
|
|
<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>
|
|
<if test="source != null">source = #{source},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteProProjectInfoSubdeptsUsersById" parameterType="Long">
|
|
update pro_project_info_subdepts_users set is_del = 2 where id = #{id}
|
|
</update>
|
|
|
|
<update id="deleteProProjectInfoSubdeptsUsersByIds" parameterType="String">
|
|
update pro_project_info_subdepts_users set is_del = 2 where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="findUserByUserPhone" parameterType="String" resultType="int">
|
|
select count(1) from sys_user where phonenumber=#{phonenumber}
|
|
</select>
|
|
|
|
<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
|
|
use_status = 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>
|
|
|
|
<select id="findActReProcdefDept" resultType="Map">
|
|
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
|
|
</select>
|
|
|
|
<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>
|
|
|
|
<update id="updateUseStatusByParams">
|
|
update pro_project_info_subdepts_users set use_status = 2
|
|
where 1=1
|
|
<if test="subDeptId != null "> and sub_dept_id = #{subDeptId}</if>
|
|
<if test="subDeptGroupId != null "> and sub_dept_group = #{subDeptGroupId}</if>
|
|
</update>
|
|
|
|
<update id="editDefaultProjectById">
|
|
update pro_project_info_subdepts_users set sort_by = project_id where user_id = #{userId}
|
|
</update>
|
|
|
|
<select id="findUserPhone" resultType="Map">
|
|
select count(1) as total from sys_user su where (user_name = #{userPhone} or phonenumber = #{userPhone})
|
|
</select>
|
|
|
|
<select id="findProUserPhone" resultType="Map">
|
|
select count(1) as total from pro_project_info_subdepts_users where project_id = #{proId} and user_phone = #{userPhone}
|
|
</select>
|
|
|
|
<update id="updateUserPhone">
|
|
update sys_user set phonenumber = #{newUserPhone} where phonenumber = #{oldUserPhone}
|
|
</update>
|
|
|
|
<update id="updateUserNames">
|
|
update sys_user set user_name = #{newUserPhone} where user_name = #{oldUserPhone}
|
|
</update>
|
|
|
|
<update id="updatePhone">
|
|
update pro_project_info_subdepts_users set user_phone = #{newUserPhone} where user_phone = #{oldUserPhone}
|
|
</update>
|
|
|
|
<select id="fileGroupLeaderUsers" resultType="Map">
|
|
select user_phone as id, user_id as userId, user_name as userName, user_post as userPost, card_code as userCode from pro_project_info_subdepts_users
|
|
where sub_dept_id=#{subDeptId} and approve_status <![CDATA[ >= ]]> 100 and use_status = 0 and
|
|
(
|
|
user_post in (2,6,8)
|
|
<if test="craftPost != null and craftPost != ''"> or craft_post = #{craftPost}</if>
|
|
)
|
|
</select>
|
|
|
|
<select id="groupWorkderNative" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
select psu.card_code cardCode,nav.address comName
|
|
from pro_project_info_subdepts_users psu
|
|
left join sys_native nav on left(psu.card_code,6)=nav.id
|
|
where psu.project_id = #{projectId}
|
|
and psu.user_post != '66'
|
|
and psu.approve_status >= 100
|
|
and psu.is_del != 2
|
|
</select>
|
|
<select id="getWorkerCountGroupByType" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
select dic2.dict_label as craft_post_name,
|
|
count(1) comId
|
|
from pro_project_info_subdepts_users psu
|
|
join sys_dict_data dic2 on psu.`craft_post` = dic2.`dict_value` and dic2.`dict_type` = 'pro_craft_post'
|
|
where psu.is_del!=2
|
|
and psu.project_id=#{projectId}
|
|
GROUP BY dic2.dict_label
|
|
order by count(1) desc
|
|
</select>
|
|
|
|
<select id="getAttendanceAlert" resultMap="ProProjectInfoSubdeptsUsersResult">
|
|
select us.*,TIMESTAMPDIFF(Day, att.dt,now()) com_id from (
|
|
SELECT
|
|
psu.id, psu.par_id,psu.project_id, pi.project_name, psu.sub_dept_id, psu.sub_dept_type,
|
|
pdept.sub_dept_name, psu.sub_dept_group_name, psu.user_name
|
|
from pro_project_info_subdepts_users psu
|
|
left join pro_project_info pi on pi.id = psu.project_id
|
|
join pro_project_info_subdepts pdept on psu.sub_dept_id=pdept.id
|
|
where psu.is_del!=2 and psu.use_status=0 and psu.project_id=#{projectId}
|
|
) us
|
|
join (
|
|
select userId,max(ifnull(inTime,outTime)) dt from attendance_ubi_data
|
|
where projectid=#{projectId} and is_del!=1
|
|
group by userId
|
|
order by max(ifnull(inTime,outTime)) ) att on us.id=att.userId
|
|
</select>
|
|
</mapper> |