47 lines
1.8 KiB
XML
47 lines
1.8 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.adc.da.slrs.sarPosition.dao.TsPositionDao">
|
|
<resultMap id="PositionAndRole" type="com.adc.da.slrs.sarPosition.entity.TsPosition">
|
|
<id property="id" column="id"/>
|
|
<result property="operateTime" column="operate_time"/>
|
|
<result property="operator" column="operator"/>
|
|
<result property="name" column="name"/>
|
|
<result property="createDeptId" column="create_dept_id"/>
|
|
<result property="createById" column="create_by_id"/>
|
|
<result property="type" column="type"/>
|
|
<collection property="roles" ofType="com.adc.da.slrs.sarRole.entity.TsRole">
|
|
<result property="id" column="rid"/>
|
|
<result property="name" column="r_name"/>
|
|
</collection>
|
|
</resultMap>
|
|
<select id="getRole" resultType="com.adc.da.slrs.sarRole.entity.TsRole">
|
|
select * from ts_role r
|
|
left join ts_position_role ps
|
|
on r.id=ps.role_id
|
|
where ps.position_id=#{positionId}
|
|
</select>
|
|
|
|
<select id="selectPositionAndRole" resultMap="PositionAndRole">
|
|
select p.*,r.id rid,r.name r_name from ts_position p
|
|
left join ts_position_role pr
|
|
on p.id=pr.position_id
|
|
left join ts_role r
|
|
on pr.role_id=r.id
|
|
<where>
|
|
<if test="name!=null">
|
|
p.name like concat(concat('%',#{name}),'%')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getRoleIdsByPositionIds" resultType="String">
|
|
select distinct role_id from ts_position_role
|
|
where position_id in
|
|
(
|
|
<foreach collection="list" item="positionId" separator=",">
|
|
#{positionId}
|
|
</foreach>
|
|
)
|
|
</select>
|
|
</mapper>
|