mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
板材库修改必填字段
This commit is contained in:
+8
@@ -144,4 +144,12 @@ public class PartsController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/cad/page")
|
||||
@Operation(summary = "cad获得配件分页")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('system:accessory:query','base:accessory:query')")
|
||||
public CommonResult<PageResult<PartsRespVO>> getCadPage(@Valid PartsCadPageReqVO pageReqVO) {
|
||||
PageResult<PartsDO> pageResult = partsService.getCadPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PartsRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package com.cf.imes.module.manage.controller.admin.parts.vo;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageParam;
|
||||
import com.cf.imes.module.manage.validation.parts.PartsNumberValid;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* cad 传参
|
||||
*/
|
||||
@Schema(description = "管理后台 - 配件分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PartsCadPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "商品名称", example = "张三")
|
||||
@Size(max = 64, message = "配件名称长度不能超过64个字符")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "颜色")
|
||||
@Size(max = 32, message = "颜色长度不能超过32个字符")
|
||||
private String color;
|
||||
|
||||
@Schema(description = "材质:颗粒板、欧松板、多层板、生态板、禾香板、密度板、实木、铝蜂窝板、铝塑板")
|
||||
@Size(max = 64, message = "材质长度不能超过64个字符")
|
||||
private String material;
|
||||
|
||||
@Schema(description = "配件类型", example = "2")
|
||||
@Size(max = 32, message = "配件类型长度不能超过323个字符")
|
||||
private String category;
|
||||
|
||||
@Schema(description = "配件子类", example = "2")
|
||||
@Size(max = 64, message = "配件子类长度不能超过64个字符")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "型号")
|
||||
@Size(max = 64, message = "配件型号长度不能超过64个字符")
|
||||
private String model;
|
||||
|
||||
@Schema(description = "规格")
|
||||
@Size(max = 64, message = "配件规格不能超过64个字符")
|
||||
private String spec;
|
||||
|
||||
@Schema(description = "宽度")
|
||||
@PartsNumberValid(name = "宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "长度")
|
||||
@PartsNumberValid(name = "长度")
|
||||
private Double length;
|
||||
|
||||
@Schema(description = "厚度")
|
||||
@PartsNumberValid(name = "厚度")
|
||||
private Double thickness;
|
||||
|
||||
@Schema(description = "品牌")
|
||||
@Size(max = 64, message = "配件品牌不能超过64个字符")
|
||||
private String brand;
|
||||
|
||||
@Schema(description = "厂家")
|
||||
@Size(max = 128, message = "厂家长度不能超过64个字符")
|
||||
private String factory;
|
||||
|
||||
@Schema(description = "单位")
|
||||
@Size(max = 32, message = "单位长度不能超过64个字符")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "是否复合部件:0 否 1 是")
|
||||
private Boolean isComposite;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
@Size(max = 255, message = "备注长度不能超过255个字符")
|
||||
private String remark;
|
||||
|
||||
private Long organId;
|
||||
|
||||
@Schema(description = "排序", example = "ascend")
|
||||
private String order;
|
||||
|
||||
@Schema(description = "排序字段", example = "id")
|
||||
private String field;
|
||||
|
||||
}
|
||||
+11
-9
@@ -118,15 +118,17 @@ public class PlateController {
|
||||
// @PreAuthorize("@ss.hasPermission('manage:plate:export')")
|
||||
@PreAuthorize("@ss.hasAnyPermissions('manage:plate:export','base:plate:export')")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
// 手动创建导出 demo
|
||||
List<PlateImportExcelVO> list = Arrays.asList(
|
||||
PlateImportExcelVO.builder().goodsId("BD10010001").goodsName("18mm-多层板-暖白").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2440))
|
||||
.thickness(String.valueOf(18)).brand("AAA").spec("2440*1220*18").color("暖白").price("120").texture("无").build(),
|
||||
PlateImportExcelVO.builder().goodsId("BD10010002").goodsName("18mm-颗粒板-高级灰").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2750))
|
||||
.thickness(String.valueOf(18)).brand("鸿达树").spec("2750*1220*18").color("高级灰").price("120").texture("无").build()
|
||||
);
|
||||
// 输出
|
||||
ExcelUtils.write(response, IMPORT_TEMPLATE, "板材列表", PlateImportExcelVO.class, list);
|
||||
// // 手动创建导出 demo
|
||||
// List<PlateImportExcelVO> list = Arrays.asList(
|
||||
// PlateImportExcelVO.builder().goodsId("BD10010001").goodsName("18mm-多层板-暖白").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2440))
|
||||
// .thickness(String.valueOf(18)).brand("AAA").spec("2440*1220*18").color("暖白").price("120").texture("无").build(),
|
||||
// PlateImportExcelVO.builder().goodsId("BD10010002").goodsName("18mm-颗粒板-高级灰").material("多层板").width(String.valueOf(1220)).height(String.valueOf(2750))
|
||||
// .thickness(String.valueOf(18)).brand("鸿达树").spec("2750*1220*18").color("高级灰").price("120").texture("无").build()
|
||||
// );
|
||||
// // 输出
|
||||
// ExcelUtils.write(response, IMPORT_TEMPLATE, "板材列表", PlateImportExcelVO.class, list);
|
||||
|
||||
plateService.exportTemplate(response, "excel_plate_add.xlsx");
|
||||
}
|
||||
|
||||
// @GetMapping("/get-import-template")
|
||||
|
||||
+4
-5
@@ -40,16 +40,16 @@ public class PlateImportExcelVO {
|
||||
@NotEmpty(message = "颜色不能为空")
|
||||
private String color;
|
||||
|
||||
@ExcelProperty(value = "*纹理")
|
||||
@ExcelProperty(value = "纹理")
|
||||
@ColumnWidth(10)
|
||||
private String texture;
|
||||
|
||||
@ExcelProperty("*宽度")
|
||||
@ExcelProperty("宽度")
|
||||
@ColumnWidth(10)
|
||||
@NotEmpty(message = "宽度不能为空")
|
||||
private String width;
|
||||
|
||||
@ExcelProperty("*高度")// float(8,3)
|
||||
@ExcelProperty("高度")// float(8,3)
|
||||
@ColumnWidth(10)
|
||||
@NotEmpty(message = "高度不能为空")
|
||||
private String height;
|
||||
@@ -79,8 +79,7 @@ public class PlateImportExcelVO {
|
||||
|
||||
public boolean isValidGoods() {
|
||||
return !(goodsId == null || goodsId.isEmpty() || goodsName == null || goodsName.isEmpty() || material == null ||
|
||||
material.isEmpty() || color == null || color.isEmpty() || width == null ||width.isEmpty() || height == null ||
|
||||
height.isEmpty() || height == null ||thickness.isEmpty() );
|
||||
material.isEmpty() || color == null || color.isEmpty() ||thickness.isEmpty() );
|
||||
}
|
||||
|
||||
// 数据长度判断
|
||||
|
||||
+3
-3
@@ -36,16 +36,16 @@ public class PlateSaveReqVO {
|
||||
private String color;
|
||||
|
||||
@Schema(description = "纹理", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "纹理不能为空")
|
||||
// @NotNull(message = "纹理不能为空")
|
||||
private Boolean texture;
|
||||
|
||||
@Schema(description = "宽度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "宽度不能为空")
|
||||
// @NotNull(message = "宽度不能为空")
|
||||
@NumberValid(name = "宽度")
|
||||
private Double width;
|
||||
|
||||
@Schema(description = "高度", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "高度不能为空")
|
||||
// @NotNull(message = "高度不能为空")
|
||||
@NumberValid(name = "高度")
|
||||
private Double height;
|
||||
|
||||
|
||||
+69
@@ -3,6 +3,7 @@ package com.cf.imes.module.manage.dal.mysql.parts;
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsCadPageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsPageReqVO;
|
||||
import com.cf.imes.module.manage.dal.dataobject.parts.PartsDO;
|
||||
|
||||
@@ -103,4 +104,72 @@ public interface PartsMapper extends BaseMapperX<PartsDO> {
|
||||
.eq(PartsDO::getOrganId, organId));
|
||||
}
|
||||
|
||||
default PageResult<PartsDO> selectCadPage(PartsCadPageReqVO reqVO) {
|
||||
LambdaQueryWrapperX<PartsDO> queryWrapper = new LambdaQueryWrapperX<PartsDO>()
|
||||
.eqIfPresent(PartsDO::getOrganId, reqVO.getOrganId())
|
||||
.eqIfPresent(PartsDO::getCategory, reqVO.getCategory())
|
||||
.likeIfPresent(PartsDO::getColor, reqVO.getColor())
|
||||
.likeIfPresent(PartsDO::getType, reqVO.getType())
|
||||
.likeIfPresent(PartsDO::getName, reqVO.getName())
|
||||
.likeIfPresent(PartsDO::getMaterial, reqVO.getMaterial())
|
||||
.likeIfPresent(PartsDO::getModel, reqVO.getModel())
|
||||
.likeIfPresent(PartsDO::getSpec, reqVO.getSpec())
|
||||
.likeIfPresent(PartsDO::getBrand, reqVO.getBrand())
|
||||
.likeIfPresent(PartsDO::getFactory, reqVO.getFactory())
|
||||
.likeIfPresent(PartsDO::getUnit, reqVO.getUnit())
|
||||
.eqIfPresent(PartsDO::getIsComposite, reqVO.getIsComposite())
|
||||
.eqIfPresent(PartsDO::getWidth, reqVO.getWidth())
|
||||
.eqIfPresent(PartsDO::getLength, reqVO.getLength())
|
||||
.eqIfPresent(PartsDO::getThickness, reqVO.getThickness())
|
||||
.likeIfPresent(PartsDO::getRemark, reqVO.getRemark());
|
||||
|
||||
if (reqVO.getOrder() == null) {
|
||||
queryWrapper.orderByDesc(PartsDO::getId);
|
||||
}else {
|
||||
if (reqVO.getOrder().equals("ascend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "isComposite" -> queryWrapper.orderByAsc(PartsDO::getIsComposite);
|
||||
case "category" -> queryWrapper.orderByAsc(PartsDO::getCategory);
|
||||
case "type" -> queryWrapper.orderByAsc(PartsDO::getType);
|
||||
case "name" -> queryWrapper.orderByAsc(PartsDO::getName);
|
||||
case "model" -> queryWrapper.orderByAsc(PartsDO::getModel);
|
||||
case "material" -> queryWrapper.orderByAsc(PartsDO::getMaterial);
|
||||
case "color" -> queryWrapper.orderByAsc(PartsDO::getColor);
|
||||
case "unit" -> queryWrapper.orderByAsc(PartsDO::getUnit);
|
||||
case "spec" -> queryWrapper.orderByAsc(PartsDO::getSpec);
|
||||
case "brand" -> queryWrapper.orderByAsc(PartsDO::getBrand);
|
||||
case "factory" -> queryWrapper.orderByAsc(PartsDO::getFactory);
|
||||
case "width" -> queryWrapper.orderByAsc(PartsDO::getWidth);
|
||||
case "length" -> queryWrapper.orderByAsc(PartsDO::getLength);
|
||||
case "thickness" -> queryWrapper.orderByAsc(PartsDO::getThickness);
|
||||
default -> {
|
||||
// default不排序
|
||||
}
|
||||
}
|
||||
}else if (reqVO.getOrder().equals("descend")) {
|
||||
switch (reqVO.getField()) {
|
||||
case "isComposite" -> queryWrapper.orderByDesc(PartsDO::getIsComposite);
|
||||
case "category" -> queryWrapper.orderByDesc(PartsDO::getCategory);
|
||||
case "type" -> queryWrapper.orderByDesc(PartsDO::getType);
|
||||
case "name" -> queryWrapper.orderByDesc(PartsDO::getName);
|
||||
case "model" -> queryWrapper.orderByDesc(PartsDO::getModel);
|
||||
case "material" -> queryWrapper.orderByDesc(PartsDO::getMaterial);
|
||||
case "color" -> queryWrapper.orderByDesc(PartsDO::getColor);
|
||||
case "unit" -> queryWrapper.orderByDesc(PartsDO::getUnit);
|
||||
case "spec" -> queryWrapper.orderByDesc(PartsDO::getSpec);
|
||||
case "brand" -> queryWrapper.orderByDesc(PartsDO::getBrand);
|
||||
case "factory" -> queryWrapper.orderByDesc(PartsDO::getFactory);
|
||||
case "width" -> queryWrapper.orderByDesc(PartsDO::getWidth);
|
||||
case "length" -> queryWrapper.orderByDesc(PartsDO::getLength);
|
||||
case "thickness" -> queryWrapper.orderByDesc(PartsDO::getThickness);
|
||||
default -> {
|
||||
// default不排序
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return selectPage(reqVO, queryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
+3
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.*;
|
||||
|
||||
import com.cf.imes.framework.common.pojo.PageResult;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsCadPageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsImportExcelVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsPageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsSaveReqVO;
|
||||
@@ -60,6 +61,8 @@ public interface PartsService {
|
||||
*/
|
||||
PageResult<PartsDO> getPage(PartsPageReqVO pageReqVO);
|
||||
|
||||
PageResult<PartsDO> getCadPage(PartsCadPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 生产导入文件模板下载
|
||||
*/
|
||||
|
||||
+9
@@ -3,6 +3,7 @@ package com.cf.imes.module.manage.service.parts;
|
||||
import com.cf.imes.framework.common.pojo.CommonResult;
|
||||
import com.cf.imes.framework.organ.core.aop.OrganIgnore;
|
||||
import com.cf.imes.framework.organ.core.context.OrganContextHolder;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsCadPageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsImportExcelVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsPageReqVO;
|
||||
import com.cf.imes.module.manage.controller.admin.parts.vo.PartsSaveReqVO;
|
||||
@@ -156,6 +157,14 @@ public class PartsServiceImpl implements PartsService {
|
||||
return partsMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public PageResult<PartsDO> getCadPage(PartsCadPageReqVO pageReqVO) {
|
||||
pageReqVO.setOrganId(getOrganId(BASE_PARTS_QUERY_PERMISSION, getLoginUser().getId(), pageReqVO.getOrganId()));
|
||||
|
||||
return partsMapper.selectCadPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OrganIgnore
|
||||
public void exportTemplate(HttpServletResponse response, String value) {
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user