<?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>