You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.5 KiB
69 lines
2.5 KiB
<?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.epmet.dao.ProjectSatisfactionStatisticsDao">
|
|
|
|
<!-- 更新项目评价数据 -->
|
|
<update id="updateEvaluateData">
|
|
UPDATE project_satisfaction_statistics
|
|
SET
|
|
<if test="evalType == 'bad' ">
|
|
BAD_COUNT = BAD_COUNT + 1,
|
|
</if>
|
|
<if test="evalType == 'good' ">
|
|
GOOD_COUNT = GOOD_COUNT + 1,
|
|
</if>
|
|
<if test="evalType == 'perfect' ">
|
|
PERFECT_COUNT = PERFECT_COUNT + 1,
|
|
</if>
|
|
UPDATED_TIME = NOW()
|
|
WHERE DEL_FLAG = '0'
|
|
AND PROJECT_ID = #{projectId}
|
|
</update>
|
|
|
|
<!-- 校验此项目是否存在 -->
|
|
<select id="checkProjectExists" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT( 1 )
|
|
FROM
|
|
project_satisfaction_statistics
|
|
WHERE
|
|
del_flag = '0'
|
|
AND PROJECT_ID = #{projectId}
|
|
</select>
|
|
|
|
<!-- 查询已经存在的记录 -->
|
|
<select id="selectExistsProject" resultType="java.lang.String">
|
|
SELECT PROJECT_ID FROM project_satisfaction_statistics WHERE DEL_FLAG = '0'
|
|
</select>
|
|
<!-- 根据项目ID查询此项目评价信息 -->
|
|
<select id="selectInfoByProjectId" resultType="com.epmet.entity.ProjectSatisfactionStatisticsEntity">
|
|
select * from project_satisfaction_statistics where DEL_FLAG = '0' AND PROJECT_ID = #{projectId}
|
|
</select>
|
|
|
|
<!-- 查询评价分数小于xx分的项目 -->
|
|
<select id="selectProjectByScore" resultType="com.epmet.dto.result.MassesDiscontentResultDTO">
|
|
select a.* from
|
|
(SELECT
|
|
s.PROJECT_ID,
|
|
p.ORIGIN_ID AS issueId,
|
|
IFNULL((((s.SHOULD_EVALUATE_COUNT - s.GOOD_COUNT - s.BAD_COUNT - s.PERFECT_COUNT) * 80 + s.BAD_COUNT * 60 + s.GOOD_COUNT * 80 + s.PERFECT_COUNT * 100 )/ s.SHOULD_EVALUATE_COUNT),0) AS score
|
|
FROM project_satisfaction_statistics s
|
|
LEFT JOIN project p on p.id = s.PROJECT_ID AND p.DEL_FLAG = '0'
|
|
WHERE s.DEL_FLAG = '0'
|
|
AND (
|
|
<foreach collection="projectIds" item="projectId" separator=" OR ">
|
|
s.PROJECT_ID = #{projectId}
|
|
</foreach>
|
|
)) a
|
|
where score <![CDATA[ < ]]> #{setScore}
|
|
<if test="sortType == 'desc' ">
|
|
ORDER BY score DESC
|
|
</if>
|
|
<if test="sortType == 'asc' ">
|
|
ORDER BY score ASC
|
|
</if>
|
|
</select>
|
|
|
|
|
|
</mapper>
|