新增系统地址后台唯一性校验规则

This commit is contained in:
lhc
2021-05-18 17:48:17 +08:00
parent 6d24aef511
commit 5c83f37a3f
3 changed files with 99 additions and 84 deletions

View File

@@ -26,44 +26,50 @@ import io.swagger.annotations.ApiOperation;
@RequestMapping("os")
@Api(tags = "应用系统管理")
public class OsController {
final OsService osService;
public OsController(OsService osService) {
this.osService = osService;
}
final OsService osService;
@GetMapping("/{oscode}")
@ApiOperation(value = "校验系统编码是否存在", notes = "将自动传承key-value对象模式即可")
public ResultVO<Object> checkExistOs(@PathVariable String oscode) {
return osService.checkExistOs(oscode);
}
@PostMapping()
@LogAnno(operateType="新增系统信息",moduleName="系统管理-权限管理-系统信息管理")
@ApiOperation(value = "新增系统", notes = "将自动传承key-value对象模式即可")
public ResultVO<Object> addOs(@RequestParam Map<String,Object> os) {
return osService.addOs(os);
}
public OsController(OsService osService) {
this.osService = osService;
}
@PutMapping("/{version}")
@LogAnno(operateType="更新系统信息",moduleName="系统管理-权限管理-系统信息管理")
@ApiOperation(value = "更新系统信息")
public ResultVO<Integer> updateOs(@RequestParam Map<String,Object> os,@PathVariable Integer version) {
return osService.updateOs(os,version);
}
@GetMapping("/{oscode}")
@ApiOperation(value = "校验系统编码是否存在", notes = "将自动传承key-value对象模式即可")
public ResultVO<Object> checkExistOs(@PathVariable String oscode) {
return osService.checkExistOs(oscode);
}
@DeleteMapping("/{ids}")
@LogAnno(operateType="删除系统信息",moduleName="系统管理-权限管理-系统信息管理")
@ApiOperation(value = "删除系统信息")
public ResultVO<Object> deleteOs(@PathVariable String ids) {
return osService.deleteOs(ids);
}
@GetMapping("validUrl")
@ApiOperation(value = "校验系统编码是否存在", notes = "将自动传承key-value对象模式即可")
public ResultVO<Object> validUrl(String url) {
return osService.validUrl(url);
}
@GetMapping()
@ApiOperation(value = "获取系统信息列表")
public ResultVO<PageInfo<Map<String,Object>>> getOsList(String data, WebPageInfo webPageInfo) {
return osService.getOsList(data, webPageInfo);
}
@PostMapping()
@LogAnno(operateType = "新增系统信息", moduleName = "系统管理-权限管理-系统信息管理")
@ApiOperation(value = "新增系统", notes = "将自动传承key-value对象模式即可")
public ResultVO<Object> addOs(@RequestParam Map<String, Object> os) {
return osService.addOs(os);
}
@PutMapping("/{version}")
@LogAnno(operateType = "更新系统信息", moduleName = "系统管理-权限管理-系统信息管理")
@ApiOperation(value = "更新系统信息")
public ResultVO<Integer> updateOs(@RequestParam Map<String, Object> os, @PathVariable Integer version) {
return osService.updateOs(os, version);
}
@DeleteMapping("/{ids}")
@LogAnno(operateType = "删除系统信息", moduleName = "系统管理-权限管理-系统信息管理")
@ApiOperation(value = "删除系统信息")
public ResultVO<Object> deleteOs(@PathVariable String ids) {
return osService.deleteOs(ids);
}
@GetMapping()
@ApiOperation(value = "获取系统信息列表")
public ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo) {
return osService.getOsList(data, webPageInfo);
}
}

View File

@@ -7,14 +7,16 @@ import com.hcframe.base.common.ResultVO;
import com.hcframe.base.common.WebPageInfo;
public interface OsService {
ResultVO<Object> checkExistOs(String oscode);
ResultVO<Object> addOs(Map<String, Object> os);
ResultVO<Object> checkExistOs(String oscode);
ResultVO<Integer> updateOs(Map<String, Object> os, Integer version);
ResultVO<Object> addOs(Map<String, Object> os);
ResultVO<Object> deleteOs(String ids);
ResultVO<Integer> updateOs(Map<String, Object> os, Integer version);
ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo);
ResultVO<Object> deleteOs(String ids);
ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo);
ResultVO<Object> validUrl(String url);
}

View File

@@ -1,6 +1,5 @@
package com.hcframe.user.module.userinfo.service.impl;
import java.util.Arrays;
import java.util.Map;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -16,57 +15,65 @@ import com.hcframe.base.module.data.module.Condition;
import com.hcframe.base.module.data.service.TableService;
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
import com.hcframe.user.module.userinfo.service.OsService;
import com.hcframe.user.module.userinfo.service.TitleService;
@Service
public class OsServiceImpl implements OsService{
private static final String OS_ID = "OS_ID";
private static final String OS_SYS_OS = "OS_SYS_OS";
private static final OsSysTable TABLE_INFO = OsSysTable.builder().tableName(OS_SYS_OS).tablePk(OS_ID).build();
public class OsServiceImpl implements OsService {
final BaseMapper baseMapper;
private static final String OS_ID = "OS_ID";
private static final String OS_SYS_OS = "OS_SYS_OS";
private static final OsSysTable TABLE_INFO = OsSysTable.builder().tableName(OS_SYS_OS).tablePk(OS_ID).build();
final TableService tableService;
final BaseMapper baseMapper;
public OsServiceImpl(@Qualifier(BaseMapperImpl.BASE) BaseMapper baseMapper,
TableService tableService) {
this.baseMapper = baseMapper;
this.tableService = tableService;
}
@Override
public ResultVO<Object> checkExistOs(String oscode){
Condition condition = Condition.creatCriteria().andEqual("OS_CODE",oscode).andEqual("DELETED",1).build();
Long i = baseMapper.count(OS_SYS_OS, condition);
if (i > 0L) {
return ResultVO.getFailed("系统编码不能重复");
}
return ResultVO.getSuccess();
}
final TableService tableService;
@Override
public ResultVO<Object> addOs(Map<String, Object> os) {
return ResultVO.getSuccess(tableService.saveWithDate(TABLE_INFO, os));
}
public OsServiceImpl(@Qualifier(BaseMapperImpl.BASE) BaseMapper baseMapper,
TableService tableService) {
this.baseMapper = baseMapper;
this.tableService = tableService;
}
@Override
public ResultVO<Integer> updateOs(Map<String, Object> os, Integer version) {
return tableService.updateWithDate(TABLE_INFO,os,version);
}
@Override
public ResultVO<Object> checkExistOs(String oscode) {
Condition condition = Condition.creatCriteria().andEqual("OS_CODE", oscode).build();
Long i = baseMapper.count(OS_SYS_OS, condition);
if (i > 0L) {
return ResultVO.getFailed("系统编码不能重复");
}
return ResultVO.getSuccess();
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVO<Object> deleteOs(String ids) {
String[] idArr = ids.split(",");
tableService.delete(TABLE_INFO, ids);
return ResultVO.getSuccess();
}
@Override
public ResultVO<Object> addOs(Map<String, Object> os) {
return ResultVO.getSuccess(tableService.saveWithDate(TABLE_INFO, os));
}
@Override
public ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo) {
PageInfo<Map<String,Object>> pageInfo = tableService.searchSingleTables(data, TABLE_INFO, webPageInfo);
return ResultVO.getSuccess(pageInfo);
}
@Override
public ResultVO<Integer> updateOs(Map<String, Object> os, Integer version) {
return tableService.updateWithDate(TABLE_INFO, os, version);
}
@Override
@Transactional(rollbackFor = Exception.class)
public ResultVO<Object> deleteOs(String ids) {
String[] idArr = ids.split(",");
tableService.delete(TABLE_INFO, ids);
return ResultVO.getSuccess();
}
@Override
public ResultVO<PageInfo<Map<String, Object>>> getOsList(String data, WebPageInfo webPageInfo) {
PageInfo<Map<String, Object>> pageInfo = tableService.searchSingleTables(data, TABLE_INFO, webPageInfo);
return ResultVO.getSuccess(pageInfo);
}
@Override
public ResultVO<Object> validUrl(String url) {
Condition condition = Condition.creatCriteria().andEqual("OS_URL", url).build();
Long i = baseMapper.count(OS_SYS_OS, condition);
if (i > 0L) {
return ResultVO.getFailed("访问地址不能重复");
}
return ResultVO.getSuccess();
}
}