Commit 9f8b4dbc authored by 李永强's avatar 李永强

调整功能

parent 10957a02
...@@ -16,10 +16,10 @@ public interface JurisdictionDao { ...@@ -16,10 +16,10 @@ public interface JurisdictionDao {
Role getRole(Long id); Role getRole(Long id);
void addAuthority(@Param("roleId") Long roleId, @Param("menuId") Long[] menuId); void addAuthority(@Param("roleId") Long roleId, @Param("menuIds") Long[] menuIds);
void delAuthority(@Param("roleId") Long roleId, @Param("menuId") Long[] menuId); void delAuthority(@Param("roleId") Long roleId, @Param("menuIds") Long[] menuIds);
void roleToUser(@Param("roleId") Long[] roleId, @Param("userId") Long userId); void roleToUser(@Param("roleIds") Long[] roleIds, @Param("userId") Long userId);
} }
...@@ -48,7 +48,7 @@ public class UserService { ...@@ -48,7 +48,7 @@ public class UserService {
user.setPassword(PasswordUtils.encryption(user.getUserName())); user.setPassword(PasswordUtils.encryption(user.getUserName()));
try { try {
userDao.addUser(user); userDao.addUser(user);
jurisdictionService.roleToUser(RoleTable.detection_admin.getId(), user.getId()); jurisdictionService.roleToUser(RoleTable.detection_admin.getId().toString(), user.getId());
} catch (DuplicateKeyException e) { } catch (DuplicateKeyException e) {
throw new ServiceException("已经存在该用户"); throw new ServiceException("已经存在该用户");
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
from menu from menu
where 1 = 1 where 1 = 1
<if test="remark!=null"> <if test="remark!=null">
and menu_remark like '%'||#{remark}||'%' and menu_describe like '%'||#{remark}||'%'
</if> </if>
<if test="url!=null"> <if test="url!=null">
and menu_url like '%'||#{url}||'%' and menu_url like '%'||#{url}||'%'
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
</select> </select>
<select id="getRole" resultMap="complexRoleMap"> <select id="getRole" resultMap="complexRoleMap">
select role.*,menu.* select role.*, menu.*
from role from role
left join role_menu on rm_role_id = role_id left join role_menu on rm_role_id = role_id
left join menu on menu.menu_id = role_menu.rm_menu_id left join menu on menu.menu_id = role_menu.rm_menu_id
...@@ -56,19 +56,28 @@ ...@@ -56,19 +56,28 @@
<insert id="addAuthority"> <insert id="addAuthority">
insert into role_menu (rm_role_id, rm_menu_id) insert into role_menu (rm_role_id, rm_menu_id)
values (#{roleId}, #{menuId}); values
<foreach collection="menuIds" item="menuId" separator=",">
(#{roleId}, #{menuId})
</foreach>
</insert> </insert>
<delete id="delAuthority"> <delete id="delAuthority">
delete delete
from role_menu from role_menu
where rm_role_id = #{roleId} where rm_role_id = #{roleId}
and rm_menu_id = #{menuId}; and rm_menu_id in
<foreach collection="menuIds" item="menuId" separator=",">
(#{roleId}, #{menuId})
</foreach>
</delete> </delete>
<insert id="roleToUser"> <insert id="roleToUser">
insert into user_role (ur_role_id, ur_user_id) insert into user_role (ur_role_id, ur_user_id)
values (#{roleId}, #{userId}); values
<foreach collection="roleIds" item="roleIds" separator=",">
(#{roleId}, #{userId})
</foreach>
</insert> </insert>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment