| | |
| | | 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.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.starter.exception.VciBaseException; |
| | | import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | 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.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | |
| | | /** |
| | | * 码段基础信息控制器 |
| | | * |
| | | * @author weidy |
| | | * @author ludc |
| | | * @date 2022-01-24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/codeBasicSecController") |
| | | @Api(value = "码段基础信息控制器", tags = "码段基础信息控制器") |
| | | public class CodeBasicSecController { |
| | | |
| | | /** |
| | | * 码段基础信息 服务 |
| | | */ |
| | | @Autowired |
| | | private CodeBasicSecServiceI codeBasicSecService; |
| | | private ICodeBasicSecService codeBasicSecService; |
| | | |
| | | /** |
| | | * 码段基础信息列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 码段基础信息显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeBasicSec") |
| | | public DataGrid<CodeBasicSecVO> gridCodeBasicSec(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeBasicSecService.gridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页 码段基础信息列表", notes = "传入codeRuleVO") |
| | | public R<IPage<CodeBasicSecVO>> gridCodeBasicSec(BladeQueryObject bladeQueryObject){ |
| | | IPage<CodeBasicSecVO> codeRuleVOIPage = codeBasicSecService.gridCodeBasicSec(bladeQueryObject.getQuery().setAscs("ordernum"),bladeQueryObject.getConditionMap()); |
| | | return R.data(codeRuleVOIPage); |
| | | } |
| | | /** |
| | | |
| | | /** |
| | | * 增加 码段基础信息 |
| | | * @param codeBasicSecDTO 码段基础信息数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public BaseResult<CodeBasicSecVO> addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | CodeBasicSecVO codeBasicSecVO = null; |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "增加 码段基础信息", notes = "codeBasicSecDTO") |
| | | public R addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | boolean resBoolean; |
| | | try { |
| | | codeBasicSecVO = codeBasicSecService.addSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return BaseResult.fail(e.getCode()); |
| | | resBoolean = codeBasicSecService.addSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return R.fail(e.getCode()); |
| | | } |
| | | return BaseResult.success(codeBasicSecVO); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | /** |
| | | * 修改 码段基础信息 |
| | | /** 修改 码段基础信息 |
| | | * @param codeBasicSecDTO 码段基础信息数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public BaseResult<CodeBasicSecVO> editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | CodeBasicSecVO codeBasicSecVO = null; |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "修改 码段基础信息", notes = "codeBasicSecDTO") |
| | | public R editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | boolean resBoolean; |
| | | try { |
| | | codeBasicSecVO = codeBasicSecService.editSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return BaseResult.fail(e.getCode()); |
| | | resBoolean = codeBasicSecService.editSave(codeBasicSecDTO); |
| | | } catch (VciBaseException e) { |
| | | return R.fail(e.getCode()); |
| | | } |
| | | return BaseResult.success(codeBasicSecVO); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除码段基础信息 |
| | |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public BaseResult delCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) { |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "删除码段基础信息", notes = "codeBasicSecDTO") |
| | | public R delCodeBasicSec(@Valid @RequestBody CodeBasicSecDTO codeBasicSecDTO) { |
| | | return codeBasicSecService.deleteCodeBasicSec(codeBasicSecDTO); |
| | | } |
| | | |
| | |
| | | * @return 码段基础信息显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public BaseResult<CodeBasicSecVO> getObjectByOid(String oid){ |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "删除码段基础信息", notes = "codeBasicSecDTO") |
| | | public R<CodeBasicSecVO> getObjectByOid(String oid){ |
| | | CodeBasicSecVO codeBasicSecVO = codeBasicSecService.getObjectByOid(oid); |
| | | return BaseResult.success(codeBasicSecVO); |
| | | return R.data(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; |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "主键批量获取码段基础信息", notes = "oids") |
| | | public R<Collection<CodeBasicSecVO>> listCodeBasicSecByOids(String oids){ |
| | | Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids)); |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 参照码段基础信息列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 码段基础信息显示对象列表,生效的内容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public DataGrid<CodeBasicSecVO> refDataGridCodeBasicSec(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeBasicSecService.refDataGridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "参照码段基础信息列表", notes = "codeBasicSecVO") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridCodeBasicSec(BladeQueryObject bladeQueryObject){ |
| | | return R.data(codeBasicSecService.refDataGridCodeBasicSec(bladeQueryObject.getQuery(), bladeQueryObject.getConditionMap())); |
| | | } |
| | | |
| | | /** |
| | | * 参数分类码段基础信息列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule |
| | | * @param bladeQueryObject 基础查询对象,包含查询条件,分页,排序等,必须要有编码规则的主键 pkCodeRule |
| | | * @return 码段的信息 |
| | | */ |
| | | @GetMapping("/refDataGridClassifySec") |
| | | public DataGrid<CodeBasicSecVO> refDataGridClassifySec(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeBasicSecService.refDataGridClassifySec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "参数分类码段基础信息列表", notes = "codeBasicSecVO") |
| | | public R<IPage<CodeBasicSecVO>> refDataGridClassifySec(BladeQueryObject bladeQueryObject){ |
| | | return R.data(codeBasicSecService.refDataGridClassifySec(bladeQueryObject.getQuery(), bladeQueryObject.getConditionMap())); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 克隆结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @PostMapping("/clone") |
| | | public BaseResult cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | @ApiOperationSupport(order = 10) |
| | | @ApiOperation(value = "克隆码段信息", notes = "codeBasicSecDTO") |
| | | public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ |
| | | VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"选择码段主键"); |
| | | List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr()); |
| | | if (CollectionUtils.isEmpty(oidArr)){ |
| | | return BaseResult.fail("选择码段主键不能为空"); |
| | | return R.fail("选择码段主键不能为空"); |
| | | } |
| | | return codeBasicSecService.cloneCodeBasicSec(oidArr,codeBasicSecDTO.getPkCodeRule()); |
| | | } |
| | |
| | | * @param oid 目标分类码段主键 |
| | | * @return 分类码段树结构 |
| | | */ |
| | | @GetMapping("/treeCodeClassifySec") |
| | | /*@GetMapping("/treeCodeClassifySec") |
| | | @ApiOperationSupport(order = 11) |
| | | @ApiOperation(value = "查询目标分类码段所在的树结构", notes = "oid") |
| | | public List<Tree> gridCodeClassifySecTree (String oid){ |
| | | VciBaseUtil.alertNotNull(oid,"分类码段主键"); |
| | | return codeBasicSecService.gridCodeClassifySecTree(oid); |
| | | } |
| | | }*/ |
| | | |
| | | /** |
| | | * 上移 |
| | |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("/upOrderNum") |
| | | public BaseResult upOrderNum(String oid){ |
| | | codeBasicSecService.upOrderNum(oid); |
| | | return BaseResult.success(); |
| | | @ApiOperationSupport(order = 11) |
| | | @ApiOperation(value = "上移", notes = "oid") |
| | | public R upOrderNum(@Valid @RequestParam String oid){ |
| | | return R.status(codeBasicSecService.upOrderNum(oid)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("/downOrderNum") |
| | | public BaseResult downOrderNum(String oid){ |
| | | codeBasicSecService.downOrderNum(oid); |
| | | return BaseResult.success(); |
| | | @ApiOperationSupport(order = 12) |
| | | @ApiOperation(value = "下移", notes = "oid") |
| | | public R downOrderNum(@Valid @RequestParam String oid){ |
| | | return R.status(codeBasicSecService.downOrderNum(oid)); |
| | | } |
| | | |
| | | } |