gs_sub_evaluate/src/main/resources/mappers/evaluate/TeamEvaluateMapper.xml

278 lines
12 KiB
XML
Raw Normal View History

2025-01-16 16:02:08 +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.gs.sub.evaluate.evaluate.dao.TeamEvaluateDao">
<!--评价/审核/重新评价-->
<update id="evaluateData">
<if test="operType == 1 or operType == 3">
UPDATE pt_team_exit SET manager = #{manager},level = #{level},mark = #{mark},ev_status = '1',check_status = '0',
ev_user_id = #{evUserId},ev_user_name = #{evUserName},reject_reason = null WHERE id = #{id}
</if>
<if test="operType == 2">
<if test="roleId == 5">
UPDATE pt_team_exit SET check_status_two = #{checkStatus},reject_reason_two = #{rejectReason},
check_user_id_two = #{checkUserId},check_user_name_two = #{checkUserName}, check_status = #{checkStatus} WHERE id = #{id}
</if>
<if test="roleId == 6">
UPDATE pt_team_exit SET check_status = #{checkStatus},reject_reason =
#{rejectReason},
<if test="checkStatus == 2 || checkStatus == '2'">
reject_reason_two = '',
check_status_two = null,
</if>
<if test="checkStatus == 1 || checkStatus == '1'">
reject_reason_two = '',
check_status_two = 0,
</if>
check_user_id = #{checkUserId},check_user_name = #{checkUserName} WHERE id = #{id}
</if>
</if>
</update>
<!--operType 1.评价列表 2.审核评价列表 3.所有评价列表-->
<select id="findByPage" parameterType="com.bonus.gs.sub.evaluate.evaluate.beans.TeamEvaluateBean"
resultType="com.bonus.gs.sub.evaluate.evaluate.beans.TeamEvaluateBean">
SELECT
pte.id,
pte.team_name AS teamName,
pte.user_name AS userName,
pte.phone AS phone,
pte.sub_name AS subName,
pte.pro_name AS proName,
pte.manager,
DATE_FORMAT(pte.evaluate_time,'%Y-%m-%d %H:%i:%s') AS evaluateTime,
CASE pte.level WHEN '1' THEN '优' WHEN '2' THEN '良' WHEN '3' THEN '中' WHEN '4' THEN '差' END AS level,
CASE pte.ev_status WHEN '0' THEN '待评价' WHEN '1' THEN '已评价' ELSE '待评价' END AS evStatus,
CASE pte.check_status WHEN '0' THEN '待审核' WHEN '1' THEN '已通过' WHEN '2' THEN '评价驳回' ELSE '待审核' END
AS checkStatus,
pte.reject_reason AS rejectReason,
pu.TELPHONE AS sendPhone,
pte.parent_id AS parentId
FROM pt_team_exit pte
LEFT JOIN pm_user pu ON pte.ev_user_id = pu.ID
<where>
<if test="param.operType == 1">
AND pte.parent_id = #{param.parentId}
</if>
<if test="param.operType == 2">
AND pte.ev_status = '1'
</if>
<if test="param.keyWord!=null and param.keyWord!=''">
AND (
INSTR(pte.team_name,#{param.keyWord}) > 0 OR
INSTR(pte.phone,#{param.keyWord}) > 0 OR
INSTR(pte.user_name,#{param.keyWord}) > 0 OR
INSTR(pte.sub_name,#{param.keyWord}) > 0 OR
INSTR(pte.pro_name,#{param.keyWord}) > 0 OR
INSTR(pte.manager,#{param.keyWord}) > 0
)
</if>
<if test="param.evStatus == 1">
AND (pte.ev_status = '0' OR pte.ev_status IS NULL)
</if>
<if test="param.evStatus == 2">
AND pte.ev_status = '1' AND pte.check_status != '2'
</if>
<if test="param.evStatus == 3">
AND pte.check_status = '2'
</if>
<if test="param.checkStatus !=null and param.checkStatus!=''">
AND pte.check_status = #{param.checkStatus}
</if>
<if test="param.startDate!=null and param.startDate!='' and param.endDate!=null and param.endDate!=''">
AND DATE_FORMAT(pte.evaluate_time, '%Y-%m-%d') BETWEEN #{param.startDate} AND #{param.endDate}
</if>
</where>
</select>
<!--获取评价详情-->
<select id="getEvaluateData" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.TeamEvaluateBean">
SELECT pte.id,
pte.manager AS manager,
2025-02-27 16:40:55 +08:00
DATE_FORMAT(pte.evaluate_time,'%Y-%m-%d') AS evaluateTime,
2025-01-16 16:02:08 +08:00
pte.level,
pte.mark,
pte.team_name AS teamName,
pte.user_name AS userName,
pte.phone AS phone,
pte.sub_name AS subName,
pte.pro_name AS proName,
pte.manager
FROM pt_team_exit pte
WHERE pte.id = #{id}
</select>
<!--获取班组评价列表-->
<select id="getExportExcelData" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.TeamEvaluateBean">
SELECT
pte.id,
pte.team_name AS teamName,
pte.user_name AS userName,
pte.phone AS phone,
pte.sub_name AS subName,
pte.pro_name AS proName,
pte.manager,
DATE_FORMAT(pte.evaluate_time,'%Y-%m-%d %H:%i:%s') AS evaluateTime,
CASE pte.level WHEN '1' THEN '优' WHEN '2' THEN '良' WHEN '3' THEN '中' WHEN '4' THEN '差' END AS level,
CASE pte.ev_status WHEN '0' THEN '待评价' WHEN '1' THEN '已评价' ELSE '待评价' END AS evStatus,
CASE pte.check_status WHEN '0' THEN '待审核' WHEN '1' THEN '已通过' WHEN '2' THEN '评价驳回' ELSE '待审核' END AS checkStatus,
pte.reject_reason AS rejectReason
FROM pt_team_exit pte
<where>
<if test="param.operType == 1">
AND pte.parent_id = #{param.parentId}
</if>
<if test="param.operType == 2">
AND pte.ev_status = '1'
</if>
<if test="param.keyWord!=null and param.keyWord!=''">
AND (
INSTR(pte.team_name,#{param.keyWord}) > 0 OR
INSTR(pte.phone,#{param.keyWord}) > 0 OR
INSTR(pte.user_name,#{param.keyWord}) > 0 OR
INSTR(pte.sub_name,#{param.keyWord}) > 0 OR
INSTR(pte.pro_name,#{param.keyWord}) > 0 OR
INSTR(pte.manager,#{param.keyWord}) > 0
)
</if>
<if test="param.evStatus == 1">
AND (pte.ev_status = '0' OR pte.ev_status IS NULL)
</if>
<if test="param.evStatus == 2">
AND pte.ev_status = '1' AND pte.check_status != '2'
</if>
<if test="param.evStatus == 3">
AND pte.check_status = '2'
</if>
<if test="param.checkStatus !=null and param.checkStatus!=''">
AND pte.check_status = #{param.checkStatus}
</if>
<if test="param.startDate!=null and param.startDate!='' and param.endDate!=null and param.endDate!=''">
AND DATE_FORMAT(pte.evaluate_time, '%Y-%m-%d') BETWEEN #{param.startDate} AND #{param.endDate}
</if>
</where>
</select>
<!--获取项目经理的手机号-->
<select id="getSendPhone" resultType="java.lang.String">
SELECT GROUP_CONCAT(TELPHONE)
FROM gs_exam.pm_user WHERE dept_id = #{parentId}
2025-01-16 16:02:08 +08:00
GROUP BY dept_id
</select>
<select id="getTeamEvaluateList" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.TeamEvaluateBean">
SELECT
pte.id,
pte.team_name AS teamName,
pte.user_name AS userName,
pte.phone AS phone,
pte.sub_name AS subName,
pte.pro_name AS proName,
pte.manager,
2025-03-03 14:21:47 +08:00
pte.evaluate_time evaluateTime,
2025-01-24 15:59:01 +08:00
su.phone AS sendPhone,
2025-01-16 16:02:08 +08:00
DATE_FORMAT(pte.evaluate_time,'%Y-%m-%d %H:%i:%s') AS evaluateTime,
CASE pte.level WHEN '1' THEN '优' WHEN '2' THEN '良' WHEN '3' THEN '中' WHEN '4' THEN '差' END AS level,
CASE pte.ev_status WHEN '0' THEN '待评价' WHEN '1' THEN '已评价' ELSE '待评价' END AS evStatus,
<if test="roleId == 6">
case pte.check_status
WHEN '0' THEN '待审核'
WHEN '1' THEN '已通过'
WHEN '2' THEN '评价驳回'
ELSE '待审核'
END AS checkStatus,
pte.reject_reason AS rejectReason,
</if>
<if test="roleId == 5">
case (if(pte.check_status = '1',pte.check_status_two,pte.check_status))
WHEN '0' THEN '待审核'
WHEN '1' THEN '已通过'
WHEN '2' THEN '评价驳回'
ELSE '待审核'
END AS checkStatus,
pte.reject_reason_two AS rejectReason,
</if>
<if test="roleId != 5 and roleId != 6">
case (if(pte.check_status = '1',pte.check_status_two,pte.check_status))
WHEN '0' THEN '待审核'
WHEN '1' THEN '已通过'
WHEN '2' THEN '评价驳回'
ELSE '待审核'
END AS checkStatus,
IF(pte.reject_reason is not null and pte.reject_reason != '' , pte.reject_reason ,pte.reject_reason_two) AS rejectReason,
</if>
pte.check_status as status,
pu.TELPHONE AS sendPhone,
pte.parent_id AS parentId
FROM pt_team_exit pte
LEFT JOIN gs_exam.pm_user pu ON pte.ev_user_id = pu.ID
2025-01-16 16:02:08 +08:00
LEFT JOIN pm_org_info poi ON poi.id = pte.parent_id
LEFT JOIN pm_org_info poi1 ON poi1.id = poi.parent_id
2025-01-24 15:59:01 +08:00
left join sys_user su on su.id = pte.ev_user_id
2025-01-16 16:02:08 +08:00
<where>
2025-03-03 14:21:47 +08:00
<if test="times!=null and times!=''">
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
and DATE_FORMAT(pte.evaluate_time,'%Y-%m-%d') between #{startTime} and #{endTime}
</if>
</if>
2025-01-16 16:02:08 +08:00
<if test="operType == 1">
AND poi1.user_id = #{evUserId}
</if>
<if test="operType == 2">
AND pte.ev_status = '1'
<if test="roleId == 5">
and pte.check_status is not null
</if>
<if test="roleId == 1">
and 1 = 1
</if>
<if test="roleId != 1 and roleId != 5 and roleId != 6">
and pte.check_status = 10
</if>
</if>
<if test="keyWord!=null and keyWord!=''">
AND (
INSTR(pte.team_name,#{keyWord}) > 0 OR
INSTR(pte.phone,#{keyWord}) > 0 OR
INSTR(pte.user_name,#{keyWord}) > 0 OR
INSTR(pte.sub_name,#{keyWord}) > 0 OR
INSTR(pte.pro_name,#{keyWord}) > 0 OR
INSTR(pte.manager,#{keyWord}) > 0
)
</if>
2025-03-03 14:21:47 +08:00
2025-02-26 16:55:36 +08:00
<if test="evStatus == 4">
AND (pte.ev_status = '1' and (check_status=0 or check_status_two=0 ))
</if>
<if test="evStatus == 6">
AND (pte.ev_status = '1' and (check_status=1 and check_status_two=1 ))
</if>
<if test="evStatus == 7">
AND (pte.ev_status = '1' and (check_status=2 or check_status_two=2 ))
</if>
2025-01-16 16:02:08 +08:00
<if test="evStatus == 1">
AND (pte.ev_status = '0' OR pte.ev_status IS NULL)
</if>
<if test="evStatus == 2">
AND pte.ev_status = '1' AND pte.check_status != '2'
</if>
<if test="evStatus == 3">
AND pte.check_status = '2'
</if>
<if test="checkStatus !=null and checkStatus!=''">
AND pte.check_status = #{checkStatus}
</if>
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
AND DATE_FORMAT(pte.evaluate_time, '%Y-%m-%d') BETWEEN #{startDate} AND #{endDate}
</if>
2025-03-03 14:21:47 +08:00
<if test="subName!=null and subName!=''">
AND pte.sub_name=#{subName}
</if>
2025-01-16 16:02:08 +08:00
</where>
2025-07-16 09:58:56 +08:00
ORDER BY pte.create_time DESC
2025-01-16 16:02:08 +08:00
</select>
2025-03-03 14:21:47 +08:00
<!--查询班组评价全部分包商-->
<select id="getSupList" resultType="java.lang.String">
select distinct sub_name
from pt_team_exit
</select>
2025-01-16 16:02:08 +08:00
</mapper>