yanyang #19

Merged
yanyang merged 2 commits from yanyang into master 2023-01-06 16:37:28 +08:00
12 changed files with 95 additions and 4 deletions

View File

@ -166,4 +166,10 @@ public class ProductFeaturesController {
return productFeaturesService.list(); return productFeaturesService.list();
} }
@PostMapping("getProductFeaturesByType")
@ApiOperation("根据特性类型 获取特性列表 计量型1 计数型2")
public List<ProductFeaturesDTO> getProductFeaturesByType(Integer type){
return productFeaturesService.getProductFeaturesByType(type);
}
} }

View File

@ -3,6 +3,8 @@ package com.cnbm.basic.controller;
import com.cnbm.admin.annotation.LogOperation; import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.admin.params.IdParam; import com.cnbm.admin.params.IdParam;
import com.cnbm.basic.dto.UnitDTO; import com.cnbm.basic.dto.UnitDTO;
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
import com.cnbm.basic.entity.WorkingProcedure;
import com.cnbm.common.constant.Constant; import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils; import com.cnbm.common.utils.ExcelUtils;
@ -141,4 +143,15 @@ public class WorkingProcedureController {
return workingProcedureService.list(); return workingProcedureService.list();
} }
@PostMapping(value = "listByType/{typeId}")
@ApiOperation(value = "根据工序类型 获取工序列表")
public List<WorkingProcedure> listByType(@PathVariable("typeId") Long typeId) {
return workingProcedureService.listByType(typeId);
}
@PostMapping(value = "listWithType")
@ApiOperation(value = "工序类型及对应工序列表")
public List<WorkingProcedureTypeDTO> listWithType () {
return workingProcedureService.listWithType();
}
} }

View File

@ -1,11 +1,13 @@
package com.cnbm.basic.dto; package com.cnbm.basic.dto;
import com.cnbm.basic.entity.WorkingProcedure;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
* 工序类型表 * 工序类型表
@ -59,4 +61,7 @@ public class WorkingProcedureTypeDTO implements Serializable {
@ApiModelProperty(value = "版本号") @ApiModelProperty(value = "版本号")
private Integer version; private Integer version;
@ApiModelProperty(value = "工序列表")
private List<WorkingProcedure> workingProcedureList;
} }

View File

@ -27,4 +27,6 @@ public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
String getControlGraphNameById(Long id); String getControlGraphNameById(Long id);
List<ProductFeaturesDTO> list(); List<ProductFeaturesDTO> list();
List<ProductFeaturesDTO> getProductFeaturesByType(Integer type);
} }

View File

@ -1,9 +1,13 @@
package com.cnbm.basic.mapper; package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
import com.cnbm.common.dao.BaseDao; import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.WorkingProcedureType; import com.cnbm.basic.entity.WorkingProcedureType;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 工序类型表 * 工序类型表
* *
@ -13,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface WorkingProcedureTypeMapper extends BaseDao<WorkingProcedureType> { public interface WorkingProcedureTypeMapper extends BaseDao<WorkingProcedureType> {
List<WorkingProcedureTypeDTO> list();
} }

View File

@ -36,5 +36,7 @@ public interface IProductFeaturesService extends CrudService<ProductFeatures, Pr
List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params); List<ProductFeaturesDTO> getFeaturesList(Map<String, Object> params);
List<ProductFeaturesDTO> list();; List<ProductFeaturesDTO> list();
List<ProductFeaturesDTO> getProductFeaturesByType(Integer type);
} }

View File

@ -1,5 +1,6 @@
package com.cnbm.basic.service; package com.cnbm.basic.service;
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService; import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
@ -30,4 +31,8 @@ public interface IWorkingProcedureService extends CrudService<WorkingProcedure,
List<WorkingProcedureDTO> getWorkingProcedureByProductId(Long productId); List<WorkingProcedureDTO> getWorkingProcedureByProductId(Long productId);
List<WorkingProcedureDTO> list(); List<WorkingProcedureDTO> list();
List<WorkingProcedure> listByType(Long typeId);
List<WorkingProcedureTypeDTO> listWithType();
} }

View File

@ -163,4 +163,11 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public List<ProductFeaturesDTO> getProductFeaturesByType(Integer type) {
List<ProductFeaturesDTO> listByType = mapper.getProductFeaturesByType(type);
return listByType;
}
} }

View File

@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.cnbm.basic.dto.UnitDTO; import com.cnbm.basic.dto.UnitDTO;
import com.cnbm.basic.dto.WorkingProcedureTypeDTO;
import com.cnbm.basic.entity.Machine; import com.cnbm.basic.entity.Machine;
import com.cnbm.basic.entity.ProductWorkingprocedureRelation; import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
import com.cnbm.basic.entity.WorkingProcedureType; import com.cnbm.basic.entity.WorkingProcedureType;
import com.cnbm.basic.mapper.ProductWorkingprocedureRelationMapper; import com.cnbm.basic.mapper.ProductWorkingprocedureRelationMapper;
import com.cnbm.basic.mapper.UnitMapper; import com.cnbm.basic.mapper.UnitMapper;
import com.cnbm.basic.mapper.WorkingProcedureTypeMapper;
import com.cnbm.common.page.PageData; import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl; import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.WorkingProcedureDTO; import com.cnbm.basic.dto.WorkingProcedureDTO;
@ -153,11 +155,36 @@ public class WorkingProcedureServiceImpl extends CrudServiceImpl<WorkingProcedur
@Autowired @Autowired
private WorkingProcedureMapper workingProcedureMapper; private WorkingProcedureMapper workingProcedureMapper;
@Autowired
private WorkingProcedureTypeMapper workingProcedureTypeMapper;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public List<WorkingProcedureDTO> list() { public List<WorkingProcedureDTO> list() {
List<WorkingProcedureDTO> list = workingProcedureMapper.list(); List<WorkingProcedureDTO> list = workingProcedureMapper.list();
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public List<WorkingProcedure> listByType(Long typeId) {
QueryWrapper<WorkingProcedure> wrapper = new QueryWrapper<>();
wrapper.eq(ObjectUtils.isNotNull(typeId), "working_procedure_type_id", typeId);
List<WorkingProcedure> listOfType = workingProcedureMapper.selectList(wrapper);
return listOfType;
}
@Override
@Transactional(rollbackFor = Exception.class)
public List<WorkingProcedureTypeDTO> listWithType () {
List<WorkingProcedureTypeDTO> workingProcedureTypeDTOList = workingProcedureTypeMapper.list();
for(WorkingProcedureTypeDTO workingProcedureTypeDTO: workingProcedureTypeDTOList){
List<WorkingProcedure> workingProcedureList = listByType(workingProcedureTypeDTO.getId());
if(workingProcedureList!=null & workingProcedureList.size() > 0)
workingProcedureTypeDTO.setWorkingProcedureList(workingProcedureList);
}
return workingProcedureTypeDTOList;
}
} }

View File

@ -79,4 +79,12 @@
order by id asc order by id asc
</select> </select>
<select id="getProductFeaturesByType" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
select * from product_features
<where>
valid = 1 AND type = #{type}
</where>
order by id asc
</select>
</mapper> </mapper>

View File

@ -3,8 +3,9 @@
<mapper namespace="com.cnbm.basic.mapper.WorkingProcedureMapper"> <mapper namespace="com.cnbm.basic.mapper.WorkingProcedureMapper">
<select id="list" resultType="com.cnbm.basic.dto.WorkingProcedureDTO"> <select id="list" resultType="com.cnbm.basic.dto.WorkingProcedureDTO">
select * from working_procedure select wp.*,wpt.name as workingProcedureTypeName from working_procedure wp
order by id asc LEFT JOIN working_procedure_type wpt ON wp.working_procedure_type_id=wpt.id
order by wp.id asc
</select> </select>
</mapper> </mapper>

View File

@ -0,0 +1,10 @@
<?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="com.cnbm.basic.mapper.WorkingProcedureTypeMapper">
<select id="list" resultType="com.cnbm.basic.dto.WorkingProcedureTypeDTO">
select * from working_procedure_type
order by id asc
</select>
</mapper>