Browse Source

8-21 角色优先级删除

lijianlin/feature-20250728171217-三期金豆消费相关
lijianlin 1 day ago
parent
commit
99d5c7a7b2
  1. 2
      src/main/java/com/example/demo/domain/entity/Role.java
  2. 10
      src/main/resources/mapper/RoleMapper.xml

2
src/main/java/com/example/demo/domain/entity/Role.java

@ -17,7 +17,7 @@ public class Role implements Serializable {
private Integer id; // 角色id private Integer id; // 角色id
private String roleName; // 角色名 private String roleName; // 角色名
private String roleKey; // 角色标识符 private String roleKey; // 角色标识符
private Integer priority;//优先级
// private Integer priority;//优先级
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
private Date createTime; // 创建时间 private Date createTime; // 创建时间

10
src/main/resources/mapper/RoleMapper.xml

@ -7,9 +7,7 @@
<if test="roleName != null"> <if test="roleName != null">
role_name = #{roleName}, role_name = #{roleName},
</if> </if>
<if test="priority != null">
priority = #{priority},
</if>
<if test="fatherId != null"> <if test="fatherId != null">
father_id = #{fatherId}, father_id = #{fatherId},
</if> </if>
@ -46,18 +44,18 @@
</where> </where>
</select> </select>
<select id="selectByFatherId" resultType="com.example.demo.domain.vo.coin.RoleVo"> <select id="selectByFatherId" resultType="com.example.demo.domain.vo.coin.RoleVo">
SELECT id,role_name,priority FROM role
SELECT id,role_name FROM role
<where> <where>
father_id = #{id} father_id = #{id}
</where> </where>
ORDER BY priority desc
ORDER BY update_time desc
</select> </select>
<!-- 插入角色信息 --> <!-- 插入角色信息 -->
<insert id="addRole" parameterType="com.example.demo.domain.vo.coin.RoleVo" useGeneratedKeys="true" keyProperty="id"> <insert id="addRole" parameterType="com.example.demo.domain.vo.coin.RoleVo" useGeneratedKeys="true" keyProperty="id">
INSERT INTO role INSERT INTO role
(role_name,father_id, market) (role_name,father_id, market)
VALUES (#{roleName}, #{priority}, #{fatherId}, #{market})
VALUES (#{roleName}, #{fatherId}, #{market})
</insert> </insert>
<!-- 删除 role_menu 表中对应角色的数据 --> <!-- 删除 role_menu 表中对应角色的数据 -->

Loading…
Cancel
Save