XcglAssoZxfjkcMapper.xml 8.94 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
<?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.XcglAssoZxfjkcMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoZxfjkc" >
                <id column="id" property="id" />
                <result column="userid" property="userid" />
                <result column="taxmonth" property="taxmonth" />
                <result column="childrenedu" property="childrenedu" />
                <result column="houseloans" property="houseloans" />
                <result column="houserents" property="houserents" />
                <result column="supportolder" property="supportolder" />
                <result column="continueedu" property="continueedu" />
                <result column="totalmoney" property="totalmoney" />
                <result column="addtime" property="addtime" />
                <result column="qyid" property="qyid" />
    </resultMap>
    
    <resultMap id="AdditionalDeductionMap" type="cn.timer.api.dto.xcgl.AdditionalDeductionDto" >
                <result column="zxfjid" property="zxfjid" />
ilal committed
22
                <result column="date" property="date" />
yuquan.zhu committed
23
                <result column="name" property="name" />
ilal committed
24
                <result column="phone" property="phone" />
yuquan.zhu committed
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
                <result column="empNum" property="empNum" />
                <result column="zljy" property="zljy" />
                <result column="zfdk" property="zfdk" />
                <result column="zfzj" property="zfzj" />
                <result column="sylr" property="sylr" />
                <result column="jxjy" property="jxjy" />
                <result column="lj" property="lj" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                userid,
                taxmonth,
                childrenedu,
                houseloans,
                houserents,
                supportolder,
                continueedu,
                totalmoney,
                addtime,
                qyid
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglAssoZxfjkc_id,
                userid XcglAssoZxfjkc_userid,
                taxmonth XcglAssoZxfjkc_taxmonth,
                childrenedu XcglAssoZxfjkc_childrenedu,
                houseloans XcglAssoZxfjkc_houseloans,
                houserents XcglAssoZxfjkc_houserents,
                supportolder XcglAssoZxfjkc_supportolder,
                continueedu XcglAssoZxfjkc_continueedu,
                totalmoney XcglAssoZxfjkc_totalmoney,
                addtime XcglAssoZxfjkc_addtime,
                qyid XcglAssoZxfjkc_qyid
    </sql>
	
	<select id="selectAdditionalDeduction" resultMap="AdditionalDeductionMap">
		select emp.`name` as name,
			emp.emp_num as empNum,
ilal committed
65
			emp.phone,
yuquan.zhu committed
66
			zxfj.id as zxfjid,
ilal committed
67 68 69 70 71 72 73 74
			zxfj.taxmonth as date,
			zxfj.childrenedu as zljy,
			zxfj.houseloans as zfdk,
			zxfj.houserents as zfzj,
			zxfj.supportolder as sylr,
			zxfj.continueedu as jxjy,
			zxfj.totalmoney as lj
		from yggl_main_emp emp
ilal committed
75
		LEFT JOIN xcgl_asso_zxfjkc as zxfj on zxfj.userid = emp.emp_num and zxfj.qyid = #{param.orgcode}
ilal committed
76 77 78 79
		<if test="param.datetime != ''" >
			and zxfj.taxmonth = #{param.datetime}
		</if>
		where emp.org_code = #{param.orgcode}
mobh committed
80 81 82 83 84 85
        <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>
ilal committed
86 87 88 89 90 91 92 93 94 95 96
		<if test="param.text != ''" >
			and (emp.`name` like CONCAT('%',#{param.text},'%') or emp.emp_num = #{param.text})
		</if>
	</select>
	
	<select id="selectAdditionalDeductiontwo" resultMap="AdditionalDeductionMap">
		select emp.`name` as name,
			emp.emp_num as empNum,
			emp.phone,
			zxfj.id as zxfjid,
			zxfj.taxmonth as date,
yuquan.zhu committed
97 98 99 100 101 102 103 104
			zxfj.childrenedu as zljy,
			zxfj.houseloans as zfdk,
			zxfj.houserents as zfzj,
			zxfj.supportolder as sylr,
			zxfj.continueedu as jxjy,
			zxfj.totalmoney as lj
		from yggl_main_emp emp
		LEFT JOIN xcgl_asso_zxfjkc as zxfj on zxfj.userid = emp.emp_num 
mobh committed
105 106
		<if test="param.datetime != ''" >
			and zxfj.taxmonth = #{param.datetime}
yuquan.zhu committed
107
		</if>
mobh committed
108 109 110 111 112 113 114 115 116
		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})
yuquan.zhu committed
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 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
		</if>
	</select>

    <insert id="insertXcglAssoZxfjkc" parameterType="cn.timer.api.bean.xcgl.XcglAssoZxfjkc" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO xcgl_asso_zxfjkc
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        userid,
                        </if>
                        <if test ='null != taxmonth'>
                        taxmonth,
                        </if>
                        <if test ='null != childrenedu'>
                        childrenedu,
                        </if>
                        <if test ='null != houseloans'>
                        houseloans,
                        </if>
                        <if test ='null != houserents'>
                        houserents,
                        </if>
                        <if test ='null != supportolder'>
                        supportolder,
                        </if>
                        <if test ='null != continueedu'>
                        continueedu,
                        </if>
                        <if test ='null != totalmoney'>
                        totalmoney,
                        </if>
                        <if test ='null != addtime'>
                        addtime,
                        </if>
                        <if test ='null != qyid'>
                        qyid
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != userid'>
                        #{userid},
                        </if>
                        <if test ='null != taxmonth'>
                        #{taxmonth},
                        </if>
                        <if test ='null != childrenedu'>
                        #{childrenedu},
                        </if>
                        <if test ='null != houseloans'>
                        #{houseloans},
                        </if>
                        <if test ='null != houserents'>
                        #{houserents},
                        </if>
                        <if test ='null != supportolder'>
                        #{supportolder},
                        </if>
                        <if test ='null != continueedu'>
                        #{continueedu},
                        </if>
                        <if test ='null != totalmoney'>
                        #{totalmoney},
                        </if>
                        <if test ='null != addtime'>
                        #{addtime},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid}
                        </if>
        </trim>
    </insert>

188
    <!-- <delete id="delete" >
yuquan.zhu committed
189 190
        DELETE FROM xcgl_asso_zxfjkc
        WHERE id = #{id}
191
    </delete> -->
yuquan.zhu committed
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210

    <update id="updateXcglAssoZxfjkc" parameterType="cn.timer.api.bean.xcgl.XcglAssoZxfjkc">
        UPDATE xcgl_asso_zxfjkc
        <set>
                    <if test ='null != userid'>userid = #{userid},</if>
                    <if test ='null != taxmonth'>taxmonth = #{taxmonth},</if>
                    <if test ='null != childrenedu'>childrenedu = #{childrenedu},</if>
                    <if test ='null != houseloans'>houseloans = #{houseloans},</if>
                    <if test ='null != houserents'>houserents = #{houserents},</if>
                    <if test ='null != supportolder'>supportolder = #{supportolder},</if>
                    <if test ='null != continueedu'>continueedu = #{continueedu},</if>
                    <if test ='null != totalmoney'>totalmoney = #{totalmoney},</if>
                    <if test ='null != addtime'>addtime = #{addtime},</if>
                    <if test ='null != qyid'>qyid = #{qyid}</if>
        </set>
        WHERE id = #{id}
    </update>


211
   <!--  <select id="load" resultMap="BaseResultMap">
yuquan.zhu committed
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
        SELECT <include refid="Base_Column_List" />
        FROM xcgl_asso_zxfjkc
        WHERE id = #{id}
    </select>

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

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

</mapper>