ZzglLogDgjlMapper.xml 5.43 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
<?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.zzgl.ZzglLogDgjlMapper">

	<resultMap id="BaseResultMap"
		type="cn.timer.api.bean.zzgl.ZzglLogDgjl">
		<id column="id" property="id" />
		<result column="org_code" property="orgCode" />
		<result column="emp_num" property="empNum" />
		<result column="obmgw_id" property="obmgwId" />
		<result column="nbmgw_id" property="nbmgwId" />
		<result column="update_id" property="updateId" />
		<result column="create_time" property="createTime" />
	</resultMap>

	<sql id="Base_Column_List">
		a.id,
		a.org_code,
		a.emp_num,
		a.obmgw_id,
		a.nbmgw_id,
		a.update_id,
		a.create_time
	</sql>

	<sql id="Base_Column_List_Alias">
		id ZzglLogDgjl_id,
		org_code ZzglLogDgjl_org_code,
		emp_num
		ZzglLogDgjl_emp_num,
		obmgw_id ZzglLogDgjl_obmgw_id,
		nbmgw_id
		ZzglLogDgjl_nbmgw_id,
		update_id ZzglLogDgjl_update_id,
		create_time
		ZzglLogDgjl_create_time
	</sql>

	<select id="selectListdgjl"
		resultType="cn.timer.api.dto.zzgl.ZzglLogDgjlDto"
		parameterType="cn.timer.api.dto.zzgl.ZzglLogDgjlQueryDto">
		SELECT
		<include refid="Base_Column_List" />
		,b.name username
		FROM
		zzgl_log_dgjl a,yggl_main_emp b
		<where>
			a.emp_num = b.emp_num
			<if test="orgCode != null and orgCode != ''">
				and a.org_code = #{orgCode}
			</if>
			<if test="query != null and query != ''">
				and b.name like CONCAT(#{query},'%')
			</if>
			<if test="startTime != null and startTime != ''">
				and a.create_time <![CDATA[ >= ]]>
				#{startTime}
			</if>
			<if test="endTime != null and endTime != ''">
				and a.create_time <![CDATA[ <= ]]>
				#{endTime}
			</if>
		</where>
	</select>

	<select id="selectListdgjls"
		resultType="cn.timer.api.dto.zzgl.LogDgjlsDto"
		parameterType="cn.timer.api.dto.zzgl.LogDgjlsQueryDto">
		SELECT
				c.name `name`,b.name `obmgw`,e.name `nbmgw`,a.emp_num `empNum`,d.name `updateMen`,
				a.create_time `createTime`
			FROM
				zzgl_log_dgjl a
			LEFT JOIN yggl_main_emp c ON a.emp_num = c.emp_num
			LEFT JOIN zzgl_bmgw_m b ON a.obmgw_id = b.id
			LEFT JOIN zzgl_bmgw_m e ON a.nbmgw_id = e.id
			LEFT JOIN yggl_main_emp d ON a.update_id = d.emp_num 
		<where>
80 81
			a.org_code = #{param.orgCode} AND c.org_code = #{param.orgCode} AND b.org_code = #{param.orgCode}
			 AND e.org_code = #{param.orgCode} AND d.org_code = #{param.orgCode}
yuquan.zhu committed
82 83 84 85 86 87 88 89 90 91 92 93 94
			<if test="null != param.query and param.query != ''">
				and (c.name like CONCAT('%',#{param.query},'%') or
				a.emp_num like CONCAT('%',#{param.query},'%') or 
				c.phone like CONCAT('%',#{param.query},'%'))
			</if>
			<if test="param.deptIdList != null">
				and a.nbmgw_id in
				<foreach item="item" index="index"
					collection="param.deptIdList.toArray()" open="(" separator="," close=")">
					#{item}
				</foreach>
			</if>
		</where>
东州 翁 committed
95
		GROUP BY `createTime` order by a.create_time DESC
yuquan.zhu committed
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
	</select>




	<insert id="insertbydeldept">
		insert into zzgl_log_dgjl
		(create_time,emp_num,nbmgw_id,obmgw_id,org_code,update_id,comment)
		select NOW(),emp_num,null,bmgw_id,org_code,#{uid},'删除岗位调岗' from
		yggl_main_emp where bmgw_id in
		<foreach item="item" index="index" collection="ids" open="("
			separator="," close=")">#{item}</foreach>
	</insert>
	<insert id="insertbyaddemp">
		insert into zzgl_log_dgjl
		(create_time,emp_num,nbmgw_id,obmgw_id,org_code,update_id,comment)
		select NOW(),emp_num,#{gwid},bmgw_id,org_code,#{uid},#{comm} from
		yggl_main_emp where org_code=#{orgc} and emp_num in
		<foreach item="item" index="index" collection="ids" open="("
			separator="," close=")">#{item}</foreach>
	</insert>
	<!-- <insert id="insert" useGeneratedKeys="true" keyColumn="id" parameterType="cn.timer.api.bean.zzgl.ZzglLogDgjl"> 
		INSERT INTO zzgl_log_dgjl <trim prefix="(" suffix=")" suffixOverrides=","> 
		<if test ='null != orgCode'> org_code, </if> <if test ='null != empNum'> 
		emp_num, </if> <if test ='null != obmgwId'> obmgw_id, </if> <if test ='null 
		!= nbmgwId'> nbmgw_id, </if> <if test ='null != updateId'> update_id, </if> 
		<if test ='null != createTime'> create_time </if> </trim> <trim prefix="values 
		(" suffix=")" suffixOverrides=","> <if test ='null != orgCode'> #{orgCode}, 
		</if> <if test ='null != empNum'> #{empNum}, </if> <if test ='null != obmgwId'> 
		#{obmgwId}, </if> <if test ='null != nbmgwId'> #{nbmgwId}, </if> <if test 
		='null != updateId'> #{updateId}, </if> <if test ='null != createTime'> #{createTime} 
		</if> </trim> </insert> <delete id="delete" > DELETE FROM zzgl_log_dgjl WHERE 
		id = #{id} </delete> <update id="update" parameterType="cn.timer.api.bean.zzgl.ZzglLogDgjl"> 
		UPDATE zzgl_log_dgjl <set> <if test ='null != orgCode'>org_code = #{orgCode},</if> 
		<if test ='null != empNum'>emp_num = #{empNum},</if> <if test ='null != obmgwId'>obmgw_id 
		= #{obmgwId},</if> <if test ='null != nbmgwId'>nbmgw_id = #{nbmgwId},</if> 
		<if test ='null != updateId'>update_id = #{updateId},</if> <if test ='null 
		!= createTime'>create_time = #{createTime}</if> </set> WHERE id = #{id} </update> 
		<select id="load" resultMap="BaseResultMap"> SELECT <include refid="Base_Column_List" 
		/> FROM zzgl_log_dgjl WHERE id = #{id} </select> <select id="pageList" resultMap="BaseResultMap"> 
		SELECT <include refid="Base_Column_List" /> FROM zzgl_log_dgjl LIMIT #{offset}, 
		#{pageSize} </select> <select id="pageListCount" resultType="java.lang.Integer"> 
		SELECT count(1) FROM zzgl_log_dgjl </select> -->

</mapper>