XcglAssoXzuryMapper.xml 5.13 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
<?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.XcglAssoXzuryMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoXzury" >
                <id column="id" property="id" />
                <result column="xzzid" property="xzzid" />
                <result column="userid" property="userid" />
                <result column="qyid" property="qyid" />
    </resultMap>
    
    <resultMap id="SalaryPersonFieldMap" type="cn.timer.api.dto.xcgl.SalaryPersonFieldDto" >
                <result column="username" property="username" />
                <result column="usernum" property="usernum" />
                <result column="xzzid" property="xzzid" />
                <result column="dept" property="dept" />
                <result column="post" property="post" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                xzzid,
                userid,
                qyid
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglAssoXzury_id,
                xzzid XcglAssoXzury_xzzid,
                userid XcglAssoXzury_userid,
                qyid XcglAssoXzury_qyid
    </sql>

 	<insert id="insertxcglassoxzuryList" parameterType="java.util.List" >
	    insert into xcgl_asso_xzury (xzzid, userid, 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.userid != null" >
	        #{item.userid,jdbcType=INTEGER},
	      </if>
	      <if test="item.qyid != null" >
	        #{item.qyid,jdbcType=INTEGER}
	      </if>
	      )
	    </foreach>
   </insert>

	<select id="selectISswitchdate" resultMap="BaseResultMap">
			select xzury.* from xcgl_asso_xzury xzury
				LEFT JOIN xcgl_asso_jsgzzx as jsgzzx on jsgzzx.xzzid = xzury.xzzid
				LEFT JOIN xcgl_asso_xzb as xzb on xzb.xzxid = jsgzzx.id
				where xzury.xzzid = #{xzzid} 
				and xzb.xzyf = #{xzyf}
				LIMIT 1
	</select>

		<select id="selectpersonfieldList" resultMap="SalaryPersonFieldMap">
			select emp.`name` as username,
					xzury.userid as usernum,
					xzury.xzzid as xzzid,
					bmgw.dept,
			 		bmgw.post
			from xcgl_asso_xzury xzury
			LEFT JOIN yggl_main_emp as emp on emp.emp_num = xzury.userid and emp.org_code = #{orgcode}
			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 xzury.xzzid = #{xzzid}
		</select>
		
	<select id="selectImportedSalary" resultMap="BaseResultMap">
		select * from xcgl_asso_xzury xzury
			where xzury.xzzid = #{xzzid}
			and xzury.userid in (select emp.emp_num from yggl_main_emp emp where emp.`name` = #{name} and emp.org_code = #{orgcode})
	</select>

	<delete id="xzurydelete" >
        DELETE FROM xcgl_asso_xzury
        WHERE xzzid = #{xzzid}
    </delete>
    
    <delete id="deleteByuseridoqyid" >
        DELETE FROM xcgl_asso_xzury
        WHERE userid = #{userid}
        and qyid = #{qyid}
    </delete>


94
    <!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzury">
yuquan.zhu committed
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 140 141 142 143 144 145 146 147 148 149 150 151
        INSERT INTO xcgl_asso_xzury
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != xzzid'>
                        xzzid,
                        </if>
                        <if test ='null != userid'>
                        userid,
                        </if>
                        <if test ='null != qyid'>
                        qyid
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != xzzid'>
                        #{xzzid},
                        </if>
                        <if test ='null != userid'>
                        #{userid},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid}
                        </if>
        </trim>
    </insert>

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

    <update id="update" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzury">
        UPDATE xcgl_asso_xzury
        <set>
                    <if test ='null != xzzid'>xzzid = #{xzzid},</if>
                    <if test ='null != userid'>userid = #{userid},</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_xzury
        WHERE id = #{id}
    </select>

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM xcgl_asso_xzury
    </select>
152
 -->
yuquan.zhu committed
153 154

</mapper>