| | |
| | | return Result.success(link1); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页表格", tags = "123") |
| | | @ApiOperation(value = "分页表格") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(name = "pageNo", value = "起始页", dataTypeClass = Integer.class, required = true), |
| | | @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true), |
| | |
| | | |
| | | <select id="getLinkBasicPage" resultType="map"> |
| | | SELECT l.`id`, l.`entrust_coding`, l.`entrusted`, d.`samples_number`, d.`sample_name`, d.`specifications_models`, |
| | | DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, l.`completion_deadline`, l.`contacts`, d.`date_survey`, d.`inspection_status` |
| | | DATE_FORMAT(l.`inspection_time`,'%Y-%m-%d') inspectionTime, DATE_FORMAT(l.`completion_deadline`,'%Y-%m-%d') inspectionTime, l.`contacts`, d.`date_survey`, d.`inspection_status` |
| | | FROM link_basic_information l, link_detection d |
| | | WHERE l.`id` = d.`link_basic_id` |
| | | AND l.`state` = 1 |
| | |
| | | @Autowired |
| | | private ClassifyService classifyService; |
| | | |
| | | @ApiOperation("添加分类:如果选择了name即添加的为子节点数据;如果没有选择即添加的为父节点数据;后台处理") |
| | | @ApiOperation("添加分类") |
| | | @PostMapping("/add") |
| | | public Result<?> addClassifyInformation(@RequestBody Classify classify) { |
| | | if (ObjectUtils.isEmpty(classify.getSonName())){ |
| | | return Result.fail("请填写分类名称!"); |
| | | } |
| | | Integer isAddClassifySuccess = classifyService.addClassifyInformation(classify); |
| | | if (isAddClassifySuccess == 1) { |
| | | if (ObjectUtils.isEmpty(classify.getSonName())){ |
| | | return Result.success("添加父级【"+ classify.getFatherName() +"】分类成功!"); |
| | | } |
| | | return Result.success("添加分类【"+ classify.getSonName() +"】成功!"); |
| | | } else if (isAddClassifySuccess == 2){ |
| | | return Result.fail("抱歉重复添加父级【"+ classify.getFatherName() +"】分类,添加失败!"); |
| | | } else if (isAddClassifySuccess == 3) { |
| | | return Result.fail("抱歉重复添加子级【"+ classify.getSonName() +"】,添加失败!"); |
| | | } else if (isAddClassifySuccess == 2) { |
| | | return Result.fail("抱歉重复添加分类名称【"+ classify.getSonName() +"】,添加失败!"); |
| | | } |
| | | return Result.fail("添加分类【"+ classify.getSonName() +"】失败!"); |
| | | } |
| | |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | |
| | | /** |
| | | * <p> |
| | | * |
| | |
| | | @ApiModelProperty(value = "分类父名称", example = "温度测量仪表") |
| | | private String fatherName; |
| | | |
| | | @NotBlank(message = "名称不允许为空!") |
| | | @ApiModelProperty(value = "分类子名称", example = "体温计",required = true) |
| | | private String sonName; |
| | | |
| | |
| | | |
| | | @Override |
| | | public Integer addClassifyInformation(Classify classify) { |
| | | if (ObjectUtils.isEmpty(classify.getFatherName())){ |
| | | classify.setFatherName(classify.getSonName()); |
| | | classify.setSonName(null); |
| | | LambdaQueryWrapper<Classify> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Classify::getFatherName, classify.getFatherName()); |
| | | wrapper.isNull(Classify::getSonName); |
| | | wrapper.eq(Classify::getState, 1); |
| | | Classify classify1 = classifyMapper.selectOne(wrapper); |
| | | if (ObjectUtils.isEmpty(classify1)){ |
| | | return classifyMapper.insert(classify); |
| | | } |
| | | return 2; |
| | | } |
| | | LambdaQueryWrapper<Classify> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Classify::getFatherName, classify.getFatherName()); |
| | | wrapper.eq(Classify::getSonName, classify.getSonName()); |
| | |
| | | if (ObjectUtils.isEmpty(classify1)){ |
| | | return classifyMapper.insert(classify); |
| | | } else { |
| | | return 3; |
| | | return 2; |
| | | } |
| | | } |
| | | |
| | |
| | | return Result.fail("删除失败!"); |
| | | } |
| | | |
| | | @ApiOperation("侧边栏四级展开") |
| | | @ApiOperation(value = "标准库-->物料-->侧边栏四级展开", tags = "⭐⭐⭐后端调整") |
| | | @ApiImplicitParams(value = { |
| | | @ApiImplicitParam(value = "型号/型号名称", name = "specificationName", dataTypeClass = String.class) |
| | | }) |
| | |
| | | |
| | | //根据物料id查询物料信息 |
| | | Map selectMaterialById(String materialId); |
| | | |
| | | // 四级树 |
| | | List<Map<String, Object>> FourTree(String specificationsName); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> getFourLevelInformation(String specificationName) { |
| | | LambdaQueryWrapper<Material> typeWrapper = new LambdaQueryWrapper<>(); |
| | | typeWrapper.groupBy(Material::getType); |
| | | typeWrapper.select(Material::getType); |
| | | List<Map<String, Object>> typeMaps = materialMapper.selectMaps(typeWrapper); |
| | | for (Map<String, Object> typeMap : typeMaps){ |
| | | LambdaQueryWrapper<Material> materialWrapper = new LambdaQueryWrapper<>(); |
| | | materialWrapper.eq(Material::getType, typeMap.get("type")); |
| | | materialWrapper.select(Material::getId, Material::getName); |
| | | List<Map<String, Object>> materialMaps = materialMapper.selectMaps(materialWrapper); |
| | | if (!ObjectUtils.isEmpty(materialMaps)){ |
| | | for (Map<String, Object> materialMap : materialMaps){ |
| | | LambdaQueryWrapper<Standard> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(Standard::getMaterialId, materialMap.get("id")); |
| | | wrapper.select(Standard::getId, Standard::getName); |
| | | List<Map<String, Object>> standardMaps = standardService.listMaps(wrapper); |
| | | if (!ObjectUtils.isEmpty(standardMaps)){ |
| | | for (Map<String, Object> standardMap : standardMaps){ |
| | | LambdaQueryWrapper<Specifications> specificationWrapper = new LambdaQueryWrapper<>(); |
| | | specificationWrapper.eq(Specifications::getStandardId, standardMap.get("id")); |
| | | if (!ObjectUtils.isEmpty(specificationName)){ |
| | | specificationWrapper.eq(Specifications::getName, specificationName); |
| | | } |
| | | specificationWrapper.select(Specifications::getId, Specifications::getName); |
| | | List<Map<String, Object>> specificationsMaps = specificationsService.listMaps(specificationWrapper); |
| | | if (!ObjectUtils.isEmpty(specificationsMaps)){ |
| | | standardMap.put("children", specificationsMaps); |
| | | } else { |
| | | standardMap.put("children", null); |
| | | } |
| | | } |
| | | materialMap.put("children", standardMaps); |
| | | } else { |
| | | materialMap.put("children", null); |
| | | } |
| | | } |
| | | typeMap.put("children", materialMaps); |
| | | } else { |
| | | typeMap.put("children", null); |
| | | } |
| | | } |
| | | return typeMaps; |
| | | return materialMapper.FourTree(specificationName); |
| | | } |
| | | } |
| | |
| | | and s.serial_id = sn.id |
| | | and m.id=#{materialId} |
| | | </select> |
| | | |
| | | <resultMap id="OneLevelTreeMap" type="Map"> |
| | | <id property="id" column="materialId"/> |
| | | <result property="name" column="materialName"/> |
| | | <collection property="children" resultMap="TwoLevelTreeMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TwoLevelTreeMap" type="Map"> |
| | | <id property="id" column="standardId"/> |
| | | <result property="name" column="standardName"/> |
| | | <collection property="children" resultMap="ThreeLevelTreeMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="ThreeLevelTreeMap" type="Map"> |
| | | <id property="id" column="specificationsId"/> |
| | | <result property="name" column="specificationsName"/> |
| | | <collection property="children" resultMap="FourLevelTreeMap" javaType="List"/> |
| | | </resultMap> |
| | | |
| | | <resultMap id="FourLevelTreeMap" type="Map"> |
| | | <id property="id" column="productId"/> |
| | | <result property="name" column="productName"/> |
| | | </resultMap> |
| | | |
| | | <select id="FourTree" resultMap="OneLevelTreeMap"> |
| | | SELECT m.`id` materialId, m.`name` materialName, s.`id` standardId, s.`name` standardName, |
| | | f.`id` specificationsId, f.`name` specificationsName, p.`id` productId, p.`name` productName |
| | | FROM material m |
| | | LEFT JOIN (SELECT s.`id`, s.`name`, s.`material_id` FROM standard s WHERE s.`state` = 1) s ON m.id = s.`material_id` |
| | | LEFT JOIN (SELECT f.`id`, f.`name`, f.`standard_id` FROM specifications f WHERE f.`state` = 1 |
| | | <if test="specificationsName != null and specificationsName != ''"> |
| | | AND f.`name` = #{specificationsName} |
| | | </if> |
| | | ) f ON s.`id` = f.`standard_id` |
| | | LEFT JOIN (SELECT p.`id`, p.`name`, p.`specifications_id` FROM product p WHERE p.`state` = 1) p ON f.`id` = p.`specifications_id` |
| | | WHERE m.`state` = 1 |
| | | </select> |
| | | </mapper> |