Ver código fonte

product_features表

pull/1/head
闫阳 2 anos atrás
pai
commit
718ad8a8c2
8 arquivos alterados com 542 adições e 0 exclusões
  1. +116
    -0
      ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java
  2. +116
    -0
      ym-baisc/src/main/java/com/cnbm/basic/dto/ProductFeaturesDTO.java
  3. +117
    -0
      ym-baisc/src/main/java/com/cnbm/basic/entity/ProductFeatures.java
  4. +80
    -0
      ym-baisc/src/main/java/com/cnbm/basic/excel/ProductFeaturesExcel.java
  5. +16
    -0
      ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java
  6. +26
    -0
      ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java
  7. +66
    -0
      ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java
  8. +5
    -0
      ym-baisc/src/main/resources/ProductFeaturesMapper.xml

+ 116
- 0
ym-baisc/src/main/java/com/cnbm/basic/controller/ProductFeaturesController.java Ver arquivo

@@ -0,0 +1,116 @@
package com.cnbm.basic.controller;

import com.cnbm.admin.annotation.LogOperation;
import com.cnbm.common.constant.Constant;
import com.cnbm.common.page.PageData;
import com.cnbm.common.utils.ExcelUtils;
import com.cnbm.common.utils.Result;
import com.cnbm.common.validator.AssertUtils;
import com.cnbm.common.validator.ValidatorUtils;
import com.cnbm.common.validator.group.AddGroup;
import com.cnbm.common.validator.group.DefaultGroup;
import com.cnbm.common.validator.group.UpdateGroup;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.excel.ProductFeaturesExcel;
import com.cnbm.basic.service.IProductFeaturesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;


/**
* 产品特性 表 前端控制器
*
* @author why
* @since 2022-07-15
*/
@RestController
@RequestMapping("/code/productFeatures")
@Api(tags="产品特性 表")
public class ProductFeaturesController {
@Autowired
private IProductFeaturesService productFeaturesService;

@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码,从1开始", paramType = "query", required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataTypeClass=Integer.class) ,
@ApiImplicitParam(name = Constant.ORDER_FIELD, value = "排序字段", paramType = "query", dataTypeClass=String.class) ,
@ApiImplicitParam(name = Constant.ORDER, value = "排序方式,可选值(asc、desc)", paramType = "query", dataTypeClass=String.class)
})
@PreAuthorize("@ex.hasAuthority('code:productFeatures:page')")
public Result<PageData<ProductFeaturesDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<ProductFeaturesDTO> page = productFeaturesService.page(params);

return new Result<PageData<ProductFeaturesDTO>>().ok(page);
}

@GetMapping("{id}")
@ApiOperation("信息")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:info')")
public Result<ProductFeaturesDTO> get(@PathVariable("id") Long id){
ProductFeaturesDTO data = productFeaturesService.get(id);

return new Result<ProductFeaturesDTO>().ok(data);
}

@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:save')")
public Result save(@RequestBody ProductFeaturesDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);

productFeaturesService.save(dto);

return new Result();
}

@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:update')")
public Result update(@RequestBody ProductFeaturesDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);

productFeaturesService.update(dto);

return new Result();
}

@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:delete')")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

productFeaturesService.delete(ids);

return new Result();
}

@GetMapping("export")
@ApiOperation("导出")
@LogOperation("导出")
@PreAuthorize("@ex.hasAuthority('code:productFeatures:export')")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<ProductFeaturesDTO> list = productFeaturesService.list(params);

ExcelUtils.exportExcelToTarget(response, null, list, ProductFeaturesExcel.class);
}

}

+ 116
- 0
ym-baisc/src/main/java/com/cnbm/basic/dto/ProductFeaturesDTO.java Ver arquivo

@@ -0,0 +1,116 @@
package com.cnbm.basic.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

import java.math.BigDecimal;


/**
* 产品特性 表
*
* @author why
* @since 2022-07-15
*/
@Data
@ApiModel(value = "产品特性 表DTO对象")
public class ProductFeaturesDTO implements Serializable {
private static final long serialVersionUID = 1L;



@ApiModelProperty(value = "ID")
private BigDecimal id;

@ApiModelProperty(value = "产品id,关联product表")
private BigDecimal productId;

@ApiModelProperty(value = "量具id,关联measure_tool表")
private BigDecimal measureToolId;

@ApiModelProperty(value = "单位 id,关联unit表")
private BigDecimal unitId;

@ApiModelProperty(value = "产品特性 名")
private String name;

@ApiModelProperty(value = "产品特性 编码")
private String code;

@ApiModelProperty(value = "产品特性类型:1 计量型;2 计数型")
private BigDecimal type;

@ApiModelProperty(value = "缺陷等级:1 致命缺陷;2 严重缺陷;3.轻微缺陷")
private BigDecimal defectLevel;

@ApiModelProperty(value = "产品特性 规格")
private String specifications;

@ApiModelProperty(value = "检验参数 规格下线")
private Float lsl;

@ApiModelProperty(value = "检验参数 规格中心线")
private Float sl;

@ApiModelProperty(value = "检验参数 规格上线")
private Float usl;

@ApiModelProperty(value = "工序id,关联 working_procedure 表id")
private BigDecimal workingProcedureId;

@ApiModelProperty(value = "分析图形,关联control_graph表id")
private BigDecimal controlGraphId;

@ApiModelProperty(value = "(如果为空就代表4个阶段都不是)检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;;如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private BigDecimal inspectionStage;

@ApiModelProperty(value = "是否需要spc分析,1 yes;0 no")
private BigDecimal isSpc;

@ApiModelProperty(value = "样本大小,一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private BigDecimal sampleSize;

@ApiModelProperty(value = "采样频率,只用于展示")
private String samplingFrequency;

@ApiModelProperty(value = "小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private BigDecimal decimalPlaces;

@ApiModelProperty(value = "目标cpk")
private Float targetCpk;

@ApiModelProperty(value = "目标cpk")
private Float targetPpk;

@ApiModelProperty(value = "备注")
private String remark;

@ApiModelProperty(value = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;

@ApiModelProperty(value = "创建人")
private BigDecimal creatorId;

@ApiModelProperty(value = "创建人姓名")
private String creatorName;

@ApiModelProperty(value = "创建时间")
private LocalDateTime createTime;

@ApiModelProperty(value = "更新人")
private BigDecimal updaterId;

@ApiModelProperty(value = "更新人姓名")
private String updaterName;

@ApiModelProperty(value = "更新时间")
private LocalDateTime updateTime;

@ApiModelProperty(value = "版本号")
private BigDecimal version;

}

+ 117
- 0
ym-baisc/src/main/java/com/cnbm/basic/entity/ProductFeatures.java Ver arquivo

@@ -0,0 +1,117 @@
package com.cnbm.basic.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
* <p>
* 产品特性 表
* </p>
*
* @author why
* @since 2022-07-15
*/
@Data
@TableName("product_features")
@ApiModel(value = "ProductFeatures对象", description = "产品特性 表")
public class ProductFeatures implements Serializable {

private static final long serialVersionUID = 1L;

@ApiModelProperty("ID")
private BigDecimal id;

@ApiModelProperty("产品id,关联product表")
private BigDecimal productId;

@ApiModelProperty("量具id,关联measure_tool表")
private BigDecimal measureToolId;

@ApiModelProperty("单位 id,关联unit表")
private BigDecimal unitId;

@ApiModelProperty("产品特性 名")
private String name;

@ApiModelProperty("产品特性 编码")
private String code;

@ApiModelProperty("产品特性类型:1 计量型;2 计数型")
private BigDecimal type;

@ApiModelProperty("缺陷等级:1 致命缺陷;2 严重缺陷;3.轻微缺陷")
private BigDecimal defectLevel;

@ApiModelProperty("产品特性 规格")
private String specifications;

@ApiModelProperty("检验参数 规格下线")
private Float lsl;

@ApiModelProperty("检验参数 规格中心线")
private Float sl;

@ApiModelProperty("检验参数 规格上线")
private Float usl;

@ApiModelProperty("工序id,关联 working_procedure 表id")
private BigDecimal workingProcedureId;

@ApiModelProperty("分析图形,关联control_graph表id")
private BigDecimal controlGraphId;

@ApiModelProperty("(如果为空就代表4个阶段都不是)检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;;如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private BigDecimal inspectionStage;

@ApiModelProperty("是否需要spc分析,1 yes;0 no")
private BigDecimal isSpc;

@ApiModelProperty("样本大小,一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private BigDecimal sampleSize;

@ApiModelProperty("采样频率,只用于展示")
private String samplingFrequency;

@ApiModelProperty("小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private BigDecimal decimalPlaces;

@ApiModelProperty("目标cpk")
private Float targetCpk;

@ApiModelProperty("目标cpk")
private Float targetPpk;

@ApiModelProperty("备注")
private String remark;

@ApiModelProperty("删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;

@ApiModelProperty("创建人")
private BigDecimal creatorId;

@ApiModelProperty("创建人姓名")
private String creatorName;

@ApiModelProperty("创建时间")
private LocalDateTime createTime;

@ApiModelProperty("更新人")
private BigDecimal updaterId;

@ApiModelProperty("更新人姓名")
private String updaterName;

@ApiModelProperty("更新时间")
private LocalDateTime updateTime;

@ApiModelProperty("版本号")
private BigDecimal version;


}

+ 80
- 0
ym-baisc/src/main/java/com/cnbm/basic/excel/ProductFeaturesExcel.java Ver arquivo

@@ -0,0 +1,80 @@
package com.cnbm.basic.excel;

import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;

import java.time.LocalDateTime;
import java.math.BigDecimal;

import java.util.Date;

/**
* 产品特性 表
*
* @author why
* @since 2022-07-15
*/
@Data
public class ProductFeaturesExcel {
@Excel(name = "ID")
private BigDecimal id;
@Excel(name = "产品id,关联product表")
private BigDecimal productId;
@Excel(name = "量具id,关联measure_tool表")
private BigDecimal measureToolId;
@Excel(name = "单位 id,关联unit表")
private BigDecimal unitId;
@Excel(name = "产品特性 名")
private String name;
@Excel(name = "产品特性 编码")
private String code;
@Excel(name = "产品特性类型:1 计量型;2 计数型")
private BigDecimal type;
@Excel(name = "缺陷等级:1 致命缺陷;2 严重缺陷;3.轻微缺陷")
private BigDecimal defectLevel;
@Excel(name = "产品特性 规格")
private String specifications;
@Excel(name = "检验参数 规格下线")
private Float lsl;
@Excel(name = "检验参数 规格中心线")
private Float sl;
@Excel(name = "检验参数 规格上线")
private Float usl;
@Excel(name = "工序id,关联 working_procedure 表id")
private BigDecimal workingProcedureId;
@Excel(name = "分析图形,关联control_graph表id")
private BigDecimal controlGraphId;
@Excel(name = "(如果为空就代表4个阶段都不是)检验阶段;1 进货检验、 2 过程检验、 3 成品检验、 4 出货检验;;如果有多个用逗号隔开,比如 1,4 就代表选中了进货检验和出货检验")
private BigDecimal inspectionStage;
@Excel(name = "是否需要spc分析,1 yes;0 no")
private BigDecimal isSpc;
@Excel(name = "样本大小,一般2-25之间。 会依据这个size 把所有待分析的数据 组成一个一个样本")
private BigDecimal sampleSize;
@Excel(name = "采样频率,只用于展示")
private String samplingFrequency;
@Excel(name = "小数位数(限制 检验参数小数点后面位数),这个先放着后续再说。")
private BigDecimal decimalPlaces;
@Excel(name = "目标cpk")
private Float targetCpk;
@Excel(name = "目标cpk")
private Float targetPpk;
@Excel(name = "备注")
private String remark;
@Excel(name = "删除标志,是否有效:1 可用 0不可用")
private BigDecimal valid;
@Excel(name = "创建人")
private BigDecimal creatorId;
@Excel(name = "创建人姓名")
private String creatorName;
@Excel(name = "创建时间")
private LocalDateTime createTime;
@Excel(name = "更新人")
private BigDecimal updaterId;
@Excel(name = "更新人姓名")
private String updaterName;
@Excel(name = "更新时间")
private LocalDateTime updateTime;
@Excel(name = "版本号")
private BigDecimal version;

}

+ 16
- 0
ym-baisc/src/main/java/com/cnbm/basic/mapper/ProductFeaturesMapper.java Ver arquivo

@@ -0,0 +1,16 @@
package com.cnbm.basic.mapper;

import com.cnbm.common.dao.BaseDao;
import com.cnbm.basic.entity.ProductFeatures;
import org.apache.ibatis.annotations.Mapper;

/**
* 产品特性 表
*
* @author why
* @since 2022-07-15
*/
@Mapper
public interface ProductFeaturesMapper extends BaseDao<ProductFeatures> {
}

+ 26
- 0
ym-baisc/src/main/java/com/cnbm/basic/service/IProductFeaturesService.java Ver arquivo

@@ -0,0 +1,26 @@
package com.cnbm.basic.service;

import com.cnbm.common.page.PageData;
import com.cnbm.common.service.CrudService;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.entity.ProductFeatures;

import java.util.Map;

/**
* 产品特性 表
*
* @author why
* @since 2022-07-15
*/
public interface IProductFeaturesService extends CrudService<ProductFeatures, ProductFeaturesDTO> {
PageData<ProductFeaturesDTO> page (Map<String, Object> params);

ProductFeaturesDTO get(Long id);

void save(ProductFeaturesDTO dto);

void update(ProductFeaturesDTO dto);

void delete(Long[] ids);
}

+ 66
- 0
ym-baisc/src/main/java/com/cnbm/basic/service/impl/ProductFeaturesServiceImpl.java Ver arquivo

@@ -0,0 +1,66 @@
package com.cnbm.basic.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cnbm.common.page.PageData;
import com.cnbm.common.service.impl.CrudServiceImpl;
import com.cnbm.basic.dto.ProductFeaturesDTO;
import com.cnbm.basic.mapper.ProductFeaturesMapper;
import com.cnbm.basic.entity.ProductFeatures;
import com.cnbm.basic.service.IProductFeaturesService;
import com.cnbm.common.utils.ConvertUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

/**
* 产品特性 表
*
* @author why
* @since 2022-07-15
*/
@Service
public class ProductFeaturesServiceImpl extends CrudServiceImpl<ProductFeaturesMapper, ProductFeatures, ProductFeaturesDTO> implements IProductFeaturesService {

@Override
public QueryWrapper<ProductFeatures> getWrapper(Map<String, Object> params){
String id = (String)params.get("id");

QueryWrapper<ProductFeatures> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), "id", id);

return wrapper;
}

@Override
public PageData<ProductFeaturesDTO> page (Map<String, Object> params){
IPage<ProductFeatures> page = baseDao.selectPage(
getPage(params, "id", true),
getWrapper(params)
);
return getPageData(page, ProductFeaturesDTO.class);
}

@Override
public ProductFeaturesDTO get(Long id) {
ProductFeatures entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ProductFeaturesDTO.class);
}

@Override
@Transactional(rollbackFor = Exception.class)
public void save(ProductFeaturesDTO dto) {
ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
insert(entity);
}

@Override
@Transactional(rollbackFor = Exception.class)
public void update(ProductFeaturesDTO dto) {
ProductFeatures entity = ConvertUtils.sourceToTarget(dto, ProductFeatures.class);
updateById(entity);
}

}

+ 5
- 0
ym-baisc/src/main/resources/ProductFeaturesMapper.xml Ver arquivo

@@ -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="com.cnbm.basic.mapper.ProductFeaturesMapper">

</mapper>

Carregando…
Cancelar
Salvar