XcglAssoJxgzMapper.xml 7.33 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
<?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.XcglAssoJxgzMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoJxgz" >
                <id column="id" property="id" />
                <result column="xzzid" property="xzzid" />
                <result column="name" property="name" />
                <result column="remarks" property="remarks" />
                <result column="addtime" property="addtime" />
                <result column="adduserid" property="adduserid" />
                <result column="qyid" property="qyid" />
    </resultMap>


	<resultMap id="PayGroupedDataMap" type="cn.timer.api.dto.xcgl.PayGroupedDataDto" >
            <result column="zid" property="zid" />
            <result column="zname" property="zname" />
            <result column="zremarks" property="zremarks" />
            <result column="zxzzid" property="zxzzid" />
            
            <collection property="term" ofType="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
32 33
                <result column="xdygk" property="xdygk"/>
                <result column="xdegk" property="xdegk"/>
yuquan.zhu committed
34
		   		<result column="xjxgzid" property="xjxgzid"/>
ilal committed
35
		   		<result column="xoptionid" property="xoptionid"/>
ilal committed
36
		   		<result column="xiscustom" property="xiscustom"/>
ilal committed
37
		   		<result column="xrulestate" property="xrulestate"/>
ilal committed
38
		   		<result column="zxzzid" property="zxzzid"/>
yuquan.zhu committed
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
		    </collection>
            
    </resultMap>

    <sql id="Base_Column_List">
                id,
                xzzid,
                name,
                remarks,
                addtime,
                adduserid,
                qyid
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglAssoJxgz_id,
                xzzid XcglAssoJxgz_xzzid,
                name XcglAssoJxgz_name,
                remarks XcglAssoJxgz_remarks,
                addtime XcglAssoJxgz_addtime,
                adduserid XcglAssoJxgz_adduserid,
                qyid XcglAssoJxgz_qyid
    </sql>

	<delete id="deleteByxzzid" >
        DELETE FROM xcgl_asso_jxgz
        WHERE xzzid = #{xzzid}
    </delete>


<insert id="insertxcglassojxgzList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
	    insert into xcgl_asso_jxgz (xzzid,name,remarks,addtime,adduserid,qyid)
	    <foreach collection="list" item="item" index="index" open="values " close="" separator=",">
	   	(
	      <if test="item.xzzid != null" >
	        #{item.xzzid,jdbcType=INTEGER},
	      </if>
	      <if test="item.name != null" >
	        #{item.name,jdbcType=VARCHAR},
	      </if>
	      <if test="item.remarks != null" >
	        #{item.remarks,jdbcType=VARCHAR},
	      </if>
	      <if test="item.addtime != null" >
	        #{item.addtime,jdbcType=BIGINT},
	      </if>
	      <if test="item.adduserid != null" >
	        #{item.adduserid,jdbcType=INTEGER},
	      </if>
	      <if test="item.qyid != null" >
	        #{item.qyid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
  	 </insert>


    <insert id="jxgzinsert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoJxgz">
        INSERT INTO xcgl_asso_jxgz
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != xzzid'>
                        xzzid,
                        </if>
                        <if test ='null != name'>
                        name,
                        </if>
                        <if test ='null != remarks'>
                        remarks,
                        </if>
                        <if test ='null != addtime'>
                        addtime,
                        </if>
                        <if test ='null != adduserid'>
                        adduserid,
                        </if>
                        <if test ='null != qyid'>
                        qyid
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != xzzid'>
                        #{xzzid},
                        </if>
                        <if test ='null != name'>
                        #{name},
                        </if>
                        <if test ='null != remarks'>
                        #{remarks},
                        </if>
                        <if test ='null != addtime'>
                        #{addtime},
                        </if>
                        <if test ='null != adduserid'>
                        #{adduserid},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid}
                        </if>
        </trim>
    </insert>

140
 <!--    <delete id="delete" >
yuquan.zhu committed
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
        DELETE FROM xcgl_asso_jxgz
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.xcgl.XcglAssoJxgz">
        UPDATE xcgl_asso_jxgz
        <set>
                    <if test ='null != xzzid'>xzzid = #{xzzid},</if>
                    <if test ='null != name'>name = #{name},</if>
                    <if test ='null != remarks'>remarks = #{remarks},</if>
                    <if test ='null != addtime'>addtime = #{addtime},</if>
                    <if test ='null != adduserid'>adduserid = #{adduserid},</if>
                    <if test ='null != qyid'>qyid = #{qyid}</if>
        </set>
        WHERE id = #{id}
    </update>


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

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM xcgl_asso_jxgz
174
    </select> -->
yuquan.zhu committed
175 176 177 178 179 180 181 182 183 184 185 186 187

	<select id="selectPayrollGroupList" resultMap="PayGroupedDataMap">
			select jxgz.id as zid,
				jxgz.`name` as zname,
				jxgz.remarks as zremarks,
				gzzx.id as xid,
				gzzx.salaryitem as xsalaryitem,
				gzzx.yhmbzd as xyhmbzd,
				gzzx.rule as xrule,
				gzzx.type as xtype,
				gzzx.remarks as xremarks,
				gzzx.gsid as xgsid,
				gzzx.gsgs as xgsgs,
mobh committed
188 189
				gzzx.dygk as xdygk,
				gzzx.degk as xdegk,
yuquan.zhu committed
190
				gzzx.jxgzid as xjxgzid,
ilal committed
191
				gzzx.optionid as xoptionid,
ilal committed
192
				jxgz.xzzid as zxzzid,
ilal committed
193
				gzzx.is_custom as xiscustom,
ilal committed
194 195
				gzzx.rulestate as xrulestate,
				gzzx.xzzid as zxzzid
yuquan.zhu committed
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
		from xcgl_asso_jxgz jxgz
		LEFT JOIN xcgl_asso_jsgzzx as gzzx on gzzx.jxgzid = jxgz.id
		where jxgz.xzzid = #{xzzid}
	</select>
	
	<select id="selectassojxgzList" resultMap="BaseResultMap">
			select * from xcgl_asso_jxgz jxgz
				where jxgz.id not in (
						select jxgz.id from xcgl_asso_jxgz jxgz
				RIGHT JOIN xcgl_asso_jsgzzx as zzx on zzx.jxgzid = jxgz.id
				where jxgz.xzzid =#{xzzid}
				)
				and jxgz.xzzid =#{xzzid}
	</select>

</mapper>