2022-01-11 10:21:53 +08:00
|
|
|
<?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">
|
2022-04-21 10:22:28 +08:00
|
|
|
<mapper namespace="com.xhpc.activity.mapper.XhpcWorkUserMapper">
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
2022-01-11 10:21:53 +08:00
|
|
|
<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">
|
2022-05-20 17:46:03 +08:00
|
|
|
u.work_user_id, u.user_name, u.dept_id, u.post_name, u.phone, u.email, u.wechat_openid, u.is_leader,
|
|
|
|
|
u.`status`, u.del_flag, u.create_time, u.create_by, u.update_time, u.update_by
|
2022-01-11 10:21:53 +08:00
|
|
|
</sql>
|
2022-01-11 18:11:20 +08:00
|
|
|
|
2022-05-20 17:46:03 +08:00
|
|
|
|
2022-04-21 10:22:28 +08:00
|
|
|
<select id="selectByUserNameAndPhone" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
2022-01-11 18:11:20 +08:00
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
2022-05-20 17:46:03 +08:00
|
|
|
from xhpc_work_user u
|
|
|
|
|
where u.user_name = #{userName} and u.phone=#{phone}
|
2022-01-11 18:11:20 +08:00
|
|
|
</select>
|
|
|
|
|
|
2022-05-20 17:46:03 +08:00
|
|
|
|
2022-02-21 09:35:37 +08:00
|
|
|
<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>
|
|
|
|
|
|
|
|
|
|
|
2022-04-21 10:22:28 +08:00
|
|
|
<select id="selectByOrderId" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
2022-02-21 09:35:37 +08:00
|
|
|
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>
|
|
|
|
|
|
2022-05-20 17:46:03 +08:00
|
|
|
|
2022-01-11 10:21:53 +08:00
|
|
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />
|
2022-05-20 17:46:03 +08:00
|
|
|
from xhpc_work_user u
|
|
|
|
|
where u.work_user_id = #{workUserId,jdbcType=BIGINT}
|
2022-01-11 10:21:53 +08:00
|
|
|
</select>
|
2022-05-20 17:46:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="deleteLogicByPrimaryKey" parameterType="java.lang.Long">
|
2022-01-11 10:21:53 +08:00
|
|
|
update xhpc_work_user set del_flag=2
|
|
|
|
|
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
|
|
|
|
</update>
|
2022-05-20 17:46:03 +08:00
|
|
|
|
|
|
|
|
|
2022-04-21 10:22:28 +08:00
|
|
|
<insert id="insert" keyColumn="work_user_id" keyProperty="workUserId" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain" useGeneratedKeys="true">
|
2022-01-11 10:21:53 +08:00
|
|
|
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>
|
2022-05-20 17:46:03 +08:00
|
|
|
|
|
|
|
|
|
2022-04-21 10:22:28 +08:00
|
|
|
<update id="updateByPrimaryKey" parameterType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
2022-01-11 10:21:53 +08:00
|
|
|
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>
|
2022-05-20 17:46:03 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateDomainStatusByPrimaryKey">
|
|
|
|
|
update xhpc_work_user
|
|
|
|
|
set `status` = #{status,jdbcType=SMALLINT},
|
|
|
|
|
update_time = sysdate(),
|
|
|
|
|
update_by = #{updateBy,jdbcType=VARCHAR}
|
|
|
|
|
where work_user_id = #{workUserId,jdbcType=BIGINT}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectPage" resultType="com.xhpc.activity.domain.XhpcWorkUserDomain">
|
|
|
|
|
select
|
|
|
|
|
<include refid="Base_Column_List" />, d.dept_name
|
|
|
|
|
from xhpc_work_user u
|
|
|
|
|
left xhpc_work_dept d on u.dept_id=d.work_dept_id
|
|
|
|
|
where u.del_flag=0 and d.del_flag=0 and u.status=1 and d.status=1
|
|
|
|
|
<if test="params.deptId!=null">
|
|
|
|
|
and (u.dept_id=#{params.deptId} or u.parent_dept_id=#{params.deptId})
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.userName!=null and params.userName!=''">
|
|
|
|
|
and u.user_name like concat('%', #{params.userName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
|
|
|
and u.phone like concat('%', #{params.phone}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.email!=null and params.email!=''">
|
|
|
|
|
and u.email like concat('%', #{params.email}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectMapList" resultType="java.util.Map">
|
|
|
|
|
select
|
|
|
|
|
u.work_user_id as 'id', u.user_name as 'name'
|
|
|
|
|
from xhpc_work_user u
|
|
|
|
|
where u.del_flag=0 and u.status=1
|
|
|
|
|
<if test="params.deptId!=null">
|
|
|
|
|
and u.dept_id=#{params.deptId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.userName!=null and params.userName!=''">
|
|
|
|
|
and u.user_name like concat('%', #{params.userName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.phone!=null and params.phone!=''">
|
|
|
|
|
and u.phone like concat('%', #{params.phone}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="params.email!=null and params.email!=''">
|
|
|
|
|
and u.email like concat('%', #{params.email}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
2022-01-11 10:21:53 +08:00
|
|
|
</mapper>
|