package com.vci.ubcs.code.controller;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
import com.vci.ubcs.code.dto.CodeBasicSecDTO;
|
import com.vci.ubcs.code.entity.CodeBasicSec;
|
import com.vci.ubcs.code.service.ICodeBasicSecService;
|
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
|
import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper;
|
import com.vci.ubcs.com.vci.starter.exception.VciBaseException;
|
import io.swagger.annotations.ApiOperation;
|
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.tool.api.R;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.*;
|
|
|
/**
|
* 码段基础信息控制器
|
*
|
* @author ludc
|
* @date 2022-01-24
|
*/
|
@RestController
|
@RequestMapping("/codeBasicSecController")
|
public class CodeBasicSecController {
|
|
/**
|
* 码段基础信息 服务
|
*/
|
@Autowired
|
private ICodeBasicSecService codeBasicSecService;
|
|
/**
|
* 编码规则 分页
|
*/
|
@GetMapping("/list")
|
@ApiOperationSupport(order = 1)
|
@ApiOperation(value = "分页", notes = "传入codeRuleVO")
|
public R<IPage<CodeBasicSecVO>> list(CodeBasicSec codeBasicSec, Query query) {
|
IPage<CodeBasicSec> pages = codeBasicSecService.page(Condition.getPage(query), Condition.getQueryWrapper(codeBasicSec));
|
return R.data(CodeBasicSecWrapper.build().pageVO(pages));
|
}
|
|
/**
|
* 码段基础信息列表
|
* @param codeBasicSecVO 基础查询对象,包含查询条件,分页,排序等
|
* @return 码段基础信息显示对象列表
|
*/
|
@GetMapping("/gridCodeBasicSec")
|
@ApiOperationSupport(order = 2)
|
@ApiOperation(value = "分页", notes = "传入codeRuleVO")
|
public R<IPage<CodeBasicSecVO>> gridCodeBasicSec(CodeBasicSecVO codeBasicSecVO, Query query){
|
IPage<CodeBasicSecVO> codeRuleVOIPage = codeBasicSecService.gridCodeBasicSec(Condition.getPage(query.setAscs("ordernum")),codeBasicSecVO);
|
return R.data(codeRuleVOIPage);
|
}
|
|
/**
|
* 增加 码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象
|
* @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象
|
*/
|
@PostMapping( "/addSave")
|
@ApiOperationSupport(order = 3)
|
@ApiOperation(value = "增加", notes = "codeBasicSecDTO")
|
public R addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
boolean resBoolean = false;
|
try {
|
resBoolean = codeBasicSecService.addSave(codeBasicSecDTO);
|
} catch (VciBaseException e) {
|
return R.fail(e.getCode());
|
}
|
return R.data(resBoolean);
|
}
|
|
/* *//**
|
* 修改 码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象
|
* @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象
|
*//*
|
@PutMapping("/editSave")
|
public R<CodeBasicSecVO> editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
CodeBasicSecVO codeBasicSecVO = null;
|
try {
|
codeBasicSecVO = codeBasicSecService.editSave(codeBasicSecDTO);
|
} catch (VciBaseException e) {
|
return R.fail(e.getCode());
|
}
|
return R.success(codeBasicSecVO);
|
}
|
|
|
*//**
|
* 删除码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象,oid和ts需要传输
|
* @return 删除结果反馈::success:成功,fail:失败
|
*//*
|
@DeleteMapping( "/deleteData")
|
public R delCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) {
|
return codeBasicSecService.deleteCodeBasicSec(codeBasicSecDTO);
|
}
|
|
*//**
|
* 主键获取码段基础信息
|
* @param oid 主键
|
* @return 码段基础信息显示对象
|
*//*
|
@GetMapping("/getObjectByOid")
|
public R<CodeBasicSecVO> getObjectByOid(String oid){
|
CodeBasicSecVO codeBasicSecVO = codeBasicSecService.getObjectByOid(oid);
|
return BaseResult.success(codeBasicSecVO);
|
}
|
|
*//**
|
* 主键批量获取码段基础信息
|
* @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个
|
* @return 码段基础信息显示对象
|
*//*
|
@GetMapping("/listDataByOids")
|
public R<CodeBasicSecVO> listCodeBasicSecByOids(String oids){
|
Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids));
|
R baseResult = R.success();
|
baseResult.setData(voCollection);
|
return baseResult;
|
}
|
|
|
|
*//**
|
* 参照码段基础信息列表
|
* @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等
|
* @return 码段基础信息显示对象列表,生效的内容
|
*//*
|
@GetMapping("/refDataGrid")
|
public R<IPage<CodeBasicSecVO>> refDataGridCodeBasicSec(BaseQueryObject baseQueryObject){
|
if(baseQueryObject == null){
|
baseQueryObject = new BaseQueryObject();
|
}
|
return codeBasicSecService.refDataGridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
|
}
|
|
*//**
|
* 参数分类码段基础信息列表
|
* @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule
|
* @return 码段的信息
|
*//*
|
@GetMapping("/refDataGridClassifySec")
|
public R<IPage<CodeBasicSecVO>> refDataGridClassifySec(BaseQueryObject baseQueryObject){
|
if(baseQueryObject == null){
|
baseQueryObject = new BaseQueryObject();
|
}
|
return codeBasicSecService.refDataGridClassifySec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
|
}
|
|
*//**
|
* 克隆码段信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象,oidArr:选择源码段主键的集合,pkCodeRule:目标编码规则的主键
|
* @return 克隆结果反馈::success:成功,fail:失败
|
*//*
|
@PostMapping("/clone")
|
public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"选择码段主键");
|
List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr());
|
if (CollectionUtils.isEmpty(oidArr)){
|
return R.fail("选择码段主键不能为空");
|
}
|
return codeBasicSecService.cloneCodeBasicSec(oidArr,codeBasicSecDTO.getPkCodeRule());
|
}
|
|
*//**
|
* 查询目标分类码段所在的树结构
|
* @param oid 目标分类码段主键
|
* @return 分类码段树结构
|
*//*
|
@GetMapping("/treeCodeClassifySec")
|
public List<Tree> gridCodeClassifySecTree (String oid){
|
VciBaseUtil.alertNotNull(oid,"分类码段主键");
|
return codeBasicSecService.gridCodeClassifySecTree(oid);
|
}
|
|
*//**
|
* 上移
|
* @param oid 主键
|
* @return 执行结果
|
*//*
|
@PostMapping("/upOrderNum")
|
public R upOrderNum(String oid){
|
codeBasicSecService.upOrderNum(oid);
|
return R.success();
|
}
|
|
*//**
|
* 下移
|
* @param oid 主键
|
* @return 执行结果
|
*//*
|
@PostMapping("/downOrderNum")
|
public R downOrderNum(String oid){
|
codeBasicSecService.downOrderNum(oid);
|
return R.success();
|
}*/
|
|
}
|