master
赵玉瑞 2 years ago
parent a3c5b9495f
commit dfb6a997ed
  1. 27
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/controller/ModulexController.java
  2. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/IModulexService.java
  3. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java

@ -1,6 +1,7 @@
package org.jeecg.modules.modulex.controller; package org.jeecg.modules.modulex.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -14,12 +15,16 @@ import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.modulex.entity.Modulex; import org.jeecg.modules.modulex.entity.Modulex;
import org.jeecg.modules.modulex.service.IModulexService; import org.jeecg.modules.modulex.service.IModulexService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* @Description: 模块管理 * @Description: 模块管理
@ -61,18 +66,22 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
public Result<?> fabu(@RequestParam(name = "id") String id) { public Result<?> fabu(@RequestParam(name = "id") String id) {
return modulexService.fabu(id); return modulexService.fabu(id);
} }
@GetMapping(value = "/kaishi") @GetMapping(value = "/kaishi")
public Result<?> kaishi(@RequestParam(name = "id") String id) { public Result<?> kaishi(@RequestParam(name = "id") String id) {
return modulexService.kaishi(id); return modulexService.kaishi(id);
} }
@GetMapping(value = "/tijiao") @GetMapping(value = "/tijiao")
public Result<?> tijiao(@RequestParam(name = "id") String id) { public Result<?> tijiao(@RequestParam(name = "id") String id) {
return modulexService.tijiao(id); return modulexService.tijiao(id);
} }
@GetMapping(value = "/cehui") @GetMapping(value = "/cehui")
public Result<?> cehui(@RequestParam(name = "id") String id) { public Result<?> cehui(@RequestParam(name = "id") String id) {
return modulexService.cehui(id); return modulexService.chehui(id);
} }
@GetMapping(value = "/shenhe") @GetMapping(value = "/shenhe")
public Result<?> shenhe(@RequestParam(name = "id") String id) { public Result<?> shenhe(@RequestParam(name = "id") String id) {
return modulexService.shenhe(id); return modulexService.shenhe(id);
@ -80,15 +89,25 @@ public class ModulexController extends JeecgController<Modulex, IModulexService>
/** /**
* 添加 * 添加
* * moduleName 中文名称
* @param modulex * 相同上级的模块不能重名
* @return
*/ */
@AutoLog(value = "模块管理-添加") @AutoLog(value = "模块管理-添加")
@ApiOperation(value = "模块管理-添加", notes = "模块管理-添加") @ApiOperation(value = "模块管理-添加", notes = "模块管理-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody Modulex modulex) { public Result<?> add(@RequestBody Modulex modulex) {
//版本号 顺序累加;初始值1 //版本号 顺序累加;初始值1
if (StringUtils.hasText(modulex.getPid())) {
List<String> collect = modulexService.list(
new LambdaQueryWrapper<Modulex>()
.eq(StringUtils.hasText(modulex.getPid()), Modulex::getPid, modulex.getPid()))
.stream().map(Modulex::getModuleName).collect(Collectors.toList());
collect.add(modulex.getModuleName());
HashSet<String> setList = new HashSet<>(collect);
if (collect.size() != setList.size()){
return Result.error("相同上级的模块不能重名");
}
}
Integer newVersion = modulexService.getMaxVersion(modulex.getVerison()); Integer newVersion = modulexService.getMaxVersion(modulex.getVerison());
modulex.setVerison(newVersion + 1); modulex.setVerison(newVersion + 1);
modulexService.save(modulex); modulexService.save(modulex);

@ -24,7 +24,7 @@ public interface IModulexService extends IService<Modulex> {
Result<?> tijiao(String id); Result<?> tijiao(String id);
Result<?> cehui(String id); Result<?> chehui(String id);
Result<?> shenhe(String id); Result<?> shenhe(String id);
} }

@ -103,7 +103,7 @@ public class ModulexServiceImpl extends ServiceImpl<ModulexMapper, Modulex> impl
* @param id modulex表的主键id * @param id modulex表的主键id
*/ */
@Override @Override
public Result<?> cehui(String id) { public Result<?> chehui(String id) {
Modulex byId = this.getById(id); Modulex byId = this.getById(id);
if (byId.getWorkStatus() == 2) { if (byId.getWorkStatus() == 2) {
return Result.error("正处于开发中"); return Result.error("正处于开发中");

Loading…
Cancel
Save