<?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.XcglAssoXzbMapper"> <resultMap id="BaseResultMap" type="cn.timer.api.bean.xcgl.XcglAssoXzb" > <id column="id" property="id" /> <result column="userid" property="userid" /> <result column="xzyf" property="xzyf" /> <result column="xzxid" property="xzxid" /> <result column="xzxjg" property="xzxjg" /> <result column="qyid" property="qyid" /> </resultMap> <resultMap id="CalculationDtoMap" type="cn.timer.api.dto.xcgl.CalculationDto" > <result column="orgcode" property="orgcode" /> <result column="empid" property="empid" /> <result column="empnum" property="empnum" /> <result column="empname" property="empname" /> <result column="dept" property="dept" /> <result column="post" property="post" /> <collection property="calcu" ofType="cn.timer.api.dto.xcgl.CalculationValueDto"> <result column="xzbid" property="xzbid"/> <result column="xzyf" property="xzyf"/> <result column="xzxid" property="xzxid"/> <result column="xzxjg" property="xzxjg"/> </collection> </resultMap> <resultMap id="CalculationValueMap" type="cn.timer.api.dto.xcgl.CalculationValueDto" > <result column="xzbid" property="xzbid"/> <result column="xzyf" property="xzyf"/> <result column="xzxid" property="xzxid"/> <result column="xzxjg" property="xzxjg"/> </resultMap> <sql id="Base_Column_List"> id, userid, xzyf, xzxid, xzxjg, qyid </sql> <sql id="Base_Column_List_Alias"> id XcglAssoXzb_id, userid XcglAssoXzb_userid, xzyf XcglAssoXzb_xzyf, xzxid XcglAssoXzb_xzxid, xzxjg XcglAssoXzb_xzxjg, qyid XcglAssoXzb_qyid </sql> <select id="CalculationResults" resultMap="CalculationDtoMap"> select aa.orgcode,aa.empid,aa.empnum,aa.empname,aa.xzbid,aa.xzyf, aa.xzxid,aa.xzxjg,aa.dept,aa.post from ( select emp.org_code as orgcode, emp.id as empid, emp.emp_num as empnum, emp.`name` as empname, xzbs.id as xzbid, xzbs.xzyf as xzyf, xzbs.xzxid as xzxid, xzbs.xzxjg as xzxjg, bmgw.dept, bmgw.post from yggl_main_emp emp LEFT JOIN xcgl_asso_xzb as xzbs on xzbs.userid = emp.emp_num 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 emp.emp_num in (select xzury.userid from xcgl_asso_xzury xzury where xzury.xzzid = #{xzzid}) and xzbs.xzyf = #{xzyf} or xzbs.xzyf = '' and emp.emp_num in (select xzury.userid from xcgl_asso_xzury xzury where xzury.xzzid = #{xzzid}) ) as aa where aa.orgcode = #{orgcode} </select> <select id="lateearlyDeduction" resultMap="CalculationValueMap"> select xzbs.xzyf as xzyf, xzbs.xzxid as xzxid, xzbs.xzxjg as xzxjg from yggl_main_emp emp LEFT JOIN xcgl_asso_xzb as xzbs on xzbs.userid = emp.emp_num where emp.emp_num = #{empnum} and xzbs.xzxid = (select jsgz.id from xcgl_asso_jsgzzx jsgz where jsgz.xzzid = #{xzzid} and jsgz.salaryitem = #{salaryitem}) </select> <select id="SimultaneousAttendance" resultMap="CalculationDtoMap"> select emp.id as empid, emp.emp_num as empnum, emp.`name` as empname, xzbs.id as xzbid, xzbs.xzyf as xzyf, xzbs.xzxid as xzxid, xzbs.xzxjg as xzxjg, bmgw.dept, bmgw.post from yggl_main_emp emp LEFT JOIN xcgl_asso_xzb as xzbs on xzbs.userid = emp.emp_num 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 emp.emp_num in (select xzury.userid from xcgl_asso_xzury xzury where xzury.xzzid = #{xzzid}) and xzbs.xzxid in (select jsgzzx.id from xcgl_asso_jsgzzx jsgzzx LEFT JOIN xcgl_asso_option as opt on opt.id = jsgzzx.optionid where opt.itemid = 2 and jsgzzx.xzzid = #{xzzid}) </select> <delete id="deleteByuserid" > <!-- DELETE FROM xcgl_asso_xzb WHERE userid = #{userid} --> DELETE FROM xcgl_asso_xzb WHERE userid = #{userid} and xzxid not in(select jsgzzx.id from xcgl_asso_jsgzzx jsgzzx LEFT JOIN xcgl_asso_option as opt on opt.id = jsgzzx.optionid where opt.itemid = 2 and jsgzzx.xzzid = #{xzzid}) and xzyf = #{xzyf} </delete> <delete id="deleteXcglAssoXzb"> DELETE FROM xcgl_asso_xzb WHERE userid = #{userid} </delete> <delete id="deleteByAttendance" > DELETE from xcgl_asso_xzb where userid = #{userid} and xzxid in (select jsgzzx.id from xcgl_asso_jsgzzx jsgzzx LEFT JOIN xcgl_asso_option as opt on opt.id = jsgzzx.optionid where opt.itemid = 2 and jsgzzx.xzzid = #{xzzid}) and xzyf = #{xzyf} </delete> <insert id="xzbinsert" useGeneratedKeys="true" keyProperty="id" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzb"> INSERT INTO xcgl_asso_xzb <trim prefix="(" suffix=")" suffixOverrides=","> <if test ='null != userid'> userid, </if> <if test ='null != xzyf'> xzyf, </if> <if test ='null != xzxid'> xzxid, </if> <if test ='null != xzxjg'> xzxjg, </if> <if test ='null != qyid'> qyid </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null != userid'> #{userid}, </if> <if test ='null != xzyf'> #{xzyf}, </if> <if test ='null != xzxid'> #{xzxid}, </if> <if test ='null != xzxjg'> #{xzxjg}, </if> <if test ='null != qyid'> #{qyid} </if> </trim> </insert> <delete id="delete" > DELETE FROM xcgl_asso_xzb WHERE id = #{id} </delete> <update id="ModifyImportedSalary" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzb"> UPDATE xcgl_asso_xzb set xzxjg = #{xzxjg} where userid = #{userid} and xzyf = #{xzyf} and xzxid = #{xzxid} </update> <update id="update" parameterType="cn.timer.api.bean.xcgl.XcglAssoXzb"> UPDATE xcgl_asso_xzb <set> <if test ='null != userid'>userid = #{userid},</if> <if test ='null != xzyf'>xzyf = #{xzyf},</if> <if test ='null != xzxid'>xzxid = #{xzxid},</if> <if test ='null != xzxjg'>xzxjg = #{xzxjg},</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_xzb WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM xcgl_asso_xzb LIMIT #{offset}, #{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer"> SELECT count(1) FROM xcgl_asso_xzb </select> </mapper>