Browse Source

人员解绑

chenw 7 years ago
parent
commit
904763e92c

+ 6 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/mapper/AccountRoleMapper.java

@@ -50,4 +50,10 @@ public interface AccountRoleMapper {
     void deleteByRoleId(@Param("roleId") Long roleId);
 
     List<AccountRoleDTO> selectAccountRole(@Param("condition") String condition, @Param("companyId") Long companyId);
+
+    /**
+     * 解除账户绑定的所有角色
+     * @param id
+     */
+    void unBindRolesById(Long id);
 }

+ 1 - 0
base-servers/account/account-server/src/main/java/com/usoftchina/saas/account/service/impl/AccountServiceImpl.java

@@ -125,6 +125,7 @@ public class AccountServiceImpl implements AccountService {
 
     @Override
     public void bindRoles(Long accountId, String roleIds) {
+        accountRoleMapper.unBindRolesById(accountId);
         String[] array = roleIds.split(",");
         for (int i = 0; i < array.length; i++){
             bindRole(accountId, Long.parseLong(array[i]));

+ 3 - 0
base-servers/account/account-server/src/main/resources/mapper/AccountRoleMapper.xml

@@ -31,4 +31,7 @@
         </where>
         group by a.id,a.username,a.realname,a.email,a.mobile
     </select>
+    <delete id="unBindRolesById" parameterType="java.lang.Long">
+        DELETE FROM AC_ACCOUNT_COMPANY WHERE ACCOUNT_ID = #{id}
+    </delete>
 </mapper>