| | |
| | | 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("添加成功!"); |
| | |
| | | //@RequiresPermissions("org.jeecg.modules:tms_tools_classify:exportXls") |
| | | @RequestMapping(value = "/exportXls") |
| | | public ModelAndView exportXls(HttpServletRequest request, ToolsClassify toolsClassify) { |
| | | return super.exportXls(request, toolsClassify, ToolsClassify.class, "tms_tools_classify"); |
| | | return this.toolsClassifyService.toolClassifyExport(request, toolsClassify, ToolsClassify.class, "工具分类"); |
| | | //return super.exportXls(request, toolsClassify, ToolsClassify.class, "tms_tools_classify"); |
| | | } |
| | | |
| | | /** |
| | | * 通过excel导入数据 |
| | | * |
| | | * @param request |
| | | * @param response |
| | | * @return |
| | | */ |
| | | //@RequiresPermissions("tms_tools_classify:importExcel") |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | return super.importExcel(request, response, ToolsClassify.class); |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) throws IOException{ |
| | | return this.toolsClassifyService.toolClassifyImportExcel(request,response); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @AutoLog(value = "工具分类树") |
| | | @ApiOperation(value = "工具分类树", notes = "工具分类树") |
| | | @GetMapping("/loadTree") |