| | |
| | | package org.jeecg.modules.tms.controller; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.jeecg.common.api.vo.CommonGenericTree; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.jeecg.modules.tms.entity.ToolsClassify; |
| | | import org.jeecg.modules.tms.entity.Warehouse; |
| | | import org.jeecg.modules.tms.service.IToolsClassifyService; |
| | |
| | | public class ToolsClassifyController extends JeecgController<ToolsClassify, IToolsClassifyService> { |
| | | @Autowired |
| | | private IToolsClassifyService toolsClassifyService; |
| | | |
| | | @Autowired |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | //@RequiresPermissions("org.jeecg.modules:tms_tools_classify:add") |
| | | @PostMapping(value = "/add") |
| | | public Result<String> add(@RequestBody ToolsClassify toolsClassify) { |
| | | //根据编码规则生成工具分类编码 |
| | | if("1".equals(toolsClassify.getEncodingType())){ |
| | | toolsClassify.setClassifyId(businessCodeRuleService.generateBusinessCodeSeq("ToolsClassify")); |
| | | }else if("2".equals(toolsClassify.getEncodingType())){ |
| | | String classifyIds = ""; |
| | | String classifyId = toolsClassify.getClassifyId(); |
| | | String parentId = toolsClassify.getParentId(); |
| | | while (StringUtils.isNotBlank(classifyId)){ |
| | | classifyIds = classifyId+classifyIds; |
| | | //获取父节点的编码 |
| | | ToolsClassify parentToolsClassify = toolsClassifyService.getById(parentId); |
| | | if(parentToolsClassify != null && StringUtils.isNotBlank(parentToolsClassify.getClassifyId()) && !"0".equals(parentToolsClassify.getClassifyId())){ |
| | | classifyId = parentToolsClassify.getClassifyId(); |
| | | parentId = parentToolsClassify.getParentId(); |
| | | }else{ |
| | | classifyId = ""; |
| | | } |
| | | } |
| | | toolsClassify.setClassifyId(classifyIds); |
| | | }else if("3".equals(toolsClassify.getEncodingType())){ |
| | | toolsClassify.setClassifyId(toolsClassify.getClassifyId()); |
| | | } |
| | | toolsClassify.setStatus("1"); |
| | | toolsClassifyService.save(toolsClassify); |
| | | return Result.OK("添加成功!"); |