From 43e6e247da3438edffe8d02e9b75093e72455d2f Mon Sep 17 00:00:00 2001 From: xiang2lin <251481237@qq.com> Date: Thu, 27 Mar 2025 15:52:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=98=E8=B4=A7=E8=87=AA=E7=94=B1=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/inventory/dao/IInventoryExtDao.java | 15 ++ .../dao/impl/InventoryExtDaoImpl.java | 16 ++ .../inventory/entity/InventoryEntity.java | 10 ++ .../inventory/entity/InventoryExtEntity.java | 104 ++++++++++++ .../inventory/entity/InventoryExtEntity.xml | 150 ++++++++++++++++++ .../service/IInventoryExtService.java | 23 +++ .../service/impl/InventoryExtServiceImpl.java | 64 ++++++++ .../service/impl/InventoryService.java | 7 + 8 files changed, 389 insertions(+) create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/IInventoryExtDao.java create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/impl/InventoryExtDaoImpl.java create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.java create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.xml create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/IInventoryExtService.java create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryExtServiceImpl.java diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/IInventoryExtDao.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/IInventoryExtDao.java new file mode 100644 index 00000000..bccf8ebf --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/IInventoryExtDao.java @@ -0,0 +1,15 @@ +package com.hzya.frame.u8.base.inventory.dao; + +import com.hzya.frame.basedao.dao.IBaseDao; +import com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity; + +/** + * @description: 存货档案扩展自定义项 dao + * @tableName: Inventory_extradefine + * @entityName: InventoryExtEntity + * @author: gjh + * @history: 1.0 + */ +public interface IInventoryExtDao extends IBaseDao { + +} diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/impl/InventoryExtDaoImpl.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/impl/InventoryExtDaoImpl.java new file mode 100644 index 00000000..2691cfad --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/dao/impl/InventoryExtDaoImpl.java @@ -0,0 +1,16 @@ +package com.hzya.frame.u8.base.inventory.dao.impl; +import com.hzya.frame.basedao.dao.MybatisGenericDao; +import com.hzya.frame.u8.base.inventory.dao.IInventoryExtDao; +import com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity; +import org.springframework.stereotype.Repository; +/** + * @description: 存货档案扩展自定义项 dao + * @tableName: Inventory_extradefine + * @entityName: InventoryExtEntity + * @author: gjh + * @history:1.0 + */ +@Repository("Inventory_extradefinedao") +public class InventoryExtDaoImpl extends MybatisGenericDao implements IInventoryExtDao { + +} diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryEntity.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryEntity.java index dd4d1469..a431f0e0 100644 --- a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryEntity.java +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryEntity.java @@ -13,6 +13,8 @@ import java.util.Date; **/ public class InventoryEntity extends BaseEntity { + //存货自由项 + private InventoryExtEntity invExtEntity; /** 无备注 */ private String cInvCode; /** 无备注 */ @@ -533,6 +535,14 @@ public class InventoryEntity extends BaseEntity { /** 无备注 */ private Integer iOldpartMngRule; + public InventoryExtEntity getInvExtEntity() { + return invExtEntity; + } + + public void setInvExtEntity(InventoryExtEntity invExtEntity) { + this.invExtEntity = invExtEntity; + } + public String getcInvCode() { return cInvCode; } diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.java new file mode 100644 index 00000000..c39e3573 --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.java @@ -0,0 +1,104 @@ +package com.hzya.frame.u8.base.inventory.entity; +import com.hzya.frame.web.entity.BaseEntity; +/** + * @description: 存货档案扩展自定义项 + * @tableName: Inventory_extradefine + * @entityName: InventoryExtEntity + * @author: gjh + * @history: 1.0 + */ +public class InventoryExtEntity extends BaseEntity { + +/** 存货编码 */ +private String cInvCode; +/** 无备注 */ +private String cidefine1; +/** 无备注 */ +private String cidefine2; +/** 无备注 */ +private String cidefine3; +private String cidefine4; +private String cidefine5; +private String cidefine6; +private String cidefine7; + + +/** 无备注 */ +public void setCInvCode(String cInvCode) { + this.cInvCode = cInvCode; + } +/** 无备注 */ +public String getCInvCode() { + return cInvCode; + } + + +/** 无备注 */ +public void setCidefine1(String cidefine1) { + this.cidefine1 = cidefine1; + } +/** 无备注 */ +public String getCidefine1() { + return cidefine1; + } + + +/** 无备注 */ +public void setCidefine2(String cidefine2) { + this.cidefine2 = cidefine2; + } +/** 无备注 */ +public String getCidefine2() { + return cidefine2; + } + + +/** 无备注 */ +public void setCidefine3(String cidefine3) { + this.cidefine3 = cidefine3; + } +/** 无备注 */ +public String getCidefine3() { + return cidefine3; + } + + public String getcInvCode() { + return cInvCode; + } + + public void setcInvCode(String cInvCode) { + this.cInvCode = cInvCode; + } + + public String getCidefine4() { + return cidefine4; + } + + public void setCidefine4(String cidefine4) { + this.cidefine4 = cidefine4; + } + + public String getCidefine5() { + return cidefine5; + } + + public void setCidefine5(String cidefine5) { + this.cidefine5 = cidefine5; + } + + public String getCidefine6() { + return cidefine6; + } + + public void setCidefine6(String cidefine6) { + this.cidefine6 = cidefine6; + } + + public String getCidefine7() { + return cidefine7; + } + + public void setCidefine7(String cidefine7) { + this.cidefine7 = cidefine7; + } +} diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.xml b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.xml new file mode 100644 index 00000000..dc2b505e --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/entity/InventoryExtEntity.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + cInvCode, + cidefine1, + cidefine2, + cidefine3, + cidefine4, + cidefine5, + cidefine6, + cidefine7 + + + + + + + + + + + + + + + + + + + insert into Inventory_extradefine( + + cInvCode, + cidefine1, + cidefine2, + cidefine3, + cidefine4, + cidefine5, + cidefine6, + cidefine7, + + )values + ( + + #{cInvCode}, + #{cidefine1}, + #{cidefine2}, + #{cidefine3}, + #{cidefine4}, + #{cidefine5}, + #{cidefine6}, + #{cidefine7}, + + ) + + + + + update Inventory_extradefine set + + cInvCode = #{cInvCode}, + cidefine1 = #{cidefine1}, + cidefine2 = #{cidefine2}, + cidefine3 = #{cidefine3}, + cidefine4 = #{cidefine4}, + cidefine5 = #{cidefine5}, + cidefine6 = #{cidefine6}, + cidefine7 = #{cidefine7}, + + where cInvCode = #{cInvCode} + + diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/IInventoryExtService.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/IInventoryExtService.java new file mode 100644 index 00000000..0c470776 --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/IInventoryExtService.java @@ -0,0 +1,23 @@ +package com.hzya.frame.u8.base.inventory.service; + +import com.hzya.frame.basedao.service.IBaseService; +import com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity; + +/** + * @description: 存货档案扩展自定义项 service + * @tableName: Inventory_extradefine + * @entityName: InventoryExtEntity + * @author: gjh + * @history: 1.0 + */ +public interface IInventoryExtService extends IBaseService { + + /** + * 根据存货编码查询存货扩展自定义项 + * @param entity + * @return + */ + InventoryExtEntity getInvExt(InventoryExtEntity entity)throws Exception; + + void saveOrUpdateInv(InventoryExtEntity entity)throws Exception; +} \ No newline at end of file diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryExtServiceImpl.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryExtServiceImpl.java new file mode 100644 index 00000000..6586871f --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryExtServiceImpl.java @@ -0,0 +1,64 @@ +package com.hzya.frame.u8.base.inventory.service.impl; +import cn.hutool.core.util.StrUtil; +import com.baomidou.dynamic.datasource.annotation.DS; +import com.hzya.frame.basedao.service.impl.BaseService; +import com.hzya.frame.u8.base.inventory.dao.IInventoryExtDao; +import com.hzya.frame.u8.base.inventory.entity.InventoryExtEntity; +import com.hzya.frame.u8.base.inventory.service.IInventoryExtService; +import com.hzya.frame.web.exception.BaseSystemException; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @description: 存货档案扩展自定义项 service + * @tableName: Inventory_extradefine + * @entityName: InventoryExtEntity + * @author: gjh + * @history: 1.0 + */ +@Service(value="Inventory_extradefineService") +public class InventoryExtServiceImpl extends BaseService implements IInventoryExtService { + + protected IInventoryExtDao inventoryextDao; + + @Autowired + public void setInventoryExtDao(IInventoryExtDao dao) { + this.inventoryextDao = dao; + this.dao=dao; + } + + /** + * 根据存货编码查询存货扩展自定义项 + * + * @param entity + * @return + */ + @DS("#entity.dataSourceCode") + @Override + public InventoryExtEntity getInvExt(InventoryExtEntity entity) throws Exception { + if (null != entity && StrUtil.isNotEmpty(entity.getcInvCode())){ + List query = inventoryextDao.query(entity); + if (CollectionUtils.isNotEmpty(query)){ + if (query.size() > 1){ + throw new BaseSystemException("根据存货编码"+entity.getcInvCode()+"查询到多条扩展自定义项数据,请检查数据准确性"); + } + return query.get(0); + } + } + return null; + } + + @DS("#entity.dataSourceCode") + @Override + public void saveOrUpdateInv(InventoryExtEntity entity) throws Exception { + InventoryExtEntity invExt = getInvExt(entity); + if (null != invExt){ + inventoryextDao.update(entity); + }else { + inventoryextDao.save(entity); + } + } +} diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryService.java b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryService.java index 46ff08e2..ff7e9b70 100644 --- a/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryService.java +++ b/fw-u8/src/main/java/com/hzya/frame/u8/base/inventory/service/impl/InventoryService.java @@ -13,6 +13,7 @@ import com.hzya.frame.u8.base.inventory.entity.BasPartEntity; import com.hzya.frame.u8.base.inventory.entity.InventoryEntity; import com.hzya.frame.u8.base.inventory.entity.InventorySubEntity; import com.hzya.frame.u8.base.inventory.service.IBasPartService; +import com.hzya.frame.u8.base.inventory.service.IInventoryExtService; import com.hzya.frame.u8.base.inventory.service.IInventoryService; import com.hzya.frame.u8.base.inventory.service.IInventorySubService; import com.hzya.frame.web.exception.BaseSystemException; @@ -21,6 +22,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; import java.util.List; /** @@ -46,6 +49,8 @@ public class InventoryService extends BaseService implem private IBasPartService basPartService; @Autowired private IUAIdentityService uaIdentityService; + @Resource + private IInventoryExtService inventoryExtService; /** * 查询存货档案 * @@ -89,6 +94,8 @@ public class InventoryService extends BaseService implem }else { subService.update(subEntity); } + //保存扩展自由项 + inventoryExtService.saveOrUpdateInv(entity.getInvExtEntity()); //保存自定义表 //先查一下bas_part有没有 BasPartEntity part = new BasPartEntity();