MerchantRoleStaffRelationMapper.xml
2.3 KB
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
<?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.com.glsx.merchants.mapper.MerchantRoleStaffRelationMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.merchants.entity.MerchantRoleStaffRelation">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="role_id" jdbcType="INTEGER" property="roleId"/>
<result column="staff_id" jdbcType="INTEGER" property="staffId"/>
<result column="created_by" jdbcType="INTEGER" property="createdBy"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_by" jdbcType="INTEGER" property="updatedBy"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="role_name" jdbcType="TINYINT" property="roleName"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, role_id, staff_id, created_by, created_time, updated_by, updated_time, del_flag
</sql>
<delete id="deleteByStaffId" parameterType="cn.com.glsx.merchants.entity.MerchantRoleStaffRelation">
update platform_merchant_role_staff_relation
set
del_flag = -1,
updated_time = NOW(),
updated_by = #{merchantRoleStaffRelation.updatedBy}
where
<if test="merchantRoleStaffRelation.staffId != null">
staff_id = #{merchantRoleStaffRelation.staffId}
</if>
</delete>
<select id="findRelation" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select t1.*,t2.role_name from platform_merchant_role_staff_relation t1
LEFT JOIN platform_merchant_role t2 on t1.role_id=t2.id
where t1.staff_id=#{staffId} and t1.del_flag=0
</select>
<select id="findByStaffIds" resultMap="BaseResultMap">
select * from platform_merchant_role_staff_relation where del_flag = 0
and staff_id in
<foreach collection="staffIdSet" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>