Selaa lähdekoodia

学生功能配置调整

dzx 3 viikkoa sitten
vanhempi
commit
cba9357804

+ 10 - 4
src/main/java/com/xjrsoft/module/system/controller/XjrMenuGroupSetController.java

@@ -4,10 +4,12 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
+import com.xjrsoft.module.organization.entity.Role;
 import com.xjrsoft.module.system.dto.AddXjrMenuGroupDto;
 import com.xjrsoft.module.system.dto.AddXjrMenuGroupSetDto;
 import com.xjrsoft.module.system.dto.UpdateXjrMenuGroupSetDto;
@@ -53,11 +55,15 @@ public class XjrMenuGroupSetController {
     @SaCheckPermission("xjrmenugroupset:detail")
     public RT<PageOutput<XjrMenuGroupSetPageVo>> page(@Valid XjrMenuGroupSetPageDto dto){
 
-        LambdaQueryWrapper<XjrMenuGroupSet> queryWrapper = new LambdaQueryWrapper<>();
+        MPJLambdaWrapper<XjrMenuGroupSet> queryWrapper = new MPJLambdaWrapper<>();
         queryWrapper
-                    .orderByDesc(XjrMenuGroupSet::getId)
-                .select(XjrMenuGroupSet.class,x -> VoToColumnUtil.fieldsToColumns(XjrMenuGroupSetPageVo.class).contains(x.getProperty()));
-        IPage<XjrMenuGroupSet> page = xjrMenuGroupSetService.page(ConventPage.getPage(dto), queryWrapper);
+                .leftJoin(Role.class, Role::getId, XjrMenuGroupSet::getRoleId)
+                .select(XjrMenuGroupSet::getId)
+                .selectAs(Role::getName, XjrMenuGroupSetPageVo::getRoleName)
+                .select(XjrMenuGroupSet.class,x -> VoToColumnUtil.fieldsToColumns(XjrMenuGroupSetPageVo.class).contains(x.getProperty()))
+                .orderByDesc(XjrMenuGroupSet::getCreateDate)
+                .disableSubLogicDel();
+        IPage<XjrMenuGroupSetPageVo> page = xjrMenuGroupSetService.selectJoinListPage(ConventPage.getPage(dto), XjrMenuGroupSetPageVo.class, queryWrapper);
         PageOutput<XjrMenuGroupSetPageVo> pageOutput = ConventPage.getPageOutput(page, XjrMenuGroupSetPageVo.class);
         return RT.ok(pageOutput);
     }

+ 0 - 6
src/main/java/com/xjrsoft/module/system/dto/AddXjrMenuGroupSetDto.java

@@ -35,12 +35,6 @@ public class AddXjrMenuGroupSetDto implements Serializable {
     @ApiModelProperty("使用范围(1:全部学生 2:白名单学生)")
     private Integer useRange;
 
-    /**
-    * xjrMenuGroup
-    */
-    @ApiModelProperty("xjrMenuGroup子表")
-    private List<AddXjrMenuGroupDto> xjrMenuGroupList;
-
     @ApiModelProperty("角色id")
     private Long roleId;
 }

+ 0 - 34
src/main/java/com/xjrsoft/module/system/service/impl/XjrMenuGroupSetServiceImpl.java

@@ -38,11 +38,6 @@ public class XjrMenuGroupSetServiceImpl extends MPJBaseServiceImpl<XjrMenuGroupS
     @Transactional(rollbackFor = Exception.class)
     public Boolean add(XjrMenuGroupSet xjrMenuGroupSet) {
         setMapper.insert(xjrMenuGroupSet);
-        for (XjrMenuGroup xjrMenuGroup : xjrMenuGroupSet.getXjrMenuGroupList()) {
-            xjrMenuGroup.setXjrMenuGroupSetId(xjrMenuGroupSet.getId());
-            groupMapper.insert(xjrMenuGroup);
-        }
-
         return true;
     }
 
@@ -50,35 +45,6 @@ public class XjrMenuGroupSetServiceImpl extends MPJBaseServiceImpl<XjrMenuGroupS
     @Transactional(rollbackFor = Exception.class)
     public Boolean update(XjrMenuGroupSet xjrMenuGroupSet) {
         setMapper.updateById(xjrMenuGroupSet);
-        //********************************* XjrMenuGroup  增删改  开始 *******************************************/
-        {
-            // 查出所有子级的id
-            List<XjrMenuGroup> xjrMenuGroupList = groupMapper.selectList(Wrappers.lambdaQuery(XjrMenuGroup.class).eq(XjrMenuGroup::getXjrMenuGroupSetId, xjrMenuGroupSet.getId()).select(XjrMenuGroup::getId));
-            List<Long> xjrMenuGroupIds = xjrMenuGroupList.stream().map(XjrMenuGroup::getId).collect(Collectors.toList());
-            //原有子表单 没有被删除的主键
-            List<Long> xjrMenuGroupOldIds = xjrMenuGroupSet.getXjrMenuGroupList().stream().map(XjrMenuGroup::getId).filter(Objects::nonNull).collect(Collectors.toList());
-            //找到需要删除的id
-            List<Long> xjrMenuGroupRemoveIds = xjrMenuGroupIds.stream().filter(item -> !xjrMenuGroupOldIds.contains(item)).collect(Collectors.toList());
-
-            for (XjrMenuGroup xjrMenuGroup : xjrMenuGroupSet.getXjrMenuGroupList()) {
-                //如果不等于空则修改
-                if (xjrMenuGroup.getId() != null) {
-                    groupMapper.updateById(xjrMenuGroup);
-                }
-                //如果等于空 则新增
-                else {
-                    //已经不存在的id 删除
-                    xjrMenuGroup.setXjrMenuGroupSetId(xjrMenuGroupSet.getId());
-                    groupMapper.insert(xjrMenuGroup);
-                }
-            }
-            //已经不存在的id 删除
-            if(xjrMenuGroupRemoveIds.size() > 0){
-                groupMapper.deleteBatchIds(xjrMenuGroupRemoveIds);
-            }
-        }
-        //********************************* XjrMenuGroup  增删改  结束 *******************************************/
-
         return true;
     }
 

+ 3 - 0
src/main/java/com/xjrsoft/module/system/vo/XjrMenuGroupSetPageVo.java

@@ -68,4 +68,7 @@ public class XjrMenuGroupSetPageVo {
     @ApiModelProperty("角色id")
     private Long roleId;
 
+    @ApiModelProperty("配置对象")
+    private String roleName;
+
 }