This commit is contained in:
闫阳 2022-08-09 15:16:12 +08:00
parent 73efee55e7
commit 16a52e69c8
12 changed files with 126 additions and 1 deletions

View File

@ -1,6 +1,9 @@
package com.cnbm.basic.controller; 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.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.entity.ProductFeatures;
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;
@ -114,4 +117,11 @@ public class ProductFeaturesController {
ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class);
} }
@PostMapping("getProductFeaturesByProductId")
@ApiOperation("查询产品特性 依据产品id")
public Result<List<ProductFeaturesDTO>> getProductFeaturesByProductId(@RequestBody IdParam id){
List<ProductFeaturesDTO> list = productFeaturesService.getProductFeaturesByProductId(id.getId());
return new Result<List<ProductFeaturesDTO>>().ok(list);
}
} }

View File

@ -29,9 +29,15 @@ public class ProductFeaturesDTO implements Serializable {
@ApiModelProperty(value = "量具id关联measure_tool表") @ApiModelProperty(value = "量具id关联measure_tool表")
private Long measureToolId; private Long measureToolId;
@ApiModelProperty(value = "量具名称关联measure_tool表")
private String measureToolName;
@ApiModelProperty(value = "单位 id关联unit表") @ApiModelProperty(value = "单位 id关联unit表")
private Long unitId; private Long unitId;
@ApiModelProperty(value = "单位名称关联unit表")
private String unitName;
@ApiModelProperty(value = "产品特性 名") @ApiModelProperty(value = "产品特性 名")
private String name; private String name;
@ -59,9 +65,18 @@ public class ProductFeaturesDTO implements Serializable {
@ApiModelProperty(value = "工序id关联 working_procedure 表id") @ApiModelProperty(value = "工序id关联 working_procedure 表id")
private Long workingProcedureId; private Long workingProcedureId;
@ApiModelProperty(value = "工序编码,关联 working_procedure 表id")
private String workingProcedureCode;
@ApiModelProperty(value = "工序名称,关联 working_procedure 表id")
private String workingProcedureName;
@ApiModelProperty(value = "分析图形关联control_graph表id") @ApiModelProperty(value = "分析图形关联control_graph表id")
private Long controlGraphId; private Long controlGraphId;
@ApiModelProperty(value = "分析图形名关联control_graph表id")
private String controlGraphName;
@ApiModelProperty(value = "是否需要spc分析1 yes;0 no") @ApiModelProperty(value = "是否需要spc分析1 yes;0 no")
private Integer isSpc; private Integer isSpc;

View File

@ -1,9 +1,12 @@
package com.cnbm.basic.mapper; package com.cnbm.basic.mapper;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.common.dao.BaseDao; import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 产品特性 * 产品特性
* *
@ -12,5 +15,5 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> { public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id);
} }

View File

@ -5,6 +5,7 @@ import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.entity.ProductFeatures; import com.cnbm.basic.entity.ProductFeatures;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -23,4 +24,6 @@ public interface IProductFeaturesService extends CrudService<ProductFeatures, Pr
void update(ProductFeaturesDTO dto); void update(ProductFeaturesDTO dto);
void delete(Long[] ids); void delete(Long[] ids);
List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id);
} }

View File

@ -22,6 +22,8 @@ public interface IProductService extends CrudService<Product, ProductDTO> {
void update(ProductDTO dto); void update(ProductDTO dto);
void delete(Long[] ids);
boolean changeStatus(Long id); boolean changeStatus(Long id);
} }

View File

@ -26,5 +26,7 @@ public interface IUnitService extends CrudService<Unit, UnitDTO> {
List<UnitDTO> list(); List<UnitDTO> list();
void delete(Long[] ids);
boolean changeStatus(Long id); boolean changeStatus(Long id);
} }

View File

@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
/** /**
@ -78,4 +79,11 @@ public class MeasureToolServiceImpl extends CrudServiceImpl<MeasureToolMapper, M
return updateById(entity); return updateById(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
} }

View File

@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
/** /**
@ -64,4 +65,11 @@ public class ProductFeaturesHisServiceImpl extends CrudServiceImpl<ProductFeatur
updateById(entity); updateById(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
} }

View File

@ -2,8 +2,13 @@ package com.cnbm.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.cnbm.admin.params.IdParam;
import com.cnbm.basic.dto.ProductFeaturesHisDTO; import com.cnbm.basic.dto.ProductFeaturesHisDTO;
import com.cnbm.basic.dto.WorkingProcedureDTO;
import com.cnbm.basic.entity.ProductFeaturesHis; import com.cnbm.basic.entity.ProductFeaturesHis;
import com.cnbm.basic.entity.ProductWorkingprocedureRelation;
import com.cnbm.basic.entity.WorkingProcedure;
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.ProductFeaturesDTO; import com.cnbm.basic.dto.ProductFeaturesDTO;
@ -16,6 +21,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -77,4 +85,41 @@ public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesM
} }
@Autowired
private ProductFeaturesMapper mapper;
// @Autowired
// private WorkingProcedureServiceImpl workingProcedureServiceImpl;
@Override
public List<ProductFeaturesDTO> getProductFeaturesByProductId(Long id){
List<ProductFeaturesDTO> list = mapper.getProductFeaturesByProductId(id);
return list;
/*
QueryWrapper<ProductFeatures> wrapper = new QueryWrapper<>();
wrapper.eq(ObjectUtils.isNotNull(productId), "product_id", productId);
List<ProductFeatures> productFeaturesList = mapper.selectList(wrapper);
List<ProductFeaturesDTO> productFeaturesDTOList = ConvertUtils.sourceToTarget(productFeaturesList,ProductFeaturesDTO.class);
for(ProductFeaturesDTO dto:productFeaturesDTOList) {
WorkingProcedure workingProcedure = workingProcedureServiceImpl.selectById(dto.getWorkingProcedureId());
if (workingProcedure != null) {
String workingProcedureCode = workingProcedure.getCode();
String workingProcedureName = workingProcedure.getName();
dto.setWorkingProcedureCode(workingProcedureCode);
dto.setWorkingProcedureName(workingProcedureName);
}
}
return productFeaturesDTOList;
*/
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
} }

View File

@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Map; import java.util.Map;
/** /**
@ -104,4 +105,11 @@ public class ProductServiceImpl extends CrudServiceImpl<ProductMapper, Product,
return updateById(entity); return updateById(entity);
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
} }

View File

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -85,4 +86,11 @@ public class UnitServiceImpl extends CrudServiceImpl<UnitMapper, Unit, UnitDTO>
return list; return list;
} }
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(Long[] ids) {
//删除
deleteBatchIds(Arrays.asList(ids));
}
} }

View File

@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ProductFeaturesMapper"> <mapper namespace="com.cnbm.basic.mapper.ProductFeaturesMapper">
<select id="getProductFeaturesByProductId" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
select p.*,w.code as workingProcedureCode,w.name as workingProcedureName,m.name as measureToolName,u.name as unitName,c.name as controlGraphName
from product_features p
LEFT JOIN working_procedure w ON p.working_procedure_id=w.id
LEFT JOIN measure_tool m ON p.measure_tool_id=m.id
LEFT JOIN unit u ON p.unit_id=u.id
LEFT JOIN control_graph c ON p.control_graph_id=c.id
<where>
p.valid = 1 AND p.product_id = #{id}
</where>
order by p.id asc
</select>
</mapper> </mapper>