|
|
|
@ -1,7 +1,6 @@ |
|
|
|
|
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.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
@ -13,18 +12,14 @@ import org.jeecg.common.aspect.annotation.AutoLog; |
|
|
|
|
import org.jeecg.common.system.base.controller.JeecgController; |
|
|
|
|
import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
|
import org.jeecg.modules.modulex.entity.Modulex; |
|
|
|
|
import org.jeecg.modules.modulex.mapper.ModulexMapper; |
|
|
|
|
import org.jeecg.modules.modulex.service.IModulexService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: 模块管理 |
|
|
|
@ -39,8 +34,6 @@ import java.util.stream.Collectors; |
|
|
|
|
public class ModulexController extends JeecgController<Modulex, IModulexService> { |
|
|
|
|
@Autowired |
|
|
|
|
private IModulexService modulexService; |
|
|
|
|
@Resource |
|
|
|
|
private ModulexMapper modulexMapper; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
@ -61,27 +54,6 @@ public class ModulexController extends JeecgController<Modulex, IModulexService> |
|
|
|
|
QueryWrapper<Modulex> queryWrapper = QueryGenerator.initQueryWrapper(modulex, req.getParameterMap()); |
|
|
|
|
Page<Modulex> page = new Page<Modulex>(pageNo, pageSize); |
|
|
|
|
IPage<Modulex> pageList = modulexService.page(page, queryWrapper); |
|
|
|
|
List<Modulex> modulexList = pageList.getRecords(); |
|
|
|
|
for (Modulex modu :modulexList) { |
|
|
|
|
if (!StringUtils.hasText(modu.getManagerUsers())){ |
|
|
|
|
break; |
|
|
|
|
}else { |
|
|
|
|
String[] split = modu.getManagerUsers().split(","); |
|
|
|
|
List<String> stringList = Arrays.asList(split); |
|
|
|
|
List<String> strings = new ArrayList<>(); |
|
|
|
|
stringList.forEach(manager -> { |
|
|
|
|
String realName = modulexMapper.getRealName(manager); |
|
|
|
|
if (StringUtils.hasText(realName)) { |
|
|
|
|
strings.add(realName); |
|
|
|
|
} else { |
|
|
|
|
strings.add(manager); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
String toString = strings.toString(); |
|
|
|
|
String substring = toString.substring(1, toString.length() - 1); |
|
|
|
|
modu.setManagerUsers_dictText(substring); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Result.OK(pageList); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -89,22 +61,18 @@ public class ModulexController extends JeecgController<Modulex, IModulexService> |
|
|
|
|
public Result<?> fabu(@RequestParam(name="id") String id) { |
|
|
|
|
return modulexService.fabu(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/kaishi") |
|
|
|
|
public Result<?> kaishi(@RequestParam(name="id") String id) { |
|
|
|
|
return modulexService.kaishi(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/tijiao") |
|
|
|
|
public Result<?> tijiao(@RequestParam(name="id") String id) { |
|
|
|
|
return modulexService.tijiao(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/cehui") |
|
|
|
|
public Result<?> cehui(@RequestParam(name="id") String id) { |
|
|
|
|
return modulexService.chehui(id); |
|
|
|
|
return modulexService.cehui(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/shenhe") |
|
|
|
|
public Result<?> shenhe(@RequestParam(name="id") String id) { |
|
|
|
|
return modulexService.shenhe(id); |
|
|
|
@ -112,25 +80,15 @@ public class ModulexController extends JeecgController<Modulex, IModulexService> |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 添加 |
|
|
|
|
* moduleName 中文名称 |
|
|
|
|
* 相同上级的模块不能重名 |
|
|
|
|
* |
|
|
|
|
* @param modulex |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@AutoLog(value = "模块管理-添加") |
|
|
|
|
@ApiOperation(value="模块管理-添加", notes="模块管理-添加") |
|
|
|
|
@PostMapping(value = "/add") |
|
|
|
|
public Result<?> add(@RequestBody Modulex modulex) { |
|
|
|
|
//版本号 顺序累加;初始值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()); |
|
|
|
|
modulex.setVerison(newVersion+1); |
|
|
|
|
modulexService.save(modulex); |
|
|
|
|