角色/权限管理
This commit is contained in:
parent
2798408108
commit
e2366a91a1
@ -14,4 +14,6 @@ public interface RoleMapper extends Mapper<Role> {
|
||||
Role selectRoleByInputCode(@Param("inputCode") String inputCode);
|
||||
|
||||
Integer updateStatus(@Param("idRole") Integer idRole, @Param("status") String status);
|
||||
|
||||
Integer update(@Param("idRole") Integer idRole, @Param("name") String name, @Param("inputCode") String inputCode, @Param("weights") Integer weights);
|
||||
}
|
@ -51,13 +51,12 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
|
||||
public Map saveRole(Role role) {
|
||||
Integer result = 0;
|
||||
if (role.getIdRole() == null) {
|
||||
role.setStatus("0");
|
||||
role.setCreatedTime(new Date());
|
||||
role.setUpdatedTime(role.getCreatedTime());
|
||||
result = roleMapper.insertSelective(role);
|
||||
} else {
|
||||
role.setCreatedTime(new Date());
|
||||
result = roleMapper.updateByPrimaryKeySelective(role);
|
||||
result = roleMapper.update(role.getIdRole(),role.getName(),role.getInputCode(),role.getWeights());
|
||||
}
|
||||
Map map = new HashMap(1);
|
||||
if (result == 0) {
|
||||
|
@ -16,6 +16,9 @@
|
||||
<update id="updateStatus">
|
||||
update vertical_role set status = #{status},updated_time = sysdate() where id = #{idRole}
|
||||
</update>
|
||||
<update id="update">
|
||||
update vertical_role set name = #{name}, input_code = ${inputCode}, weights = #{weights}, updated_time = sysdate() where id = #{idRole}
|
||||
</update>
|
||||
|
||||
<select id="selectRoleByIdUser" resultMap="BaseResultMap">
|
||||
select sr.* from vertical_user_role sur left join vertical_role sr on sur.id_role = sr.id where id_user = #{id}
|
||||
|
Loading…
Reference in New Issue
Block a user