| | |
| | | /* |
| | | * 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.service.CodeClassifyTemplateAttrServiceI; |
| | | 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.util.VciBaseUtil; |
| | | import com.vci.web.pageModel.OsBtmTypeAttributeVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeClassifyTemplateAttrDTO; |
| | | import com.vci.ubcs.code.entity.CodeClassifyTemplateAttr; |
| | | import com.vci.ubcs.code.service.ICodeClassifyTemplateAttrService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyTemplateAttrVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import com.vci.ubcs.code.wrapper.CodeClassifyTemplateAttrWrapper; |
| | | import com.vci.ubcs.omd.vo.BtmTypeAttributeVO; |
| | | import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject; |
| | | import com.vci.ubcs.starter.web.pagemodel.DataGrid; |
| | | 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.secure.BladeUser; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 主题库分类的模板属性控制器 |
| | | * 编码库定义-模板属性 控制器 |
| | | * |
| | | * @author weidy |
| | | * @date 2022-01-24 |
| | | * @author yuxc |
| | | * @since 2023-04-19 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | | @RequestMapping("/codeClassifyTempAttrController") |
| | | public class CodeClassifyTemplateAttrController { |
| | | /** |
| | | * 主题库分类的模板属性 服务 |
| | | */ |
| | | @Autowired |
| | | private CodeClassifyTemplateAttrServiceI codeClassifyTemplateAttrService; |
| | | @Api(value = "编码库定义-模板属性", tags = "编码库定义-模板属性接口") |
| | | public class CodeClassifyTemplateAttrController extends BladeController { |
| | | |
| | | private final ICodeClassifyTemplateAttrService CodeClstempattrService; |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 详情 |
| | | */ |
| | | @GetMapping("/detail") |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "详情", notes = "传入CodeClstempattr") |
| | | public R<CodeClassifyTemplateAttrVO> detail(CodeClassifyTemplateAttr CodeClstempattr) { |
| | | CodeClassifyTemplateAttr detail = CodeClstempattrService.getOne(Condition.getQueryWrapper(CodeClstempattr)); |
| | | return R.data(CodeClassifyTemplateAttrWrapper.build().entityVO(detail)); |
| | | } |
| | | /** |
| | | * 编码库定义-模板属性 分页 |
| | | */ |
| | | @GetMapping("/list") |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "分页", notes = "传入CodeClstempattr") |
| | | public R<IPage<CodeClassifyTemplateAttrVO>> list(CodeClassifyTemplateAttr CodeClstempattr, Query query) { |
| | | IPage<CodeClassifyTemplateAttr> pages = CodeClstempattrService.page(Condition.getPage(query), Condition.getQueryWrapper(CodeClstempattr)); |
| | | return R.data(CodeClassifyTemplateAttrWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入CodeClstempattr") |
| | | public R<IPage<CodeClassifyTemplateAttrVO>> page(CodeClassifyTemplateAttrVO CodeClstempattr, Query query) { |
| | | IPage<CodeClassifyTemplateAttrVO> pages = CodeClstempattrService.selectCodeClstempattrPage(Condition.getPage(query), CodeClstempattr); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 新增 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "新增", notes = "传入CodeClstempattr") |
| | | public R save(@Valid @RequestBody CodeClassifyTemplateAttr CodeClstempattr) { |
| | | return R.status(CodeClstempattrService.save(CodeClstempattr)); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 修改 |
| | | */ |
| | | @PostMapping("/update") |
| | | @ApiOperationSupport(order = 5) |
| | | @ApiOperation(value = "修改", notes = "传入CodeClstempattr") |
| | | public R update(@Valid @RequestBody CodeClassifyTemplateAttr CodeClstempattr) { |
| | | return R.status(CodeClstempattrService.updateById(CodeClstempattr)); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 新增或修改 |
| | | */ |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入CodeClstempattr") |
| | | public R submit(@Valid @RequestBody CodeClassifyTemplateAttr CodeClstempattr) { |
| | | return R.status(CodeClstempattrService.saveOrUpdate(CodeClstempattr)); |
| | | } |
| | | |
| | | /** |
| | | * 编码库定义-模板属性 删除 |
| | | */ |
| | | @PostMapping("/remove") |
| | | @ApiOperationSupport(order = 7) |
| | | @ApiOperation(value = "逻辑删除", notes = "传入ids") |
| | | public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
| | | return R.status(CodeClstempattrService.removeBatchByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 主题库分类的模板属性列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 主题库分类的模板属性显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplateAttr") |
| | | public DataGrid<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeClassifyTemplateAttrService.gridCodeClassifyTemplateAttr(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | /** |
| | | * 增加 主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public BaseResult<CodeClassifyTemplateAttrVO> addSave(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO){ |
| | | CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = codeClassifyTemplateAttrService.addSave(codeClassifyTemplateAttrDTO); |
| | | return BaseResult.success(codeClassifyTemplateAttrVO); |
| | | } |
| | | /** |
| | | * 主题库分类的模板属性列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 主题库分类的模板属性显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeClassifyTemplateAttr") |
| | | public DataGrid<CodeClassifyTemplateAttrVO> gridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | //String tenantId = AuthUtil.getTenantId().toString(); |
| | | Map<String, String> conditionMap = baseQueryObject.getConditionMap(); |
| | | /*if(Func.isNotEmpty(tenantId)){ |
| | | conditionMap.put("TENANT_ID",tenantId); |
| | | }*/ |
| | | return CodeClstempattrService.gridCodeClassifyTemplateAttr(conditionMap,baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * 批量保存列表数据 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @PostMapping( "/batchAddSave") |
| | | public BaseResult<List<CodeClassifyTemplateAttrVO>> batchAddSaves(@RequestBody List<CodeClassifyTemplateAttrDTO> list){ |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return BaseResult.fail("列表不能为空!"); |
| | | } |
| | | List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOs = codeClassifyTemplateAttrService.batchAddSave(list); |
| | | return BaseResult.success(codeClassifyTemplateAttrVOs); |
| | | } |
| | | /** |
| | | * 增加 主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeClassifyTemplateAttrVO> addSave(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO){ |
| | | CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = CodeClstempattrService.addSave(codeClassifyTemplateAttrDTO); |
| | | return R.data(codeClassifyTemplateAttrVO); |
| | | } |
| | | |
| | | /** |
| | | * 批量保存列表数据 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | @PostMapping( "/batchAddSave") |
| | | public R<List<CodeClassifyTemplateAttrVO>> batchAddSaves(@RequestBody List<CodeClassifyTemplateAttrDTO> list){ |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return R.fail("列表不能为空!"); |
| | | } |
| | | List<CodeClassifyTemplateAttrVO> codeClassifyTemplateAttrVOs = CodeClstempattrService.batchAddSave(list); |
| | | return R.data(codeClassifyTemplateAttrVOs); |
| | | } |
| | | |
| | | /** |
| | | * 修改 主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public BaseResult<CodeClassifyTemplateAttrVO> editSave(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO){ |
| | | return codeClassifyTemplateAttrService.editSave(codeClassifyTemplateAttrDTO); |
| | | } |
| | | /** |
| | | * 修改 主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeClassifyTemplateAttrVO> editSave(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO){ |
| | | return CodeClstempattrService.editSave(codeClassifyTemplateAttrDTO); |
| | | } |
| | | |
| | | /** |
| | | * 删除主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象,oid和ts需要传输 |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeClassifyTemplateAttr(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO) { |
| | | return CodeClstempattrService.deleteCodeClassifyTemplateAttr(codeClassifyTemplateAttrDTO); |
| | | } |
| | | |
| | | /** |
| | | * 删除主题库分类的模板属性 |
| | | * @param codeClassifyTemplateAttrDTO 主题库分类的模板属性数据传输对象,oid和ts需要传输 |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public BaseResult delCodeClassifyTemplateAttr(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyTemplateAttrDTO) { |
| | | return codeClassifyTemplateAttrService.deleteCodeClassifyTemplateAttr(codeClassifyTemplateAttrDTO); |
| | | } |
| | | /** |
| | | * 主键获取主题库分类的模板属性 |
| | | * @param oid 主键 |
| | | * @return 主题库分类的模板属性显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeClassifyTemplateAttrVO> getObjectByOid(String oid){ |
| | | CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = CodeClstempattrService.getObjectByOid(oid); |
| | | return R.data(codeClassifyTemplateAttrVO); |
| | | } |
| | | |
| | | /** |
| | | * 主键获取主题库分类的模板属性 |
| | | * @param oid 主键 |
| | | * @return 主题库分类的模板属性显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public BaseResult<CodeClassifyTemplateAttrVO> getObjectByOid(String oid){ |
| | | CodeClassifyTemplateAttrVO codeClassifyTemplateAttrVO = codeClassifyTemplateAttrService.getObjectByOid(oid); |
| | | return BaseResult.success(codeClassifyTemplateAttrVO); |
| | | } |
| | | /** |
| | | * 主键批量获取主题库分类的模板属性 |
| | | * @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 主题库分类的模板属性显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R listCodeClassifyTemplateAttrByOids(String oids){ |
| | | Collection<CodeClassifyTemplateAttrVO> voCollection = CodeClstempattrService.listCodeClassifyTemplateAttrByOids(VciBaseUtil.str2List(oids)); |
| | | // BaseResult baseResult = BaseResult.success(); |
| | | // baseResult.setData(voCollection); |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | /** |
| | | * 主键批量获取主题库分类的模板属性 |
| | | * @param oids 主键,多个以逗号分隔,但是受性能影响,建议一次查询不超过10000个 |
| | | * @return 主题库分类的模板属性显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public BaseResult<CodeClassifyTemplateAttrVO> listCodeClassifyTemplateAttrByOids(String oids){ |
| | | Collection<CodeClassifyTemplateAttrVO> voCollection = codeClassifyTemplateAttrService.listCodeClassifyTemplateAttrByOids(VciBaseUtil.str2List(oids)); |
| | | BaseResult baseResult = BaseResult.success(); |
| | | baseResult.setData(voCollection); |
| | | return baseResult; |
| | | } |
| | | /** |
| | | * 参照主题库分类的模板属性列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 主题库分类的模板属性显示对象列表,生效的内容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public IPage<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return CodeClstempattrService.refDataGridCodeClassifyTemplateAttr(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * 查询这个业务类型下的所有属性,排除掉这个模板已经存在的属性 |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtm") |
| | | public DataGrid<BtmTypeAttributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | return CodeClstempattrService.codeClassifyTemplateAttrByBtm(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 查询这个业务类型下、这个模板已经存在的属性 |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtmHave") |
| | | public DataGrid<BtmTypeAttributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | return CodeClstempattrService.codeClassifyTemplateAttrByBtmHave(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 参照主题库分类的模板属性列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 主题库分类的模板属性显示对象列表,生效的内容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public DataGrid<CodeClassifyTemplateAttrVO> refDataGridCodeClassifyTemplateAttr(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeClassifyTemplateAttrService.refDataGridCodeClassifyTemplateAttr(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | } |
| | | |
| | | /** |
| | | * 查询这个业务类型下的所有属性,排除掉这个模板已经存在的属性 |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtm") |
| | | public DataGrid<OsBtmTypeAttributeVO> codeClassifyTemplateAttrByBtm(BaseQueryObject baseQueryObject){ |
| | | return codeClassifyTemplateAttrService.codeClassifyTemplateAttrByBtm(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 查询这个业务类型下、这个模板已经存在的属性 |
| | | * @param baseQueryObject |
| | | * @return |
| | | */ |
| | | @GetMapping("/codeClassifyTemplateAttrByBtmHave") |
| | | public DataGrid<OsBtmTypeAttributeVO> codeClassifyTemplateAttrByBtmHave(BaseQueryObject baseQueryObject){ |
| | | return codeClassifyTemplateAttrService.codeClassifyTemplateAttrByBtmHave(baseQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * 同步到其他模板 |
| | | * @param codeClassifyAttrDTO id 英文名称 |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping( "/copyto") |
| | | public BaseResult copyto(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyAttrDTO) { |
| | | return codeClassifyTemplateAttrService.copyto(codeClassifyAttrDTO); |
| | | } |
| | | |
| | | /** |
| | | * 同步到其他模板 |
| | | * @param codeClassifyAttrDTO id 英文名称 |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping( "/copyto") |
| | | public R copyto(@RequestBody CodeClassifyTemplateAttrDTO codeClassifyAttrDTO) { |
| | | return CodeClstempattrService.copyto(codeClassifyAttrDTO); |
| | | } |
| | | |
| | | |
| | | } |