JxglPerformanceAppraisalMapper.xml 16.3 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
                <association property="appraisal" column="b_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisal" columnPrefix="b_"
tangzhaoqian committed
46 47
                resultMap="cn.timer.api.dao.jxgl.JxglAppraisalMapper.BaseResultMap_My">
                </association>
48 49 50
                <association property="appraisalAssessment" column="c_id" javaType="cn.timer.api.bean.jxgl.JxglAppraisalAssessment" columnPrefix="c_"
                resultMap="cn.timer.api.dao.jxgl.JxglAppraisalAssessmentMapper.BaseResultMap" />
                
51 52 53 54 55 56 57 58 59 60 61 62 63 64
    </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,
65
                process_node,
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
                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
87 88
    </sql>
    
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
    <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>
    
112 113 114 115 116 117 118 119 120 121 122 123
    <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,
124
                process_node JxglPerformanceAppraisal_process_node,
125 126 127
                being_appraisal_person JxglPerformanceAppraisal_being_appraisal_person,
                create_time JxglPerformanceAppraisal_create_time,
                update_time JxglPerformanceAppraisal_update_time
128 129
    </sql>

130 131 132 133 134 135 136 137 138
	<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
139
        WHERE a.org_code = #{param.orgCode} AND a.sts != 3
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
        	<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>
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
    
	<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,
188
        	b.id b_id, b.sts b_sts,
tangzhaoqian committed
189
        	(SELECT name FROM yggl_main_emp WHERE emp_num = d.executor_id AND org_code = a.org_code) as b_executor_name,
190 191 192 193
        	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
194
		LEFT JOIN jxgl_appraisal_assessment c ON b.id = c.appraisal_id AND c.type = 1
tangzhaoqian committed
195
		LEFT JOIN jxgl_process_node d ON b.id = d.appraisal_id AND d.sts = 1
196
		WHERE a.org_code = #{param.orgCode} AND b.emp_num = #{param.id}
197

198
    </select>
tangzhaoqian committed
199 200 201 202
    
    <select id="selectMyByQuery" resultMap="BaseResultMap_ALl" >
        SELECT 
        	a.name,a.appraisal_start_time,a.appraisal_end_time,
203
        	b.id b_id,b.sts b_sts,
tangzhaoqian committed
204
        	c.comprehensive_score c_comprehensive_score,
205 206 207
        	c.level c_level,
        	e.name b_executor_name, e.phone b_phone,
        	(SELECT name FROM zzgl_bmgw_m WHERE id = (SELECT up_id FROM zzgl_bmgw_m WHERE id = e.bmgw_id limit 1) limit 1) as b_bm_name
tangzhaoqian committed
208 209 210 211
		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 AND c.type = 1 
		LEFT JOIN jxgl_process_node d ON b.id = d.appraisal_id AND d.sts = 1
212
		LEFT JOIN yggl_main_emp e ON b.emp_num = e.emp_num AND a.org_code = e.org_code
tangzhaoqian committed
213 214
		<where>
			AND a.org_code = #{param.orgCode} 
215
			AND d.executor_id = #{param.id} 
tangzhaoqian committed
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
			<if test="param.sts != null and param.sts == 0">
				AND b.sts = 0
			</if>
			<if test="param.sts != null and param.sts == 1">
				AND b.sts = 1
			</if>
			<if test="param.sts != null and param.sts == 2">
				AND b.sts in (2,3)
			</if>
			<if test="param.sts != null and param.sts == 3">
				AND b.sts = 4
			</if>
		</where>
		
    </select>
    
    
233 234 235 236 237 238 239 240 241 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
	<!-- 

    <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'>
269 270 271
                        process_node,
                        </if>
                        <if test ='null != beingAppraisalPerson'>
272 273 274 275 276 277 278
                        being_appraisal_person,
                        </if>
                        <if test ='null != createTime'>
                        create_time,
                        </if>
                        <if test ='null != updateTime'>
                        update_time
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
                        </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'>
313 314 315
                        #{processNode},
                        </if>
                        <if test ='null != beingAppraisalPerson'>
316 317 318 319 320 321 322
                        #{beingAppraisalPerson},
                        </if>
                        <if test ='null != createTime'>
                        #{createTime},
                        </if>
                        <if test ='null != updateTime'>
                        #{updateTime}
323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
                        </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>
345
                    <if test ='null != processNode'>process_node = #{processNode},</if>
346 347 348
                    <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>
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373
        </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>