| | |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.ubcs.code.service.CodeFixedValueServiceI; |
| | | 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.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import com.vci.ubcs.code.dto.CodeFixedValueDTO; |
| | | import com.vci.ubcs.code.entity.CodeFixedValue; |
| | | import com.vci.ubcs.code.service.ICodeFixedValueService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeFixedValueVO; |
| | | 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.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | | * 固定码段的码值控制器 |
| | | * |
| | | * @author weidy |
| | | * @author ludc |
| | | * @date 2022-01-24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/codeFixedValueController") |
| | | @Api(value = "固定码段的码值控制器", tags = "固定码段的码值控制器") |
| | | public class CodeFixedValueController { |
| | | |
| | | /** |
| | | * 固定码段的码值 服务 |
| | | */ |
| | | @Autowired |
| | | private CodeFixedValueServiceI codeFixedValueService; |
| | | private ICodeFixedValueService codeFixedValueService; |
| | | |
| | | /** |
| | | * 固定码段的码值列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param codeFixedValueVO query 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 固定码段的码值显示对象列表 |
| | | */ |
| | | @GetMapping("/gridCodeFixedValue") |
| | | public DataGrid<CodeFixedValueVO> gridCodeFixedValue(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeFixedValueService.gridCodeFixedValue(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "固定码段的码值列表", notes = "CodeFixedValueVO") |
| | | public R<IPage<CodeFixedValueVO>> gridCodeFixedValue(CodeFixedValueVO codeFixedValueVO, Query query){ |
| | | return R.data(codeFixedValueService.gridCodeFixedValue(codeFixedValueVO, Condition.getPage(query.setAscs("orderNum")))); |
| | | } |
| | | |
| | | /** |
| | | * 增加 固定码段的码值 |
| | | * @param codeFixedValueDTO 固定码段的码值数据传输对象 |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public BaseResult<CodeFixedValueVO> addSave(@RequestBody CodeFixedValueDTO codeFixedValueDTO){ |
| | | CodeFixedValueVO codeFixedValueVO = codeFixedValueService.addSave(codeFixedValueDTO); |
| | | return BaseResult.success(codeFixedValueVO); |
| | | public R addSave(@RequestBody CodeFixedValueDTO codeFixedValueDTO){ |
| | | boolean resBoolean = codeFixedValueService.addSave(codeFixedValueDTO); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 执行结果,success为true表示成功,msg是失败的提示信息,obj是添加完成后的显示对象 |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public BaseResult<CodeFixedValueVO> editSave(@RequestBody CodeFixedValueDTO codeFixedValueDTO){ |
| | | CodeFixedValueVO codeFixedValueVO = codeFixedValueService.editSave(codeFixedValueDTO); |
| | | return BaseResult.success(codeFixedValueVO); |
| | | public R editSave(@RequestBody CodeFixedValueDTO codeFixedValueDTO){ |
| | | boolean resBoolean = codeFixedValueService.editSave(codeFixedValueDTO); |
| | | return R.status(resBoolean); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除固定码段的码值 |
| | |
| | | * @return 删除结果反馈::success:成功,fail:失败 |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public BaseResult delCodeFixedValue( CodeFixedValueDTO codeFixedValueDTO) { |
| | | public R delCodeFixedValue(@Valid @RequestBody CodeFixedValueDTO codeFixedValueDTO) { |
| | | return codeFixedValueService.deleteCodeFixedValue(codeFixedValueDTO); |
| | | } |
| | | |
| | |
| | | * @return 固定码段的码值显示对象 |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public BaseResult<CodeFixedValueVO> getObjectByOid(String oid){ |
| | | public R<CodeFixedValueVO> getObjectByOid(String oid){ |
| | | CodeFixedValueVO codeFixedValueVO = codeFixedValueService.getObjectByOid(oid); |
| | | return BaseResult.success(codeFixedValueVO); |
| | | return R.data(codeFixedValueVO); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 固定码段的码值显示对象 |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public BaseResult<CodeFixedValueVO> listCodeFixedValueByOids(String oids){ |
| | | public R<Collection<CodeFixedValueVO>> listCodeFixedValueByOids(String oids){ |
| | | Collection<CodeFixedValueVO> voCollection = codeFixedValueService.listCodeFixedValueByOids(VciBaseUtil.str2List(oids)); |
| | | BaseResult baseResult = BaseResult.success(); |
| | | baseResult.setData(voCollection); |
| | | return baseResult; |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 参照固定码段的码值列表 |
| | | * @param baseQueryObject 基础查询对象,包含查询条件,分页,排序等 |
| | | * @param codeFixedValueVO query 基础查询对象,包含查询条件,分页,排序等 |
| | | * @return 固定码段的码值显示对象列表,生效的内容 |
| | | */ |
| | | @GetMapping("/refDataGrid") |
| | | public DataGrid<CodeFixedValueVO> refDataGridCodeFixedValue(BaseQueryObject baseQueryObject){ |
| | | if(baseQueryObject == null){ |
| | | baseQueryObject = new BaseQueryObject(); |
| | | } |
| | | return codeFixedValueService.refDataGridCodeFixedValue(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); |
| | | public R<IPage<CodeFixedValueVO>> refDataGridCodeFixedValue(CodeFixedValueVO codeFixedValueVO, Query query){ |
| | | return R.data(codeFixedValueService.refDataGridCodeFixedValue(codeFixedValueVO,Condition.getPage(query.setAscs("ordernum")))); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return 执行结果 |
| | | */ |
| | | @PostMapping("/saveOrder") |
| | | public BaseResult<CodeFixedValueVO> batchSave4Order(@RequestBody Map<String,Object> param){ |
| | | JSONArray json = JSONArray.parseArray(String.valueOf(param.get("dtoList"))); |
| | | public R batchSave4Order(@RequestBody Map<String,Object> param){ |
| | | JSONArray json = JSONArray.parseArray(String.valueOf(param.get("dtoList"))); |
| | | List<CodeFixedValueDTO> dtoList = new ArrayList<>(); |
| | | for (int i = 0; i < json.size(); i++) { |
| | | CodeFixedValueDTO codeFixedValueDTO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(json.get(i))), CodeFixedValueDTO.class); |
| | | dtoList.add(codeFixedValueDTO); |
| | | } |
| | | String codefixedsecoid = (String) param.get("codefixedsecoid"); |
| | | String codefixedsecoid = (String) param.get("codeFixedSecOid"); |
| | | VciBaseUtil.alertNotNull(dtoList,"码值对象集合",codefixedsecoid,"固定码段的主键"); |
| | | if (CollectionUtils.isEmpty(dtoList)){ |
| | | return codeFixedValueService.batchDeleteBySecOid(codefixedsecoid); |
| | | return R.status(codeFixedValueService.batchDeleteBySecOid(codefixedsecoid)); |
| | | } |
| | | return codeFixedValueService.batchSave4Order(dtoList,codefixedsecoid); |
| | | } |