|
|
|
@ -7,7 +7,12 @@ |
|
|
|
<if test="roleName != null"> |
|
|
|
role_name = #{roleName}, |
|
|
|
</if> |
|
|
|
|
|
|
|
<if test="market != null"> |
|
|
|
market = #{market}, |
|
|
|
</if> |
|
|
|
<if test="channel != null"> |
|
|
|
channel = #{channel}, |
|
|
|
</if> |
|
|
|
<if test="fatherId != null"> |
|
|
|
father_id = #{fatherId}, |
|
|
|
</if> |
|
|
|
@ -32,7 +37,7 @@ |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="selectAllRole" resultType="com.example.demo.domain.vo.coin.RoleVo"> |
|
|
|
SELECT id,role_name FROM role |
|
|
|
SELECT id,role_name,market,channel FROM role |
|
|
|
<where> |
|
|
|
<!-- 判断 market 是否不为总部且 markets 不为空 --> |
|
|
|
<if test="markets != null and markets.size() > 0 and '总部' not in markets and '研发部' not in markets"> |
|
|
|
@ -44,7 +49,7 @@ |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
<select id="selectByFatherId" resultType="com.example.demo.domain.vo.coin.RoleVo"> |
|
|
|
SELECT id,role_name FROM role |
|
|
|
SELECT id,role_name,market,channel FROM role |
|
|
|
<where> |
|
|
|
father_id = #{id} |
|
|
|
</where> |
|
|
|
@ -54,8 +59,8 @@ |
|
|
|
<!-- 插入角色信息 --> |
|
|
|
<insert id="addRole" parameterType="com.example.demo.domain.vo.coin.RoleVo" useGeneratedKeys="true" keyProperty="id"> |
|
|
|
INSERT INTO role |
|
|
|
(role_name,father_id, market) |
|
|
|
VALUES (#{roleName}, #{fatherId}, #{market}) |
|
|
|
(role_name,father_id, market,channel) |
|
|
|
VALUES (#{roleName}, #{fatherId}, #{market},#{channel}) |
|
|
|
</insert> |
|
|
|
|
|
|
|
<!-- 删除 role_menu 表中对应角色的数据 --> |
|
|
|
@ -75,6 +80,7 @@ |
|
|
|
r.market AS market, |
|
|
|
r.create_time AS createTime, |
|
|
|
r.update_time AS updateTime, |
|
|
|
r.channel AS channel, |
|
|
|
-- 通过自连接查询父角色名称 |
|
|
|
father.role_name AS fatherName |
|
|
|
FROM role r |
|
|
|
|