XcglAssoXzdazdyMapper.xml 12.6 KB
Newer Older
yuquan.zhu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?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.xcgl.XcglAssoXzdazdyMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoXzdazdy" >
                <id column="id" property="id" />
                <result column="zdmc" property="zdmc" />
                <result column="zdsrklx" property="zdsrklx" />
                <result column="zdlx" property="zdlx" />
                <result column="qyid" property="qyid" />
                <result column="xhpx" property="xhpx" />
    </resultMap>
    
    <resultMap id="FixedSalaryStaffMap" type="cn.timer.api.dto.xcgl.FixedSalaryStaffDto" >
            <result column="id" property="id" />
            <result column="empnum" property="empnum" />
            <result column="empname" property="empname" />
            <result column="empjobtype" property="empjobtype" />
            <result column="empjobstatus" property="empjobstatus" />
            <result column="emprztime" property="emprztime" />
            <result column="empzztime" property="empzztime" />
            <result column="sfdx" property="sfdx" />
            <result column="tratime" property="tratime" />
mobh committed
25 26
			<result column="txzt" property="txzt" />
			<result column="remarks" property="remarks" />
ilal committed
27 28 29
			
			<result column="phone" property="phone" />
			<result column="sxrq" property="sxrq" />
mobh committed
30

yuquan.zhu committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
            
            <collection property="defdto" ofType="cn.timer.api.dto.xcgl.DefinedItemsDto">
		   		<result column="dazid" property="dazid"/>
		   		<result column="xzdazdyid" property="xzdazdyid"/>
		   		<result column="dazrsz" property="dazrsz"/>
		   		<result column="xzdadxid" property="xzdadxid"/>
		    </collection>
            
    </resultMap>
    
    <resultMap id="ChangeSalaryDtoMap" type="cn.timer.api.dto.xcgl.ChangeSalaryDto" >
                <result column="empnum" property="empnum" />
                <result column="empname" property="empname" />
                <result column="tratime" property="tratime" />
                <result column="xzdazdyid" property="xzdazdyid" />
                <result column="dazrsz" property="dazrsz" />
                <result column="xzdadxid" property="xzdadxid" />
                <result column="zdyzdmc" property="zdyzdmc" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                zdmc,
                zdsrklx,
                zdlx,
                qyid,
                xhpx
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglAssoXzdazdy_id,
                zdmc XcglAssoXzdazdy_zdmc,
                zdsrklx XcglAssoXzdazdy_zdsrklx,
                zdlx XcglAssoXzdazdy_zdlx,
                qyid XcglAssoXzdazdy_qyid,
                xhpx XcglAssoXzdazdy_xhpx
    </sql>


	  <select id="selectxcglassoxzdazdy" resultMap="BaseResultMap">
ilal committed
71
			select * from xcgl_asso_xzdazdy xzzdy
yuquan.zhu committed
72
			where xzzdy.qyid = #{qyid}
ilal committed
73
			and xzzdy.zdmc in ('底薪','岗位津贴')
yuquan.zhu committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
	  </select>

	<select id="SalaryFixedWages" resultMap="BaseResultMap">
		select * from xcgl_asso_xzdazdy xzdazdy
			where xzdazdy.zdmc = #{zdmc} LIMIT 1
	</select>

	<insert id="insertxcglassoxzdazdyList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
	    insert into xcgl_asso_xzdazdy (zdmc, zdsrklx, zdlx,qyid,xhpx)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.zdmc != null" >
	        #{item.zdmc,jdbcType=VARCHAR},
	      </if>
	      <if test="item.zdsrklx != null" >
	        #{item.zdsrklx,jdbcType=INTEGER},
	      </if>
	      <if test="item.zdlx != null" >
	        #{item.zdlx,jdbcType=INTEGER},
	      </if>
	      <if test="item.qyid != null" >
	        #{item.qyid,jdbcType=INTEGER},
	      </if>
	      <if test="item.xhpx != null" >
	        #{item.xhpx,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
  	 </insert>


    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzdazdy">
        INSERT INTO xcgl_asso_xzdazdy
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != zdmc'>
                        zdmc,
                        </if>
                        <if test ='null != zdsrklx'>
                        zdsrklx,
                        </if>
                        <if test ='null != zdlx'>
                        zdlx,
                        </if>
                        <if test ='null != qyid'>
                        qyid,
                        </if>
                        <if test ='null != xhpx'>
                        xhpx
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != zdmc'>
                        #{zdmc},
                        </if>
                        <if test ='null != zdsrklx'>
                        #{zdsrklx},
                        </if>
                        <if test ='null != zdlx'>
                        #{zdlx},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid},
                        </if>
                        <if test ='null != xhpx'>
                        #{xhpx}
                        </if>
        </trim>
    </insert>

143
<!--     <delete id="delete" >
yuquan.zhu committed
144 145
        DELETE FROM xcgl_asso_xzdazdy
        WHERE id = #{id}
146
    </delete> -->
yuquan.zhu committed
147 148 149 150 151 152 153 154 155 156 157 158 159

    <update id="dazdyupdate" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzdazdy">
        UPDATE xcgl_asso_xzdazdy
        <set>
             <if test ='null != zdmc'>zdmc = #{zdmc},</if>
             <if test ='null != zdsrklx'>zdsrklx = #{zdsrklx},</if>
             <if test ='null != zdlx'>zdlx = #{zdlx},</if>
             <if test ='null != qyid'>qyid = #{qyid},</if>
             <if test ='null != xhpx'>xhpx = #{xhpx}</if>
        </set>
        WHERE id = #{id}
    </update>

160
<!-- 
yuquan.zhu committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
    <select id="load" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List" />
        FROM xcgl_asso_xzdazdy
        WHERE id = #{id}
    </select>

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM xcgl_asso_xzdazdy
176
    </select> -->
yuquan.zhu committed
177

mobh committed
178 179 180
	<select id="selectFixedSalaryStaffCount" resultType="java.lang.Long">
		select COUNT(*) from yggl_main_emp emp
		where emp.org_code = #{param.orgcode}
mobh committed
181 182 183 184 185
		<if test="param.status != null and param.status.size() >0" >
			and emp.job_status in
			<foreach collection="param.status" open="(" close=")" separator="," index="i" item="item">
				#{item, jdbcType=INTEGER}
			</foreach>
mobh committed
186 187 188 189 190
		</if>
		<if test="param.text != ''" >
			and (emp.`name` like CONCAT('%',#{param.text},'%') or emp.emp_num = #{param.text})
		</if>
	</select>
yuquan.zhu committed
191 192 193 194 195 196 197 198 199 200 201 202 203
	<select id="selectFixedSalaryStaff" resultMap="FixedSalaryStaffMap">
			select emp.emp_num empnum, 
			emp.`name` empname,
			case emp.job_type
				when 0 then '全职'
				when 1 then '实习生'
				when 2 then '兼职'
				when 3 then '劳务派遣'
				when 4 then '劳务'
				when 5 then '派遣'
				when 6 then '外包'
				else '退休返聘' end as empjobtype,
			case emp.job_status 
tangzhaoqian committed
204 205
				when 0 then '试用'
				when 1 then '正式'
yuquan.zhu committed
206 207
				when 2 then '离职中'
				else '已离职' end as empjobstatus,
ilal committed
208 209
			emp.phone,
			(select xsz.sxrq from xcgl_asso_xzdadx xsz where xsz.txzt = 0 and xsz.userid = emp.emp_num) as sxrq,
yuquan.zhu committed
210 211 212 213 214 215 216 217
			SUBSTR(emp.rz_time,1,10) emprztime ,
			SUBSTR(emp.zz_time,1,10) empzztime,
			IF(dadx.userid IS NOT NULL,1,0) as sfdx,
			dadx.sxrq as tratime,
			xzdaz.id as dazid,
			xzdaz.xzdazdyid as xzdazdyid,
			xzdaz.rsz as dazrsz,
			xzdaz.xzdadxid as xzdadxid
mobh committed
218 219
		  from (select * from yggl_main_emp emp
			where emp.org_code = #{param.orgcode}
mobh committed
220 221 222 223 224 225
		<if test="param.status != null and param.status.size() >0" >
			and emp.job_status in
			<foreach collection="param.status" open="(" close=")" separator="," index="i" item="item">
				#{item, jdbcType=INTEGER}
			</foreach>
		</if>
mobh committed
226 227 228 229 230 231
			<if test="param.text != ''" >
				and (emp.`name` like CONCAT('%',#{param.text},'%') or emp.emp_num = #{param.text})
			</if>
			LIMIT #{param.offset}, #{param.totalPage}
		  	) emp
		LEFT JOIN xcgl_asso_xzdadx as dadx on dadx.userid = emp.emp_num and dadx.txzt = 0
yuquan.zhu committed
232 233
		LEFT JOIN xcgl_asso_xzdaz as xzdaz on xzdaz.xzdadxid = dadx.id
	</select>
mobh committed
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 269 270 271 272 273 274 275


	<select id="selectFixedSalaryStaffAll" resultMap="FixedSalaryStaffMap">
		select emp.emp_num empnum,
		emp.`name` empname,
		case emp.job_type
		when 0 then '全职'
		when 1 then '实习生'
		when 2 then '兼职'
		when 3 then '劳务派遣'
		when 4 then '劳务'
		when 5 then '派遣'
		when 6 then '外包'
		else '退休返聘' end as empjobtype,
		case emp.job_status
		when 0 then '试用'
		when 1 then '正式'
		when 2 then '离职中'
		else '已离职' end as empjobstatus,
		SUBSTR(emp.rz_time,1,10) emprztime ,
		SUBSTR(emp.zz_time,1,10) empzztime,
		IF(dadx.userid IS NOT NULL,1,0) as sfdx,
		dadx.sxrq as tratime,
		xzdaz.id as dazid,
		xzdaz.xzdazdyid as xzdazdyid,
		xzdaz.rsz as dazrsz,
		xzdaz.xzdadxid as xzdadxid
		from (select * from yggl_main_emp emp
		where emp.org_code = #{param.orgcode}
		<if test="param.status != null and param.status.size() >0" >
			and emp.job_status in
			<foreach collection="param.status" open="(" close=")" separator="," index="i" item="item">
				#{item, jdbcType=INTEGER}
			</foreach>
		</if>
		<if test="param.text != ''" >
			and (emp.`name` like CONCAT('%',#{param.text},'%') or emp.emp_num = #{param.text})
		</if>
		) emp
		LEFT JOIN xcgl_asso_xzdadx as dadx on dadx.userid = emp.emp_num and dadx.txzt = 0
		LEFT JOIN xcgl_asso_xzdaz as xzdaz on xzdaz.xzdadxid = dadx.id
	</select>
ilal committed
276 277 278 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
	
	<select id="selectPaygroupStaff" resultMap="FixedSalaryStaffMap">
			select emp.emp_num empnum, 
			emp.`name` empname,
			case emp.job_type
				when 0 then '全职'
				when 1 then '实习生'
				when 2 then '兼职'
				when 3 then '劳务派遣'
				when 4 then '劳务'
				when 5 then '派遣'
				when 6 then '外包'
				else '退休返聘' end as empjobtype,
			case emp.job_status 
				when 0 then '试用'
				when 1 then '正式'
				when 2 then '离职中'
				else '已离职' end as empjobstatus,
			SUBSTR(emp.rz_time,1,10) emprztime ,
			SUBSTR(emp.zz_time,1,10) empzztime,
			IF(dadx.userid IS NOT NULL,1,0) as sfdx,
			dadx.sxrq as tratime,
			xzdaz.id as dazid,
			xzdaz.xzdazdyid as xzdazdyid,
			xzdaz.rsz as dazrsz,
			xzdaz.xzdadxid as xzdadxid
		  from yggl_main_emp emp
		LEFT JOIN xcgl_asso_xzdadx as dadx on dadx.userid = emp.emp_num and dadx.txzt = 0
		LEFT JOIN xcgl_asso_xzdaz as xzdaz on xzdaz.xzdadxid = dadx.id
		LEFT JOIN xcgl_asso_xzury as xz on xz.userid = emp.emp_num and xz.qyid = emp.org_code
		where emp.org_code = #{orgcode}
		and xz.xzzid = #{paygroupid}
		<if test="text != ''" >
			and (emp.`name` like CONCAT('%',#{text},'%') or emp.emp_num = #{text})
		</if>
	</select>
yuquan.zhu committed
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 337 338 339 340 341 342 343 344



	<select id="AchieveSalaryAdjustment" resultMap="ChangeSalaryDtoMap">
			select emp.emp_num empnum, 
				emp.`name` empname,
				dadx.sxrq as tratime,
				xzdaz.xzdazdyid as xzdazdyid,
				xzdaz.rsz as dazrsz,
				xzdaz.xzdadxid as xzdadxid,
				zdy.zdmc as zdyzdmc,
				dadx.remarks
				from yggl_main_emp emp
			LEFT JOIN xcgl_asso_xzdadx as dadx on dadx.userid = emp.emp_num and dadx.txzt = 0
			LEFT JOIN xcgl_asso_xzdaz as xzdaz on xzdaz.xzdadxid = dadx.id
			LEFT JOIN xcgl_asso_xzdazdy as zdy on zdy.id = xzdaz.xzdazdyid
			where emp.org_code = #{orgcode}
			and emp.emp_num = #{empnum}
	</select>
	
	<select id="SalaryAdjustmentRecord" resultMap="FixedSalaryStaffMap">
		select dadx.id ,emp.emp_num empnum, 
			emp.`name` empname,
			case emp.job_type
				when 0 then '全职'
				when 1 then '实习生'
				when 2 then '兼职'
				when 3 then '劳务派遣'
				when 4 then '劳务'
				when 5 then '派遣'
				when 6 then '外包'
				else '退休返聘' end as empjobtype,
			case emp.job_status 
tangzhaoqian committed
345 346
				when 0 then '试用'
				when 1 then '正式'
yuquan.zhu committed
347 348 349 350 351 352
				when 2 then '离职中'
				else '已离职' end as empjobstatus,
			SUBSTR(emp.rz_time,1,10) emprztime ,
			SUBSTR(emp.zz_time,1,10) empzztime,
		IF(dadx.userid IS NOT NULL,1,0) AS sfdx,
		dadx.sxrq as tratime,
mobh committed
353 354
		dadx.txzt as txzt,
		dadx.remarks as remarks,
yuquan.zhu committed
355 356 357 358 359 360 361 362
		xzdaz.id as dazid,
		xzdaz.xzdazdyid as xzdazdyid,
		xzdaz.rsz as dazrsz,
		xzdaz.xzdadxid as xzdadxid
			from xcgl_asso_xzdadx as dadx
		LEFT JOIN yggl_main_emp emp on dadx.userid = emp.emp_num
		LEFT JOIN xcgl_asso_xzdaz as xzdaz on xzdaz.xzdadxid = dadx.id
		where emp.org_code = #{orgcode}
mobh committed
363 364
		and emp.emp_num = #{empnum}
		ORDER BY dadx.txzt, dadx.sxrq DESC
yuquan.zhu committed
365 366 367
	</select>

</mapper>