package com.vci.ubcs.code.controller;
|
|
import com.vci.ubcs.code.service.CodeBasicSecServiceI;
|
import com.vci.starter.web.exception.VciBaseException;
|
import com.vci.starter.web.pagemodel.BaseQueryObject;
|
import com.vci.starter.web.pagemodel.BaseResult;
|
import com.vci.starter.web.pagemodel.DataGrid;
|
import com.vci.starter.web.pagemodel.Tree;
|
import com.vci.starter.web.util.VciBaseUtil;
|
import com.vci.ubcs.code.dto.CodeBasicSecDTO;
|
import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.util.CollectionUtils;
|
import org.springframework.web.bind.annotation.*;
|
|
import java.util.Collection;
|
import java.util.List;
|
|
|
/**
|
* 码段基础信息控制器
|
*
|
* @author weidy
|
* @date 2022-01-24
|
*/
|
@RestController
|
@RequestMapping("/codeBasicSecController")
|
public class CodeBasicSecController {
|
/**
|
* 码段基础信息 服务
|
*/
|
@Autowired
|
private CodeBasicSecServiceI codeBasicSecService;
|
|
/**
|
* 码段基础信息列表
|
* @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等
|
* @return 码段基础信息显示对象列表
|
*/
|
@GetMapping("/gridCodeBasicSec")
|
public DataGrid<CodeBasicSecVO> gridCodeBasicSec(BaseQueryObject baseQueryObject){
|
if(baseQueryObject == null){
|
baseQueryObject = new BaseQueryObject();
|
}
|
return codeBasicSecService.gridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
|
}
|
/**
|
* 增加 码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象
|
* @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象
|
*/
|
@PostMapping( "/addSave")
|
public BaseResult<CodeBasicSecVO> addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
CodeBasicSecVO codeBasicSecVO = null;
|
try {
|
codeBasicSecVO = codeBasicSecService.addSave(codeBasicSecDTO);
|
} catch (VciBaseException e) {
|
return BaseResult.fail(e.getCode());
|
}
|
return BaseResult.success(codeBasicSecVO);
|
}
|
|
/**
|
* 修改 码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象
|
* @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象
|
*/
|
@PutMapping("/editSave")
|
public BaseResult<CodeBasicSecVO> editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
CodeBasicSecVO codeBasicSecVO = null;
|
try {
|
codeBasicSecVO = codeBasicSecService.editSave(codeBasicSecDTO);
|
} catch (VciBaseException e) {
|
return BaseResult.fail(e.getCode());
|
}
|
return BaseResult.success(codeBasicSecVO);
|
}
|
|
|
/**
|
* 删除码段基础信息
|
* @param codeBasicSecDTO 码段基础信息数据传输对象,oid和ts需要传输
|
* @return 删除结果反馈::success:成功,fail:失败
|
*/
|
@DeleteMapping( "/deleteData")
|
public BaseResult delCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) {
|
return codeBasicSecService.deleteCodeBasicSec(codeBasicSecDTO);
|
}
|
|
/**
|
* 主键获取码段基础信息
|
* @param oid 主键
|
* @return 码段基础信息显示对象
|
*/
|
@GetMapping("/getObjectByOid")
|
public BaseResult<CodeBasicSecVO> getObjectByOid(String oid){
|
CodeBasicSecVO codeBasicSecVO = codeBasicSecService.getObjectByOid(oid);
|
return BaseResult.success(codeBasicSecVO);
|
}
|
|
/**
|
* 主键批量获取码段基础信息
|
* @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个
|
* @return 码段基础信息显示对象
|
*/
|
@GetMapping("/listDataByOids")
|
public BaseResult<CodeBasicSecVO> listCodeBasicSecByOids(String oids){
|
Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids));
|
BaseResult baseResult = BaseResult.success();
|
baseResult.setData(voCollection);
|
return baseResult;
|
}
|
|
|
|
/**
|
* 参照码段基础信息列表
|
* @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等
|
* @return 码段基础信息显示对象列表,生效的内容
|
*/
|
@GetMapping("/refDataGrid")
|
public DataGrid<CodeBasicSecVO> refDataGridCodeBasicSec(BaseQueryObject baseQueryObject){
|
if(baseQueryObject == null){
|
baseQueryObject = new BaseQueryObject();
|
}
|
return codeBasicSecService.refDataGridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
|
}
|
|
/**
|
* 参数分类码段基础信息列表
|
* @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule
|
* @return 码段的信息
|
*/
|
@GetMapping("/refDataGridClassifySec")
|
public DataGrid<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 BaseResult cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){
|
VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"选择码段主键");
|
List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr());
|
if (CollectionUtils.isEmpty(oidArr)){
|
return BaseResult.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 BaseResult upOrderNum(String oid){
|
codeBasicSecService.upOrderNum(oid);
|
return BaseResult.success();
|
}
|
|
/**
|
* 下移
|
* @param oid 主键
|
* @return 执行结果
|
*/
|
@PostMapping("/downOrderNum")
|
public BaseResult downOrderNum(String oid){
|
codeBasicSecService.downOrderNum(oid);
|
return BaseResult.success();
|
}
|
|
}
|