|
|
@@ -3,11 +3,17 @@ package cn.iocoder.yudao.module.system.service.homepage;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.homepage.vo.RolePagePageReqVO;
|
|
|
+import cn.iocoder.yudao.module.system.controller.admin.homepage.vo.RolePageRespVO;
|
|
|
import cn.iocoder.yudao.module.system.controller.admin.homepage.vo.RolePageSaveReqVO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.homepage.PageUiComponentDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.homepage.RolePageDO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.mysql.homepage.RolePageMapper;
|
|
|
+import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import jakarta.annotation.Resource;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
@@ -24,6 +30,12 @@ public class RolePageServiceImpl extends ServiceImpl<RolePageMapper, RolePageDO>
|
|
|
|
|
|
@Resource
|
|
|
private RolePageMapper rolePageMapper;
|
|
|
+ @Lazy
|
|
|
+ @Resource
|
|
|
+ private RoleService roleService;
|
|
|
+ @Lazy
|
|
|
+ @Resource
|
|
|
+ private PageUiComponentService pageUiComponentService;
|
|
|
|
|
|
@Override
|
|
|
public Long createRolePage(RolePageSaveReqVO createReqVO) {
|
|
|
@@ -56,13 +68,30 @@ public class RolePageServiceImpl extends ServiceImpl<RolePageMapper, RolePageDO>
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public RolePageDO getRolePage(Long id) {
|
|
|
- return rolePageMapper.selectById(id);
|
|
|
+ public RolePageRespVO getRolePage(Long id) {
|
|
|
+ RolePageDO rolePageDO = rolePageMapper.selectById(id);
|
|
|
+ RolePageRespVO bean = BeanUtils.toBean(rolePageDO, RolePageRespVO.class);
|
|
|
+ if (bean != null) {
|
|
|
+ // 查询角色名称
|
|
|
+ RoleDO roleDO = roleService.getById(bean.getRoleId());
|
|
|
+ if (roleDO != null) {
|
|
|
+ bean.setRoleName(roleDO.getName());
|
|
|
+ }
|
|
|
+ // 查询分页下有哪些组件
|
|
|
+ List<PageUiComponentDO> uiComponentListByPageId = pageUiComponentService.getUiComponentListByPageId(id);
|
|
|
+ bean.setPageUiComponentDOList(uiComponentListByPageId);
|
|
|
+ }
|
|
|
+ return bean;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public PageResult<RolePageDO> getRolePagePage(RolePagePageReqVO pageReqVO) {
|
|
|
- return rolePageMapper.selectPage(pageReqVO);
|
|
|
+ public PageResult<RolePageRespVO> getRolePagePage(RolePagePageReqVO pageReqVO) {
|
|
|
+ Page<RolePageDO> page = new Page<RolePageDO>().setCurrent(pageReqVO.getPageNo()).setSize(pageReqVO.getPageSize());
|
|
|
+ Page<RolePageRespVO> pageResult = rolePageMapper.getRolePagePage(page, pageReqVO);
|
|
|
+ PageResult<RolePageRespVO> respVOPageResult = new PageResult<>();
|
|
|
+ respVOPageResult.setList(pageResult.getRecords());
|
|
|
+ respVOPageResult.setTotal(pageResult.getTotal());
|
|
|
+ return respVOPageResult;
|
|
|
}
|
|
|
|
|
|
}
|