XcglSalaryItemMapper.xml 3.28 KB
Newer Older
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
<?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.XcglSalaryItemMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglSalaryItem" >
           <id column="id" property="id" />
           <result column="itemnanme" property="itemnanme" />
    </resultMap>
    
    <resultMap id="XcglAssoOptionDtoMap" type="cn.timer.api.dto.xcgl.XcglAssoOptionDto" >
           <id column="itid" property="itid" />
           <result column="itname" property="itname" />
                
           <collection property="asso" ofType="cn.timer.api.dto.xcgl.XcglAssoDto">
		   		<result column="optid" property="optid"/>
		   		<result column="optname" property="optname"/>
		   		<result column="optitemid" property="optitemid"/>
		   		<result column="opttype" property="opttype"/>
		    </collection>
    </resultMap>
    
    

    <sql id="Base_Column_List">
                id,
                itemnanme
    </sql>
    
    <sql id="Base_Column_List_Alias">
                id XcglSalaryItem_id,
                itemnanme XcglSalaryItem_itemnanme
    </sql>

	<select id="selectxcglsalaryitemList" resultMap="XcglAssoOptionDtoMap">
				select  item.id as itid,
					item.itemnanme as itname,
					opt.id as optid,
					opt.optionname as optname,
					opt.itemid as optitemid,
					opt.type as opttype
				from xcgl_salary_item item
			LEFT JOIN xcgl_asso_option as opt on opt.itemid = item.id
			<where>
                <if test="opttype != null"> opt.type = #{opttype}</if>
            </where>
            UNION 
				select 
					8 AS itid,
					'自定义项' AS itname,
					0 AS optid,
					zxz.salaryitem AS optname,
					8 AS optitemid,
					2 AS opttype 
				from xcgl_asso_jsgzzx zxz 
				where zxz.is_custom = 1
				and zxz.xzzid = #{zxzzid}
	</select>


<!--  

    <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.xcgl.XcglSalaryItem">
        INSERT INTO xcgl_salary_item
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != itemnanme'>
                        itemnanme
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != itemnanme'>
                        #{itemnanme}
                        </if>
        </trim>
    </insert>

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

    <update id="update" parameterType="cn.timer.api.bean.xcgl.XcglSalaryItem">
        UPDATE xcgl_salary_item
        <set>
                    <if test ='null != itemnanme'>itemnanme = #{itemnanme}</if>
        </set>
        WHERE id = #{id}
    </update>


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

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM xcgl_salary_item
    </select>
-->

</mapper>