XcglAssoJsgzzxMapper.xml 11.8 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
<?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.XcglAssoJsgzzxMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoJsgzzx" >
                <id column="id" property="id" />
                <result column="salaryitem" property="salaryitem" />
                <result column="yhmbzd" property="yhmbzd" />
                <result column="rule" property="rule" />
                <result column="type" property="type" />
                <result column="addtime" property="addtime" />
                <result column="adduserid" property="adduserid" />
                <result column="jxgzid" property="jxgzid" />
                <result column="remarks" property="remarks" />
                <result column="gsid" property="gsid" />
                <result column="gsgs" property="gsgs" />
                <result column="xzzid" property="xzzid" />
                <result column="rulestate" property="rulestate" />
                <result column="optionid" property="optionid" />
ilal committed
21
                <result column="is_custom" property="isCustom" />
ilal committed
22
                <result column="xzdazdyid" property="xzdazdyid" />
yuquan.zhu committed
23 24 25 26 27 28 29 30 31 32 33 34
    </resultMap>
    
		    
	<resultMap id="PayTermDtoMap" type="cn.timer.api.dto.xcgl.PayTermDto" >
                <result column="xid" property="xid"/>
		   		<result column="xsalaryitem" property="xsalaryitem"/>
		   		<result column="xyhmbzd" property="xyhmbzd"/>
		   		<result column="xrule" property="xrule"/>
		   		<result column="xtype" property="xtype"/>
		   		<result column="xremarks" property="xremarks"/>
		   		<result column="xgsid" property="xgsid"/>
		   		<result column="xgsgs" property="xgsgs"/>
mobh committed
35 36
                <result column="xdygk" property="xdygk"/>
                <result column="xdegk" property="xdegk"/>
yuquan.zhu committed
37
		   		<result column="xjxgzid" property="xjxgzid"/>
ilal committed
38
		   		<result column="xiscustom" property="xiscustom"/>
ilal committed
39
		   		<result column="xrulestate" property="xrulestate"/>
yuquan.zhu committed
40 41 42 43 44 45 46 47 48
    </resultMap>
    
    
	<resultMap id="CalculationOptionsDtoMap" type="cn.timer.api.dto.xcgl.CalculationOptionsDto" >
                <result column="id" property="id"/>
		   		<result column="salaryitem" property="salaryitem"/>
		   		<result column="rsz" property="rsz"/>
    </resultMap>
    
ilal committed
49 50 51 52 53 54 55
    <select id="SalaryRuleGroupItem" resultMap="BaseResultMap">
    	select * from xcgl_asso_jsgzzx js
		where js.xzzid = #{xzzid}
		ORDER BY js.rulestate = 2 or js.rulestate = 3 ASC,
		js.id ASC
    </select>
    
yuquan.zhu committed
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
    <select id="selectSalarySectionList" resultMap="BaseResultMap">
    		select jsgzzx.* from xcgl_asso_jsgzzx jsgzzx
				LEFT JOIN xcgl_asso_option as opt on opt.id = jsgzzx.optionid
				where opt.itemid = 2
				and jsgzzx.xzzid = #{xzzid}
    </select>
    
    
    <select id="selectxcglassojxgzList" resultMap="PayTermDtoMap">
			select gzzx.id as xid,
				gzzx.salaryitem as xsalaryitem,
				gzzx.yhmbzd as xyhmbzd,
				gzzx.rule as xrule,
				gzzx.type as xtype,
				gzzx.jxgzid as xjxgzid,
				gzzx.remarks as xremarks,
				gzzx.gsid as xgsid,
mobh committed
73 74
				gzzx.gsgs as xgsgs,
				gzzx.dygk as xdygk,
ilal committed
75
				gzzx.degk as xdegk,
ilal committed
76 77
				gzzx.is_custom as xiscustom,
				gzzx.rulestate as xrulestate
yuquan.zhu committed
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
			from xcgl_asso_jsgzzx gzzx
		where gzzx.jxgzid = 0
		and gzzx.xzzid = #{xzzid}
	</select>
    
    <select id="selectCalculationOptionsList" resultMap="CalculationOptionsDtoMap">
    		select jsgzzx.id,
				jsgzzx.salaryitem,
				daz.rsz
			from xcgl_asso_jsgzzx jsgzzx
		LEFT JOIN xcgl_asso_xzdazdy as zdy on zdy.zdmc = jsgzzx.salaryitem
		LEFT JOIN xcgl_asso_xzdaz as daz on daz.xzdazdyid = zdy.id
		LEFT JOIN xcgl_asso_xzdadx as xzdadx on xzdadx.id = daz.xzdadxid and xzdadx.txzt = 0
		where jsgzzx.xzzid = #{xzzid}
		and jsgzzx.rulestate = 1
		and xzdadx.userid = #{userid}
    </select>
    
     <delete id="deleteByxzzid" >
        DELETE FROM xcgl_asso_jsgzzx
        WHERE xzzid = #{xzzid}
     </delete>
mobh committed
100 101 102 103 104 105
    <!-- 删除薪资档案值的同时删除已添加到薪资组(未锁定的组)中的薪资项 -->
    <delete id="deleteByxzdazdyid">
        delete jsgzzx from xcgl_asso_jsgzzx jsgzzx, xcgl_admin_xzz xxz
        where jsgzzx.xzdazdyid = #{xzdazdyid} and xxz.is_xzsd = 0
        and jsgzzx.xzzid = xxz.id
    </delete>
yuquan.zhu committed
106 107
    
    <insert id="insertxcglassojsgzzxList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
mobh committed
108
	    insert into xcgl_asso_jsgzzx (salaryitem,yhmbzd,rule,type,addtime,adduserid,jxgzid,remarks,gsid,gsgs,dygk,degk,xzzid,rulestate,optionid)
yuquan.zhu committed
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
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.salaryitem != null" >
	        #{item.salaryitem,jdbcType=VARCHAR},
	      </if>
	      <if test="item.yhmbzd != null" >
	        #{item.yhmbzd,jdbcType=VARCHAR},
	      </if>
	      <if test="item.rule != null" >
	        #{item.rule,jdbcType=VARCHAR},
	      </if>
	      <if test="item.type != null" >
	        #{item.type,jdbcType=INTEGER},
	      </if>
	      <if test="item.addtime != null" >
	        #{item.addtime,jdbcType=BIGINT},
	      </if>
	      <if test="item.adduserid != null" >
	        #{item.adduserid,jdbcType=INTEGER},
	      </if>
	      <if test="item.jxgzid != null" >
	        #{item.jxgzid,jdbcType=INTEGER},
	      </if>
	      <if test="item.remarks != null" >
	        #{item.remarks,jdbcType=VARCHAR},
	      </if>
	      <if test="item.gsid != null" >
	        #{item.gsid,jdbcType=INTEGER},
	      </if>
	      <if test="item.gsgs != null" >
	        #{item.gsgs,jdbcType=VARCHAR},
	      </if>
mobh committed
141 142 143 144 145 146 147 148

            <if test="item.dygk != null" >
                #{item.dygk,jdbcType=DOUBLE},
            </if>
            <if test="item.degk != null" >
                #{item.degk,jdbcType=DOUBLE},
            </if>

yuquan.zhu committed
149 150 151 152 153 154 155 156 157 158 159 160
	      <if test="item.xzzid != null" >
	        #{item.xzzid,jdbcType=INTEGER},
	      </if>
	      <if test="item.rulestate != null" >
	        #{item.rulestate,jdbcType=INTEGER},
	      </if>
	      <if test="item.optionid != null" >
	        #{item.optionid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
  	 </insert>
ilal committed
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
  	 
  	 <insert id="insertxcglassojsgzzxListTwo" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
	    insert into xcgl_asso_jsgzzx (salaryitem,yhmbzd,rule,type,addtime,adduserid,jxgzid,remarks,gsid,gsgs,dygk,degk,xzzid,rulestate,optionid,xzdazdyid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	        #{item.salaryitem,jdbcType=VARCHAR},
	        #{item.yhmbzd,jdbcType=VARCHAR},
	        #{item.rule,jdbcType=VARCHAR},
	        #{item.type,jdbcType=INTEGER},
	        #{item.addtime,jdbcType=BIGINT},
	        #{item.adduserid,jdbcType=INTEGER},
	        #{item.jxgzid,jdbcType=INTEGER},
	        #{item.remarks,jdbcType=VARCHAR},
	        #{item.gsid,jdbcType=INTEGER},
	        #{item.gsgs,jdbcType=VARCHAR},
              #{item.dygk,jdbcType=DOUBLE},
              #{item.degk,jdbcType=DOUBLE},
	        #{item.xzzid,jdbcType=INTEGER},
	        #{item.rulestate,jdbcType=INTEGER},
	        #{item.optionid,jdbcType=INTEGER},
	        #{item.xzdazdyid,jdbcType=INTEGER}
	      )
	    </foreach>
  	 </insert>
yuquan.zhu committed
185 186 187 188 189 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


    <insert id="jsgzzxinsert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoJsgzzx">
        INSERT INTO xcgl_asso_jsgzzx
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != salaryitem'>
                        salaryitem,
                        </if>
                        <if test ='null != yhmbzd'>
                        yhmbzd,
                        </if>
                        <if test ='null != rule'>
                        rule,
                        </if>
                        <if test ='null != type'>
                        type,
                        </if>
                        <if test ='null != addtime'>
                        addtime,
                        </if>
                        <if test ='null != adduserid'>
                        adduserid,
                        </if>
                        <if test ='null != jxgzid'>
                        jxgzid,
                        </if>
                        <if test ='null != remarks'>
                        remarks,
                        </if>
                        <if test ='null != gsid'>
                        gsid,
                        </if>
                        <if test ='null != gsgs'>
                        gsgs,
                        </if>
                        <if test ='null != xzzid'>
                        xzzid,
                        </if>
                        <if test ='null != rulestate'>
                        rulestate,
                        </if>
                        <if test ='null != optionid'>
ilal committed
227 228 229 230
                        optionid,
                        </if>
                        <if test ='null != isCustom'>
                        is_custom
yuquan.zhu committed
231 232 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 269 270
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != salaryitem'>
                        #{salaryitem},
                        </if>
                        <if test ='null != yhmbzd'>
                        #{yhmbzd},
                        </if>
                        <if test ='null != rule'>
                        #{rule},
                        </if>
                        <if test ='null != type'>
                        #{type},
                        </if>
                        <if test ='null != addtime'>
                        #{addtime},
                        </if>
                        <if test ='null != adduserid'>
                        #{adduserid},
                        </if>
                        <if test ='null != jxgzid'>
                        #{jxgzid},
                        </if>
                        <if test ='null != remarks'>
                        #{remarks},
                        </if>
                        <if test ='null != gsid'>
                        #{gsid},
                        </if>
                        <if test ='null != gsgs'>
                        #{gsgs},
                        </if>
                        <if test ='null != xzzid'>
                        #{xzzid},
                        </if>
                        <if test ='null != rulestate'>
                        #{rulestate},
                        </if>
                        <if test ='null != optionid'>
ilal committed
271 272 273 274
                        #{optionid},
                        </if>
                        <if test ='null != isCustom'>
                        #{isCustom}
yuquan.zhu committed
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
                        </if>
        </trim>
    </insert>

    <update id="jsgzzxupdate" parameterType="cn.timer.api.bean.xcgl.XcglAssoJsgzzx">
        UPDATE xcgl_asso_jsgzzx
        <set>
                    <if test ='null != salaryitem'>salaryitem = #{salaryitem},</if>
                    <if test ='null != yhmbzd'>yhmbzd = #{yhmbzd},</if>
                    <if test ='null != rule'>rule = #{rule},</if>
                    <if test ='null != type'>type = #{type},</if>
                    <if test ='null != addtime'>addtime = #{addtime},</if>
                    <if test ='null != adduserid'>adduserid = #{adduserid},</if>
                    <if test ='null != jxgzid'>jxgzid = #{jxgzid},</if>
                    <if test ='null != remarks'>remarks = #{remarks},</if>
                    <if test ='null != gsid'>gsid = #{gsid},</if>
                    <if test ='null != gsgs'>gsgs = #{gsgs},</if>
                    <if test ='null != xzzid'>xzzid = #{xzzid},</if>
                    <if test ='null != rulestate'>rulestate = #{rulestate},</if>
ilal committed
294 295
                    <if test ='null != optionid'>optionid = #{optionid},</if>
                    <if test ='null != optionid'>is_custom = #{isCustom}</if>
yuquan.zhu committed
296 297 298 299 300 301 302
        </set>
        WHERE id = #{id}
    </update>



</mapper>