|
@@ -20,6 +20,34 @@
|
|
|
a.DATE_EVALUATION
|
|
|
</sql>
|
|
|
|
|
|
+ <sql id="permissonSql">
|
|
|
+ <if test="dto.permissonType == 5 or dto.permissonType == 2">
|
|
|
+ and ( a.DEPT_ORG_ID in
|
|
|
+ <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ or
|
|
|
+ a.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="dto.permissonType == 4 or dto.permissonType == 3">
|
|
|
+ and a.DEPT_ORG_ID in
|
|
|
+ <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="dto.permissonType == 1">
|
|
|
+ and a.COMPANY_ORG_ID in
|
|
|
+ <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item.orgId}
|
|
|
+ </foreach>
|
|
|
+ and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID = 0)
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
<insert id="insertEvaluationResult" useGeneratedKeys="true" keyProperty="id" parameterType="com.huaxu.evaluation.entity.EvaluationResultEntity">
|
|
|
insert sc_evaluation_result (TENANT_ID,COMPANY_ORG_ID,DEPT_ORG_ID,EVALUATION_BE,`STATE`,`CYCLE`,`YEAR`,`MONTH`,EVALUATION_GRADE,
|
|
|
`VALUE`,DATE_START,DATE_END,DATE_EVALUATION,STATUS,DATE_CREATE,CREATE_BY,DATE_UPDATE,UPDATE_BY)
|
|
@@ -38,51 +66,27 @@
|
|
|
<where>
|
|
|
a.status = 1 and a.tenant_id = #{dto.tenantId}
|
|
|
<if test="dto.userType != null and dto.userType != -999 and dto.userType != -9999 and dto.programItems != null and dto.programItems.size() > 0">
|
|
|
- <if test="dto.permissonType == 5 or dto.permissonType == 2">
|
|
|
- and ( a.DEPT_ORG_ID in
|
|
|
- <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
- #{item.orgId}
|
|
|
- </foreach>
|
|
|
- or
|
|
|
- a.COMPANY_ORG_ID in
|
|
|
- <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
- #{item.orgId}
|
|
|
- </foreach>
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="dto.permissonType == 4 or dto.permissonType == 3">
|
|
|
- and a.DEPT_ORG_ID in
|
|
|
- <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
- #{item.orgId}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="dto.permissonType == 1">
|
|
|
- and a.COMPANY_ORG_ID in
|
|
|
- <foreach collection="dto.programItems" item="item" open="(" close=")" separator=",">
|
|
|
- #{item.orgId}
|
|
|
- </foreach>
|
|
|
- and (a.DEPT_ORG_ID is null or a.DEPT_ORG_ID = 0)
|
|
|
- </if>
|
|
|
- <if test="dto.userName != null">
|
|
|
- and a.EVALUATION_BE like CONCAT('%',#{dto.userName,jdbcType=VARCHAR},'%')
|
|
|
- </if>
|
|
|
- <if test="dto.companyOrgId != null">
|
|
|
- and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
- </if>
|
|
|
- <if test="dto.deptOrgId != null">
|
|
|
- and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
- </if>
|
|
|
- <if test="dto.sort == 1 and dto.state != null">
|
|
|
- and a.`STATE` = #{dto.state}
|
|
|
- </if>
|
|
|
- <if test="dto.sort == 2">
|
|
|
- and a.`STATE` = 1
|
|
|
- </if>
|
|
|
- and a.`cycle` = #{dto.cycle}
|
|
|
- and a.`YEAR` = #{dto.year}
|
|
|
- <if test="dto.cycle != 2">
|
|
|
- and a.`month` = #{dto.month}
|
|
|
- </if>
|
|
|
+ <include refid="permissonSql"></include>
|
|
|
+ </if>
|
|
|
+ <if test="dto.userName != null">
|
|
|
+ and a.EVALUATION_BE like CONCAT('%',#{dto.userName,jdbcType=VARCHAR},'%')
|
|
|
+ </if>
|
|
|
+ <if test="dto.companyOrgId != null">
|
|
|
+ and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.deptOrgId != null">
|
|
|
+ and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.sort == 1 and dto.state != null">
|
|
|
+ and a.`STATE` = #{dto.state}
|
|
|
+ </if>
|
|
|
+ <if test="dto.sort == 2">
|
|
|
+ and a.`STATE` = 1
|
|
|
+ </if>
|
|
|
+ and a.`cycle` = #{dto.cycle}
|
|
|
+ and a.`YEAR` = #{dto.year}
|
|
|
+ <if test="dto.cycle != 2">
|
|
|
+ and a.`month` = #{dto.month}
|
|
|
</if>
|
|
|
</where>
|
|
|
<if test="dto.sort == 1">
|
|
@@ -103,4 +107,108 @@
|
|
|
DATE_UPDATE = #{dateUpdate},DATE_EVALUATION =#{dateEvaluation},EVALUATION_BY =#{evaluationBy}
|
|
|
where id = #{evaluationResultId}
|
|
|
</update>
|
|
|
+
|
|
|
+ <select id="findRanking" resultType="com.huaxu.evaluation.vo.EvaluationReportRankingVo">
|
|
|
+ select a.EVALUATION_BE,a.VALUE,a.EVALUATION_GRADE,t.COMPLETE_COUNT,t.COMPLETION_RATE
|
|
|
+ from sc_evaluation_result a
|
|
|
+ inner join sc_evaluation_result_task t on a.id = t.EVALUATION_RESULT_ID
|
|
|
+ <where>
|
|
|
+ a.status = 1 and a.tenant_id = #{dto.tenantId} and t.status = 1
|
|
|
+ <if test="dto.userType != null and dto.userType != -999 and dto.userType != -9999 and dto.programItems != null and dto.programItems.size() > 0">
|
|
|
+ <include refid="permissonSql"></include>
|
|
|
+ </if>
|
|
|
+ <if test="dto.companyOrgId != null">
|
|
|
+ and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.deptOrgId != null">
|
|
|
+ and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
+ </if>
|
|
|
+ and a.`STATE` = 1
|
|
|
+ and a.`cycle` = #{dto.cycle}
|
|
|
+ and a.`YEAR` = #{dto.year}
|
|
|
+ <if test="dto.cycle != 2">
|
|
|
+ and a.`month` = #{dto.month}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ order by a.VALUE desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findGradePercentage" resultType="com.huaxu.evaluation.vo.EvaluationGradePercentageVo">
|
|
|
+ select a.EVALUATION_GRADE, count(1) as "percentage"
|
|
|
+ from sc_evaluation_result a
|
|
|
+ <where>
|
|
|
+ a.status = 1 and a.tenant_id = #{dto.tenantId}
|
|
|
+ <if test="dto.userType != null and dto.userType != -999 and dto.userType != -9999 and dto.programItems != null and dto.programItems.size() > 0">
|
|
|
+ <include refid="permissonSql"></include>
|
|
|
+ </if>
|
|
|
+ <if test="dto.companyOrgId != null">
|
|
|
+ and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.deptOrgId != null">
|
|
|
+ and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
+ </if>
|
|
|
+ and a.`STATE` = 1
|
|
|
+ and a.`cycle` = #{dto.cycle}
|
|
|
+ and a.`YEAR` = #{dto.year}
|
|
|
+ <if test="dto.cycle != 2">
|
|
|
+ and a.`month` = #{dto.month}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by a.EVALUATION_GRADE
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countQualifiedNumber" resultType="com.huaxu.evaluation.vo.EvaluationQualifiedNumberVo">
|
|
|
+ select a.month, count(1) as "qualifiedNumber"
|
|
|
+ from sc_evaluation_result a
|
|
|
+ <where>
|
|
|
+ a.status = 1 and a.tenant_id = #{dto.tenantId}
|
|
|
+ <if test="dto.userType != null and dto.userType != -999 and dto.userType != -9999 and dto.programItems != null and dto.programItems.size() > 0">
|
|
|
+ <include refid="permissonSql"></include>
|
|
|
+ </if>
|
|
|
+ <if test="dto.companyOrgId != null">
|
|
|
+ and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.deptOrgId != null">
|
|
|
+ and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
+ </if>
|
|
|
+ and a.`STATE` = 1
|
|
|
+ and a.`cycle` = #{dto.cycle}
|
|
|
+ and a.`YEAR` = #{dto.year}
|
|
|
+ <if test="dto.months != null">
|
|
|
+ and a.`MONTH` in
|
|
|
+ <foreach collection="dto.months" item="month" open="(" close=")" separator=",">
|
|
|
+ #{month}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ and a.VALUE <![CDATA[ >= ]]> #{qualifiedValue}
|
|
|
+ </where>
|
|
|
+ group by a.`YEAR`,a.`MONTH`
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="countPerformanceAvg" resultType="com.huaxu.evaluation.vo.EvaluationPerformanceAvgVo">
|
|
|
+ select a.month, ROUND( SUM(a.value) / count(1), 2 ) AS "avg"
|
|
|
+ from sc_evaluation_result a
|
|
|
+ <where>
|
|
|
+ a.status = 1 and a.tenant_id = #{dto.tenantId}
|
|
|
+ <if test="dto.userType != null and dto.userType != -999 and dto.userType != -9999 and dto.programItems != null and dto.programItems.size() > 0">
|
|
|
+ <include refid="permissonSql"></include>
|
|
|
+ </if>
|
|
|
+ <if test="dto.companyOrgId != null">
|
|
|
+ and a.COMPANY_ORG_ID = #{dto.companyOrgId}
|
|
|
+ </if>
|
|
|
+ <if test="dto.deptOrgId != null">
|
|
|
+ and a.DEPT_ORG_ID = #{dto.deptOrgId}
|
|
|
+ </if>
|
|
|
+ and a.`STATE` = 1
|
|
|
+ and a.`cycle` = #{dto.cycle}
|
|
|
+ and a.`YEAR` = #{dto.year}
|
|
|
+ <if test="dto.months != null">
|
|
|
+ and a.`MONTH` in
|
|
|
+ <foreach collection="dto.months" item="month" open="(" close=")" separator=",">
|
|
|
+ #{month}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ group by a.`YEAR`,a.`MONTH`
|
|
|
+ </select>
|
|
|
</mapper>
|