| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | import com.vci.ubcs.code.lifecycle.CodeClassifyTemplateLC; |
| | | import com.vci.ubcs.code.service.CodeClassifyTemplateServiceI; |
| | | import com.vci.starter.web.pagemodel.*; |
| | | import com.vci.starter.web.util.VciBaseUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeClassifyTemplateDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplate; |
| | | import com.vci.ubcs.code.enumpack.CodeClassifyTemplateLC; |
| | | import com.vci.ubcs.code.mapper.CodeClassifyTemplateMapper; |
| | | import com.vci.ubcs.code.service.ICodeClstemplateService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyTemplateWrapper; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 分类模板对象控制器 |
| | | * 编码库定义-模板管理 控制器 |
| | | * |
| | | * @author weidy |
| | | * @date 2022-01-24 |
| | | * @author yuxc |
| | | * @since 2023-04-10 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeClassifyTemplateController") |
| | | public class CodeClassifyTemplateController { |
| | | /** |
| | | * 分类模板对象 服务 |
| | | */ |
| | | @Autowired |
| | | private CodeClassifyTemplateServiceI codeClassifyTemplateService; |
| | | @Api(value = "编码库定义-模板管理", tags = "编码库定义-模板管理接口") |
| | | public class CodeClassifyTemplateController extends BladeController { |
| | | |
| | | /** |
| | | * 分类模板对象树 |
| | | * @param treeQueryObject 树形查询对象 |
| | | * @return 分类模板对象显示树 |
| | | */ |
| | | @GetMapping("/treeCodeClassifyTemplate") |
| | | public List<Tree> treeCodeClassifyTemplate(TreeQueryObject treeQueryObject) { |
| | | return codeClassifyTemplateService.treeCodeClassifyTemplate(treeQueryObject); |
| | | } |
| | | private final ICodeClstemplateService plCodeClstemplateService; |
| | | |
| | | /** |
| | | * 分类模板列表 |
| | | * @param baseQueryObject 基础查询对象 |
| | | * @return 显示对象 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplate") |
| | | public DataGrid<CodeClassifyTemplateVO> gridCodeClassifyTemplate(BaseQueryObject baseQueryObject){ |
| | | return codeClassifyTemplateService.gridCodeClassifyTemplate(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | CodeClassifyTemplateMapper codeClassifyTemplateMapper; |
| | | |
| | | /** |
| | | * 增加 分类模板对象 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public BaseResult<CodeClassifyTemplateVO> addSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ |
| | | return codeClassifyTemplateService.addSave(codeClassifyTemplateDTO); |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入plCodeClstemplate") |
| | | public R<CodeClassifyTemplateVO> detail(CodeClassifyTemplate plCodeClstemplate) { |
| | | CodeClassifyTemplate detail = plCodeClstemplateService.getOne(Condition.getQueryWrapper(plCodeClstemplate)); |
| | | return R.data(CodeClassifyTemplateWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 分页,分类模板列表对应以前平台的gridCodeClassifyTemplate |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入plCodeClstemplate") |
| | | public R<IPage<CodeClassifyTemplateVO>> list(CodeClassifyTemplate plCodeClstemplate, Query query) { |
| | | IPage<CodeClassifyTemplate> pages = plCodeClstemplateService.page(Condition.getPage(query), Condition.getQueryWrapper(plCodeClstemplate)); |
| | | return R.data(CodeClassifyTemplateWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 修改 分类模板对象 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public BaseResult<CodeClassifyTemplateVO> editSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ |
| | | return codeClassifyTemplateService.editSave(codeClassifyTemplateDTO); |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入plCodeClstemplate") |
| | | public R<IPage<CodeClassifyTemplateVO>> page(CodeClassifyTemplateVO plCodeClstemplate, Query query) { |
| | | IPage<CodeClassifyTemplateVO> pages = plCodeClstemplateService.selectPlCodeClstemplatePage(Condition.getPage(query), plCodeClstemplate); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 检查 分类模板对象是否删除 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象,必须要有oid和ts属性 |
| | | * @return 执行结果 success为true为可以删除,false表示有数据引用,obj为true表示有下级 |
| | | */ |
| | | @PostMapping( "/checkIsCanDelete") |
| | | public BaseResult checkIsCanDelete(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO) { |
| | | return codeClassifyTemplateService.checkIsCanDelete(codeClassifyTemplateDTO); |
| | | } |
| | | /** |
| | | * 修改 分类模板对象 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeClassifyTemplateVO> editSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ |
| | | return plCodeClstemplateService.editSave(codeClassifyTemplateDTO); |
| | | } |
| | | |
| | | /** |
| | | * 删除分类模板对象 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象,oid和ts需要传输 |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public BaseResult delCodeClassifyTemplate( CodeClassifyTemplateDTO codeClassifyTemplateDTO) { |
| | | return codeClassifyTemplateService.deleteCodeClassifyTemplate(codeClassifyTemplateDTO); |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入plCodeClstemplate") |
| | | public R save(@Valid @RequestBody CodeClassifyTemplate plCodeClstemplate) { |
| | | return R.status(plCodeClstemplateService.save(plCodeClstemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 主键获取分类模板对象 |
| | | * @param oid 主键 |
| | | * @return 分类模板对象显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public BaseResult<CodeClassifyTemplateVO> getObjectByOid(String oid){ |
| | | CodeClassifyTemplateVO codeClassifyTemplateVO = codeClassifyTemplateService.getObjectByOid(oid); |
| | | return BaseResult.success(codeClassifyTemplateVO); |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入plCodeClstemplate") |
| | | public R update(@Valid @RequestBody CodeClassifyTemplate plCodeClstemplate) { |
| | | return R.status(plCodeClstemplateService.updateById(plCodeClstemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 主键批量获取分类模板对象 |
| | | * @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 分类模板对象显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public BaseResult<CodeClassifyTemplateVO> listCodeClassifyTemplateByOids(String oids){ |
| | | Collection<CodeClassifyTemplateVO> voCollection = codeClassifyTemplateService.listCodeClassifyTemplateByOids(VciBaseUtil.str2List(oids)); |
| | | BaseResult baseResult = BaseResult.success(); |
| | | baseResult.setData(voCollection); |
| | | return baseResult; |
| | | } |
| | | /** |
| | | * 编码库定义-模板管理 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入plCodeClstemplate") |
| | | public R submit(@Valid @RequestBody CodeClassifyTemplate plCodeClstemplate) { |
| | | return R.status(plCodeClstemplateService.saveOrUpdate(plCodeClstemplate)); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板管理 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(SqlHelper.retBool(codeClassifyTemplateMapper.deleteBatchIds(Func.toLongList(ids)))); |
| | | } |
| | | |
| | | /** |
| | | * 分类模板对象树 |
| | | * @param treeQueryObject 树形查询对象 |
| | | * @return 分类模板对象显示树 |
| | | */ |
| | | @GetMapping("/treeCodeClassifyTemplate") |
| | | public List<Tree> treeCodeClassifyTemplate(TreeQueryObject treeQueryObject) { |
| | | return plCodeClstemplateService.treeCodeClassifyTemplate(treeQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 分类模板列表 |
| | | * @param baseQueryObject 基础查询对象 |
| | | * @return 显示对象 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplate") |
| | | public DataGrid<CodeClassifyTemplateVO> gridCodeClassifyTemplate(BaseQueryObject baseQueryObject){ |
| | | |
| | | return plCodeClstemplateService.gridCodeClassifyTemplate(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 检查 分类模板对象是否删除 |
| | | * @param codeClstemplateDTO 分类模板对象数据传输对象,必须要有oid和ts属性 |
| | | * @return 执行结果 success为true为可以删除,false表示有数据引用,obj为true表示有下级 |
| | | */ |
| | | @PostMapping( "/checkIsCanDelete") |
| | | public R checkIsCanDelete(@RequestBody CodeClassifyTemplateDTO codeClstemplateDTO) { |
| | | |
| | | /** |
| | | * 参照树 分类模板对象 |
| | | * @param treeQueryObject 树形查询对象 |
| | | * @return 分类模板对象显示树 |
| | | */ |
| | | @GetMapping("/referTree") |
| | | public List<Tree> referTree(TreeQueryObject treeQueryObject) { |
| | | return codeClassifyTemplateService.referTree(treeQueryObject); |
| | | } |
| | | return plCodeClstemplateService.checkIsCanDelete(codeClstemplateDTO); |
| | | } |
| | | |
| | | /** |
| | | * 启用 |
| | | * @param codeClassifyDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/enableData") |
| | | public BaseResult enable( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return codeClassifyTemplateService.updateLcStatus(codeClassifyDTO.getOid(), CodeClassifyTemplateLC.RELEASED.getValue()); |
| | | } |
| | | /** |
| | | * 删除分类模板对象 |
| | | * @param codeClstemplateDTO 分类模板对象数据传输对象,oid和ts需要传输 |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeClassifyTemplate(@Valid @RequestBody CodeClassifyTemplateDTO codeClstemplateDTO) { |
| | | return plCodeClstemplateService.deleteCodeClassifyTemplate(codeClstemplateDTO); |
| | | } |
| | | |
| | | /** |
| | | * 停用 |
| | | * @param codeClassifyDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/disableData") |
| | | public BaseResult disableData( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return codeClassifyTemplateService.updateLcStatus(codeClassifyDTO.getOid(),CodeClassifyTemplateLC.DISABLED.getValue()); |
| | | } |
| | | /** |
| | | * 主键获取分类模板对象 |
| | | * @param oid 主键 |
| | | * @return 分类模板对象显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeClassifyTemplateVO> getObjectByOid(String oid){ |
| | | CodeClassifyTemplateVO codeClassifyTemplateVO = plCodeClstemplateService.getObjectByOid(oid); |
| | | return R.data(codeClassifyTemplateVO); |
| | | } |
| | | |
| | | /** |
| | | * 再编辑 |
| | | * @param codeClassifyDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/editDate") |
| | | public BaseResult editDate( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return codeClassifyTemplateService.updateLcStatus(codeClassifyDTO.getOid(),CodeClassifyTemplateLC.EDITING.getValue()); |
| | | } |
| | | /** |
| | | * 主键批量获取分类模板对象 |
| | | * @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 分类模板对象显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R<Collection<CodeClassifyTemplateVO>> listCodeClassifyTemplateByOids(String oids){ |
| | | Collection<CodeClassifyTemplateVO> voCollection = plCodeClstemplateService.listCodeClassifyTemplateByOids(VciBaseUtil.str2List(oids)); |
| | | |
| | | /** |
| | | * 升版 |
| | | * @param codeClassifyDTO |
| | | * @return oid模板oid |
| | | */ |
| | | @PostMapping( "/upgrade") |
| | | public BaseResult Upgrade(@RequestBody CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return R.data(voCollection) ; |
| | | } |
| | | |
| | | return codeClassifyTemplateService.Upgrade(codeClassifyDTO); |
| | | } |
| | | /** |
| | | * 参照树 分类模板对象 |
| | | * @param treeQueryObject 树形查询对象 |
| | | * @return 分类模板对象显示树 |
| | | */ |
| | | @GetMapping("/referTree") |
| | | public List<Tree> referTree(TreeQueryObject treeQueryObject) { |
| | | return plCodeClstemplateService.referTree(treeQueryObject); |
| | | } |
| | | /** |
| | | * 增加 分类模板对象 |
| | | * @param codeClassifyTemplateDTO 分类模板对象数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeClassifyTemplateVO> addSave(@RequestBody CodeClassifyTemplateDTO codeClassifyTemplateDTO){ |
| | | return plCodeClstemplateService.addSave(codeClassifyTemplateDTO); |
| | | } |
| | | |
| | | @GetMapping( "/upgrade1") |
| | | public BaseResult upgrade1( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | /** |
| | | * 启用 |
| | | * @param codeClstemplateDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/enableData") |
| | | public R enable( CodeClassifyTemplateDTO codeClstemplateDTO) { |
| | | return plCodeClstemplateService.updateLcStatus(codeClstemplateDTO.getOid(), CodeClassifyTemplateLC.RELEASED.getValue()); |
| | | } |
| | | |
| | | return Upgrade(codeClassifyDTO); |
| | | } |
| | | /** |
| | | * 停用 |
| | | * @param codeClassifyDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/disableData") |
| | | public R disableData( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return plCodeClstemplateService.updateLcStatus(codeClassifyDTO.getOid(),CodeClassifyTemplateLC.DISABLED.getValue()); |
| | | } |
| | | |
| | | /** |
| | | * 克隆 |
| | | * @param codeClassifyDTO |
| | | * @return oid模板oid |
| | | */ |
| | | @PostMapping( "/copy") |
| | | public BaseResult copyTemplate(@RequestBody CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | /** |
| | | * 再编辑 |
| | | * @param codeClassifyDTO oid |
| | | * @return |
| | | */ |
| | | @PostMapping( "/editDate") |
| | | public R editDate( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | return plCodeClstemplateService.updateLcStatus(codeClassifyDTO.getOid(),CodeClassifyTemplateLC.EDITING.getValue()); |
| | | } |
| | | |
| | | return codeClassifyTemplateService.copyTemplate(codeClassifyDTO); |
| | | } |
| | | /** |
| | | * 升版 |
| | | * @param codeClassifyDTO |
| | | * @return oid模板oid |
| | | */ |
| | | @PostMapping( "/upgrade") |
| | | public R Upgrade(@RequestBody CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | |
| | | @GetMapping( "/copyTemplate1") |
| | | public BaseResult copyTemplate1( CodeClassifyTemplateDTO codeClassifyDTO) { |
| | | |
| | | return copyTemplate(codeClassifyDTO); |
| | | } |
| | | |
| | | return plCodeClstemplateService.Upgrade(codeClassifyDTO); |
| | | } |
| | | } |