XcglAssoGztztMapper.xml 8.14 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
<?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.XcglAssoGztztMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoGztzt" >
                <id column="id" property="id" />
                <result column="userid" property="userid" />
                <result column="xzyf" property="xzyf" />
                <result column="fs_type" property="fsType" />
                <result column="ck_type" property="ckType" />
                <result column="qr_type" property="qrType" />
                <result column="fkyj" property="fkyj" />
                <result column="yhqm" property="yhqm" />
                <result column="qyid" property="qyid" />
                <result column="gztszid" property="gztszid" />
    </resultMap>
    
    <resultMap id="PayslipDetailsMap" type="cn.timer.api.dto.xcgl.PayslipDetailsDto" >
                <result column="id" property="id" />
                <result column="empname" property="empname" />
                <result column="empjobstatus" property="empjobstatus" />
                <result column="fstype" property="fstype" />
                <result column="cktype" property="cktype" />
                <result column="qrtype" property="qrtype" />
                <result column="dept" property="dept" />
                <result column="post" property="post" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                userid,
                xzyf,
                fs_type,
                ck_type,
                qr_type,
                fkyj,
                yhqm,
                qyid,
                gztszid
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglAssoGztzt_id,
                userid XcglAssoGztzt_userid,
                xzyf XcglAssoGztzt_xzyf,
                fs_type XcglAssoGztzt_fs_type,
                ck_type XcglAssoGztzt_ck_type,
                qr_type XcglAssoGztzt_qr_type,
                fkyj XcglAssoGztzt_fkyj,
                yhqm XcglAssoGztzt_yhqm,
                qyid XcglAssoGztzt_qyid,
                gztszid XcglAssoGztzt_gztszid
    </sql>
    
    <select id="PayslipDetails" resultMap="PayslipDetailsMap">
	    	select emp.`name` as empname,
				case emp.job_status 
					when 0 then '正式'
					when 1 then '试用'
					when 2 then '离职中'
					else '已离职' end as empjobstatus,
			      gztzt.fs_type as fstype,
						gztzt.ck_type as cktype,
						gztzt.qr_type as qrtype,
						gztzt.id,
						bmgw.dept,
			 			bmgw.post
					from xcgl_asso_gztzt gztzt
		LEFT JOIN yggl_main_emp as emp on emp.emp_num = gztzt.userid and emp.org_code = #{qyid}
		LEFT JOIN (select m.name as post,um.name as dept,m.id as mid
						 from zzgl_bmgw_m m 
						 left join zzgl_bmgw_m um on um.id = m.up_id  
					) as bmgw on bmgw.mid = emp.bmgw_id
		where gztzt.gztszid = #{gztszid}
		and gztzt.qyid = #{qyid}
    </select>
    
    <delete id="deletexcglassogztzt" >
        DELETE FROM xcgl_asso_gztzt
        WHERE gztszid = #{gztszid}
    </delete>
    
    <delete id="deletegztztByxzzid" >
		    delete from xcgl_asso_gztzt
		where gztszid in (
		select gztsz.id from xcgl_asso_gztsz gztsz
		where gztsz.xzzid = #{xzzid})
	</delete>

	<insert id="insertxcglassogztztList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
	    insert into xcgl_asso_gztzt (userid,xzyf,fs_type,ck_type,qr_type,fkyj,yhqm,qyid,gztszid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.userid != null" >
	        #{item.userid,jdbcType=INTEGER},
	      </if>
	      <if test="item.xzyf != null" >
	        #{item.xzyf,jdbcType=VARCHAR},
	      </if>
	      <if test="item.fsType != null" >
	        #{item.fsType,jdbcType=INTEGER},
	      </if>
	      <if test="item.ckType != null" >
	        #{item.ckType,jdbcType=INTEGER},
	      </if>
	      <if test="item.qrType != null" >
	        #{item.qrType,jdbcType=INTEGER},
	      </if>
	      <if test="item.fkyj != null" >
	        #{item.fkyj,jdbcType=VARCHAR},
	      </if>
	      <if test="item.yhqm != null" >
	        #{item.yhqm,jdbcType=VARCHAR},
	      </if>
	      <if test="item.qyid != null" >
	        #{item.qyid,jdbcType=INTEGER},
	      </if>
	      <if test="item.gztszid != null" >
	        #{item.gztszid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
  	 </insert>


127
    <!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoGztzt">
yuquan.zhu committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 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 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 INTO xcgl_asso_gztzt
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        userid,
                        </if>
                        <if test ='null != xzyf'>
                        xzyf,
                        </if>
                        <if test ='null != fsType'>
                        fs_type,
                        </if>
                        <if test ='null != ckType'>
                        ck_type,
                        </if>
                        <if test ='null != qrType'>
                        qr_type,
                        </if>
                        <if test ='null != fkyj'>
                        fkyj,
                        </if>
                        <if test ='null != yhqm'>
                        yhqm,
                        </if>
                        <if test ='null != qyid'>
                        qyid,
                        </if>
                        <if test ='null != gztszid'>
                        gztszid
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        #{userid},
                        </if>
                        <if test ='null != xzyf'>
                        #{xzyf},
                        </if>
                        <if test ='null != fsType'>
                        #{fsType},
                        </if>
                        <if test ='null != ckType'>
                        #{ckType},
                        </if>
                        <if test ='null != qrType'>
                        #{qrType},
                        </if>
                        <if test ='null != fkyj'>
                        #{fkyj},
                        </if>
                        <if test ='null != yhqm'>
                        #{yhqm},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid},
                        </if>
                        <if test ='null != gztszid'>
                        #{gztszid}
                        </if>
        </trim>
    </insert>

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

    <update id="update" parameterType="cn.timer.api.bean.xcgl.XcglAssoGztzt">
        UPDATE xcgl_asso_gztzt
        <set>
                    <if test ='null != userid'>userid = #{userid},</if>
                    <if test ='null != xzyf'>xzyf = #{xzyf},</if>
                    <if test ='null != fsType'>fs_type = #{fsType},</if>
                    <if test ='null != ckType'>ck_type = #{ckType},</if>
                    <if test ='null != qrType'>qr_type = #{qrType},</if>
                    <if test ='null != fkyj'>fkyj = #{fkyj},</if>
                    <if test ='null != yhqm'>yhqm = #{yhqm},</if>
                    <if test ='null != qyid'>qyid = #{qyid},</if>
                    <if test ='null != qyid'>gztszid = #{gztszid}</if>
        </set>
        WHERE id = #{id}
    </update>


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

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM xcgl_asso_gztzt
    </select>
227
 -->
yuquan.zhu committed
228 229

</mapper>