提交 45bd1571 作者: 张小凤

role(add)

上级 c85a6696
...@@ -61,4 +61,11 @@ public class RoleController extends BaseController { ...@@ -61,4 +61,11 @@ public class RoleController extends BaseController {
} }
@ApiOperation(value = "角色管理-当前角色绑定了那些账号")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("roleAccountList")
public ResultBody roleAccountList(@ApiParam(value = "角色id", required = true) @RequestParam Integer id) {
return roleService.roleAccountList(id);
}
} }
...@@ -33,5 +33,7 @@ public interface RoleDao { ...@@ -33,5 +33,7 @@ public interface RoleDao {
Integer countRoleNameId(RoleInfoDO rd); Integer countRoleNameId(RoleInfoDO rd);
Integer countNotDelUserAccountByRole(Integer id); Integer countNotDelUserAccountByRole(Integer id);
List<RoleInfoDO> roleAccountList(Integer id);
} }
...@@ -20,4 +20,6 @@ public interface RoleService { ...@@ -20,4 +20,6 @@ public interface RoleService {
ResultBody removeRoleInfo(Integer id); ResultBody removeRoleInfo(Integer id);
PageResult listPageRoleInfo(RoleInfoQO param, LoginSuccessDTO userLoginInfoFromRedis); PageResult listPageRoleInfo(RoleInfoQO param, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody roleAccountList(Integer id);
} }
...@@ -13,6 +13,7 @@ import com.mmc.iuav.user.service.RoleService; ...@@ -13,6 +13,7 @@ import com.mmc.iuav.user.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -76,5 +77,11 @@ public class RoleServiceImpl implements RoleService { ...@@ -76,5 +77,11 @@ public class RoleServiceImpl implements RoleService {
}).collect(Collectors.toList())); }).collect(Collectors.toList()));
} }
@Override
public ResultBody roleAccountList(Integer id) {
List<RoleInfoDO> roleInfoDOS = roleDao.roleAccountList(id);
return ResultBody.success(roleInfoDOS);
}
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<result property="userAccountId" column="user_account_id"/> <result property="userAccountId" column="user_account_id"/>
<result property="userName" column="user_name"/> <result property="userName" column="user_name"/>
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="userName" column="user_name"/>
</resultMap> </resultMap>
...@@ -132,8 +133,19 @@ ...@@ -132,8 +133,19 @@
</select> </select>
<select id="countNotDelUserAccountByRole" resultType="java.lang.Integer"> <select id="countNotDelUserAccountByRole" resultType="java.lang.Integer">
select count(*) SELECT count(*)
from user_role_rel FROM user_role_rel ur
where role_id = #{id} INNER JOIN user_account ua ON ur.user_account_id = ua.id
WHERE ur.role_id = #{id}
AND ua.is_deleted = 0
</select>
<select id="roleAccountList" resultMap="roleInfoResultMap">
SELECT urr.user_account_id,
ua.user_name
FROM user_role_rel urr
LEFT JOIN user_account ua ON ua.id = urr.user_account_id
WHERE urr.role_id = #{id}
AND ua.is_deleted = 0
</select> </select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论