新ui项目信息查看

dev
wish 1 year ago
parent b900aa85a7
commit 2ea88ceb84
  1. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/IFunctionxService.java
  2. 25
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functionx/service/impl/FunctionxServiceImpl.java
  3. 86
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/controller/NewProjectController.java
  4. 21
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/FunctionDto.java
  5. 21
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ModuleDto.java
  6. 21
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/ProjectDto.java
  7. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/newlayout/dto/RuleDto.java
  8. 3
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/IRulexService.java
  9. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/rulex/service/impl/RulexServiceImpl.java
  10. 30
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
  11. 403
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java
  12. 13
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/IProjectxService.java
  13. 61
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/projectx/service/impl/ProjectxServiceImpl.java

@ -3,6 +3,7 @@ package org.jeecg.modules.demo.functionx.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.newlayout.dto.FunctionDto;
import org.jeecg.modules.modulex.entity.Modulex;
import java.util.List;
@ -39,4 +40,5 @@ public interface IFunctionxService extends IService<Functionx> {
*/
List<Functionx> queryFunctionListByModuleId(Modulex modulex);
List<FunctionDto> queryFunctionDtoListByModuleId(Modulex modulex);
}

@ -8,11 +8,16 @@ import org.jeecg.modules.demo.functiontemplate.mapper.FunctionTemplateMapper;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper;
import org.jeecg.modules.demo.functionx.service.IFunctionxService;
import org.jeecg.modules.demo.newlayout.dto.FunctionDto;
import org.jeecg.modules.demo.newlayout.dto.RuleDto;
import org.jeecg.modules.demo.rulex.service.IRulexService;
import org.jeecg.modules.modulex.entity.Modulex;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -29,6 +34,8 @@ public class FunctionxServiceImpl extends ServiceImpl<FunctionxMapper, Functionx
FunctionxMapper functionxMapper;
@Autowired
FunctionTemplateMapper functionTemplateMapper;
@Autowired
private IRulexService rulexService;
@Override
public String findModuleCode(String id) {
@ -179,4 +186,22 @@ public class FunctionxServiceImpl extends ServiceImpl<FunctionxMapper, Functionx
functionWrapper.eq(Functionx::getModuleId, modulex.getId());
return this.list(functionWrapper);
}
@Override
public List<FunctionDto> queryFunctionDtoListByModuleId(Modulex modulex) {
LambdaQueryWrapper<Functionx> functionWrapper = new LambdaQueryWrapper<>();
functionWrapper.eq(Functionx::getModuleId, modulex.getId());
List<Functionx> functionxList = this.list(functionWrapper);
List<FunctionDto> functionDtoList = new ArrayList<>();
functionxList.forEach(functionx -> {
FunctionDto functionDto = new FunctionDto();
BeanUtils.copyProperties(functionx, functionDto);
// 查询该功能下所有的规则
List<RuleDto> ruleDtoList =
rulexService.queryRuleDtoListByFunctionId(functionx);
functionDto.setRuleDtoList(ruleDtoList);
functionDtoList.add(functionDto);
});
return functionDtoList;
}
}

@ -0,0 +1,86 @@
package org.jeecg.modules.demo.newlayout.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.demo.newlayout.dto.ProjectDto;
import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.service.IProjectxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 新项目控制器.
*
* @author wish
* @version 1.0.0
* @date 2023/07/10
*/
@Slf4j
@RestController
@RequestMapping("/newprojectx/newprojectx")
public class NewProjectController {
@Autowired
private IProjectxService projectService;
/**
* 列表查询.
*
* @param projectx projectx
* @param request 请求
* @return {@link Result}<{@link ?}>
*/
@GetMapping("/list")
public Result<?> list(Projectx projectx, HttpServletRequest request) {
QueryWrapper<Projectx> queryWrapper = QueryGenerator.initQueryWrapper(
projectx, request.getParameterMap());
List<ProjectDto> list = projectService.listDto(queryWrapper);
return Result.OK(list);
}
/**
* 分页查询.
*
* @param page 页面
* @param pageSize 页面大小
* @param projectx projectx
* @param request 请求
* @return {@link Result}<{@link Page}<{@link ?}>>
*/
@GetMapping("/page")
public Result<Page<?>> page(@RequestParam(value = "page", defaultValue = "1")
Integer page,
@RequestParam(value = "pageSize", defaultValue = "5")
Integer pageSize,
Projectx projectx, HttpServletRequest request) {
if (page <= 0 || pageSize <= 0) {
page = 1;
pageSize = 5;
}
QueryWrapper<Projectx> queryWrapper = QueryGenerator.initQueryWrapper(
projectx, request.getParameterMap());
Page<Projectx> projectPage = new Page<>(page, pageSize);
Page<ProjectDto> projectDtoPage = projectService.pageDto(projectPage, queryWrapper);
return Result.OK(projectDtoPage);
}
/**
* 通过id获取项目dto.
*
* @param projectx projectx
* @return {@link Result}<{@link ProjectDto}>
*/
@GetMapping("/queryById")
public Result<ProjectDto> getProjectDtoById(Projectx projectx) {
ProjectDto projectDto = projectService.queryDtoById(projectx);
return Result.OK(projectDto);
}
}

@ -0,0 +1,21 @@
package org.jeecg.modules.demo.newlayout.dto;
import lombok.Data;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import java.util.List;
/**
* 功能dto
*
* @author wish
* @version 1.0.0
* @date 2023/07/10
*/
@Data
public class FunctionDto extends Functionx {
/**
* 规则dto列表
*/
List<RuleDto> ruleDtoList;
}

@ -0,0 +1,21 @@
package org.jeecg.modules.demo.newlayout.dto;
import lombok.Data;
import org.jeecg.modules.modulex.entity.Modulex;
import java.util.List;
/**
* 模块dto
*
* @author wish
* @version 1.0.0
* @date 2023/07/10
*/
@Data
public class ModuleDto extends Modulex {
/**
* 功能dto列表
*/
List<FunctionDto> functionDtoList;
}

@ -0,0 +1,21 @@
package org.jeecg.modules.demo.newlayout.dto;
import lombok.Data;
import org.jeecg.modules.projectx.entity.Projectx;
import java.util.List;
/**
* 项目dto.
*
* @author wish
* @version 1.0.0
* @date 2023/07/10
*/
@Data
public class ProjectDto extends Projectx {
/**
* 模块dto列表.
*/
List<ModuleDto> moduleDtoList;
}

@ -0,0 +1,8 @@
package org.jeecg.modules.demo.newlayout.dto;
import lombok.Data;
import org.jeecg.modules.demo.rulex.entity.Rulex;
@Data
public class RuleDto extends Rulex {
}

@ -2,6 +2,7 @@ package org.jeecg.modules.demo.rulex.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.newlayout.dto.RuleDto;
import org.jeecg.modules.demo.rulex.entity.Rulex;
import com.baomidou.mybatisplus.extension.service.IService;
@ -18,4 +19,6 @@ public interface IRulexService extends IService<Rulex> {
Result<?> sort(String id);
List<Rulex> queryRuleListByFunctionId(Functionx functionx);
List<RuleDto> queryRuleDtoListByFunctionId(Functionx functionx);
}

@ -3,14 +3,17 @@ package org.jeecg.modules.demo.rulex.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.newlayout.dto.RuleDto;
import org.jeecg.modules.demo.rulex.entity.Rulex;
import org.jeecg.modules.demo.rulex.mapper.RulexMapper;
import org.jeecg.modules.demo.rulex.service.IRulexService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
/**
@ -54,4 +57,19 @@ public class RulexServiceImpl extends ServiceImpl<RulexMapper, Rulex> implements
ruleWrapper.eq(Rulex::getFunctionId, functionx.getId());
return this.list(ruleWrapper);
}
@Override
public List<RuleDto> queryRuleDtoListByFunctionId(Functionx functionx) {
LambdaQueryWrapper<Rulex> ruleWrapper = new LambdaQueryWrapper<>();
ruleWrapper.eq(Rulex::getFunctionId, functionx.getId());
List<Rulex> rulexList = this.list(ruleWrapper);
// 将rule封装为ruleDto
List<RuleDto> ruleDtoList = new ArrayList<>();
for (Rulex rulex : rulexList) {
RuleDto ruleDto = new RuleDto();
BeanUtils.copyProperties(rulex, ruleDto);
ruleDtoList.add(ruleDto);
}
return ruleDtoList;
}
}

@ -3,32 +3,38 @@ package org.jeecg.modules.modulex.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.newlayout.dto.ModuleDto;
import org.jeecg.modules.modulex.entity.Modulex;
import org.jeecg.modules.projectx.entity.Projectx;
import java.util.List;
/**
* @Description: 模块管理
* @Author: jeecg-boot
* @Date: 2023-04-10
* @Date: 2023-04-10
* @Version: V1.0
*/
public interface IModulexService extends IService<Modulex> {
/**
* 得到最大的版本号
*/
Integer getMaxVersion(Integer verison);
/**
* 得到最大的版本号
*/
Integer getMaxVersion(Integer verison);
Result<?> fabu(String id);
Result<?> fabu(String id);
Result<?> kaishi(String id);
Result<?> kaishi(String id);
Result<?> tijiao(String id);
Result<?> tijiao(String id);
Result<?> chehui(String id);
Result<?> chehui(String id);
Result<?> shenhe(String id);
Result<?> shenhe(String id);
void setmodule(String id, String moduleId);
void setmodule(String id, String moduleId);
void copy(Modulex modulex);
void copy(Modulex modulex);
List<ModuleDto> queryDtoListByProId(Projectx project);
}

@ -6,6 +6,8 @@ import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.demo.functionx.entity.Functionx;
import org.jeecg.modules.demo.functionx.mapper.FunctionxMapper;
import org.jeecg.modules.demo.functionx.service.IFunctionxService;
import org.jeecg.modules.demo.newlayout.dto.FunctionDto;
import org.jeecg.modules.demo.newlayout.dto.ModuleDto;
import org.jeecg.modules.demo.rulex.entity.Rulex;
import org.jeecg.modules.demo.rulex.service.IRulexService;
import org.jeecg.modules.fieldx.entity.Fieldx;
@ -13,6 +15,7 @@ import org.jeecg.modules.fieldx.service.IFieldxService;
import org.jeecg.modules.modulex.entity.Modulex;
import org.jeecg.modules.modulex.mapper.ModulexMapper;
import org.jeecg.modules.modulex.service.IModulexService;
import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.tablex.entity.Tablex;
import org.jeecg.modules.tablex.service.ITablexService;
import org.springframework.beans.BeanUtils;
@ -22,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
@ -35,226 +39,245 @@ import java.util.List;
@Service
public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> implements IModulexService {
@Resource
private FunctionxMapper functionxMapper;
@Resource
private FunctionxMapper functionxMapper;
@Resource
private ModulexMapper modulexMapper;
@Resource
private ModulexMapper modulexMapper;
@Autowired
private IFunctionxService iFunctionxService;
@Autowired
private IFunctionxService iFunctionxService;
@Autowired
private IRulexService iRulexService;
@Autowired
private IRulexService iRulexService;
@Autowired
private ITablexService iTablexService;
@Autowired
private ITablexService iTablexService;
@Autowired
private IFieldxService iFieldxService;
@Autowired
private IFieldxService iFieldxService;
/**
* 得到最大的版本号
*/
@Override
public Integer getMaxVersion(Integer verison) {
return this.list().size();
}
/**
* 得到最大的版本号
*/
@Override
public Integer getMaxVersion(Integer verison) {
return this.list().size();
}
/**
* 发布点击发布按钮状态变成已发布
* 任务责任人即开发者可以操作开始提交等功能
* 模块管理下属所有功能状态变为已发布
*
* @param id modulex表的主键id
*/
@Override
public Result<?> fabu(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 1) {
return Result.error("当前功能已发布!!!");
} else {
byId.setWorkStatus(1);
this.updateById(byId);
//模块管理下属所有功能状态变为已发布
this.handleStatus(id, 1);
return Result.OK("发布成功!!");
}
/**
* 发布点击发布按钮状态变成已发布
* 任务责任人即开发者可以操作开始提交等功能
* 模块管理下属所有功能状态变为已发布
*
* @param id modulex表的主键id
*/
@Override
public Result<?> fabu(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 1) {
return Result.error("当前功能已发布!!!");
} else {
byId.setWorkStatus(1);
this.updateById(byId);
//模块管理下属所有功能状态变为已发布
this.handleStatus(id, 1);
return Result.OK("发布成功!!");
}
}
/**
* 开始任务责任人即开发者使用的功能点击开始按钮状态变为开发中
* 表示任务开始开始时间设置为当前时间
*
* @param id modulex表的主键id
*/
@Override
public Result<?> kaishi(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() != 1) {
return Result.error("当前不处于已发布阶段,无法开始,请先发布");
} else {
byId.setWorkStatus(2);
byId.setStartTime(new Date());
this.updateById(byId);
/**
* 开始任务责任人即开发者使用的功能点击开始按钮状态变为开发中
* 表示任务开始开始时间设置为当前时间
*
* @param id modulex表的主键id
*/
@Override
public Result<?> kaishi(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() != 1) {
return Result.error("当前不处于已发布阶段,无法开始,请先发布");
} else {
byId.setWorkStatus(2);
byId.setStartTime(new Date());
this.updateById(byId);
return Result.OK("任务开始成功");
}
return Result.OK("任务开始成功");
}
}
/**
* 提交任务责任人即开发者使用的功能点击提交按钮表示任务完成状态变为已提交
* 提交时间设置为当前时间并自动计算实际时长
* 模块管理下属所有功能状态变成已完成才能点击提交按钮
*
* @param id modulex表的主键id
*/
@Override
public Result<?> tijiao(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() != 2) {
return Result.error("当前不处于开发中阶段,无法提交");
} else {
byId.setWorkStatus(3);
byId.setSubmitTime(new Date());
this.updateById(byId);
this.handleStatus(id, 3);
return Result.OK("提交成功!!");
}
/**
* 提交任务责任人即开发者使用的功能点击提交按钮表示任务完成状态变为已提交
* 提交时间设置为当前时间并自动计算实际时长
* 模块管理下属所有功能状态变成已完成才能点击提交按钮
*
* @param id modulex表的主键id
*/
@Override
public Result<?> tijiao(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() != 2) {
return Result.error("当前不处于开发中阶段,无法提交");
} else {
byId.setWorkStatus(3);
byId.setSubmitTime(new Date());
this.updateById(byId);
this.handleStatus(id, 3);
return Result.OK("提交成功!!");
}
/**
* 撤回项目负责人管理员使用点击撤回状态变为开发中
*
* @param id modulex表的主键id
* <p>
* 问题模块管理中撤回后该模块的功能对应的所有任务状也做撤回操作肯该功能所对应的开发规则的任务状态也做撤回操作
*/
@Override
@Transactional(readOnly = false, rollbackFor = Exception.class)
public Result<?> chehui(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 2) {
return Result.error("正处于开发中");
}
byId.setWorkStatus(2);
this.updateById(byId);
}
//add by zhc 7.5
this.doWorkStatusRollBack(id);
return Result.OK("撤回成功");
/**
* 撤回项目负责人管理员使用点击撤回状态变为开发中
*
* @param id modulex表的主键id
* <p>
* 问题模块管理中撤回后该模块的功能对应的所有任务状也做撤回操作肯该功能所对应的开发规则的任务状态也做撤回操作
*/
@Override
@Transactional(readOnly = false, rollbackFor = Exception.class)
public Result<?> chehui(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 2) {
return Result.error("正处于开发中");
}
byId.setWorkStatus(2);
this.updateById(byId);
@Transactional(readOnly = false, rollbackFor = Exception.class)
public void doWorkStatusRollBack(final String moduleId) {
/**
* work_status值未发布0已发布1开发中2已完成3已撤回4已取消9默认0
*/
iFunctionxService.lambdaUpdate().set(Functionx::getWorkStatus, 4).set(Functionx::getUpdateTime, new Date()).eq(Functionx::getModuleId, moduleId).update();
iRulexService.lambdaUpdate().set(Rulex::getWorkStatus, 4).set(Rulex::getUpdateTime, new Date()).eq(Rulex::getModuleId, moduleId).update();
}
//add by zhc 7.5
this.doWorkStatusRollBack(id);
return Result.OK("撤回成功");
}
@Transactional(readOnly = false, rollbackFor = Exception.class)
public void doWorkStatusRollBack(final String moduleId) {
/**
* BUG反馈项目负责人管理员使用点击BUG反馈状态变为DEBUG下属功能状态不变BUG管理增加一条记录记录BUG内容
* 审核项目负责人管理员使用点击完成状态变为已审核
*
* @param id modulex表的主键id
* work_status值未发布0已发布1开发中2已完成3已撤回4已取消9默认0
*/
@Override
public Result<?> shenhe(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 4) {
return Result.error("已审核");
}
byId.setWorkStatus(4);
this.updateById(byId);
return Result.OK("审核通过");
}
iFunctionxService.lambdaUpdate().set(Functionx::getWorkStatus, 4).set(Functionx::getUpdateTime, new Date()).eq(Functionx::getModuleId, moduleId).update();
iRulexService.lambdaUpdate().set(Rulex::getWorkStatus, 4).set(Rulex::getUpdateTime, new Date()).eq(Rulex::getModuleId, moduleId).update();
}
@Override
public void setmodule(String id, String moduleId) {
modulexMapper.setmodule(id, moduleId);
/**
* BUG反馈项目负责人管理员使用点击BUG反馈状态变为DEBUG下属功能状态不变BUG管理增加一条记录记录BUG内容
* 审核项目负责人管理员使用点击完成状态变为已审核
*
* @param id modulex表的主键id
*/
@Override
public Result<?> shenhe(String id) {
Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 4) {
return Result.error("已审核");
}
byId.setWorkStatus(4);
this.updateById(byId);
return Result.OK("审核通过");
}
/**
* 模块管理中复制功能新增模块对应的实体和字段功能和规则
*
* @param modulex
*/
@Transactional(readOnly = false, rollbackFor = Exception.class)
@Override
public void copy(Modulex modulex) {
Integer newVersion = this.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1);
modulex.setRelatedBean(null);
//复制模块
this.save(modulex);
@Override
public void setmodule(String id, String moduleId) {
modulexMapper.setmodule(id, moduleId);
}
String id = modulex.getId();
//复制实体&字段
Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper<Tablex>().eq(Tablex::getModuleId, modulex.getCopyId()));
if (!ObjectUtils.isEmpty(tablex)) {
Tablex tablex1 = new Tablex();
BeanUtils.copyProperties(tablex, tablex1);
tablex1.setId(null);
tablex1.setModuleId(modulex.getId());
tablex1.setTableName(modulex.getModuleName());
tablex1.setTableEnName(modulex.getModuleEnName());
tablex1.setCreateTime(new Date());
iTablexService.save(tablex1);
List<Fieldx> fieldxList = iFieldxService.list(new LambdaQueryWrapper<Fieldx>().eq(Fieldx::getTableId, tablex.getId()));
if (!ObjectUtils.isEmpty(fieldxList)) {
List<Fieldx> addList = new LinkedList<>();
fieldxList.forEach(e -> {
Fieldx fieldx1 = new Fieldx();
BeanUtils.copyProperties(e, fieldx1);
fieldx1.setId(null);
fieldx1.setTableId(tablex1.getId());
fieldx1.setCreateTime(new Date());
/**
* 模块管理中复制功能新增模块对应的实体和字段功能和规则
*
* @param modulex
*/
@Transactional(readOnly = false, rollbackFor = Exception.class)
@Override
public void copy(Modulex modulex) {
Integer newVersion = this.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1);
modulex.setRelatedBean(null);
//复制模块
this.save(modulex);
addList.add(fieldx1);
});
iFieldxService.saveBatch(addList);
}
this.lambdaUpdate().set(Modulex::getRelatedBean, tablex1.getId()).eq(Modulex::getId, id).update();
}
String id = modulex.getId();
//复制实体&字段
Tablex tablex = iTablexService.getOne(new LambdaQueryWrapper<Tablex>().eq(Tablex::getModuleId, modulex.getCopyId()));
if (!ObjectUtils.isEmpty(tablex)) {
Tablex tablex1 = new Tablex();
BeanUtils.copyProperties(tablex, tablex1);
tablex1.setId(null);
tablex1.setModuleId(modulex.getId());
tablex1.setTableName(modulex.getModuleName());
tablex1.setTableEnName(modulex.getModuleEnName());
tablex1.setCreateTime(new Date());
iTablexService.save(tablex1);
List<Fieldx> fieldxList = iFieldxService.list(new LambdaQueryWrapper<Fieldx>().eq(Fieldx::getTableId, tablex.getId()));
if (!ObjectUtils.isEmpty(fieldxList)) {
List<Fieldx> addList = new LinkedList<>();
fieldxList.forEach(e -> {
Fieldx fieldx1 = new Fieldx();
BeanUtils.copyProperties(e, fieldx1);
fieldx1.setId(null);
fieldx1.setTableId(tablex1.getId());
fieldx1.setCreateTime(new Date());
//复制功能
List<Functionx> functionxList = iFunctionxService.list(new LambdaQueryWrapper<Functionx>().eq(Functionx::getModuleId, modulex.getCopyId()));
if (!ObjectUtils.isEmpty(functionxList)) {
List<Functionx> addList = new LinkedList<>();
functionxList.forEach(e -> {
Functionx functionx = new Functionx();
BeanUtils.copyProperties(e, functionx);
functionx.setId(null);
functionx.setModuleId(modulex.getId());
functionx.setCreateTime(new Date());
addList.add(functionx);
});
iFunctionxService.saveBatch(addList);
}
addList.add(fieldx1);
});
iFieldxService.saveBatch(addList);
}
this.lambdaUpdate().set(Modulex::getRelatedBean, tablex1.getId()).eq(Modulex::getId, id).update();
}
//复制功能
List<Functionx> functionxList = iFunctionxService.list(new LambdaQueryWrapper<Functionx>().eq(Functionx::getModuleId, modulex.getCopyId()));
if (!ObjectUtils.isEmpty(functionxList)) {
List<Functionx> addList = new LinkedList<>();
functionxList.forEach(e -> {
Functionx functionx = new Functionx();
BeanUtils.copyProperties(e, functionx);
functionx.setId(null);
functionx.setModuleId(modulex.getId());
functionx.setCreateTime(new Date());
addList.add(functionx);
});
iFunctionxService.saveBatch(addList);
}
}
@Override
public List<ModuleDto> queryDtoListByProId(Projectx projectx) {
LambdaQueryWrapper<Modulex> moduleWrapper = new LambdaQueryWrapper<>();
moduleWrapper.eq(Modulex::getProjectId, projectx.getId());
List<Modulex> modulexList = this.list(moduleWrapper);
// 将模块转为dto
List<ModuleDto> moduleDtoList = new ArrayList<>();
for (Modulex modulex : modulexList) {
ModuleDto moduleDto = new ModuleDto();
BeanUtils.copyProperties(modulex, moduleDto);
// 查询当前模块下所有的功能dto
List<FunctionDto> functionDtoList =
iFunctionxService.queryFunctionDtoListByModuleId(modulex);
moduleDto.setFunctionDtoList(functionDtoList);
moduleDtoList.add(moduleDto);
}
return moduleDtoList;
}
private void handleStatus(String id, Integer a) {
//先查字模块 先查询父id 等于 这个 id 的数据
List<Modulex> modulexs = this.list(new LambdaQueryWrapper<Modulex>().eq(Modulex::getPid, id));
if (modulexs.size() > 0) {
modulexs.forEach(modulex -> {
modulex.setWorkStatus(a);
this.updateById(modulex);
});
}
//再查下属功能
List<Functionx> functionxs = functionxMapper.selectList(new LambdaQueryWrapper<Functionx>().eq(Functionx::getModuleId, id));
if (functionxs.size() > 0) {
functionxs.forEach(funcx -> {
funcx.setWorkStatus(a);
functionxMapper.updateById(funcx);
});
}
private void handleStatus(String id, Integer a) {
//先查字模块 先查询父id 等于 这个 id 的数据
List<Modulex> modulexs = this.list(new LambdaQueryWrapper<Modulex>().eq(Modulex::getPid, id));
if (modulexs.size() > 0) {
modulexs.forEach(modulex -> {
modulex.setWorkStatus(a);
this.updateById(modulex);
});
}
//再查下属功能
List<Functionx> functionxs = functionxMapper.selectList(new LambdaQueryWrapper<Functionx>().eq(Functionx::getModuleId, id));
if (functionxs.size() > 0) {
functionxs.forEach(funcx -> {
funcx.setWorkStatus(a);
functionxMapper.updateById(funcx);
});
}
}
}

@ -1,16 +1,25 @@
package org.jeecg.modules.projectx.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.demo.newlayout.dto.ProjectDto;
import org.jeecg.modules.projectx.entity.Projectx;
import java.util.List;
/**
* @Description: 项目管理 管理项目基本信息
* @Author: jeecg-boot
* @Date: 2023-04-10
* @Date: 2023-04-10
* @Version: V1.0
*/
public interface IProjectxService extends IService<Projectx> {
List<ProjectDto> listDto(QueryWrapper<Projectx> queryWrapper);
ProjectDto queryDtoById(Projectx projectx);
Page<ProjectDto> pageDto(Page<Projectx> projectPage, QueryWrapper<Projectx> queryWrapper);
}

@ -1,18 +1,75 @@
package org.jeecg.modules.projectx.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.newlayout.dto.ModuleDto;
import org.jeecg.modules.demo.newlayout.dto.ProjectDto;
import org.jeecg.modules.modulex.service.IModulexService;
import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.mapper.ProjectxMapper;
import org.jeecg.modules.projectx.service.IProjectxService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* @Description: 项目管理 管理项目基本信息
* @Author: jeecg-boot
* @Date: 2023-04-10
* @Date: 2023-04-10
* @Version: V1.0
*/
@Service
public class ProjectxServiceImpl extends ServiceImpl<ProjectxMapper, Projectx> implements IProjectxService {
public class ProjectxServiceImpl extends ServiceImpl<ProjectxMapper, Projectx>
implements IProjectxService {
@Autowired
private IModulexService modulexService;
@Override
public List<ProjectDto> listDto(QueryWrapper<Projectx> queryWrapper) {
List<Projectx> list = this.list(queryWrapper);
List<ProjectDto> projectDtoList = new ArrayList<>();
for (Projectx projectx : list) {
projectDtoList.add(this.queryDtoById(projectx));
}
return projectDtoList;
}
@Override
public ProjectDto queryDtoById(Projectx projectx) {
if (StringUtils.isEmpty(projectx.getId())) {
return new ProjectDto();
}
// 查询当前项目信息
Projectx project = this.getById(projectx.getId());
// 将当前项目封装为dto
ProjectDto projectDto = new ProjectDto();
BeanUtils.copyProperties(project, projectDto);
// 查询当前项目的模块
List<ModuleDto> moduleDtoList = modulexService.queryDtoListByProId(project);
projectDto.setModuleDtoList(moduleDtoList);
return projectDto;
}
@Override
public Page<ProjectDto> pageDto(Page<Projectx> projectPage,
QueryWrapper<Projectx> queryWrapper) {
Page<ProjectDto> projectDtoPage = new Page<>();
this.page(projectPage, queryWrapper);
List<ProjectDto> projectDtoList = new ArrayList<>();
List<Projectx> projectxList = projectPage.getRecords();
for (Projectx projectx : projectxList) {
projectDtoList.add(this.queryDtoById(projectx));
}
BeanUtils.copyProperties(projectPage, projectDtoPage);
projectDtoPage.setRecords(projectDtoList);
return projectDtoPage;
}
}

Loading…
Cancel
Save