XcglAssoXzdazdyMapper.xml 9.06 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 25 26 27 28 29 30 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 71 72 73 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
<?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" />
            
            <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">
	    select * from xcgl_asso_xzdazdy xzzdy
			where xzzdy.qyid = #{qyid}
			and xzzdy.zdmc = '基本工资'
			or xzzdy.zdmc = '绩效工资'
			or xzzdy.zdmc = '岗位津贴'
			or xzzdy.zdmc = '加班工资'
	  </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>

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

    <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>

157
<!-- 
yuquan.zhu committed
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
    <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
173
    </select> -->
yuquan.zhu committed
174 175 176 177 178 179 180 181 182 183 184 185 186 187

	<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
188 189
				when 0 then '试用'
				when 1 then '正式'
yuquan.zhu committed
190 191 192 193 194 195 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 232 233 234 235 236 237 238 239 240 241 242 243
				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
		where emp.org_code = #{orgcode}
		<if test="status != ''" >
			and emp.job_status = #{status}
		</if>
		<if test="text != ''" >
			and (emp.`name` like CONCAT('%',#{text},'%') or emp.emp_num = #{text})
		</if>
	</select>



	<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
244 245
				when 0 then '试用'
				when 1 then '正式'
yuquan.zhu committed
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
				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 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}
		and emp.emp_num = #{empnum} 
	</select>

</mapper>