194 lines
7.0 KiB
XML

<?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="com.xhpc.activity.mapper.XhpcWorkUserMapper">
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcWorkUserDomain">
<id column="work_user_id" jdbcType="BIGINT" property="workUserId" />
<result column="user_name" jdbcType="VARCHAR" property="userName" />
<result column="dept_id" jdbcType="BIGINT" property="deptId" />
<result column="post_name" jdbcType="VARCHAR" property="postName" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="email" jdbcType="VARCHAR" property="email" />
<result column="wechat_openid" jdbcType="VARCHAR" property="wechatOpenid" />
<result column="is_leader" jdbcType="SMALLINT" property="isLeader" />
<result column="status" jdbcType="SMALLINT" property="status" />
<result column="del_flag" jdbcType="SMALLINT" property="delFlag" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
</resultMap>
<sql id="Base_Column_List">
work_user_id, user_name, dept_id, post_name, phone, email, wechat_openid, is_leader,
`status`, del_flag, create_time, create_by, update_time, update_by
</sql>
<select id="selectByUserNameAndPhone" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
select
<include refid="Base_Column_List" />
from xhpc_work_user
where user_name = #{userName} and phone=#{phone}
</select>
<select id="selectMapListByDeptId" resultType="map">
select
work_user_id as 'id',
user_name as 'name',
phone,
email
from xhpc_work_user
where del_flag=0 and status=1 and dept_id = #{deptId}
</select>
<select id="selectByOrderId" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
select
<include refid="Base_Column_List" />
FROM xhpc_work_user u
LEFT JOIN xhpc_work_order_user ou on ou.user_id=u.work_user_id
WHERE ou.order_id=#{orderId} and u.del_flag=0 and u.status=1
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from xhpc_work_user
where work_user_id = #{workUserId,jdbcType=BIGINT}
</select>
<update id="deleteByPrimaryKey" parameterType="java.lang.Long">
update xhpc_work_user set del_flag=2
where work_user_id = #{workUserId,jdbcType=BIGINT}
</update>
<insert id="insert" keyColumn="work_user_id" keyProperty="workUserId" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain" useGeneratedKeys="true">
insert into xhpc_work_user (user_name, dept_id, post_name,
phone, email, wechat_openid,
is_leader, `status`, del_flag,
create_time, create_by, update_time,
update_by)
values (#{userName,jdbcType=VARCHAR}, #{deptId,jdbcType=BIGINT}, #{postName,jdbcType=VARCHAR},
#{phone,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{wechatOpenid,jdbcType=VARCHAR},
#{isLeader,jdbcType=SMALLINT}, #{status,jdbcType=SMALLINT}, 0,
sysdate(), #{createBy,jdbcType=VARCHAR}, sysdate(),
#{updateBy,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" keyColumn="work_user_id" keyProperty="workUserId" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain" useGeneratedKeys="true">
insert into xhpc_work_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null">
user_name,
</if>
<if test="deptId != null">
dept_id,
</if>
<if test="postName != null">
post_name,
</if>
<if test="phone != null">
phone,
</if>
<if test="email != null">
email,
</if>
<if test="wechatOpenid != null">
wechat_openid,
</if>
<if test="isLeader != null">
is_leader,
</if>
<if test="status != null">
`status`,
</if>
del_flag,
create_time,
<if test="createBy != null">
create_by,
</if>
update_time,
<if test="updateBy != null">
update_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null">
#{userName,jdbcType=VARCHAR},
</if>
<if test="deptId != null">
#{deptId,jdbcType=BIGINT},
</if>
<if test="postName != null">
#{postName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
#{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
#{email,jdbcType=VARCHAR},
</if>
<if test="wechatOpenid != null">
#{wechatOpenid,jdbcType=VARCHAR},
</if>
<if test="isLeader != null">
#{isLeader,jdbcType=SMALLINT},
</if>
<if test="status != null">
#{status,jdbcType=SMALLINT},
</if>
0,
sysdate(),
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
sysdate(),
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain">
update xhpc_work_user
<set>
<if test="userName != null">
user_name = #{userName,jdbcType=VARCHAR},
</if>
<if test="deptId != null">
dept_id = #{deptId,jdbcType=BIGINT},
</if>
<if test="postName != null">
post_name = #{postName,jdbcType=VARCHAR},
</if>
<if test="phone != null">
phone = #{phone,jdbcType=VARCHAR},
</if>
<if test="email != null">
email = #{email,jdbcType=VARCHAR},
</if>
<if test="wechatOpenid != null">
wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
</if>
<if test="isLeader != null">
is_leader = #{isLeader,jdbcType=SMALLINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=SMALLINT},
</if>
update_time =sysdate(),
<if test="updateBy != null">
update_by = #{updateBy,jdbcType=VARCHAR},
</if>
</set>
where work_user_id = #{workUserId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain">
update xhpc_work_user
set user_name = #{userName,jdbcType=VARCHAR},
dept_id = #{deptId,jdbcType=BIGINT},
post_name = #{postName,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
email = #{email,jdbcType=VARCHAR},
wechat_openid = #{wechatOpenid,jdbcType=VARCHAR},
is_leader = #{isLeader,jdbcType=SMALLINT},
`status` = #{status,jdbcType=SMALLINT},
update_time = sysdate(),
update_by = #{updateBy,jdbcType=VARCHAR}
where work_user_id = #{workUserId,jdbcType=BIGINT}
</update>
</mapper>