SbgjjAdminCbryMapper.xml 17.8 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
<?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.SbgjjAdminCbryMapper">

    <resultMap id="BaseResultMap" type="cn.timer.api.bean.sbgjj.SbgjjAdminCbry" >
                <id column="id" property="id" />
                <result column="user_num" property="userNum" />
                <result column="sbcb_state" property="sbcbState" />
                <result column="gjjcb_state" property="gjjcbState" />
                <result column="jl_mode" property="jlMode" />
                <result column="cbfacs" property="cbfacs" />
                <result column="sbjl_statime" property="sbjlStatime" />
                <result column="sbjljs" property="sbjljs" />
                <result column="gjjjl_statime" property="gjjjlStatime" />
                <result column="gjjjljs" property="gjjjljs" />
                <result column="sbjl_endtime" property="sbjlEndtime" />
                <result column="gjjjl_endtime" property="gjjjlEndtime" />
                <result column="insure_num" property="insureNum" />
                <result column="insure_time" property="insureTime" />
                <result column="stop_num" property="stopNum" />
                <result column="stop_time" property="stopTime" />
                <result column="state" property="state" />
                <result column="qyid" property="qyid" />
                <result column="sbfaid" property="sbfaid" />
                <result column="gjjfaid" property="gjjfaid" />
ilal committed
27
                <result column="is_use" property="isUse" />
yuquan.zhu committed
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
    </resultMap>
    
    <resultMap id="InsuredPersonnelMap" type="cn.timer.api.dto.sbgjj.InsuredPersonnelDto" >
                <result column="empnum" property="empnum" />
                <result column="empname" property="empname" />
                <result column="cbfacs" property="cbfacs" />
                <result column="dept" property="dept" />
                <result column="post" property="post" />
                <result column="sbcbstate" property="sbcbstate" />
                <result column="gjjcbstate" property="gjjcbstate" />
                <result column="jlmode" property="jlmode" />
                <result column="emphone" property="emphone" />
                <result column="emzjnum" property="emzjnum" />
                <result column="cbryid" property="cbryid" />
                <result column="csid" property="csid" />
                <result column="sbfaid" property="sbfaid" />
                <result column="sbjlstatime" property="sbjlstatime" />
                <result column="sbjljs" property="sbjljs" />
                <result column="gjjfaid" property="gjjfaid" />
                <result column="gjjjlstatime" property="gjjjlstatime" />
                <result column="gjjjljs" property="gjjjljs" />
    </resultMap>
    
    <resultMap id="YgglEmpInfoMap" type="cn.timer.api.bean.yggl.YgglMainEmp" >
        	<id column="id" property="id" />
                <id column="id" property="id" />
                <result column="emp_num" property="empNum" />
                <result column="phone" property="phone" />
                <result column="password" property="password" />
                <result column="head_url" property="headUrl" />
                <result column="name" property="name" />
                <result column="english_name" property="englishName" />
                <result column="sex" property="sex" />
                <result column="zj_type" property="zjType" />
                <result column="zj_num" property="zjNum" />
                <result column="sfzyx_time" property="sfzyxTime" />
                <result column="birthday" property="birthday" />
                <result column="age" property="age" />
                <result column="is_married" property="isMarried" />
                <result column="is_pregnant" property="isPregnant" />
                <result column="area" property="area" />
                <result column="mz" property="mz" />
                <result column="zzmm" property="zzmm" />
                <result column="jg" property="jg" />
                <result column="city" property="city" />
                <result column="hk_type" property="hkType" />
                <result column="hk_address" property="hkAddress" />
                <result column="qq" property="qq" />
                <result column="wechat" property="wechat" />
                <result column="email" property="email" />
                <result column="blood_type" property="bloodType" />
                <result column="language" property="language" />
                <result column="edu" property="edu" />
                <result column="zy" property="zy" />
                <result column="zz_remark" property="zzRemark" />
                <result column="job_type" property="jobType" />
                <result column="job_status" property="jobStatus" />
                <result column="rz_time" property="rzTime" />
                <result column="syq" property="syq" />
                <result column="zz_time" property="zzTime" />
                <result column="sjzz_time" property="sjzzTime" />
                <result column="is_jrkq" property="isJrkq" />
                <result column="job_num" property="jobNum" />
                <result column="work_address" property="workAddress" />
                <result column="work_phone" property="workPhone" />
                <result column="work_email" property="workEmail" />
                <result column="zpqd" property="zpqd" />
                <result column="bmgw_id" property="bmgwId" />
                <result column="org_code" property="orgCode" />
                <result column="unionid" property="unionid" />
                <result column="openid" property="openid" />
                <result column="mpopenid" property="mpopenid" />
                <result column="appopenid" property="appopenid" />
    </resultMap>

    <sql id="Base_Column_List">
                id,
                user_num,
                sbcb_state,
                gjjcb_state,
                jl_mode,
                cbfacs,
                sbjl_statime,
                sbjljs,
                gjjjl_statime,
                gjjjljs,
                sbjl_endtime,
                gjjjl_endtime,
                insure_num,
                insure_time,
                stop_num,
                stop_time,
                state,
                qyid,
                sbfaid,
                gjjfaid
    </sql>
    
ilal committed
126 127 128 129 130 131 132
    <sql id="salary_List">
    	id,org_code,emp_num,age,appopenid,area,birthday,blood_type,bmgw_id,province_id,province,district_id,district,city_id,
		city,edu,english_name,head_url,hk_address,hk_type,is_jrkq,is_married,is_pregnant,jg_id,jg,job_status,job_type,language,
		address,mpopenid,mz,name,openid,job_num,password,phone,qq,rz_time,sex,sfzyx_time,sjzz_time,syq,unionid,wechat,work_address,work_email,
		work_phone,zj_num,zj_type,zpqd,zy,zz_remark,zz_time,zzmm,update_man,update_time,is_manager,before_leaving_sts,bmgw_name,custom_num
    </sql>
    
yuquan.zhu committed
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
    <sql id="Base_Column_List_Alias">
                id SbgjjAdminCbry_id,
                user_num SbgjjAdminCbry_user_num,
                sbcb_state SbgjjAdminCbry_sbcb_state,
                gjjcb_state SbgjjAdminCbry_gjjcb_state,
                jl_mode SbgjjAdminCbry_jl_mode,
                cbfacs SbgjjAdminCbry_cbfacs,
                sbjl_statime SbgjjAdminCbry_sbjl_statime,
                sbjljs SbgjjAdminCbry_sbjljs,
                gjjjl_statime SbgjjAdminCbry_gjjjl_statime,
                gjjjljs SbgjjAdminCbry_gjjjljs,
                sbjl_endtime SbgjjAdminCbry_sbjl_endtime,
                gjjjl_endtime SbgjjAdminCbry_gjjjl_endtime,
                insure_num SbgjjAdminCbry_insure_num,
                insure_time SbgjjAdminCbry_insure_time,
                stop_num SbgjjAdminCbry_stop_num,
                stop_time SbgjjAdminCbry_stop_time,
                state SbgjjAdminCbry_state,
                qyid SbgjjAdminCbry_qyid,
                sbfaid SbgjjAdminCbry_sbfaid,
                gjjfaid SbgjjAdminCbry_gjjfaid
    </sql>


ilal committed
157 158 159 160 161 162 163
	 <select id="EmployeeListByorgCode" resultMap="YgglEmpInfoMap">
	     select <include refid="salary_List" /> 
	     	from yggl_main_emp
			    where org_code = #{orgCode,jdbcType=VARCHAR}
			    and job_status != 3
			and emp_num not in (select cbry.user_num from sbgjj_admin_cbry cbry where cbry.qyid = #{orgCode,jdbcType=VARCHAR})
	  </select>
yuquan.zhu committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185


<select id="InsuredPersonnel" resultMap="InsuredPersonnelMap">
		select emp.emp_num as empnum,
			 emp.`name` as empname,
			 emp.phone as emphone,
			 emp.zj_num as emzjnum,
			 cbry.id as cbryid,
			 cbry.cbfacs as cbfacs,
			 csbh.id as csid,
			 bmgw.dept,
			 bmgw.post,
			cbry.sbcb_state as sbcbstate,
			cbry.gjjcb_state as gjjcbstate,
			cbry.jl_mode as jlmode,
			cbry.sbfaid as sbfaid,
			cbry.sbjl_statime as sbjlstatime,
			cbry.sbjljs as sbjljs,
			cbry.gjjfaid as gjjfaid,
			cbry.gjjjl_statime as gjjjlstatime,
			cbry.gjjjljs as gjjjljs
			from yggl_main_emp emp 
ilal committed
186
	LEFT JOIN sbgjj_admin_cbry as cbry on cbry.user_num = emp.emp_num and cbry.state = 1 and cbry.qyid = #{orgcode}
yuquan.zhu committed
187 188 189 190 191 192 193 194 195 196 197
	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
	LEFT JOIN sbgjj_yj_csbh as csbh on csbh.city_name = cbry.cbfacs
	where emp.org_code = #{orgcode}
	<if test="title != null" >
    	and (emp.`name` like CONCAT('%',#{title},'%') or emp.emp_num = #{title})
    </if>
</select>

lal committed
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
<select id="InsuredEmployees" resultMap="InsuredPersonnelMap">
		select emp.emp_num as empnum,
			 emp.`name` as empname,
			 emp.phone as emphone,
			 emp.zj_num as emzjnum,
			 cbry.id as cbryid,
			 cbry.cbfacs as cbfacs,
			 csbh.id as csid,
			 bmgw.dept,
			 bmgw.post,
			cbry.sbcb_state as sbcbstate,
			cbry.gjjcb_state as gjjcbstate,
			cbry.jl_mode as jlmode,
			cbry.sbfaid as sbfaid,
			cbry.sbjl_statime as sbjlstatime,
			cbry.sbjljs as sbjljs,
			cbry.gjjfaid as gjjfaid,
			cbry.gjjjl_statime as gjjjlstatime,
			cbry.gjjjljs as gjjjljs
			from yggl_main_emp emp 
	LEFT JOIN sbgjj_admin_cbry as cbry on cbry.user_num = emp.emp_num and cbry.state = 1
	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
	LEFT JOIN sbgjj_yj_csbh as csbh on csbh.city_name = cbry.cbfacs
	where emp.org_code = #{param.orgcode}
	<if test="param.title != null" >
    	and (emp.`name` like CONCAT('%',#{param.title},'%') or emp.emp_num = #{param.title})
    </if>
</select>

yuquan.zhu committed
230 231 232 233 234 235 236 237 238 239 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 283 284 285 286 287 288

    <insert id="insertsbgjjadmincbry" parameterType="cn.timer.api.bean.sbgjj.SbgjjAdminCbry" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO sbgjj_admin_cbry
        <trim prefix="(" suffix=")" suffixOverrides=",">
                        <if test ='null != userNum'>
                        user_num,
                        </if>
                        <if test ='null != sbcbState'>
                        sbcb_state,
                        </if>
                        <if test ='null != gjjcbState'>
                        gjjcb_state,
                        </if>
                        <if test ='null != jlMode'>
                        jl_mode,
                        </if>
                        <if test ='null != cbfacs'>
                        cbfacs,
                        </if>
                        <if test ='null != sbjlStatime'>
                        sbjl_statime,
                        </if>
                        <if test ='null != sbjljs'>
                        sbjljs,
                        </if>
                        <if test ='null != gjjjlStatime'>
                        gjjjl_statime,
                        </if>
                        <if test ='null != gjjjljs'>
                        gjjjljs,
                        </if>
                        <if test ='null != sbjlEndtime'>
                        sbjl_endtime,
                        </if>
                        <if test ='null != gjjjlEndtime'>
                        gjjjl_endtime,
                        </if>
                        <if test ='null != insureNum'>
                        insure_num,
                        </if>
                        <if test ='null != insureTime'>
                        insure_time,
                        </if>
                        <if test ='null != stopNum'>
                        stop_num,
                        </if>
                        <if test ='null != stopTime'>
                        stop_time,
                        </if>
                        <if test ='null != state'>
                        state,
                        </if>
                        <if test ='null != qyid'>
                        qyid,
                        </if>
                        <if test ='null != sbfaid'>
                        sbfaid,
                        </if>
                        <if test ='null != gjjfaid'>
ilal committed
289 290 291 292
                        gjjfaid,
                        </if>
                        <if test ='null != isUse'>
                        is_use
yuquan.zhu committed
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
                        </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                        <if test ='null != userNum'>
                        #{userNum},
                        </if>
                        <if test ='null != sbcbState'>
                        #{sbcbState},
                        </if>
                        <if test ='null != gjjcbState'>
                        #{gjjcbState},
                        </if>
                        <if test ='null != jlMode'>
                        #{jlMode},
                        </if>
                        <if test ='null != cbfacs'>
                        #{cbfacs},
                        </if>
                        <if test ='null != sbjlStatime'>
                        #{sbjlStatime},
                        </if>
                        <if test ='null != sbjljs'>
                        #{sbjljs},
                        </if>
                        <if test ='null != gjjjlStatime'>
                        #{gjjjlStatime},
                        </if>
                        <if test ='null != gjjjljs'>
                        #{gjjjljs},
                        </if>
                        <if test ='null != sbjlEndtime'>
                        #{sbjlEndtime},
                        </if>
                        <if test ='null != gjjjlEndtime'>
                        #{gjjjlEndtime},
                        </if>
                        <if test ='null != insureNum'>
                        #{insureNum},
                        </if>
                        <if test ='null != insureTime'>
                        #{insureTime},
                        </if>
                        <if test ='null != stopNum'>
                        #{stopNum},
                        </if>
                        <if test ='null != stopTime'>
                        #{stopTime},
                        </if>
                        <if test ='null != state'>
                        #{state},
                        </if>
                        <if test ='null != qyid'>
                        #{qyid},
                        </if>
                        <if test ='null != sbfaid'>
                        #{sbfaid},
                        </if>
                        <if test ='null != gjjfaid'>
ilal committed
351 352 353 354
                        #{gjjfaid},
                        </if>
                        <if test ='null != isUse'>
                        #{isUse}
yuquan.zhu committed
355 356 357 358
                        </if>
        </trim>
    </insert>

359
   <!--  <delete id="delete" >
yuquan.zhu committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
        DELETE FROM sbgjj_admin_cbry
        WHERE id = #{id}
    </delete>

    <update id="update" parameterType="cn.timer.api.bean.sbgjj.SbgjjAdminCbry">
        UPDATE sbgjj_admin_cbry
        <set>
                    <if test ='null != userNum'>user_num = #{userNum},</if>
                    <if test ='null != sbcbState'>sbcb_state = #{sbcbState},</if>
                    <if test ='null != gjjcbState'>gjjcb_state = #{gjjcbState},</if>
                    <if test ='null != jlMode'>jl_mode = #{jlMode},</if>
                    <if test ='null != cbfacs'>cbfacs = #{cbfacs},</if>
                    <if test ='null != sbjlStatime'>sbjl_statime = #{sbjlStatime},</if>
                    <if test ='null != sbjljs'>sbjljs = #{sbjljs},</if>
                    <if test ='null != gjjjlStatime'>gjjjl_statime = #{gjjjlStatime},</if>
                    <if test ='null != gjjjljs'>gjjjljs = #{gjjjljs},</if>
                    <if test ='null != sbjlEndtime'>sbjl_endtime = #{sbjlEndtime},</if>
                    <if test ='null != gjjjlEndtime'>gjjjl_endtime = #{gjjjlEndtime},</if>
                    <if test ='null != insureNum'>insure_num = #{insureNum},</if>
                    <if test ='null != insureTime'>insure_time = #{insureTime},</if>
                    <if test ='null != stopNum'>stop_num = #{stopNum},</if>
                    <if test ='null != stopTime'>stop_time = #{stopTime},</if>
                    <if test ='null != state'>state = #{state},</if>
                    <if test ='null != qyid'>qyid = #{qyid},</if>
                    <if test ='null != sbfaid'>sbfaid = #{sbfaid},</if>
                    <if test ='null != gjjfaid'>gjjfaid = #{gjjfaid}</if>
        </set>
        WHERE id = #{id}
    </update>


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

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

    <select id="pageListCount" resultType="java.lang.Integer">
        SELECT count(1)
        FROM sbgjj_admin_cbry
406
    </select> -->
yuquan.zhu committed
407 408 409


</mapper>