<?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.sbgjj.SbgjjAssoYjzdMapper"> <resultMap id="BaseResultMap" type="cn.timer.api.bean.sbgjj.SbgjjAssoYjzd" > <id column="id" property="id" /> <result column="user_num" property="userNum" /> <result column="totalmoney" property="totalmoney" /> <result column="gsjltotal" property="gsjltotal" /> <result column="grjltotal" property="grjltotal" /> <result column="zdtype" property="zdtype" /> <result column="zymonth" property="zymonth" /> <result column="sbfaid" property="sbfaid" /> <result column="gjjfaid" property="gjjfaid" /> <result column="qyid" property="qyid" /> <result column="sbgshj" property="sbgshj" /> <result column="sbgrhj" property="sbgrhj" /> <result column="sbhj" property="sbhj" /> <result column="gjjgshj" property="gjjgshj" /> <result column="gjjgrhj" property="gjjgrhj" /> <result column="gjjhj" property="gjjhj" /> <result column="cbryid" property="cbryid" /> </resultMap> <resultMap id="MonthlyCheckoutSheetMap" type="cn.timer.api.dto.sbgjj.MonthlyCheckoutSheetDto" > <result column="empname" property="empname" /> <result column="usernum" property="usernum" /> <result column="totalmoney" property="totalmoney" /> <result column="gsjltotal" property="gsjltotal" /> <result column="grjltotal" property="grjltotal" /> <result column="zdtype" property="zdtype" /> <result column="zymonth" property="zymonth" /> <result column="sbfaid" property="sbfaid" /> <result column="gjjfaid" property="gjjfaid" /> <result column="qyid" property="qyid" /> <result column="sbgshj" property="sbgshj" /> <result column="sbgrhj" property="sbgrhj" /> <result column="sbhj" property="sbhj" /> <result column="gjjgshj" property="gjjgshj" /> <result column="gjjgrhj" property="gjjgrhj" /> <result column="gjjhj" property="gjjhj" /> <result column="cbryid" property="cbryid" /> </resultMap> <sql id="Base_Column_List"> id, user_num, totalmoney, gsjltotal, grjltotal, zdtype, zymonth, sbfaid, gjjfaid, qyid, sbgshj, sbgrhj, sbhj, gjjgshj, gjjgrhj, gjjhj, cbryid </sql> <sql id="Base_Column_List_Alias"> id SbgjjAssoYjzd_id, user_num SbgjjAssoYjzd_user_num, totalmoney SbgjjAssoYjzd_totalmoney, gsjltotal SbgjjAssoYjzd_gsjltotal, grjltotal SbgjjAssoYjzd_grjltotal, zdtype SbgjjAssoYjzd_zdtype, zymonth SbgjjAssoYjzd_zymonth, sbfaid SbgjjAssoYjzd_sbfaid, gjjfaid SbgjjAssoYjzd_gjjfaid, qyid SbgjjAssoYjzd_qyid, sbgshj SbgjjAssoYjzd_sbgshj, sbgrhj SbgjjAssoYjzd_sbgrhj, sbhj SbgjjAssoYjzd_sbhj, gjjgshj SbgjjAssoYjzd_gjjgshj, gjjgrhj SbgjjAssoYjzd_gjjgrhj, gjjhj SbgjjAssoYjzd_gjjhj, cbryid SbgjjAssoYjzd_cbryid </sql> <select id="IndividualTotalsbgjj" resultMap="BaseResultMap"> <!-- select * from sbgjj_asso_yjzd yj where yj.cbryid = ( select cb.id from sbgjj_admin_cbry cb where cb.user_num = #{usernum} and cb.qyid = #{qyid} and cb.id in (select yj.cbryid from sbgjj_asso_yjzd yj where yj.zymonth = #{zymonth} and yj.user_num = #{usernum}) and cb.state = 1 and cb.is_use = 1 ) and yj.qyid = #{qyid} --> select * from sbgjj_asso_yjzd yj where yj.zymonth = #{zymonth} and yj.user_num = #{usernum} and yj.cbryid = ( select cb.id from sbgjj_admin_cbry cb where cb.user_num = #{usernum} and cb.state = 1 and cb.is_use = 1 and cb.qyid = #{qyid}) and yj.qyid = #{qyid} </select> <select id="MonthlycheckoutsheetList" resultMap="MonthlyCheckoutSheetMap"> select emp.`name` as empname, yjzd.user_num as usernum, bmgw.dept, bmgw.post, emp.rz_time as rztime, yjzd.totalmoney, yjzd.gsjltotal, yjzd.grjltotal, yjzd.zdtype, yjzd.zymonth, yjzd.sbfaid, yjzd.gjjfaid, yjzd.qyid, yjzd.sbgshj, yjzd.sbgrhj, yjzd.sbhj, yjzd.gjjgshj, yjzd.gjjgrhj, yjzd.gjjhj, yjzd.cbryid from sbgjj_asso_yjzd yjzd LEFT JOIN yggl_main_emp as emp on emp.emp_num = yjzd.user_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 yjzd.cbryid in (select cbry.id from sbgjj_admin_cbry cbry where cbry.is_use = 1 and cbry.qyid = #{orgcode}) and yjzd.zymonth = #{mon} and emp.org_code = #{orgcode} <if test="title != null" > and (emp.`name` like CONCAT('%',#{title},'%') or emp.emp_num = #{title}) </if> <!-- cbry.state = 1 ==> 1=1 --> </select> <select id="zcjsjginsurance" resultMap="BaseResultMap"> select * from sbgjj_asso_yjzd yjzd where yjzd.user_num = #{usernum} and yjzd.qyid = #{qyid} and yjzd.zymonth = #{zymonth} </select> <delete id="deletesbgjjassoyjzd" > DELETE FROM sbgjj_asso_yjzd WHERE user_num = #{usernum} and qyid = #{qyid} and zymonth = #{zymonth} and cbryid = #{cbryid} </delete> <insert id="insertsbgjjassoyjzd" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoYjzd" useGeneratedKeys="true" keyProperty="id"> INSERT INTO sbgjj_asso_yjzd <trim prefix="(" suffix=")" suffixOverrides=","> <if test ='null != userNum'> user_num, </if> <if test ='null != totalmoney'> totalmoney, </if> <if test ='null != gsjltotal'> gsjltotal, </if> <if test ='null != grjltotal'> grjltotal, </if> <if test ='null != zdtype'> zdtype, </if> <if test ='null != zymonth'> zymonth, </if> <if test ='null != sbfaid'> sbfaid, </if> <if test ='null != gjjfaid'> gjjfaid, </if> <if test ='null != qyid'> qyid, </if> <if test ='null != sbgshj'> sbgshj, </if> <if test ='null != sbgrhj'> sbgrhj, </if> <if test ='null != sbhj'> sbhj, </if> <if test ='null != gjjgshj'> gjjgshj, </if> <if test ='null != gjjgrhj'> gjjgrhj, </if> <if test ='null != gjjhj'> gjjhj, </if> <if test ='null != cbryid'> cbryid </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test ='null != userNum'> #{userNum}, </if> <if test ='null != totalmoney'> #{totalmoney}, </if> <if test ='null != gsjltotal'> #{gsjltotal}, </if> <if test ='null != grjltotal'> #{grjltotal}, </if> <if test ='null != zdtype'> #{zdtype}, </if> <if test ='null != zymonth'> #{zymonth}, </if> <if test ='null != sbfaid'> #{sbfaid}, </if> <if test ='null != gjjfaid'> #{gjjfaid}, </if> <if test ='null != qyid'> #{qyid}, </if> <if test ='null != sbgshj'> #{sbgshj}, </if> <if test ='null != sbgrhj'> #{sbgrhj}, </if> <if test ='null != sbhj'> #{sbhj}, </if> <if test ='null != gjjgshj'> #{gjjgshj}, </if> <if test ='null != gjjgrhj'> #{gjjgrhj}, </if> <if test ='null != gjjhj'> #{gjjhj}, </if> <if test ='null != cbryid'> #{cbryid} </if> </trim> </insert> <!-- <delete id="delete" > DELETE FROM sbgjj_asso_yjzd WHERE id = #{id} </delete> <update id="update" parameterType="cn.timer.api.bean.sbgjj.SbgjjAssoYjzd"> UPDATE sbgjj_asso_yjzd <set> <if test ='null != userNum'>user_num = #{userNum},</if> <if test ='null != totalmoney'>totalmoney = #{totalmoney},</if> <if test ='null != gsjltotal'>gsjltotal = #{gsjltotal},</if> <if test ='null != grjltotal'>grjltotal = #{grjltotal},</if> <if test ='null != zdtype'>zdtype = #{zdtype},</if> <if test ='null != zymonth'>zymonth = #{zymonth},</if> <if test ='null != sbfaid'>sbfaid = #{sbfaid},</if> <if test ='null != gjjfaid'>gjjfaid = #{gjjfaid},</if> <if test ='null != qyid'>qyid = #{qyid},</if> <if test ='null != sbgshj'>sbgshj = #{sbgshj},</if> <if test ='null != sbgrhj'>sbgrhj = #{sbgrhj},</if> <if test ='null != sbhj'>sbhj = #{sbhj},</if> <if test ='null != gjjgshj'>gjjgshj = #{gjjgshj},</if> <if test ='null != gjjgrhj'>gjjgrhj = #{gjjgrhj},</if> <if test ='null != gjjhj'>gjjhj = #{gjjhj},</if> <if test ='null != cbryid'>cbryid = #{cbryid}</if> </set> WHERE id = #{id} </update> <select id="load" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM sbgjj_asso_yjzd WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" /> FROM sbgjj_asso_yjzd LIMIT #{offset}, #{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer"> SELECT count(1) FROM sbgjj_asso_yjzd </select> --> </mapper>