¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.vci.ubcs.code.controller; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.vci.ubcs.code.dto.CodeClassifyValueDTO; |
| | | import com.vci.ubcs.code.service.ICodeClassifyValueService; |
| | | import com.vci.ubcs.code.vo.pagemodel.CodeClassifyValueVO; |
| | | import com.vci.ubcs.starter.revision.model.TreeQueryObject; |
| | | |
| | | import com.vci.ubcs.starter.web.pagemodel.Tree; |
| | | import com.vci.ubcs.starter.web.util.VciBaseUtil; |
| | | 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 |
| | | * @date 2022-01-24 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/codeClassifyValueController") |
| | | public class CodeClassifyValueController { |
| | | /** |
| | | * åç±»ç æ®µçç å¼ æå¡ |
| | | */ |
| | | @Autowired |
| | | private ICodeClassifyValueService codeClassifyValueService; |
| | | |
| | | /** |
| | | * åç±»ç æ®µçç 弿 |
| | | * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | * @return åç±»ç æ®µçç 弿¾ç¤ºæ |
| | | */ |
| | | @GetMapping("/treeCodeClassifyValue") |
| | | public List<Tree> treeCodeClassifyValue(TreeQueryObject treeQueryObject) { |
| | | return codeClassifyValueService.treeCodeClassifyValue(treeQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * å¢å åç±»ç æ®µçç å¼ |
| | | * @param codeClassifyValueDTO åç±»ç æ®µçç 弿°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PostMapping( "/addSave") |
| | | public R<CodeClassifyValueVO> addSave(@RequestBody CodeClassifyValueDTO codeClassifyValueDTO){ |
| | | return R.status(codeClassifyValueService.addSave(codeClassifyValueDTO)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ åç±»ç æ®µçç å¼ |
| | | * @param codeClassifyValueDTO åç±»ç æ®µçç 弿°æ®ä¼ è¾å¯¹è±¡ |
| | | * @return æ§è¡ç»æï¼success为true表示æåï¼msgæ¯å¤±è´¥çæç¤ºä¿¡æ¯ï¼objæ¯æ·»å 宿åçæ¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @PutMapping("/editSave") |
| | | public R<CodeClassifyValueVO> editSave(@RequestBody CodeClassifyValueDTO codeClassifyValueDTO){ |
| | | return R.status(codeClassifyValueService.editSave(codeClassifyValueDTO)); |
| | | } |
| | | |
| | | /** |
| | | * æ£æ¥ åç±»ç æ®µçç 弿¯å¦å é¤ |
| | | * @param codeClassifyValueDTO åç±»ç æ®µçç 弿°æ®ä¼ è¾å¯¹è±¡ï¼å¿
é¡»è¦æoidåts屿§ |
| | | * @return æ§è¡ç»æ success为true为å¯ä»¥å é¤ï¼falseè¡¨ç¤ºææ°æ®å¼ç¨ï¼obj为true表示æä¸çº§ |
| | | */ |
| | | @PostMapping( "/checkIsCanDelete") |
| | | public R checkIsCanDelete(CodeClassifyValueDTO codeClassifyValueDTO) { |
| | | return codeClassifyValueService.checkIsCanDelete(codeClassifyValueDTO); |
| | | } |
| | | |
| | | /** |
| | | * å é¤åç±»ç æ®µçç å¼ |
| | | * @param codeClassifyValueDTO åç±»ç æ®µçç 弿°æ®ä¼ è¾å¯¹è±¡ï¼oidåtséè¦ä¼ è¾ |
| | | * @return å é¤ç»æåé¦ï¼ï¼successï¼æåï¼failï¼å¤±è´¥ |
| | | */ |
| | | @DeleteMapping( "/deleteData") |
| | | public R delCodeClassifyValue(@Valid @RequestBody CodeClassifyValueDTO codeClassifyValueDTO) { |
| | | return codeClassifyValueService.deleteCodeClassifyValue(codeClassifyValueDTO); |
| | | } |
| | | |
| | | /** |
| | | * 主é®è·ååç±»ç æ®µçç å¼ |
| | | * @param oid ä¸»é® |
| | | * @return åç±»ç æ®µçç 弿¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/getObjectByOid") |
| | | public R<CodeClassifyValueVO> getObjectByOid(String oid){ |
| | | CodeClassifyValueVO codeClassifyValueVO = codeClassifyValueService.getObjectByOid(oid); |
| | | return R.data(codeClassifyValueVO); |
| | | } |
| | | |
| | | /** |
| | | * 䏻鮿¹éè·ååç±»ç æ®µçç å¼ |
| | | * @param oids 主é®ï¼å¤ä¸ªä»¥éå·åéï¼ä½æ¯åæ§è½å½±åï¼å»ºè®®ä¸æ¬¡æ¥è¯¢ä¸è¶
è¿10000个 |
| | | * @return åç±»ç æ®µçç 弿¾ç¤ºå¯¹è±¡ |
| | | */ |
| | | @GetMapping("/listDataByOids") |
| | | public R<Collection<CodeClassifyValueVO>> listCodeClassifyValueByOids(String oids){ |
| | | Collection<CodeClassifyValueVO> voCollection = codeClassifyValueService.listCodeClassifyValueByOids(VciBaseUtil.str2List(oids)); |
| | | return R.data(voCollection); |
| | | } |
| | | |
| | | /** |
| | | * åç
§æ åç±»ç æ®µçç å¼ |
| | | * @param treeQueryObject æ å½¢æ¥è¯¢å¯¹è±¡ |
| | | * @return åç±»ç æ®µçç 弿¾ç¤ºæ |
| | | */ |
| | | @GetMapping("/referTree") |
| | | public List<Tree> referTree(TreeQueryObject treeQueryObject) { |
| | | return codeClassifyValueService.referTree(treeQueryObject); |
| | | } |
| | | |
| | | /** |
| | | * ä¿å页é¢ä¸çåç±»ç æ®µç å¼ï¼ä¸»è¦æ¯ä¿ååºå·ç¨äºæåºãå¦ææ°æ®åºä¸åå¨é¡µé¢ä¼ è¾å¯¹è±¡éåä¸ä¸åå¨çå¼ï¼åå é¤ã |
| | | * @param param åæ°ï¼å
æ¬dtoList 页é¢ä¼ è¾å¯¹è±¡éå åcodeclassifysecoid åç±»ç æ®µä¸»é® |
| | | * @return æ§è¡ç»æ |
| | | */ |
| | | @PostMapping("/saveOrder") |
| | | public R saveOrder(@RequestBody Map<String,Object> param){ |
| | | JSONArray json = JSONArray.parseArray(String.valueOf(param.get("dtoList"))); |
| | | List<CodeClassifyValueDTO> dtoList = new ArrayList<>(); |
| | | for (int i = 0; i < json.size(); i++) { |
| | | CodeClassifyValueDTO codeFixedValueDTO = JSONObject.toJavaObject(JSONObject.parseObject(JSONObject.toJSONString(json.get(i))), CodeClassifyValueDTO.class); |
| | | dtoList.add(codeFixedValueDTO); |
| | | } |
| | | String codeclassifysecoid = (String) param.get("codeclassifysecoid"); |
| | | VciBaseUtil.alertNotNull(dtoList,"ç å¼éå"); |
| | | if (CollectionUtils.isEmpty(dtoList)){ |
| | | return R.success(""); |
| | | } |
| | | return codeClassifyValueService.batchSave4Order(dtoList,codeclassifysecoid); |
| | | } |
| | | |
| | | } |