存货自由项

This commit is contained in:
xiang2lin 2025-03-27 15:52:24 +08:00
parent 51428ca2b4
commit 43e6e247da
8 changed files with 389 additions and 0 deletions

View File

@ -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<InventoryExtEntity, String> {
}

View File

@ -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<InventoryExtEntity, String> implements IInventoryExtDao {
}

View File

@ -13,6 +13,8 @@ import java.util.Date;
**/ **/
public class InventoryEntity extends BaseEntity { public class InventoryEntity extends BaseEntity {
//存货自由项
private InventoryExtEntity invExtEntity;
/** 无备注 */ /** 无备注 */
private String cInvCode; private String cInvCode;
/** 无备注 */ /** 无备注 */
@ -533,6 +535,14 @@ public class InventoryEntity extends BaseEntity {
/** 无备注 */ /** 无备注 */
private Integer iOldpartMngRule; private Integer iOldpartMngRule;
public InventoryExtEntity getInvExtEntity() {
return invExtEntity;
}
public void setInvExtEntity(InventoryExtEntity invExtEntity) {
this.invExtEntity = invExtEntity;
}
public String getcInvCode() { public String getcInvCode() {
return cInvCode; return cInvCode;
} }

View File

@ -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;
}
}

View File

@ -0,0 +1,150 @@
<?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.hzya.frame.u8.base.inventory.dao.impl.InventoryExtDaoImpl">
<resultMap id="get-InventoryExtEntity-result" type="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
<!--无备注 -->
<result property="cInvCode" column="cInvCode" />
<!--无备注 -->
<result property="cidefine1" column="cidefine1" />
<!--无备注 -->
<result property="cidefine2" column="cidefine2" />
<!--无备注 -->
<result property="cidefine3" column="cidefine3" />
<result property="cidefine4" column="cidefine4" />
<result property="cidefine5" column="cidefine5" />
<result property="cidefine6" column="cidefine6" />
<result property="cidefine7" column="cidefine7" />
</resultMap>
<sql id="InventoryExtEntity_Base_Column_List">
cInvCode,
cidefine1,
cidefine2,
cidefine3,
cidefine4,
cidefine5,
cidefine6,
cidefine7
</sql>
<!--通过ID获取数据 -->
<select id="entity_get" resultMap="get-InventoryExtEntity-result">
select
<include refid="InventoryExtEntity_Base_Column_List" />
from Inventory_extradefine where cInvCode = #{cInvCode}
</select>
<!-- 查询 采用==查询 -->
<select id="entity_list_base" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
select
<include refid="InventoryExtEntity_Base_Column_List" />
from Inventory_extradefine
<trim prefix="where" prefixOverrides="and">
<if test="cInvCode != null and cInvCode !='' ">cInvCode = #{cInvCode} </if>
<if test="cidefine1 != null and cidefine1 !='' "> and cidefine1 = #{cidefine1}</if>
<if test="cidefine2 != null and cidefine2 !='' "> and cidefine2 = #{cidefine2}</if>
<if test="cidefine3 != null and cidefine3 !='' "> and cidefine3 = #{cidefine3}</if>
<if test="cidefine4 != null and cidefine4 !='' "> and cidefine4 = #{cidefine4}</if>
<if test="cidefine5 != null and cidefine5 !='' "> and cidefine5 = #{cidefine5}</if>
<if test="cidefine6 != null and cidefine6 !='' "> and cidefine6 = #{cidefine6}</if>
<if test="cidefine7 != null and cidefine7 !='' "> and cidefine7 = #{cidefine7}</if>
</trim>
</select>
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
select count(1) from Inventory_extradefine
<trim prefix="where" prefixOverrides="and">
<if test="cInvCode != null and cInvCode !='' ">cInvCode = #{cInvCode} </if>
<if test="cidefine1 != null and cidefine1 !='' "> and cidefine1 = #{cidefine1} </if>
<if test="cidefine2 != null and cidefine2 !='' "> and cidefine2 = #{cidefine2} </if>
<if test="cidefine3 != null and cidefine3 !='' "> and cidefine3 = #{cidefine3} </if>
<if test="cidefine4 != null and cidefine4 !='' "> and cidefine4 = #{cidefine4}</if>
<if test="cidefine5 != null and cidefine5 !='' "> and cidefine5 = #{cidefine5}</if>
<if test="cidefine6 != null and cidefine6 !='' "> and cidefine6 = #{cidefine6}</if>
<if test="cidefine7 != null and cidefine7 !='' "> and cidefine7 = #{cidefine7}</if>
</trim>
</select>
<!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
select
<include refid="InventoryExtEntity_Base_Column_List" />
from Inventory_extradefine
<trim prefix="where" prefixOverrides="and">
<if test="cInvCode != null and cInvCode !='' "> cInvCode like concat('%',#{cInvCode},'%') </if>
<if test="cidefine1 != null and cidefine1 !='' "> and cidefine1 like concat('%',#{cidefine1},'%') </if>
<if test="cidefine2 != null and cidefine2 !='' "> and cidefine2 like concat('%',#{cidefine2},'%') </if>
<if test="cidefine3 != null and cidefine3 !='' "> and cidefine3 like concat('%',#{cidefine3},'%') </if>
<if test="cidefine4 != null and cidefine4 !='' "> and cidefine4 = #{cidefine4}</if>
<if test="cidefine5 != null and cidefine5 !='' "> and cidefine5 = #{cidefine5}</if>
<if test="cidefine6 != null and cidefine6 !='' "> and cidefine6 = #{cidefine6}</if>
<if test="cidefine7 != null and cidefine7 !='' "> and cidefine7 = #{cidefine7}</if>
</trim>
</select>
<!-- 查询列表 字段采用or格式 -->
<select id="entity_list_or" resultMap="get-InventoryExtEntity-result" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
select
<include refid="InventoryExtEntity_Base_Column_List" />
from Inventory_extradefine
<trim prefix="where" prefixOverrides="or">
<if test="cInvCode != null and cInvCode !='' ">cInvCode = #{cInvCode} </if>
<if test="cidefine1 != null and cidefine1 !='' "> or cidefine1 = #{cidefine1} </if>
<if test="cidefine2 != null and cidefine2 !='' "> or cidefine2 = #{cidefine2} </if>
<if test="cidefine3 != null and cidefine3 !='' "> or cidefine3 = #{cidefine3} </if>
<if test="cidefine4 != null and cidefine4 !='' "> or cidefine4 = #{cidefine4}</if>
<if test="cidefine5 != null and cidefine5 !='' "> or cidefine5 = #{cidefine5}</if>
<if test="cidefine6 != null and cidefine6 !='' "> or cidefine6 = #{cidefine6}</if>
<if test="cidefine7 != null and cidefine7 !='' "> or cidefine7 = #{cidefine7}</if>
</trim>
</select>
<!-- 新增 -->
<insert id="entity_insert" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
insert into Inventory_extradefine(
<trim suffix="" suffixOverrides=",">
<if test="cInvCode != null and cInvCode !='' "> cInvCode, </if>
<if test="cidefine1 != null and cidefine1 !='' "> cidefine1, </if>
<if test="cidefine2 != null and cidefine2 !='' "> cidefine2, </if>
<if test="cidefine3 != null and cidefine3 !='' "> cidefine3, </if>
<if test="cidefine4 != null and cidefine4 !='' "> cidefine4, </if>
<if test="cidefine5 != null and cidefine5 !='' "> cidefine5, </if>
<if test="cidefine6 != null and cidefine6 !='' "> cidefine6, </if>
<if test="cidefine7 != null and cidefine7 !='' "> cidefine7, </if>
</trim>
)values
(
<trim suffix="" suffixOverrides=",">
<if test="cInvCode != null and cInvCode !='' "> #{cInvCode}, </if>
<if test="cidefine1 != null and cidefine1 !='' "> #{cidefine1}, </if>
<if test="cidefine2 != null and cidefine2 !='' "> #{cidefine2}, </if>
<if test="cidefine3 != null and cidefine3 !='' "> #{cidefine3}, </if>
<if test="cidefine4 != null and cidefine4 !='' "> #{cidefine4}, </if>
<if test="cidefine5 != null and cidefine5 !='' "> #{cidefine5}, </if>
<if test="cidefine6 != null and cidefine6 !='' "> #{cidefine6}, </if>
<if test="cidefine7 != null and cidefine7 !='' "> #{cidefine7}, </if>
</trim>
)
</insert>
<!-- 修改 -->
<update id="entity_update" parameterType="com.hzya.frame.base.inventory.entity.InventoryExtEntity">
update Inventory_extradefine set
<trim suffix="" suffixOverrides=",">
<if test="cInvCode != null and cInvCode !='' "> cInvCode = #{cInvCode},</if>
<if test="cidefine1 != null and cidefine1 !='' "> cidefine1 = #{cidefine1},</if>
<if test="cidefine2 != null and cidefine2 !='' "> cidefine2 = #{cidefine2},</if>
<if test="cidefine3 != null and cidefine3 !='' "> cidefine3 = #{cidefine3},</if>
<if test="cidefine4 != null and cidefine4 !='' "> cidefine4 = #{cidefine4},</if>
<if test="cidefine5 != null and cidefine5 !='' "> cidefine5 = #{cidefine5},</if>
<if test="cidefine6 != null and cidefine6 !='' "> cidefine6 = #{cidefine6},</if>
<if test="cidefine7 != null and cidefine7 !='' "> cidefine7 = #{cidefine7},</if>
</trim>
where cInvCode = #{cInvCode}
</update>
</mapper>

View File

@ -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<InventoryExtEntity,String> {
/**
* 根据存货编码查询存货扩展自定义项
* @param entity
* @return
*/
InventoryExtEntity getInvExt(InventoryExtEntity entity)throws Exception;
void saveOrUpdateInv(InventoryExtEntity entity)throws Exception;
}

View File

@ -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<InventoryExtEntity,String> 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<InventoryExtEntity> 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);
}
}
}

View File

@ -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.InventoryEntity;
import com.hzya.frame.u8.base.inventory.entity.InventorySubEntity; 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.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.IInventoryService;
import com.hzya.frame.u8.base.inventory.service.IInventorySubService; import com.hzya.frame.u8.base.inventory.service.IInventorySubService;
import com.hzya.frame.web.exception.BaseSystemException; 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.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
/** /**
@ -46,6 +49,8 @@ public class InventoryService extends BaseService<InventoryEntity,String> implem
private IBasPartService basPartService; private IBasPartService basPartService;
@Autowired @Autowired
private IUAIdentityService uaIdentityService; private IUAIdentityService uaIdentityService;
@Resource
private IInventoryExtService inventoryExtService;
/** /**
* 查询存货档案 * 查询存货档案
* *
@ -89,6 +94,8 @@ public class InventoryService extends BaseService<InventoryEntity,String> implem
}else { }else {
subService.update(subEntity); subService.update(subEntity);
} }
//保存扩展自由项
inventoryExtService.saveOrUpdateInv(entity.getInvExtEntity());
//保存自定义表 //保存自定义表
//先查一下bas_part有没有 //先查一下bas_part有没有
BasPartEntity part = new BasPartEntity(); BasPartEntity part = new BasPartEntity();