Browse Source

箱码幅面管理增删改查开发

fangxinjian 4 years ago
parent
commit
5e0398ad9f
16 changed files with 873 additions and 0 deletions
  1. 94 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/BoxCodeFormatController.java
  2. 66 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BoxCodeFormat.java
  3. 49 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/enums/StateEnum.java
  4. 32 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BoxCodeFormatMapper.java
  5. 60 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/vo/result/BoxCodeFormatVO.java
  6. 22 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/BoxCodeFormatDetailReq.java
  7. 22 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DeleteBoxCodeFormatreq.java
  8. 23 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DisableBoxCodeFormatReq.java
  9. 23 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/EnableBoxCodeFormatReq.java
  10. 27 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ListBoxCodeFormatReq.java
  11. 42 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/SaveBoxCodeFormatReq.java
  12. 60 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/BoxCodeFormatDetailRes.java
  13. 80 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ListBoxCodeFormatRes.java
  14. 62 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/BoxCodeFormatService.java
  15. 155 0
      abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/BoxCodeFormatImpl.java
  16. 56 0
      abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BoxCodeFormatMapper.xml

+ 94 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/BoxCodeFormatController.java

@@ -0,0 +1,94 @@
+package com.abi.qms.platform.controller.console;
+
+import com.abi.qms.platform.dto.req.BoxCodeFormatDetailReq;
+import com.abi.qms.platform.dto.req.DeleteBoxCodeFormatreq;
+import com.abi.qms.platform.dto.req.DisableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.EnableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.ListBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.SaveBoxCodeFormatReq;
+import com.abi.qms.platform.dto.res.BoxCodeFormatDetailRes;
+import com.abi.qms.platform.dto.res.ListBoxCodeFormatRes;
+import com.abi.qms.platform.service.BoxCodeFormatService;
+import com.abi.task.common.api.base.BaseResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 09:45
+ * @description: 箱码幅面管理
+ */
+
+@Slf4j
+@RestController
+@RequestMapping("boxCodeFormat")
+@Api(tags = "箱码幅面管理")
+public class BoxCodeFormatController {
+
+    @Autowired
+    private BoxCodeFormatService boxCodeFormatService;
+
+    @ApiOperation("箱码幅面新增/修改")
+    @PostMapping("saveBoxCodeFormat")
+    public BaseResponse saveBoxCodeFormat(@Validated @RequestBody SaveBoxCodeFormatReq saveBoxCodeFormatReq) {
+        //箱码幅面新增修改
+        boxCodeFormatService.saveBoxCodeFormat(saveBoxCodeFormatReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("箱码幅面查询分页")
+    @GetMapping("listBoxCodeFormat")
+    public BaseResponse<ListBoxCodeFormatRes> listBoxCodeFormat(@Validated ListBoxCodeFormatReq listBoxCodeFormatReq) {
+        //箱码幅面查询分页
+        ListBoxCodeFormatRes result = boxCodeFormatService.listBoxCodeFormat(listBoxCodeFormatReq);
+        //包装出参
+        return BaseResponse.create(result);
+    }
+
+    @ApiOperation("箱码幅面查询详情")
+    @GetMapping("getBoxCodeFormatDetail")
+    public BaseResponse<BoxCodeFormatDetailRes> getBoxCodeFormatDetail(@Validated BoxCodeFormatDetailReq boxCodeFormatDetailReq) {
+        //箱码幅面查询详情
+        BoxCodeFormatDetailRes result = boxCodeFormatService.getBoxCodeFormatDetail(boxCodeFormatDetailReq);
+        //包装出参
+        return BaseResponse.create(result);
+    }
+
+    @ApiOperation("箱码幅面启用")
+    @PostMapping("enableBoxCodeFormat")
+    public BaseResponse enableBoxCodeFormat(@Validated @RequestBody EnableBoxCodeFormatReq enableBoxCodeFormatReq) throws Exception {
+        //箱码幅面启用
+        boxCodeFormatService.enableBoxCodeFormat(enableBoxCodeFormatReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("箱码幅面禁用")
+    @PostMapping("disableBoxCodeFormat")
+    public BaseResponse disableBoxCodeFormat(@Validated @RequestBody DisableBoxCodeFormatReq disableBoxCodeFormatReq) throws Exception {
+        //箱码幅面禁用
+        boxCodeFormatService.disableBoxCodeFormat(disableBoxCodeFormatReq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+    @ApiOperation("删除箱码幅面")
+    @PostMapping("deleteBoxCodeFormat")
+    public BaseResponse deleteBoxCodeFormat(@Validated @RequestBody DeleteBoxCodeFormatreq deleteBoxCodeFormatreq) throws Exception {
+        //删除箱码幅面
+        boxCodeFormatService.deleteBoxCodeFormat(deleteBoxCodeFormatreq);
+        //包装出参
+        return BaseResponse.create();
+    }
+
+
+}

+ 66 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/entity/BoxCodeFormat.java

@@ -0,0 +1,66 @@
+package com.abi.qms.platform.dao.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 09:53
+ * @description: 箱码幅面对象
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value = "箱码幅面对象", description = "箱码幅面")
+public class BoxCodeFormat {
+
+    @ApiModelProperty(value = "id")
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(value = "箱码幅面名称")
+    private String name;
+
+    @ApiModelProperty(value = "部门id")
+    private Long deptId;
+
+    @ApiModelProperty(value = "码库id")
+    private Long codeStoreId;
+
+    @ApiModelProperty(value = "供应商id")
+    private Long factoryId;
+
+    @ApiModelProperty(value = "每卷色标量")
+    private Integer colorPerRollScalar;
+
+    @ApiModelProperty(value = "幅面数量")
+    private Integer formatNumber;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "状态 1-启用 0-停用")
+    private Integer state;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "修改时间")
+    private LocalDateTime updateTime;
+
+    @ApiModelProperty(value = "是否删除")
+    private Integer isDelete;
+
+
+}

+ 49 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/enums/StateEnum.java

@@ -0,0 +1,49 @@
+package com.abi.qms.platform.dao.enums;
+
+import com.baomidou.mybatisplus.annotation.EnumValue;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.EnumSet;
+import java.util.Set;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:49
+ * @description: 状态类型
+ */
+@Getter
+@AllArgsConstructor
+@JsonFormat(shape = JsonFormat.Shape.OBJECT)
+public enum StateEnum {
+
+    //供应商类型: 1-包材厂 2-啤酒厂
+    ENABLE(1, "启用"),
+    DISABLE(0, "停用");
+
+    @EnumValue
+    private Integer code;
+    private String name;
+
+    private static final Set<StateEnum> ALL = EnumSet.allOf(StateEnum.class);
+
+    public static String getName(Integer code) {
+        return ALL.stream()
+                .filter(o -> o.code.equals(code))
+                .map(StateEnum::getName)
+                .findAny().orElse(null);
+    }
+
+    public static Integer getCode(String name) {
+        return ALL.stream()
+                .filter(o -> o.name.equals(name))
+                .map(StateEnum::getCode)
+                .findAny().orElse(null);
+    }
+
+    public boolean is(Integer code) {
+        return getCode().equals(code);
+    }
+
+}

+ 32 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/BoxCodeFormatMapper.java

@@ -0,0 +1,32 @@
+package com.abi.qms.platform.dao.mapper;
+
+import com.abi.qms.platform.dao.entity.BoxCodeFormat;
+import com.abi.qms.platform.dao.vo.result.BoxCodeFormatVO;
+import com.abi.qms.platform.dto.req.ListBoxCodeFormatReq;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 09:51
+ * @description: 箱码幅面mapper接口
+ */
+public interface BoxCodeFormatMapper extends BaseMapper<BoxCodeFormat> {
+
+    /**
+     * 分页查询箱码幅面信息
+     *
+     * @param page
+     * @return
+     */
+    IPage<BoxCodeFormatVO> listBoxCodeFormat(IPage page, ListBoxCodeFormatReq param);
+
+    /**
+     * 根据ID查询详情信息
+     *
+     * @param id
+     * @return
+     */
+    BoxCodeFormatVO selectBoxCodeFormatDetailById(@Param("id") Long id);
+}

+ 60 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/vo/result/BoxCodeFormatVO.java

@@ -0,0 +1,60 @@
+package com.abi.qms.platform.dao.vo.result;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 14:22
+ * @description:
+ */
+@Data
+@ApiModel
+public class BoxCodeFormatVO implements Serializable {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "箱码幅面名称")
+    private String name;
+
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "码库名称")
+    private String codeStoreName;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String factoryName;
+
+    @ApiModelProperty(value = "每卷色标量")
+    private Integer colorPerRollScalar;
+
+    @ApiModelProperty(value = "幅面数量")
+    private Integer formatNumber;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "状态 1-启用 0-停用")
+    private Integer state;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+}

+ 22 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/BoxCodeFormatDetailReq.java

@@ -0,0 +1,22 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:31
+ * @description: 箱码幅面详情入参
+ */
+@Data
+@ApiModel
+public class BoxCodeFormatDetailReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @ApiModelProperty(value = "id")
+    private Long id;
+}

+ 22 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DeleteBoxCodeFormatreq.java

@@ -0,0 +1,22 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 15:21
+ * @description: 删除箱码幅面入参
+ */
+@Data
+@ApiModel
+public class DeleteBoxCodeFormatreq implements Serializable {
+
+    @ApiModelProperty(value = "id")
+    @NotNull(message = "箱码幅面ID为空")
+    private Long id;
+}

+ 23 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/DisableBoxCodeFormatReq.java

@@ -0,0 +1,23 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:39
+ * @description: 箱码幅面停用入参
+ */
+@Data
+@ApiModel
+public class DisableBoxCodeFormatReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @ApiModelProperty(value = "ids")
+    private List<Long> ids;
+}

+ 23 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/EnableBoxCodeFormatReq.java

@@ -0,0 +1,23 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:39
+ * @description: 箱码幅面启用入参
+ */
+@Data
+@ApiModel
+public class EnableBoxCodeFormatReq implements Serializable {
+
+    @NotNull(message = "ID为空")
+    @ApiModelProperty(value = "ids")
+    private List<Long> ids;
+}

+ 27 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ListBoxCodeFormatReq.java

@@ -0,0 +1,27 @@
+package com.abi.qms.platform.dto.req;
+
+import com.abi.task.common.api.base.PageReq;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:10
+ * @description: 箱码幅面分页查询入参
+ */
+@Data
+@ApiModel
+public class ListBoxCodeFormatReq extends PageReq implements Serializable {
+
+    @ApiModelProperty(value = "部门id")
+    private Long deptId;
+
+    @ApiModelProperty(value = "箱码幅面名称")
+    private String name;
+
+    @ApiModelProperty(value = "状态 1-启用 0-停用")
+    private Integer state;
+}

+ 42 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/SaveBoxCodeFormatReq.java

@@ -0,0 +1,42 @@
+package com.abi.qms.platform.dto.req;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 10:18
+ * @description:
+ */
+@Data
+@ApiModel
+public class SaveBoxCodeFormatReq implements Serializable {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "箱码幅面名称")
+    private String name;
+
+    @ApiModelProperty(value = "部门id")
+    private Long deptId;
+
+    @ApiModelProperty(value = "码库id")
+    private Long codeStoreId;
+
+    @ApiModelProperty(value = "供应商id")
+    private Long factoryId;
+
+    @ApiModelProperty(value = "每卷色标量")
+    private Integer colorPerRollScalar;
+
+    @ApiModelProperty(value = "幅面数量")
+    private Integer formatNumber;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+}

+ 60 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/BoxCodeFormatDetailRes.java

@@ -0,0 +1,60 @@
+package com.abi.qms.platform.dto.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:30
+ * @description: 箱码幅面详情查询出参
+ */
+@Data
+@ApiModel
+public class BoxCodeFormatDetailRes implements Serializable {
+
+    @ApiModelProperty(value = "id")
+    private Long id;
+
+    @ApiModelProperty(value = "箱码幅面名称")
+    private String name;
+
+    @ApiModelProperty(value = "部门名称")
+    private String deptName;
+
+    @ApiModelProperty(value = "码库名称")
+    private String codeStoreName;
+
+    @ApiModelProperty(value = "供应商名称")
+    private String factoryName;
+
+    @ApiModelProperty(value = "每卷色标量")
+    private Integer colorPerRollScalar;
+
+    @ApiModelProperty(value = "幅面数量")
+    private Integer formatNumber;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "状态 1-启用 0-停用")
+    private Integer state;
+
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+
+    @ApiModelProperty(value = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(value = "修改人")
+    private String updateBy;
+
+    @ApiModelProperty(value = "修改时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime updateTime;
+}

+ 80 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ListBoxCodeFormatRes.java

@@ -0,0 +1,80 @@
+package com.abi.qms.platform.dto.res;
+
+import com.abi.task.common.api.base.PageResp;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 11:12
+ * @description:
+ */
+@Data
+@ApiModel
+public class ListBoxCodeFormatRes extends PageResp implements Serializable {
+
+    @ApiModelProperty("箱码幅面列表")
+    private List<ListBoxCodeFormatRes.BoxCodeFormatBean> boxCodeFormatBeanList;
+
+    /**
+     * 箱码幅面bean
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ToString
+    @ApiModel(value = "ListBoxCodeFormatRes_BoxCodeFormatBean")
+    public static class BoxCodeFormatBean implements Serializable {
+
+        @ApiModelProperty(value = "id")
+        private Long id;
+
+        @ApiModelProperty(value = "箱码幅面名称")
+        private String name;
+
+        @ApiModelProperty(value = "部门名称")
+        private String deptName;
+
+        @ApiModelProperty(value = "码库名称")
+        private String codeStoreName;
+
+        @ApiModelProperty(value = "供应商名称")
+        private String factoryName;
+
+        @ApiModelProperty(value = "每卷色标量")
+        private Integer colorPerRollScalar;
+
+        @ApiModelProperty(value = "幅面数量")
+        private Integer formatNumber;
+
+        @ApiModelProperty(value = "备注")
+        private String remark;
+
+        @ApiModelProperty(value = "状态 1-启用 0-停用")
+        private Integer state;
+
+        @ApiModelProperty(value = "创建人")
+        private String createBy;
+
+        @ApiModelProperty(value = "创建时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime createTime;
+
+        @ApiModelProperty(value = "修改人")
+        private String updateBy;
+
+        @ApiModelProperty(value = "修改时间")
+        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+        private LocalDateTime updateTime;
+
+    }
+}

+ 62 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/BoxCodeFormatService.java

@@ -0,0 +1,62 @@
+package com.abi.qms.platform.service;
+
+import com.abi.qms.platform.dto.req.BoxCodeFormatDetailReq;
+import com.abi.qms.platform.dto.req.DeleteBoxCodeFormatreq;
+import com.abi.qms.platform.dto.req.DisableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.EnableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.ListBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.SaveBoxCodeFormatReq;
+import com.abi.qms.platform.dto.res.BoxCodeFormatDetailRes;
+import com.abi.qms.platform.dto.res.ListBoxCodeFormatRes;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 09:49
+ * @description: 箱码幅面管理
+ */
+public interface BoxCodeFormatService {
+
+    /**
+     * 新增或修改箱码幅面
+     *
+     * @param saveBoxCodeFormatReq 新增或修改箱码幅面入参
+     */
+    void saveBoxCodeFormat(SaveBoxCodeFormatReq saveBoxCodeFormatReq);
+
+    /**
+     * 分页查询箱码幅面
+     *
+     * @param listBoxCodeFormatReq 分页查询箱码幅面入参
+     * @return 分页查询箱码幅面
+     */
+    ListBoxCodeFormatRes listBoxCodeFormat(ListBoxCodeFormatReq listBoxCodeFormatReq);
+
+    /**
+     * 箱码幅面详情信息
+     *
+     * @param boxCodeFormatDetailReq 箱码详情入参
+     * @return 箱码幅面详情信息
+     */
+    BoxCodeFormatDetailRes getBoxCodeFormatDetail(BoxCodeFormatDetailReq boxCodeFormatDetailReq);
+
+    /**
+     * 启用箱码幅面
+     *
+     * @param enableBoxCodeFormatReq 启用箱码幅面入参
+     */
+    void enableBoxCodeFormat(EnableBoxCodeFormatReq enableBoxCodeFormatReq);
+
+    /**
+     * 停用箱码幅面
+     *
+     * @param disableBoxCodeFormatReq 停用箱码幅面
+     */
+    void disableBoxCodeFormat(DisableBoxCodeFormatReq disableBoxCodeFormatReq);
+
+    /**
+     * 删除箱码幅面
+     *
+     * @param deleteBoxCodeFormatreq
+     */
+    void deleteBoxCodeFormat(DeleteBoxCodeFormatreq deleteBoxCodeFormatreq);
+}

+ 155 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/BoxCodeFormatImpl.java

@@ -0,0 +1,155 @@
+package com.abi.qms.platform.service.impl;
+
+import com.abi.qms.platform.dao.entity.BoxCodeFormat;
+import com.abi.qms.platform.dao.enums.StateEnum;
+import com.abi.qms.platform.dao.mapper.BoxCodeFormatMapper;
+import com.abi.qms.platform.dao.vo.result.BoxCodeFormatVO;
+import com.abi.qms.platform.dto.req.BoxCodeFormatDetailReq;
+import com.abi.qms.platform.dto.req.DeleteBoxCodeFormatreq;
+import com.abi.qms.platform.dto.req.DisableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.EnableBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.ListBoxCodeFormatReq;
+import com.abi.qms.platform.dto.req.SaveBoxCodeFormatReq;
+import com.abi.qms.platform.dto.res.BoxCodeFormatDetailRes;
+import com.abi.qms.platform.dto.res.ListBoxCodeFormatRes;
+import com.abi.qms.platform.infrastructure.util.AssertUtil;
+import com.abi.qms.platform.infrastructure.util.PageUtil;
+import com.abi.qms.platform.service.BoxCodeFormatService;
+import com.abi.task.common.api.exception.BusinessException;
+import com.abi.task.common.utils.PojoConverterUtils;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/04/20 09:49
+ * @description: 箱码幅面管理
+ */
+@Service
+@Slf4j
+public class BoxCodeFormatImpl implements BoxCodeFormatService {
+
+    @Autowired
+    private BoxCodeFormatMapper boxCodeFormatMapper;
+
+    @Override
+    public void saveBoxCodeFormat(SaveBoxCodeFormatReq req) {
+
+        //1-声明对象
+        BoxCodeFormat boxCodeFormat = null;
+        if (req.getId() != null) {
+            boxCodeFormat = boxCodeFormatMapper.selectById(req.getId());
+            AssertUtil.isNull(boxCodeFormat, "箱码幅面ID不存在");
+        } else {
+            boxCodeFormat = new BoxCodeFormat();
+        }
+
+        //2-放入数据
+        boxCodeFormat.setDeptId(req.getDeptId());
+        boxCodeFormat.setCodeStoreId(req.getCodeStoreId());
+        boxCodeFormat.setFactoryId(req.getFactoryId());
+        boxCodeFormat.setName(req.getName());
+        boxCodeFormat.setColorPerRollScalar(req.getColorPerRollScalar());
+        boxCodeFormat.setFormatNumber(req.getFormatNumber());
+        boxCodeFormat.setRemark(req.getRemark());
+
+        //3-新增or修改
+        if (req.getId() != null) {
+            boxCodeFormatMapper.updateById(boxCodeFormat);
+        } else {
+            boxCodeFormatMapper.insert(boxCodeFormat);
+        }
+
+    }
+
+    @Override
+    public ListBoxCodeFormatRes listBoxCodeFormat(ListBoxCodeFormatReq req) {
+
+        //分页查询
+        IPage<BoxCodeFormatVO> iPage = boxCodeFormatMapper.listBoxCodeFormat(PageUtil.createPage(req), req);
+        List<BoxCodeFormatVO> formatList = iPage.getRecords();
+        //封装出参
+        ListBoxCodeFormatRes res = new ListBoxCodeFormatRes();
+        //放入分页信息
+        PageUtil.copyPageInfo(res, iPage);
+        //放入出参列表
+        List<ListBoxCodeFormatRes.BoxCodeFormatBean> beanList = PojoConverterUtils.copyList(formatList, ListBoxCodeFormatRes.BoxCodeFormatBean.class);
+        res.setBoxCodeFormatBeanList(beanList);
+
+        return res;
+    }
+
+    @Override
+    public BoxCodeFormatDetailRes getBoxCodeFormatDetail(BoxCodeFormatDetailReq req) {
+
+        //查询箱码幅面详情
+        BoxCodeFormatVO boxCodeFormatVO = boxCodeFormatMapper.selectBoxCodeFormatDetailById(req.getId());
+        AssertUtil.isNull(boxCodeFormatVO, "箱码幅面详情不存在");
+
+        //转化出参
+        BoxCodeFormatDetailRes res = PojoConverterUtils.copy(boxCodeFormatVO, BoxCodeFormatDetailRes.class);
+
+        return res;
+    }
+
+    @Override
+    public void enableBoxCodeFormat(EnableBoxCodeFormatReq req) {
+
+        List<Long> ids = req.getIds();
+
+        //循环启用
+        for (Long id : ids) {
+            //1-查询活动对象
+            BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(id);
+            AssertUtil.isNull(boxCodeFormat, "箱码幅面不存在");
+            if (!StateEnum.DISABLE.is(boxCodeFormat.getState())) {
+                continue;
+            }
+
+            //2-修改状态
+            boxCodeFormat.setState(StateEnum.ENABLE.getCode());
+            boxCodeFormatMapper.updateById(boxCodeFormat);
+        }
+    }
+
+    @Override
+    public void disableBoxCodeFormat(DisableBoxCodeFormatReq req) {
+
+        List<Long> ids = req.getIds();
+
+        //循环禁用
+        for (Long id : ids) {
+            //1-查询活动对象
+            BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(id);
+            AssertUtil.isNull(boxCodeFormat, "箱码幅面不存在");
+            if (!StateEnum.ENABLE.is(boxCodeFormat.getState())) {
+                return;
+            }
+
+            //2-修改状态
+            boxCodeFormat.setState(StateEnum.DISABLE.getCode());
+            boxCodeFormatMapper.updateById(boxCodeFormat);
+        }
+
+    }
+
+    @Override
+    public void deleteBoxCodeFormat(DeleteBoxCodeFormatreq req) {
+
+        //查询箱码幅面
+        BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(req.getId());
+        if (boxCodeFormat == null) {
+            throw new BusinessException("箱码幅面不存在");
+        }
+
+        //逻辑删除
+        boxCodeFormat.setIsDelete(1);
+        boxCodeFormatMapper.updateById(boxCodeFormat);
+    }
+
+
+}

+ 56 - 0
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/BoxCodeFormatMapper.xml

@@ -0,0 +1,56 @@
+<?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.abi.qms.platform.dao.mapper.BoxCodeFormatMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.abi.qms.platform.dao.entity.BoxCodeFormat">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="dept_id" property="deptId"/>
+        <result column="code_store_id" property="codeStoreId"/>
+        <result column="factory_id" property="factoryId"/>
+        <result column="color_per_roll_scalar" property="colorPerRollScalar"/>
+        <result column="format_number" property="formatNumber"/>
+        <result column="remark" property="remark"/>
+        <result column="state" property="state"/>
+        <result column="create_by" property="createBy"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_by" property="updateBy"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="is_delete" property="isDelete"/>
+    </resultMap>
+
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id,name,dept_id,code_store_id,factory_id,color_per_roll_scalar,format_number,remark,state,create_by,create_time,update_by,update_time,is_delete
+    </sql>
+
+    <select id="listBoxCodeFormat" resultType="com.abi.qms.platform.dao.vo.result.BoxCodeFormatVO">
+        select bcf.id, bcf.name,bcf.color_per_roll_scalar,bcf.format_number,bcf.remark,
+        bcf.state,bcf.update_time,bd.dept_name,bf.factory_name
+        from box_code_format bcf
+        left join base_department bd on bd.id=bcf.dept_id
+        left join base_factory bf on bf.id=bcf.factory_id
+        <where>
+            bcf.is_delete = 0
+            <if test="param.deptId != null and param.deptId != ''">
+                AND bd.id = #{param.deptId}
+            </if>
+            <if test="param.name != null and param.name != ''">
+                AND bcf.name like concat('%',#{param.name},'%')
+            </if>
+            AND bcf.state = #{param.state}
+        </where>
+        order by bcf.create_time desc
+    </select>
+
+    <select id="selectBoxCodeFormatDetailById" resultType="com.abi.qms.platform.dao.vo.result.BoxCodeFormatVO">
+        select bcf.id, bcf.name,bcf.color_per_roll_scalar,bcf.format_number,bcf.remark,
+        bcf.state,bcf.update_time,bd.dept_name,bf.factory_name
+        from box_code_format bcf
+        left join base_department bd on bd.id=bcf.dept_id
+        left join base_factory bf on bf.id=bcf.factory_id
+        where bcf.id = #{id} and bcf.is_delete = 0
+    </select>
+
+</mapper>