lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/RepairStandardCategoryController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,202 @@ package org.jeecg.modules.eam.controller; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; 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.eam.entity.ProcessParameters; import org.jeecg.modules.eam.entity.ProcessParametersCategory; import org.jeecg.modules.eam.entity.RepairStandard; import org.jeecg.modules.eam.entity.RepairStandardCategory; import org.jeecg.modules.eam.service.IRepairStandardCategoryService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecg.modules.eam.service.IRepairStandardService; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: mom_eam_repair_standard_category * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Api(tags="mom_eam_repair_standard_category") @RestController @RequestMapping("/eam/repairStandardCategory") @Slf4j public class RepairStandardCategoryController extends JeecgController<RepairStandardCategory, IRepairStandardCategoryService> { @Autowired private IRepairStandardCategoryService repairStandardCategoryService; @Autowired private IRepairStandardService repairStandardService; /** * å页å表æ¥è¯¢ * * @param repairStandardCategory * @param pageNo * @param pageSize * @param req * @return */ //@AutoLog(value = "mom_eam_repair_standard_category-å页å表æ¥è¯¢") @ApiOperation(value="mom_eam_repair_standard_category-å页å表æ¥è¯¢", notes="mom_eam_repair_standard_category-å页å表æ¥è¯¢") @GetMapping(value = "/list") public Result<IPage<RepairStandardCategory>> queryPageList(RepairStandardCategory repairStandardCategory, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { QueryWrapper<RepairStandardCategory> queryWrapper = QueryGenerator.initQueryWrapper(repairStandardCategory, req.getParameterMap()); Page<RepairStandardCategory> page = new Page<RepairStandardCategory>(pageNo, pageSize); IPage<RepairStandardCategory> pageList = repairStandardCategoryService.page(page, queryWrapper); return Result.OK(pageList); } /** * æ·»å * * @param repairStandardCategory * @return */ @AutoLog(value = "mom_eam_repair_standard_category-æ·»å ") @ApiOperation(value="mom_eam_repair_standard_category-æ·»å ", notes="mom_eam_repair_standard_category-æ·»å ") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard_category:add") @PostMapping(value = "/add") public Result<String> add(@RequestBody RepairStandardCategory repairStandardCategory) { repairStandardCategoryService.save(repairStandardCategory); return Result.OK("æ·»å æåï¼"); } /** * ç¼è¾ * * @param repairStandardCategory * @return */ @AutoLog(value = "mom_eam_repair_standard_category-ç¼è¾") @ApiOperation(value="mom_eam_repair_standard_category-ç¼è¾", notes="mom_eam_repair_standard_category-ç¼è¾") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard_category:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result<String> edit(@RequestBody RepairStandardCategory repairStandardCategory) { repairStandardCategoryService.updateById(repairStandardCategory); return Result.OK("ç¼è¾æå!"); } /** * éè¿idå é¤ * * @param id * @return */ @AutoLog(value = "mom_eam_repair_standard_category-éè¿idå é¤") @ApiOperation(value="mom_eam_repair_standard_category-éè¿idå é¤", notes="mom_eam_repair_standard_category-éè¿idå é¤") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard_category:delete") @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name="id",required=true) String id) { List<RepairStandard> repairStandardList = repairStandardService.lambdaQuery() .eq(RepairStandard::getRepairStandardCategoryId, id) .eq(RepairStandard::getDelFlag, "0").list(); if(repairStandardList.size()>0){ return Result.error(repairStandardList.size()+""); } repairStandardCategoryService.removeById(id); return Result.OK("å 餿å!"); } /** * æ¹éå é¤ * * @param ids * @return */ @AutoLog(value = "mom_eam_repair_standard_category-æ¹éå é¤") @ApiOperation(value="mom_eam_repair_standard_category-æ¹éå é¤", notes="mom_eam_repair_standard_category-æ¹éå é¤") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard_category:deleteBatch") @DeleteMapping(value = "/deleteBatch") public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.repairStandardCategoryService.removeByIds(Arrays.asList(ids.split(","))); return Result.OK("æ¹éå 餿å!"); } /** * éè¿idæ¥è¯¢ * * @param id * @return */ //@AutoLog(value = "mom_eam_repair_standard_category-éè¿idæ¥è¯¢") @ApiOperation(value="mom_eam_repair_standard_category-éè¿idæ¥è¯¢", notes="mom_eam_repair_standard_category-éè¿idæ¥è¯¢") @GetMapping(value = "/queryById") public Result<RepairStandardCategory> queryById(@RequestParam(name="id",required=true) String id) { RepairStandardCategory repairStandardCategory = repairStandardCategoryService.getById(id); if(repairStandardCategory==null) { return Result.error("æªæ¾å°å¯¹åºæ°æ®"); } return Result.OK(repairStandardCategory); } /** * 导åºexcel * * @param request * @param repairStandardCategory */ //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard_category:exportXls") @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, RepairStandardCategory repairStandardCategory) { return super.exportXls(request, repairStandardCategory, RepairStandardCategory.class, "mom_eam_repair_standard_category"); } /** * éè¿excelå¯¼å ¥æ°æ® * * @param request * @param response * @return */ //@RequiresPermissions("mom_eam_repair_standard_category:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, RepairStandardCategory.class); } /** * @MethodName: loadTree * @Description: æ éåå æ */ @GetMapping("/loadTree") public Result<?> loadTree(HttpServletRequest httpServletRequest) { List<CommonGenericTree> list = repairStandardCategoryService.loadTree(); return Result.ok(list); } } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/RepairStandardController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,195 @@ package org.jeecg.modules.eam.controller; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.eam.entity.ProcessParameters; import org.jeecg.modules.eam.entity.ProcessParametersCategory; import org.jeecg.modules.eam.entity.RepairStandard; import org.jeecg.modules.eam.entity.RepairStandardCategory; import org.jeecg.modules.eam.service.IRepairStandardCategoryService; import org.jeecg.modules.eam.service.IRepairStandardService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecg.common.system.base.controller.JeecgController; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.aspect.annotation.AutoLog; /** * @Description: mom_eam_repair_standard * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Api(tags="mom_eam_repair_standard") @RestController @RequestMapping("/eam/repairStandard") @Slf4j public class RepairStandardController extends JeecgController<RepairStandard, IRepairStandardService> { @Autowired private IRepairStandardService repairStandardService; @Autowired private IRepairStandardCategoryService repairStandardCategoryService; /** * å页å表æ¥è¯¢ * * @param repairStandard * @param pageNo * @param pageSize * @param req * @return */ //@AutoLog(value = "mom_eam_repair_standard-å页å表æ¥è¯¢") @ApiOperation(value="mom_eam_repair_standard-å页å表æ¥è¯¢", notes="mom_eam_repair_standard-å页å表æ¥è¯¢") @GetMapping(value = "/list") public Result<IPage<RepairStandard>> queryPageList(RepairStandard repairStandard, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, HttpServletRequest req) { QueryWrapper<RepairStandard> queryWrapper = QueryGenerator.initQueryWrapper(repairStandard, req.getParameterMap()); Page<RepairStandard> page = new Page<RepairStandard>(pageNo, pageSize); IPage<RepairStandard> pageList = repairStandardService.page(page, queryWrapper); List<RepairStandard> records = pageList.getRecords(); for (RepairStandard record : records) { String repairStandardCategoryId = record.getRepairStandardCategoryId(); RepairStandardCategory standardCategory = repairStandardCategoryService.getById(repairStandardCategoryId); if(standardCategory != null ){ record.setRepairStandardCategoryNumName(standardCategory.getNum()+"/"+ standardCategory.getName()); }else{ record.setRepairStandardCategoryNumName("/"); } } return Result.OK(pageList); } /** * æ·»å * * @param repairStandard * @return */ @AutoLog(value = "mom_eam_repair_standard-æ·»å ") @ApiOperation(value="mom_eam_repair_standard-æ·»å ", notes="mom_eam_repair_standard-æ·»å ") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard:add") @PostMapping(value = "/add") public Result<String> add(@RequestBody RepairStandard repairStandard) { repairStandardService.save(repairStandard); return Result.OK("æ·»å æåï¼"); } /** * ç¼è¾ * * @param repairStandard * @return */ @AutoLog(value = "mom_eam_repair_standard-ç¼è¾") @ApiOperation(value="mom_eam_repair_standard-ç¼è¾", notes="mom_eam_repair_standard-ç¼è¾") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard:edit") @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) public Result<String> edit(@RequestBody RepairStandard repairStandard) { repairStandardService.updateById(repairStandard); return Result.OK("ç¼è¾æå!"); } /** * éè¿idå é¤ * * @param id * @return */ @AutoLog(value = "mom_eam_repair_standard-éè¿idå é¤") @ApiOperation(value="mom_eam_repair_standard-éè¿idå é¤", notes="mom_eam_repair_standard-éè¿idå é¤") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard:delete") @DeleteMapping(value = "/delete") public Result<String> delete(@RequestParam(name="id",required=true) String id) { repairStandardService.removeById(id); return Result.OK("å 餿å!"); } /** * æ¹éå é¤ * * @param ids * @return */ @AutoLog(value = "mom_eam_repair_standard-æ¹éå é¤") @ApiOperation(value="mom_eam_repair_standard-æ¹éå é¤", notes="mom_eam_repair_standard-æ¹éå é¤") //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard:deleteBatch") @DeleteMapping(value = "/deleteBatch") public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { this.repairStandardService.removeByIds(Arrays.asList(ids.split(","))); return Result.OK("æ¹éå 餿å!"); } /** * éè¿idæ¥è¯¢ * * @param id * @return */ //@AutoLog(value = "mom_eam_repair_standard-éè¿idæ¥è¯¢") @ApiOperation(value="mom_eam_repair_standard-éè¿idæ¥è¯¢", notes="mom_eam_repair_standard-éè¿idæ¥è¯¢") @GetMapping(value = "/queryById") public Result<RepairStandard> queryById(@RequestParam(name="id",required=true) String id) { RepairStandard repairStandard = repairStandardService.getById(id); if(repairStandard==null) { return Result.error("æªæ¾å°å¯¹åºæ°æ®"); } return Result.OK(repairStandard); } /** * 导åºexcel * * @param request * @param repairStandard */ //@RequiresPermissions("org.jeecg.modules.mdc:mom_eam_repair_standard:exportXls") @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, RepairStandard repairStandard) { return super.exportXls(request, repairStandard, RepairStandard.class, "mom_eam_repair_standard"); } /** * éè¿excelå¯¼å ¥æ°æ® * * @param request * @param response * @return */ //@RequiresPermissions("mom_eam_repair_standard:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, RepairStandard.class); } } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/RepairStandard.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,61 @@ package org.jeecg.modules.eam.entity; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.Date; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.base.entity.JeecgEntity; import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * @Description: mom_eam_repair_standard * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Data @TableName("mom_eam_repair_standard") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) @ApiModel(value="mom_eam_repair_standard对象", description="mom_eam_repair_standard") public class RepairStandard extends JeecgEntity implements Serializable { private static final long serialVersionUID = 1L; /**num*/ @Excel(name = "num", width = 15) @ApiModelProperty(value = "num") private java.lang.String num; /**name*/ @Excel(name = "name", width = 15) @ApiModelProperty(value = "name") private java.lang.String name; /**delFlag*/ @Excel(name = "delFlag", width = 15) @ApiModelProperty(value = "delFlag") @TableLogic private java.lang.Integer delFlag = CommonConstant.DEL_FLAG_0; /**remark*/ @Excel(name = "remark", width = 15) @ApiModelProperty(value = "remark") private java.lang.String remark; /**repairStandardCategoryId*/ @Excel(name = "repairStandardCategoryId", width = 15) @ApiModelProperty(value = "repairStandardCategoryId") private java.lang.String repairStandardCategoryId; @ApiModelProperty(value = "ç»´ä¿®æ ååç±»ç¼ç /åç§°") @TableField(exist = false) private String repairStandardCategoryNumName; } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/RepairStandardCategory.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,58 @@ package org.jeecg.modules.eam.entity; import java.io.Serializable; import java.io.UnsupportedEncodingException; import java.util.Date; import java.math.BigDecimal; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableLogic; import lombok.Data; import com.fasterxml.jackson.annotation.JsonFormat; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.base.entity.JeecgEntity; import org.springframework.format.annotation.DateTimeFormat; import org.jeecgframework.poi.excel.annotation.Excel; import org.jeecg.common.aspect.annotation.Dict; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** * @Description: mom_eam_repair_standard_category * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Data @TableName("mom_eam_repair_standard_category") @Accessors(chain = true) @EqualsAndHashCode(callSuper = false) @ApiModel(value="mom_eam_repair_standard_category对象", description="mom_eam_repair_standard_category") public class RepairStandardCategory extends JeecgEntity implements Serializable { private static final long serialVersionUID = 1L; /**åç±»ç¼ç */ @Excel(name = "åç±»ç¼ç ", width = 15) @ApiModelProperty(value = "åç±»ç¼ç ") private java.lang.String num; /**åç±»åç§°*/ @Excel(name = "åç±»åç§°", width = 15) @ApiModelProperty(value = "åç±»åç§°") private java.lang.String name; /**delFlag*/ @Excel(name = "delFlag", width = 15) @ApiModelProperty(value = "delFlag") @TableLogic private java.lang.Integer delFlag = CommonConstant.DEL_FLAG_0; /**remark*/ @Excel(name = "remark", width = 15) @ApiModelProperty(value = "remark") private java.lang.String remark; /**parentId*/ @Excel(name = "parentId", width = 15) @ApiModelProperty(value = "parentId") private java.lang.String parentId; } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/RepairStandardCategoryMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ package org.jeecg.modules.eam.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.eam.entity.RepairStandardCategory; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: mom_eam_repair_standard_category * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ public interface RepairStandardCategoryMapper extends BaseMapper<RepairStandardCategory> { } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/RepairStandardMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,17 @@ package org.jeecg.modules.eam.mapper; import java.util.List; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.eam.entity.RepairStandard; import com.baomidou.mybatisplus.core.mapper.BaseMapper; /** * @Description: mom_eam_repair_standard * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ public interface RepairStandardMapper extends BaseMapper<RepairStandard> { } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairStandardCategoryMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.mdc.eam.mapper.RepairStandardCategoryMapper"> </mapper> lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/RepairStandardMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.mdc.eam.mapper.RepairStandardMapper"> </mapper> lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IRepairStandardCategoryService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package org.jeecg.modules.eam.service; import org.jeecg.common.api.vo.CommonGenericTree; import org.jeecg.modules.eam.entity.RepairStandardCategory; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; /** * @Description: mom_eam_repair_standard_category * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ public interface IRepairStandardCategoryService extends IService<RepairStandardCategory> { public List<CommonGenericTree> loadTree(); } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IRepairStandardService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ package org.jeecg.modules.eam.service; import org.jeecg.modules.eam.entity.RepairStandard; import com.baomidou.mybatisplus.extension.service.IService; /** * @Description: mom_eam_repair_standard * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ public interface IRepairStandardService extends IService<RepairStandard> { } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/RepairStandardCategoryServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,222 @@ package org.jeecg.modules.eam.service.impl; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import org.jeecg.common.api.vo.CommonGenericTree; import org.jeecg.modules.eam.entity.ProcessParametersCategory; import org.jeecg.modules.eam.entity.RepairStandardCategory; import org.jeecg.modules.eam.mapper.RepairStandardCategoryMapper; import org.jeecg.modules.eam.service.IRepairStandardCategoryService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @Description: mom_eam_repair_standard_category * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Service public class RepairStandardCategoryServiceImpl extends ServiceImpl<RepairStandardCategoryMapper, RepairStandardCategory> implements IRepairStandardCategoryService { @Override public List<CommonGenericTree> loadTree() { List<RepairStandardCategory> repairStandardCategoryList = this.lambdaQuery().eq(RepairStandardCategory::getDelFlag, "0").list(); List<CommonGenericTree> commonGenericTrees = loadTree(repairStandardCategoryList); return commonGenericTrees; } @SuppressWarnings("unchecked") public List<CommonGenericTree> loadTree(List<RepairStandardCategory> repairStandardCategoryList) { @SuppressWarnings("unused") RepairStandardCategory repairStandardCategory = new RepairStandardCategory(); List<CommonGenericTree> list = new ArrayList<>(); Map<String, CommonGenericTree> map = new HashMap<>(); Map<String, CommonGenericTree> map2 = new HashMap<>(); Map<String, CommonGenericTree> map3 = new HashMap<>(); Map<String, CommonGenericTree> map4 = new HashMap<>(); Map<String, CommonGenericTree> map5 = new HashMap<>(); Map<String, CommonGenericTree> map6 = new HashMap<>(); Map<String, CommonGenericTree> map7 = new HashMap<>(); CommonGenericTree<RepairStandardCategory> node = new CommonGenericTree<>(); node.setKey("-1"); node.setValue("-1"); node.setTitle("ç»´ä¿®æ ååç±»"); node.setRField1(""); node.setRField2(""); node.setDisabled(false); node.setEntity(new RepairStandardCategory()); list.add(node); if (CollectionUtils.isNotEmpty(list)) { CommonGenericTree<RepairStandardCategory> pcNode; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (standardCategory.getParentId().equals("-1")) { pcNode = new CommonGenericTree<>(); pcNode.setKey(standardCategory.getId()); pcNode.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); pcNode.setParentId(node.getKey()); pcNode.setIcon(""); pcNode.setType(0); pcNode.setValue(standardCategory.getId()); pcNode.setDisabled(false); pcNode.setRField1(standardCategory.getNum()); pcNode.setRField2(standardCategory.getName()); pcNode.setEntity(standardCategory); node.addChildren(pcNode); map.put(standardCategory.getId(), pcNode); } } CommonGenericTree<RepairStandardCategory> childNode; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map.containsKey(standardCategory.getParentId())) { pcNode = map.get(standardCategory.getParentId()); childNode = new CommonGenericTree<>(); childNode.setKey(standardCategory.getId()); childNode.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); childNode.setParentId(standardCategory.getParentId()); childNode.setIcon(""); childNode.setType(0); childNode.setValue(standardCategory.getId()); childNode.setDisabled(false); childNode.setRField1(standardCategory.getNum()); childNode.setRField2(standardCategory.getName()); childNode.setEntity(standardCategory); pcNode.addChildren(childNode); map2.put(standardCategory.getId(), childNode); } } if(map2.size()>0){ CommonGenericTree<RepairStandardCategory> child2Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map2.containsKey(standardCategory.getParentId())) { pcNode = map2.get(standardCategory.getParentId()); child2Node = new CommonGenericTree<>(); child2Node.setKey(standardCategory.getId()); child2Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child2Node.setParentId(standardCategory.getParentId()); child2Node.setIcon(""); child2Node.setType(0); child2Node.setValue(standardCategory.getId()); child2Node.setDisabled(false); child2Node.setRField1(standardCategory.getNum()); child2Node.setRField2(standardCategory.getName()); child2Node.setEntity(standardCategory); pcNode.addChildren(child2Node); map3.put(standardCategory.getId(), child2Node); } } if(map3.size()>0){ CommonGenericTree<RepairStandardCategory> child3Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map3.containsKey(standardCategory.getParentId())) { pcNode = map3.get(standardCategory.getParentId()); child3Node = new CommonGenericTree<>(); child3Node.setKey(standardCategory.getId()); child3Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child3Node.setParentId(standardCategory.getParentId()); child3Node.setIcon(""); child3Node.setType(0); child3Node.setValue(standardCategory.getId()); child3Node.setDisabled(false); child3Node.setRField1(standardCategory.getNum()); child3Node.setRField2(standardCategory.getName()); child3Node.setEntity(standardCategory); pcNode.addChildren(child3Node); map4.put(standardCategory.getId(), child3Node); } } if(map4.size()>0){ CommonGenericTree<RepairStandardCategory> child4Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map4.containsKey(standardCategory.getParentId())) { pcNode = map4.get(standardCategory.getParentId()); child4Node = new CommonGenericTree<>(); child4Node.setKey(standardCategory.getId()); child4Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child4Node.setParentId(standardCategory.getParentId()); child4Node.setIcon(""); child4Node.setType(0); child4Node.setValue(standardCategory.getId()); child4Node.setDisabled(false); child4Node.setRField1(standardCategory.getNum()); child4Node.setRField2(standardCategory.getName()); child4Node.setEntity(standardCategory); pcNode.addChildren(child4Node); map5.put(standardCategory.getId(), child4Node); } } if(map5.size()>0){ CommonGenericTree<RepairStandardCategory> child5Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map5.containsKey(standardCategory.getParentId())) { pcNode = map5.get(standardCategory.getParentId()); child5Node = new CommonGenericTree<>(); child5Node.setKey(standardCategory.getId()); child5Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child5Node.setParentId(standardCategory.getParentId()); child5Node.setIcon(""); child5Node.setType(0); child5Node.setValue(standardCategory.getId()); child5Node.setDisabled(false); child5Node.setRField1(standardCategory.getNum()); child5Node.setRField2(standardCategory.getName()); child5Node.setEntity(standardCategory); pcNode.addChildren(child5Node); map6.put(standardCategory.getId(), child5Node); } } if(map6.size()>0){ CommonGenericTree<RepairStandardCategory> child6Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map6.containsKey(standardCategory.getParentId())) { pcNode = map6.get(standardCategory.getParentId()); child6Node = new CommonGenericTree<>(); child6Node.setKey(standardCategory.getId()); child6Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child6Node.setParentId(standardCategory.getParentId()); child6Node.setIcon(""); child6Node.setType(0); child6Node.setValue(standardCategory.getId()); child6Node.setDisabled(false); child6Node.setRField1(standardCategory.getNum()); child6Node.setRField2(standardCategory.getName()); child6Node.setEntity(standardCategory); pcNode.addChildren(child6Node); map7.put(standardCategory.getId(), child6Node); } } if(map7.size()>0){ CommonGenericTree<RepairStandardCategory> child7Node; for (RepairStandardCategory standardCategory : repairStandardCategoryList) { if (map.containsKey(standardCategory.getParentId())) { pcNode = map7.get(standardCategory.getParentId()); child7Node = new CommonGenericTree<>(); child7Node.setKey(standardCategory.getId()); child7Node.setTitle(standardCategory.getNum() + "/" + standardCategory.getName()); child7Node.setParentId(standardCategory.getParentId()); child7Node.setIcon(""); child7Node.setType(0); child7Node.setValue(standardCategory.getId()); child7Node.setDisabled(false); child7Node.setRField1(standardCategory.getNum()); child7Node.setRField2(standardCategory.getName()); child7Node.setEntity(standardCategory); // pcNode.addChildren(child7Node); // map7.put(cause.getId(), child7Node); } } } } } } } } } return list; } } lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/RepairStandardServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package org.jeecg.modules.eam.service.impl; import org.jeecg.modules.eam.entity.RepairStandard; import org.jeecg.modules.eam.mapper.RepairStandardMapper; import org.jeecg.modules.eam.service.IRepairStandardService; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @Description: mom_eam_repair_standard * @Author: jeecg-boot * @Date: 2024-07-08 * @Version: V1.0 */ @Service public class RepairStandardServiceImpl extends ServiceImpl<RepairStandardMapper, RepairStandard> implements IRepairStandardService { }