From 6318c16656259be4c8c4a0c865846bc0e38b4415 Mon Sep 17 00:00:00 2001 From: "JinLu.Yin" <411641505@qq.com> Date: Sat, 7 May 2022 22:31:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wm/controller/WmWarehouseController.java | 113 ++++++++++++ .../com/ktg/mes/wm/domain/WmWarehouse.java | 165 ++++++++++++++++++ .../ktg/mes/wm/mapper/WmWarehouseMapper.java | 64 +++++++ .../mes/wm/service/IWmWarehouseService.java | 75 ++++++++ .../service/impl/WmWarehouseServiceImpl.java | 120 +++++++++++++ .../resources/mapper/md/MdWorkshopMapper.xml | 4 +- .../resources/mapper/wm/WmWarehouseMapper.xml | 122 +++++++++++++ 7 files changed, 661 insertions(+), 2 deletions(-) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java new file mode 100644 index 0000000..1c7bd71 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmWarehouseController.java @@ -0,0 +1,113 @@ +package com.ktg.mes.wm.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import com.ktg.common.constant.UserConstants; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmWarehouseService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * 仓库设置Controller + * + * @author yinjinlu + * @date 2022-05-07 + */ +@RestController +@RequestMapping("/mes/wm/warehouse") +public class WmWarehouseController extends BaseController +{ + @Autowired + private IWmWarehouseService wmWarehouseService; + + /** + * 查询仓库设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:list')") + @GetMapping("/list") + public TableDataInfo list(WmWarehouse wmWarehouse) + { + startPage(); + List list = wmWarehouseService.selectWmWarehouseList(wmWarehouse); + return getDataTable(list); + } + + /** + * 导出仓库设置列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:export')") + @Log(title = "仓库设置", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmWarehouse wmWarehouse) + { + List list = wmWarehouseService.selectWmWarehouseList(wmWarehouse); + ExcelUtil util = new ExcelUtil(WmWarehouse.class); + util.exportExcel(response, list, "仓库设置数据"); + } + + /** + * 获取仓库设置详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:query')") + @GetMapping(value = "/{warehouseId}") + public AjaxResult getInfo(@PathVariable("warehouseId") Long warehouseId) + { + return AjaxResult.success(wmWarehouseService.selectWmWarehouseByWarehouseId(warehouseId)); + } + + /** + * 新增仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:add')") + @Log(title = "仓库设置", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmWarehouse wmWarehouse) + { + if(UserConstants.NOT_UNIQUE.equals(wmWarehouseService.checkWarehouseCodeUnique(wmWarehouse))){ + return AjaxResult.error("仓库编码已存在!"); + } + if(UserConstants.NOT_UNIQUE.equals(wmWarehouseService.checkWarehouseNameUnique(wmWarehouse))){ + return AjaxResult.error("仓库名称已存在!"); + } + + return toAjax(wmWarehouseService.insertWmWarehouse(wmWarehouse)); + } + + /** + * 修改仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:edit')") + @Log(title = "仓库设置", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody WmWarehouse wmWarehouse) + { + return toAjax(wmWarehouseService.updateWmWarehouse(wmWarehouse)); + } + + /** + * 删除仓库设置 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:warehouse:remove')") + @Log(title = "仓库设置", businessType = BusinessType.DELETE) + @DeleteMapping("/{warehouseIds}") + public AjaxResult remove(@PathVariable Long[] warehouseIds) + { + return toAjax(wmWarehouseService.deleteWmWarehouseByWarehouseIds(warehouseIds)); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java new file mode 100644 index 0000000..fd03b97 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmWarehouse.java @@ -0,0 +1,165 @@ +package com.ktg.mes.wm.domain; + +import java.math.BigDecimal; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; + +/** + * 仓库设置对象 wm_warehouse + * + * @author yinjinlu + * @date 2022-05-07 + */ +public class WmWarehouse extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 仓库ID */ + private Long warehouseId; + + /** 仓库编码 */ + @Excel(name = "仓库编码") + private String warehouseCode; + + /** 仓库名称 */ + @Excel(name = "仓库名称") + private String warehouseName; + + /** 位置 */ + @Excel(name = "位置") + private String location; + + /** 面积 */ + @Excel(name = "面积") + private BigDecimal area; + + /** 负责人 */ + @Excel(name = "负责人") + private String charge; + + /** 预留字段1 */ + private String attr1; + + /** 预留字段2 */ + private String attr2; + + /** 预留字段3 */ + private Long attr3; + + /** 预留字段4 */ + private Long attr4; + + public void setWarehouseId(Long warehouseId) + { + this.warehouseId = warehouseId; + } + + public Long getWarehouseId() + { + return warehouseId; + } + public void setWarehouseCode(String warehouseCode) + { + this.warehouseCode = warehouseCode; + } + + public String getWarehouseCode() + { + return warehouseCode; + } + public void setWarehouseName(String warehouseName) + { + this.warehouseName = warehouseName; + } + + public String getWarehouseName() + { + return warehouseName; + } + public void setLocation(String location) + { + this.location = location; + } + + public String getLocation() + { + return location; + } + public void setArea(BigDecimal area) + { + this.area = area; + } + + public BigDecimal getArea() + { + return area; + } + public void setCharge(String charge) + { + this.charge = charge; + } + + public String getCharge() + { + return charge; + } + public void setAttr1(String attr1) + { + this.attr1 = attr1; + } + + public String getAttr1() + { + return attr1; + } + public void setAttr2(String attr2) + { + this.attr2 = attr2; + } + + public String getAttr2() + { + return attr2; + } + public void setAttr3(Long attr3) + { + this.attr3 = attr3; + } + + public Long getAttr3() + { + return attr3; + } + public void setAttr4(Long attr4) + { + this.attr4 = attr4; + } + + public Long getAttr4() + { + return attr4; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("warehouseId", getWarehouseId()) + .append("warehouseCode", getWarehouseCode()) + .append("warehouseName", getWarehouseName()) + .append("location", getLocation()) + .append("area", getArea()) + .append("charge", getCharge()) + .append("remark", getRemark()) + .append("attr1", getAttr1()) + .append("attr2", getAttr2()) + .append("attr3", getAttr3()) + .append("attr4", getAttr4()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java new file mode 100644 index 0000000..69c6f82 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmWarehouseMapper.java @@ -0,0 +1,64 @@ +package com.ktg.mes.wm.mapper; + +import java.util.List; +import com.ktg.mes.wm.domain.WmWarehouse; + +/** + * 仓库设置Mapper接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface WmWarehouseMapper +{ + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置集合 + */ + public List selectWmWarehouseList(WmWarehouse wmWarehouse); + + public WmWarehouse checkWarehouseCodeUnique(WmWarehouse wmWarehouse); + public WmWarehouse checkWarehouseNameUnique(WmWarehouse wmWarehouse); + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int insertWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int updateWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 删除仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java new file mode 100644 index 0000000..e85f8f1 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmWarehouseService.java @@ -0,0 +1,75 @@ +package com.ktg.mes.wm.service; + +import java.util.List; +import com.ktg.mes.wm.domain.WmWarehouse; + +/** + * 仓库设置Service接口 + * + * @author yinjinlu + * @date 2022-05-07 + */ +public interface IWmWarehouseService +{ + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId); + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置集合 + */ + public List selectWmWarehouseList(WmWarehouse wmWarehouse); + + /** + * 检查仓库编码是否重复 + * @param wmWarehouse + * @return + */ + public String checkWarehouseCodeUnique(WmWarehouse wmWarehouse); + + /** + * 检查仓库名称是否重复 + * @param wmWarehouse + * @return + */ + public String checkWarehouseNameUnique(WmWarehouse wmWarehouse); + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int insertWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + public int updateWmWarehouse(WmWarehouse wmWarehouse); + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的仓库设置主键集合 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds); + + /** + * 删除仓库设置信息 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + public int deleteWmWarehouseByWarehouseId(Long warehouseId); +} diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java new file mode 100644 index 0000000..3e8a31e --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmWarehouseServiceImpl.java @@ -0,0 +1,120 @@ +package com.ktg.mes.wm.service.impl; + +import java.util.List; + +import com.ktg.common.constant.UserConstants; +import com.ktg.common.utils.DateUtils; +import com.ktg.common.utils.StringUtils; +import org.apache.catalina.User; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ktg.mes.wm.mapper.WmWarehouseMapper; +import com.ktg.mes.wm.domain.WmWarehouse; +import com.ktg.mes.wm.service.IWmWarehouseService; + +/** + * 仓库设置Service业务层处理 + * + * @author yinjinlu + * @date 2022-05-07 + */ +@Service +public class WmWarehouseServiceImpl implements IWmWarehouseService +{ + @Autowired + private WmWarehouseMapper wmWarehouseMapper; + + /** + * 查询仓库设置 + * + * @param warehouseId 仓库设置主键 + * @return 仓库设置 + */ + @Override + public WmWarehouse selectWmWarehouseByWarehouseId(Long warehouseId) + { + return wmWarehouseMapper.selectWmWarehouseByWarehouseId(warehouseId); + } + + /** + * 查询仓库设置列表 + * + * @param wmWarehouse 仓库设置 + * @return 仓库设置 + */ + @Override + public List selectWmWarehouseList(WmWarehouse wmWarehouse) + { + return wmWarehouseMapper.selectWmWarehouseList(wmWarehouse); + } + + @Override + public String checkWarehouseCodeUnique(WmWarehouse wmWarehouse) { + WmWarehouse warehouse = wmWarehouseMapper.checkWarehouseCodeUnique(wmWarehouse); + Long warehouseId = wmWarehouse.getWarehouseId()==null?-1L:wmWarehouse.getWarehouseId(); + if(StringUtils.isNotNull(warehouse) && warehouse.getWarehouseId().longValue() != warehouseId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + @Override + public String checkWarehouseNameUnique(WmWarehouse wmWarehouse) { + WmWarehouse warehouse = wmWarehouseMapper.checkWarehouseNameUnique(wmWarehouse); + Long warehouseId = wmWarehouse.getWarehouseId()==null?-1L:wmWarehouse.getWarehouseId(); + if(StringUtils.isNotNull(warehouse) && warehouse.getWarehouseId().longValue() != warehouseId.longValue()){ + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 新增仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + @Override + public int insertWmWarehouse(WmWarehouse wmWarehouse) + { + wmWarehouse.setCreateTime(DateUtils.getNowDate()); + return wmWarehouseMapper.insertWmWarehouse(wmWarehouse); + } + + /** + * 修改仓库设置 + * + * @param wmWarehouse 仓库设置 + * @return 结果 + */ + @Override + public int updateWmWarehouse(WmWarehouse wmWarehouse) + { + wmWarehouse.setUpdateTime(DateUtils.getNowDate()); + return wmWarehouseMapper.updateWmWarehouse(wmWarehouse); + } + + /** + * 批量删除仓库设置 + * + * @param warehouseIds 需要删除的仓库设置主键 + * @return 结果 + */ + @Override + public int deleteWmWarehouseByWarehouseIds(Long[] warehouseIds) + { + return wmWarehouseMapper.deleteWmWarehouseByWarehouseIds(warehouseIds); + } + + /** + * 删除仓库设置信息 + * + * @param warehouseId 仓库设置主键 + * @return 结果 + */ + @Override + public int deleteWmWarehouseByWarehouseId(Long warehouseId) + { + return wmWarehouseMapper.deleteWmWarehouseByWarehouseId(warehouseId); + } +} diff --git a/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml index 77ae073..ea2dfaf 100644 --- a/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/MdWorkshopMapper.xml @@ -44,12 +44,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" diff --git a/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml b/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml new file mode 100644 index 0000000..11ac894 --- /dev/null +++ b/ktg-mes/src/main/resources/mapper/wm/WmWarehouseMapper.xml @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + select warehouse_id, warehouse_code, warehouse_name, location, area, charge, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_warehouse + + + + + + + + + + + + insert into wm_warehouse + + warehouse_code, + warehouse_name, + location, + area, + charge, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{warehouseCode}, + #{warehouseName}, + #{location}, + #{area}, + #{charge}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_warehouse + + warehouse_code = #{warehouseCode}, + warehouse_name = #{warehouseName}, + location = #{location}, + area = #{area}, + charge = #{charge}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where warehouse_id = #{warehouseId} + + + + delete from wm_warehouse where warehouse_id = #{warehouseId} + + + + delete from wm_warehouse where warehouse_id in + + #{warehouseId} + + + \ No newline at end of file