xiangpei
2024-09-03 c7f492c5accca21bdf149148a5be6503552139f1
ycl-server/src/main/resources/mapper/zgyw/CheckScoreMapper.xml
@@ -18,7 +18,8 @@
    </resultMap>
    <sql id="selectCheckScoreVo">
        select id, score, tcs.dept_id, template_id, examine_tag, examine_category, tcs.create_time,tcs.update_time,tcs.update_user, publish
        select id, score, tcs.dept_id, template_id, examine_tag, examine_category,
        tcs.create_time,tcs.update_time,tcs.update_user, publish
        from t_check_score tcs left join sys_dept d on tcs.dept_id = d.dept_id
    </sql>
@@ -120,7 +121,8 @@
    </select>
    <insert id="saveBatch">
        insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values <foreach collection="scoreList" separator="," item="score">
        insert into t_check_score (score,dept_id,template_id,examine_tag,examine_category,create_time) values
        <foreach collection="scoreList" separator="," item="score">
        (#{score.score},#{score.deptId},#{score.templateId},#{score.examineTag},#{score.examineCategory},#{score.createTime})
    </foreach>
    </insert>
@@ -131,16 +133,29 @@
            tcs.dept_id,
            examine_category,
            ROUND(AVG(score) OVER(PARTITION BY tcs.dept_id, examine_category), 2) AS score,
        tcs.publish,
            tcs.create_time AS createTime
        FROM
            t_check_score tcs
                LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
        WHERE
        <where>
            examine_tag = #{examineTag}
          AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m')
        GROUP BY tcs.dept_id, examine_category,examine_tag
            <if test="params.publish != null  and params.publish != ''">and publish = #{params.publish}</if>
            ${params.dataScope}
        </where>
        GROUP BY tcs.dept_id, tcs.examine_category, tcs.examine_tag
</select>
    <select id="getLast" resultType="com.ycl.platform.domain.entity.CheckScore">
        select * from t_check_score tcs  LEFT JOIN sys_dept d ON tcs.dept_id = d.dept_id
        <where>
            tcs.examine_tag = #{examineTag}
            <if test="params.publish != null  and params.publish != ''">and tcs.publish = #{params.publish}</if>
            ${params.dataScope}
        </where>
        order by tcs.create_time desc limit 1
    </select>
    <select id="home" resultType="java.util.Map">
        <![CDATA[
        SELECT
@@ -168,7 +183,8 @@
        WHERE
            examine_tag = 1
          AND examine_category = #{category}
          AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate}, '%Y-%m')
        AND DATE_FORMAT(tcs.create_time, '%Y-%m') BETWEEN DATE_FORMAT(#{startDate}, '%Y-%m') AND DATE_FORMAT(#{endDate},
        '%Y-%m')
        GROUP BY tcs.dept_id
        ORDER BY score DESC, tcs.dept_id
    </select>