SbgjjAssoYjzdMapper.xml 10.9 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 94 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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238
<?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="MonthlycheckoutsheetList" resultMap="MonthlyCheckoutSheetMap">
    		select emp.`name` as empname, 
			yjzd.user_num as usernum,
			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
		where yjzd.cbryid in (select cbry.id from sbgjj_admin_cbry cbry
		where cbry.state = 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>
    </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>

239
    <!-- <delete id="delete" >
yuquan.zhu committed
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282
        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
283
    </select> -->
yuquan.zhu committed
284 285 286


</mapper>