|
|
@@ -1,11 +1,12 @@
|
|
|
<?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.dk.mdm.mapper.core.StaffMapper">
|
|
|
+<mapper namespace="com.dk.mdm.mapper.mst.StaffMapper">
|
|
|
|
|
|
<!-- 通用设置 -->
|
|
|
<!-- 通用查询列 -->
|
|
|
<sql id="Base_Column_List">
|
|
|
- t.staff_id, t.staff_code, t.staff_name,t.staff_phone, t.org_id, t.role_ids, t.wx_user_id, t.remarks,
|
|
|
+ t.staff_id
|
|
|
+ , t.staff_code, t.staff_name,t.staff_phone, t.org_id, t.role_ids, t.wx_user_id, t.remarks,
|
|
|
t.flg_valid,t.flg_can_login,
|
|
|
t.cp_id, t.op_create_time, t.op_create_user_id, t.op_update_time, t.op_update_user_id
|
|
|
</sql>
|
|
|
@@ -16,26 +17,21 @@
|
|
|
<result column="staff_code" property="staffCode"/>
|
|
|
<result column="staff_name" property="staffName"/>
|
|
|
<result column="staff_phone" property="staffPhone"/>
|
|
|
- <result column="org_id" property="orgId"/>
|
|
|
+ <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
|
|
|
<result column="org_name" property="orgName"/>
|
|
|
- <result column="flg_can_login" property="flgCanLogin"/>
|
|
|
- <result column="wx_user_id" property="wxUserId"/>
|
|
|
+ <result column="role_ids" property="roleIds" typeHandler="UuidListTypeHandler"/>
|
|
|
+ <result column="wx_user_id" property="wxUserId" typeHandler="UuidTypeHandler"/>
|
|
|
<result column="remarks" property="remarks"/>
|
|
|
<result column="flg_valid" property="flgValid"/>
|
|
|
<result column="cp_id" property="cpId"/>
|
|
|
- <result column="role_ids" property="roleIds"
|
|
|
- typeHandler="com.dk.common.infrastructure.handler.StringListTypeHandler"/>
|
|
|
- <result column="op_create_time" property="opCreateTime"
|
|
|
- typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
- <result column="op_create_user_id" property="opCreateUserId"/>
|
|
|
- <result column="op_update_time" property="opUpdateTime"
|
|
|
- typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
- <result column="op_update_user_id" property="opUpdateUserId"/>
|
|
|
+ <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
|
|
|
+ <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+ <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
|
|
|
<result column="op_app_code" property="opAppCode"/>
|
|
|
- <result column="op_timestamp" property="opTimestamp"
|
|
|
- typeHandler="com.dk.common.infrastructure.handler.TimestampTypeHandler"/>
|
|
|
+ <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
|
|
|
<result column="op_db_user" property="opDbUser"/>
|
|
|
- <result column="userIds" property="userIds" typeHandler="IntListTypeHandler"/>
|
|
|
+ <result column="flg_can_login" property="flgCanLogin"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用条件列 -->
|
|
|
@@ -86,11 +82,11 @@
|
|
|
</foreach>
|
|
|
</sql>
|
|
|
|
|
|
- <!-- 查询表dkic_b.t_mst_staff,(条件查询+分页)列表 -->
|
|
|
+ <!-- 查询表t_mst_staff,(条件查询+分页)列表 -->
|
|
|
<select id="selectByCond" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
- , org.org_name,org.level_name AS org_level_name
|
|
|
+ , org.org_name
|
|
|
FROM dkic_b.t_mst_staff t
|
|
|
LEFT JOIN dkic_b.t_mst_org org
|
|
|
ON t.org_Id = org.org_Id
|
|
|
@@ -101,70 +97,38 @@
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
- <!-- 查询表dkic_b.t_mst_staff,(条件查询)个数 -->
|
|
|
+ <!-- 查询表t_mst_staff,(条件查询)个数 -->
|
|
|
<select id="countByCond" resultType="Long">
|
|
|
SELECT
|
|
|
count(1)
|
|
|
FROM dkic_b.t_mst_staff t
|
|
|
-
|
|
|
<include refid="Condition"/>
|
|
|
</select>
|
|
|
|
|
|
- <!--员工-->
|
|
|
- <select id="selectByStringId" resultMap="BaseResultMap">
|
|
|
- select <include refid="Base_Column_List"/>
|
|
|
- from dkic_b.t_mst_staff t
|
|
|
- where t.staff_id = #{staffId,typeHandler=UuidTypeHandler}
|
|
|
-
|
|
|
- </select>
|
|
|
-
|
|
|
- <!--员工编码是否重复-->
|
|
|
- <select id="selectByCode" resultType="Long">
|
|
|
- select count(1)
|
|
|
- from dkic_b.t_mst_staff
|
|
|
- where #{staffCode} = staff_code
|
|
|
- and #{cpId} = cp_id
|
|
|
- <if test="staffId != null and staffId != 0">
|
|
|
- and staff_id != #{staffId}
|
|
|
- </if>
|
|
|
- </select>
|
|
|
-
|
|
|
-
|
|
|
-<!-- <!–更新员工状态–>-->
|
|
|
-<!-- <update id="updateStaffStatus">-->
|
|
|
-<!-- update dkic_b.t_mst_staff-->
|
|
|
-<!-- set staff_status = #{staffStatus}-->
|
|
|
-<!-- where #{staffId} = staff_id-->
|
|
|
-<!-- </update>-->
|
|
|
-
|
|
|
- <!--获取工种-->
|
|
|
- <select id="selectStaffJobId" resultType="Map">
|
|
|
- select job_id AS "jobId"
|
|
|
- from core.t_job
|
|
|
- where #{jobName} = job_name
|
|
|
- and #{cpId} = cp_id
|
|
|
- and flg_valid
|
|
|
- order by display_no
|
|
|
+ <!-- 根据主键查询表t_mst_staff的一行数据 -->
|
|
|
+ <select id="selectById" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_b.t_mst_staff t
|
|
|
+ WHERE t.staff_id = #{staffId}::uuid
|
|
|
</select>
|
|
|
|
|
|
- <!--获取职务-->
|
|
|
- <select id="selectStaffPostId" resultType="Map">
|
|
|
- select post_id AS "postId"
|
|
|
- from core.t_post
|
|
|
- where #{postName} = post_name
|
|
|
- and #{cpId} = cp_id
|
|
|
- and flg_valid
|
|
|
- order by display_no
|
|
|
+ <!-- 根据主键锁定表t_mst_staff的一行数据 -->
|
|
|
+ <select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_b.t_mst_staff t
|
|
|
+ WHERE t.staff_id = #{staffId}
|
|
|
+ for update
|
|
|
</select>
|
|
|
|
|
|
- <!--获取部门-->
|
|
|
- <select id="selectStaffOrgId" resultType="Map">
|
|
|
- select org_id AS "orgId"
|
|
|
- from dkic_b.t_mst_org
|
|
|
- where #{orgName} = org_name
|
|
|
- and #{cpId} = cp_id
|
|
|
- and flg_valid
|
|
|
- order by display_no
|
|
|
+ <!-- 根据主键锁定表t_mst_staff的多行数据 -->
|
|
|
+ <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ FROM dkic_b.t_mst_staff t
|
|
|
+ <include refid="idsForeach"/>
|
|
|
+ for update
|
|
|
</select>
|
|
|
|
|
|
<insert id="insertBatch">
|
|
|
@@ -173,12 +137,14 @@
|
|
|
<trim suffixOverrides=",">
|
|
|
staff_code,
|
|
|
staff_name,
|
|
|
- job_id,
|
|
|
- post_id,
|
|
|
+ staff_phone,
|
|
|
org_id,
|
|
|
- staff_status,
|
|
|
+ role_ids,
|
|
|
+ wx_user_id,
|
|
|
remarks,
|
|
|
cp_id,
|
|
|
+ op_app_code,
|
|
|
+ flg_can_login,
|
|
|
</trim>
|
|
|
)
|
|
|
values
|
|
|
@@ -187,12 +153,14 @@
|
|
|
<trim suffixOverrides=",">
|
|
|
#{item.staffCode},
|
|
|
#{item.staffName},
|
|
|
- #{item.jobId},
|
|
|
- #{item.postId},
|
|
|
- #{item.orgId},
|
|
|
- #{item.staffStatus},
|
|
|
+ #{item.staffPhone},
|
|
|
+ #{item.orgId}::uuid,
|
|
|
+ #{item.roleIds},
|
|
|
+ #{item.wxUserId}::uuid,
|
|
|
#{item.remarks},
|
|
|
#{item.cpId},
|
|
|
+ #{item.opAppCode},
|
|
|
+ #{item.flgCanLogin},
|
|
|
</trim>
|
|
|
)
|
|
|
</foreach>
|