From de03593a26bb83f5791bf55650081062830532b2 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Fri, 15 Sep 2023 09:49:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/controller/SysCustomerController.java | 21 ++++++++-- .../java/com/op/wms/domain/SysCustomer.java | 6 +-- .../com/op/wms/mapper/SysCustomerMapper.java | 9 +++-- .../op/wms/service/ISysCustomerService.java | 10 +++-- .../service/impl/SysCustomerServiceImpl.java | 39 +++++++++++++++++-- .../mapper/wms/SysCustomerMapper.xml | 24 ++++++++++-- 6 files changed, 90 insertions(+), 19 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/SysCustomerController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/SysCustomerController.java index 7b5d2ba0..7c4158ae 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/SysCustomerController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/SysCustomerController.java @@ -2,6 +2,10 @@ package com.op.wms.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.op.common.core.utils.DateUtils; +import com.op.common.core.utils.uuid.IdUtils; +import com.op.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -61,7 +65,7 @@ public class SysCustomerController extends BaseController { */ @RequiresPermissions("wms:customer:query") @GetMapping(value = "/{clientId}") - public AjaxResult getInfo(@PathVariable("clientId") Long clientId) { + public AjaxResult getInfo(@PathVariable("clientId") String clientId) { return success(sysCustomerService.selectSysCustomerByClientId(clientId)); } @@ -72,7 +76,16 @@ public class SysCustomerController extends BaseController { @Log(title = "客户管理", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysCustomer sysCustomer) { - return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); + sysCustomer.setClientId(IdUtils.fastSimpleUUID()); + sysCustomer.setCreateBy(SecurityUtils.getUsername()); + sysCustomer.setCreateTime(DateUtils.getNowDate()); + if (sysCustomerService.checkClientCodeUnique(sysCustomer)) { + return AjaxResult.error("组织编码已存在!"); + }else if(sysCustomerService.checkClientNameUnique(sysCustomer)){ + return AjaxResult.error("组织名称已存在!"); + }else{ + return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); + } } /** @@ -82,6 +95,8 @@ public class SysCustomerController extends BaseController { @Log(title = "客户管理", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysCustomer sysCustomer) { + sysCustomer.setUpdateBy(SecurityUtils.getUsername()); + sysCustomer.setUpdateTime(DateUtils.getNowDate()); return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); } @@ -91,7 +106,7 @@ public class SysCustomerController extends BaseController { @RequiresPermissions("wms:customer:remove") @Log(title = "客户管理", businessType = BusinessType.DELETE) @DeleteMapping("/{clientIds}") - public AjaxResult remove(@PathVariable Long[] clientIds) { + public AjaxResult remove(@PathVariable String[] clientIds) { return toAjax(sysCustomerService.deleteSysCustomerByClientIds(clientIds)); } } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/SysCustomer.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/SysCustomer.java index 1b5e887a..7f364144 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/SysCustomer.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/SysCustomer.java @@ -15,7 +15,7 @@ public class SysCustomer extends BaseEntity { private static final long serialVersionUID = 1L; /** 客户ID */ - private Long clientId; + private String clientId; /** 客户编码 */ @Excel(name = "客户编码") @@ -109,11 +109,11 @@ public class SysCustomer extends BaseEntity { @Excel(name = "预留字段4") private Long attr4; - public void setClientId(Long clientId) { + public void setClientId(String clientId) { this.clientId = clientId; } - public Long getClientId() { + public String getClientId() { return clientId; } public void setClientCode(String clientCode) { diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysCustomerMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysCustomerMapper.java index 0c199285..c9ea8b87 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysCustomerMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysCustomerMapper.java @@ -17,7 +17,7 @@ public interface SysCustomerMapper { * @param clientId 客户管理主键 * @return 客户管理 */ - public SysCustomer selectSysCustomerByClientId(Long clientId); + public SysCustomer selectSysCustomerByClientId(String clientId); /** * 查询客户管理列表 @@ -49,7 +49,7 @@ public interface SysCustomerMapper { * @param clientId 客户管理主键 * @return 结果 */ - public int deleteSysCustomerByClientId(Long clientId); + public int deleteSysCustomerByClientId(String clientId); /** * 批量删除客户管理 @@ -57,5 +57,8 @@ public interface SysCustomerMapper { * @param clientIds 需要删除的数据主键集合 * @return 结果 */ - public int deleteSysCustomerByClientIds(Long[] clientIds); + public int deleteSysCustomerByClientIds(String[] clientIds); + + String checkClientCodeUnique(SysCustomer sysCustomer); + String checkClientNameUnique(SysCustomer sysCustomer); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/ISysCustomerService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/ISysCustomerService.java index 58b67b69..3bdc82c5 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/ISysCustomerService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/ISysCustomerService.java @@ -16,7 +16,7 @@ public interface ISysCustomerService { * @param clientId 客户管理主键 * @return 客户管理 */ - public SysCustomer selectSysCustomerByClientId(Long clientId); + public SysCustomer selectSysCustomerByClientId(String clientId); /** * 查询客户管理列表 @@ -48,7 +48,7 @@ public interface ISysCustomerService { * @param clientIds 需要删除的客户管理主键集合 * @return 结果 */ - public int deleteSysCustomerByClientIds(Long[] clientIds); + public int deleteSysCustomerByClientIds(String[] clientIds); /** * 删除客户管理信息 @@ -56,5 +56,9 @@ public interface ISysCustomerService { * @param clientId 客户管理主键 * @return 结果 */ - public int deleteSysCustomerByClientId(Long clientId); + public int deleteSysCustomerByClientId(String clientId); + + //增加校验 + boolean checkClientCodeUnique(SysCustomer sysCustomer); + boolean checkClientNameUnique(SysCustomer sysCustomer); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysCustomerServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysCustomerServiceImpl.java index 9617d374..7249fb01 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysCustomerServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysCustomerServiceImpl.java @@ -5,6 +5,7 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; import com.op.common.security.utils.SecurityUtils; +import com.op.wms.domain.SysFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.op.wms.mapper.SysCustomerMapper; @@ -30,7 +31,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService { */ @Override @DS("#header.poolName") - public SysCustomer selectSysCustomerByClientId(Long clientId) { + public SysCustomer selectSysCustomerByClientId(String clientId) { return sysCustomerMapper.selectSysCustomerByClientId(clientId); } @@ -82,7 +83,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService { */ @Override @DS("#header.poolName") - public int deleteSysCustomerByClientIds(Long[] clientIds) { + public int deleteSysCustomerByClientIds(String[] clientIds) { return sysCustomerMapper.deleteSysCustomerByClientIds(clientIds); } @@ -94,7 +95,39 @@ public class SysCustomerServiceImpl implements ISysCustomerService { */ @Override @DS("#header.poolName") - public int deleteSysCustomerByClientId(Long clientId) { + public int deleteSysCustomerByClientId(String clientId) { return sysCustomerMapper.deleteSysCustomerByClientId(clientId); } + + /** + * 判断客户信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkClientCodeUnique(SysCustomer sysCustomer) { + String code = sysCustomerMapper.checkClientCodeUnique(sysCustomer); + if(code == null){ + return false; + }else{ + return true; + } + } + + /** + * 判断客户信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkClientNameUnique(SysCustomer sysCustomer) { + String name = sysCustomerMapper.checkClientNameUnique(sysCustomer); + if(name== null){ + return false; + }else{ + return true; + } + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/SysCustomerMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/SysCustomerMapper.xml index 4a537352..d7795154 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/SysCustomerMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/SysCustomerMapper.xml @@ -42,8 +42,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - where client_id = #{clientId} @@ -77,6 +78,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into sys_customer + client_id, client_code, client_name, client_nick, @@ -107,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update_time, + #{clientId}, #{clientCode}, #{clientName}, #{clientNick}, @@ -173,7 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where client_id = #{clientId} - + delete from sys_customer where client_id = #{clientId} @@ -183,4 +186,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{clientId} + + + + + \ No newline at end of file From a84344faca70f4fead83a45d2f2178cfe9ed4028 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Fri, 15 Sep 2023 10:57:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=B7=A5=E8=89=BABOM=E6=94=B9=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/technology/ProProcessMapper.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/op-modules/op-technology/src/main/resources/mapper/technology/ProProcessMapper.xml b/op-modules/op-technology/src/main/resources/mapper/technology/ProProcessMapper.xml index 844dc094..5faa1055 100644 --- a/op-modules/op-technology/src/main/resources/mapper/technology/ProProcessMapper.xml +++ b/op-modules/op-technology/src/main/resources/mapper/technology/ProProcessMapper.xml @@ -311,10 +311,10 @@ -- Where -- bbc.product_code = right(bpc1.product_code,11) - select distinct bbc.bom_code,bpc1.product_desc_zh,right(bpc1.product_code,11) as pc,bbc.product_code - from base_bom_component bbc,base_product_copy1 bpc1 + select distinct bbc.bom_code,bp.product_desc_zh,right(bp.product_code,11) as pc,bbc.product_code + from base_bom_component bbc,base_product bp Where - bbc.product_code = right(bpc1.product_code,11) + bbc.product_code = right(bp.product_code,11) and bom_code = #{bomCode}