JxglPerformanceAppraisalMapper.xml 14.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?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="cn.timer.api.dao.jxgl.JxglPerformanceAppraisalMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.jxgl.JxglPerformanceAppraisal" >
                <id column="id" property="id" />
                <result column="org_code" property="orgCode" />
                <result column="name" property="name" />
                <result column="period" property="period" />
                <result column="appraisal_start_time" property="appraisalStartTime" />
                <result column="appraisal_end_time" property="appraisalEndTime" />
                <result column="is_visible" property="isVisible" />
                <result column="sts" property="sts" />
                <result column="scope" property="scope" />
                <result column="appraisal_t_name" property="appraisalTName" />
                <result column="appraisal_person_num" property="appraisalPersonNum" />
                <result column="process_node" property="processNode" />
19
                <result column="being_appraisal_person" property="beingAppraisalPerson" />
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
                <result column="create_time" property="createTime" />
                <result column="update_time" property="updateTime" />
    </resultMap>

    <resultMap id="BaseResultMap_ALl" type="cn.timer.api.bean.jxgl.JxglPerformanceAppraisal" >
                <id column="id" property="id" />
                <result column="org_code" property="orgCode" />
                <result column="name" property="name" />
                <result column="period" property="period" />
                <result column="appraisal_start_time" property="appraisalStartTime" />
                <result column="appraisal_end_time" property="appraisalEndTime" />
                <result column="is_visible" property="isVisible" />
                <result column="sts" property="sts" />
                <result column="scope" property="scope" />
                <result column="appraisal_t_name" property="appraisalTName" />
                <result column="appraisal_person_num" property="appraisalPersonNum" />
                <result column="process_node" property="processNode" />
                <result column="being_appraisal_person" property="beingAppraisalPerson" />
                <result column="create_time" property="createTime" />
                <result column="update_time" property="updateTime" />
                
                <result column="target_seting" property="targetSeting" />
                <result column="performance_score" property="performanceScore" />
                <result column="result_verification" property="resultVerification" />
                <result column="performance_archive" property="performanceArchive" />
45 46 47 48 49
                <association property="appraisal" column="b_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisal" columnPrefix="b_"
                resultMap="cn.timer.api.dao.jxgl.JxglAppraisalMapper.BaseResultMap" />
                <association property="appraisalAssessment" column="c_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisalAssessment" columnPrefix="c_"
                resultMap="cn.timer.api.dao.jxgl.JxglAppraisalAssessmentMapper.BaseResultMap" />
                
50 51 52 53 54 55 56 57 58 59 60 61 62 63
    </resultMap>

    <sql id="Base_Column_List">
                id,
                org_code,
                name,
                period,
                appraisal_start_time,
                appraisal_end_time,
                is_visible,
                sts,
                scope,
                appraisal_t_name,
                appraisal_person_num,
64
                process_node,
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
                being_appraisal_person,
                create_time,
                update_time
    </sql>
    
    <sql id="Base_Column_List_a">
                a.id,
                a.org_code,
                a.name,
                a.period,
                a.appraisal_start_time,
                a.appraisal_end_time,
                a.is_visible,
                a.sts,
                a.scope,
                a.appraisal_t_name,
                a.appraisal_person_num,
               <!--  a.process_node,
                a.being_appraisal_person, -->
                a.create_time,
                a.update_time
86 87
    </sql>
    
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    <sql id="Base_Column_List_b">
                b.id                      b_id,
                b.performance_appraisal_id b_performance_appraisal_id,
                b.emp_num                 b_emp_num,
                b.name                    b_name,
                b.appraisal_explain       b_appraisal_explain,
                b.create_time             b_create_time,
                b.update_time             b_update_time,
                b.sts                      b_sts
    </sql>
    
     <sql id="Base_Column_List_c">
                c.id                 c_id,
                c.appraisal_id       c_appraisal_id,
                c.assessor_id        c_assessor_id,
                c.assessor_name      c_assessor_name,
                c.comprehensive_score c_comprehensive_score,
                c.remarks            c_remarks,
                c.type               c_type,
                c.create_time        c_create_time,
                c.level               c_level
    </sql>
    
111 112 113 114 115 116 117 118 119 120 121 122
    <sql id="Base_Column_List_Alias">
                id JxglPerformanceAppraisal_id,
                org_code JxglPerformanceAppraisal_org_code,
                name JxglPerformanceAppraisal_name,
                period JxglPerformanceAppraisal_period,
                appraisal_start_time JxglPerformanceAppraisal_appraisal_start_time,
                appraisal_end_time JxglPerformanceAppraisal_appraisal_end_time,
                is_visible JxglPerformanceAppraisal_is_visible,
                sts JxglPerformanceAppraisal_sts,
                scope JxglPerformanceAppraisal_scope,
                appraisal_t_name JxglPerformanceAppraisal_appraisal_t_name,
                appraisal_person_num JxglPerformanceAppraisal_appraisal_person_num,
123
                process_node JxglPerformanceAppraisal_process_node,
124 125 126
                being_appraisal_person JxglPerformanceAppraisal_being_appraisal_person,
                create_time JxglPerformanceAppraisal_create_time,
                update_time JxglPerformanceAppraisal_update_time
127 128
    </sql>

129 130 131 132 133 134 135 136 137
	<select id="selectListByQuery" resultMap="BaseResultMap_ALl" >
        SELECT 
        	<include refid="Base_Column_List_a" />,
        	SUM((CASE WHEN b.sts in (0,1) THEN 1 ELSE 0 END)) AS target_seting,
			SUM((CASE WHEN b.sts in (2,3) THEN 1 ELSE 0 END)) AS performance_score,
			SUM((CASE WHEN b.sts in (4,5) THEN 1 ELSE 0 END)) AS result_verification,
			SUM((CASE WHEN b.sts = 7 THEN 1 ELSE 0 END)) AS performance_archive
        FROM jxgl_performance_appraisal a
        LEFT JOIN jxgl_appraisal b ON a.id = b.performance_appraisal_id
138
        WHERE a.org_code = #{param.orgCode} AND a.sts != 3
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
        	<if test="param.query != null and param.query != ''">
        		and (
        			a.name like CONCAT('%',#{param.query},'%') 
        		)
        	</if>
        	<if test="param.sts != null">
        		and a.sts = #{param.sts}
			</if>
        	<if test="param.startTime != null and param.startTime != ''">
        		and a.create_time <![CDATA[ >= ]]> #{param.startTime}
        	</if>
        	<if test="param.endTime != null and param.endTime != ''">
        		and a.create_time <![CDATA[ <= ]]> #{param.endTime}
        	</if> 
        GROUP BY a.id 
        ORDER BY a.id DESC
        	
    </select>
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    
	<select id="selectArchiveListByQuery" resultMap="BaseResultMap_ALl" >
        SELECT 
        	<include refid="Base_Column_List_a" />,
        	SUM((CASE WHEN b.sts in (0,1) THEN 1 ELSE 0 END)) AS target_seting,
			SUM((CASE WHEN b.sts in (2,3) THEN 1 ELSE 0 END)) AS performance_score,
			SUM((CASE WHEN b.sts in (4,5) THEN 1 ELSE 0 END)) AS result_verification,
			SUM((CASE WHEN b.sts = 7 THEN 1 ELSE 0 END)) AS performance_archive
        FROM jxgl_performance_appraisal a
        LEFT JOIN jxgl_appraisal b ON a.id = b.performance_appraisal_id
        WHERE a.org_code = #{param.orgCode} AND a.sts = 3
        	<if test="param.query != null and param.query != ''">
        		and (
        			a.name like CONCAT('%',#{param.query},'%') 
        		)
        	</if>
        	<if test="param.startTime != null and param.startTime != ''">
        		and a.create_time <![CDATA[ >= ]]> #{param.startTime}
        	</if>
        	<if test="param.endTime != null and param.endTime != ''">
        		and a.create_time <![CDATA[ <= ]]> #{param.endTime}
        	</if> 
        GROUP BY a.id 
        ORDER BY a.id DESC
        	
    </select>

	<select id="selectListEmpByQuery" resultMap="BaseResultMap_ALl" >
        SELECT 
        	a.name,a.appraisal_start_time,a.appraisal_end_time,
        	b.sts b_sts,
        	c.comprehensive_score c_comprehensive_score,
        	c.level c_level
		FROM jxgl_performance_appraisal a
		LEFT JOIN jxgl_appraisal b ON b.performance_appraisal_id = a.id
		LEFT JOIN jxgl_appraisal_assessment c ON b.id = c.appraisal_id
		WHERE a.org_code = #{param.orgCode} AND b.emp_num = #{param.id} AND c.type = 1
194

195
    </select>
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
	<!-- 

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.jxgl.JxglPerformanceAppraisal">
        INSERT INTO jxgl_performance_appraisal
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != orgCode'>
                        org_code,
                        </if>
                        <if test ='null != name'>
                        name,
                        </if>
                        <if test ='null != period'>
                        period,
                        </if>
                        <if test ='null != appraisalStartTime'>
                        appraisal_start_time,
                        </if>
                        <if test ='null != appraisalEndTime'>
                        appraisal_end_time,
                        </if>
                        <if test ='null != isVisible'>
                        is_visible,
                        </if>
                        <if test ='null != sts'>
                        sts,
                        </if>
                        <if test ='null != scope'>
                        scope,
                        </if>
                        <if test ='null != appraisalTName'>
                        appraisal_t_name,
                        </if>
                        <if test ='null != appraisalPersonNum'>
                        appraisal_person_num,
                        </if>
                        <if test ='null != processNode'>
232 233 234
                        process_node,
                        </if>
                        <if test ='null != beingAppraisalPerson'>
235 236 237 238 239 240 241
                        being_appraisal_person,
                        </if>
                        <if test ='null != createTime'>
                        create_time,
                        </if>
                        <if test ='null != updateTime'>
                        update_time
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != orgCode'>
                        #{orgCode},
                        </if>
                        <if test ='null != name'>
                        #{name},
                        </if>
                        <if test ='null != period'>
                        #{period},
                        </if>
                        <if test ='null != appraisalStartTime'>
                        #{appraisalStartTime},
                        </if>
                        <if test ='null != appraisalEndTime'>
                        #{appraisalEndTime},
                        </if>
                        <if test ='null != isVisible'>
                        #{isVisible},
                        </if>
                        <if test ='null != sts'>
                        #{sts},
                        </if>
                        <if test ='null != scope'>
                        #{scope},
                        </if>
                        <if test ='null != appraisalTName'>
                        #{appraisalTName},
                        </if>
                        <if test ='null != appraisalPersonNum'>
                        #{appraisalPersonNum},
                        </if>
                        <if test ='null != processNode'>
276 277 278
                        #{processNode},
                        </if>
                        <if test ='null != beingAppraisalPerson'>
279 280 281 282 283 284 285
                        #{beingAppraisalPerson},
                        </if>
                        <if test ='null != createTime'>
                        #{createTime},
                        </if>
                        <if test ='null != updateTime'>
                        #{updateTime}
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307
                        </if>
        </trim>
    </insert>

    <delete id="delete" >
        DELETE FROM jxgl_performance_appraisal
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.jxgl.JxglPerformanceAppraisal">
        UPDATE jxgl_performance_appraisal
        <set>
                    <if test ='null != orgCode'>org_code = #{orgCode},</if>
                    <if test ='null != name'>name = #{name},</if>
                    <if test ='null != period'>period = #{period},</if>
                    <if test ='null != appraisalStartTime'>appraisal_start_time = #{appraisalStartTime},</if>
                    <if test ='null != appraisalEndTime'>appraisal_end_time = #{appraisalEndTime},</if>
                    <if test ='null != isVisible'>is_visible = #{isVisible},</if>
                    <if test ='null != sts'>sts = #{sts},</if>
                    <if test ='null != scope'>scope = #{scope},</if>
                    <if test ='null != appraisalTName'>appraisal_t_name = #{appraisalTName},</if>
                    <if test ='null != appraisalPersonNum'>appraisal_person_num = #{appraisalPersonNum},</if>
308
                    <if test ='null != processNode'>process_node = #{processNode},</if>
309 310 311
                    <if test ='null != beingAppraisalPerson'>being_appraisal_person = #{beingAppraisalPerson},</if>
                    <if test ='null != createTime'>create_time = #{createTime},</if>
                    <if test ='null != updateTime'>update_time = #{updateTime}</if>
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
        </set>
        WHERE id = #{id}
    </update>


    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM jxgl_performance_appraisal
        WHERE id = #{id}
    </select>

    <select id="pageList" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM jxgl_performance_appraisal
        LIMIT #{offset}, #{pageSize}
    </select>

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM jxgl_performance_appraisal
    </select>

	 -->

</mapper>