Merge branch 'dev' into test

* dev:
  增加快照发布配置
  数据库唯一校验
This commit is contained in:
ranke
2026-01-15 08:52:44 +08:00
3 changed files with 19 additions and 14 deletions

12
pom.xml
View File

@@ -19,7 +19,7 @@
<url>https://github.com/YunaiV/ruoyi-vue-pro</url> <url>https://github.com/YunaiV/ruoyi-vue-pro</url>
<properties> <properties>
<revision>3.0.46</revision> <revision>3.0.47-SNAPSHOT</revision>
<!-- Maven 相关 --> <!-- Maven 相关 -->
<java.version>17</java.version> <java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.source>${java.version}</maven.compiler.source>
@@ -167,11 +167,11 @@
<name>中铜 ZStack 私服</name> <name>中铜 ZStack 私服</name>
<url>http://172.16.46.63:30708/repository/test/</url> <url>http://172.16.46.63:30708/repository/test/</url>
</repository> </repository>
<!-- <snapshotRepository>--> <snapshotRepository>
<!-- <id>ZT</id>--> <id>ZT-snap</id>
<!-- <name>中铜 ZStack 私服</name>--> <name>中铜 ZStack 私服</name>
<!-- <url>https://your-nexus.example.com/repository/maven-snapshots/</url>--> <url>http://172.16.46.63:30708/repository/test-snap/</url>
<!-- </snapshotRepository>--> </snapshotRepository>
</distributionManagement> </distributionManagement>
<profiles> <profiles>

View File

@@ -35,8 +35,8 @@ public interface InternalWarehouseMapper extends BaseMapperX<InternalWarehouseDO
.eqIfPresent(InternalWarehouseDO::getCompanyNameCustom, reqVO.getCompanyNameCustom()) .eqIfPresent(InternalWarehouseDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
.orderByDesc(InternalWarehouseDO::getId)); .orderByDesc(InternalWarehouseDO::getId));
} }
@Select("SELECT COUNT(*) AS total FROM bse_intl_wrh WHERE NUM = #{number}") @Select("SELECT * FROM bse_intl_wrh WHERE NUM = #{number}")
@TenantIgnore @TenantIgnore
Long selectCountByNumber(String number); InternalWarehouseDO selectInternalWarehouseDOByNumber(String number);
} }

View File

@@ -21,7 +21,6 @@ import com.zt.plat.framework.common.pojo.PageParam;
import com.zt.plat.framework.common.util.object.BeanUtils; import com.zt.plat.framework.common.util.object.BeanUtils;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList; import static com.zt.plat.framework.common.util.collection.CollectionUtils.convertList;
import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList; import static com.zt.plat.framework.common.util.collection.CollectionUtils.diffList;
@@ -46,23 +45,29 @@ public class InternalWarehouseServiceImpl implements InternalWarehouseService {
// 插入 // 插入
InternalWarehouseDO internalWarehouse = BeanUtils.toBean(createReqVO, InternalWarehouseDO.class); InternalWarehouseDO internalWarehouse = BeanUtils.toBean(createReqVO, InternalWarehouseDO.class);
//校验所绑定的库位是否已经存在 //校验所绑定的库位是否已经存在
validateInternalWarehouseExists(createReqVO.getNumber()); validateInternalWarehouseExists(createReqVO.getNumber(), "insert", null);
internalWarehouseMapper.insert(internalWarehouse); internalWarehouseMapper.insert(internalWarehouse);
// 返回 // 返回
return BeanUtils.toBean(internalWarehouse, InternalWarehouseRespVO.class); return BeanUtils.toBean(internalWarehouse, InternalWarehouseRespVO.class);
} }
public void validateInternalWarehouseExists(String number){ public void validateInternalWarehouseExists(String number, String type, Long id) {
if (internalWarehouseMapper.selectCountByNumber(number)>0) { InternalWarehouseDO internalWarehouseDO = internalWarehouseMapper.selectInternalWarehouseDOByNumber(number);
if (internalWarehouseDO != null && "insert".equals(type)) {
throw exception(INTERNAL_WAREHOUSE_EXISTS);
} else if (internalWarehouseDO != null && "update".equals(type) && !Objects.equals(id, internalWarehouseDO.getId())) {
throw exception(INTERNAL_WAREHOUSE_EXISTS); throw exception(INTERNAL_WAREHOUSE_EXISTS);
} }
} }
@Override @Override
public void updateInternalWarehouse(InternalWarehouseSaveReqVO updateReqVO) { public void updateInternalWarehouse(InternalWarehouseSaveReqVO updateReqVO) {
// 校验存在 // 校验存在
validateInternalWarehouseExists(updateReqVO.getId()); validateInternalWarehouseExists(updateReqVO.getId());
// 校验所绑定的库位是否已经存在
validateInternalWarehouseExists(updateReqVO.getNumber(), "update", updateReqVO.getId());
// 更新 // 更新
InternalWarehouseDO updateObj = BeanUtils.toBean(updateReqVO, InternalWarehouseDO.class); InternalWarehouseDO updateObj = BeanUtils.toBean(updateReqVO, InternalWarehouseDO.class);
internalWarehouseMapper.updateById(updateObj); internalWarehouseMapper.updateById(updateObj);
@@ -77,12 +82,12 @@ public class InternalWarehouseServiceImpl implements InternalWarehouseService {
} }
@Override @Override
public void deleteInternalWarehouseListByIds(List<Long> ids) { public void deleteInternalWarehouseListByIds(List<Long> ids) {
// 校验存在 // 校验存在
validateInternalWarehouseExists(ids); validateInternalWarehouseExists(ids);
// 删除 // 删除
internalWarehouseMapper.deleteByIds(ids); internalWarehouseMapper.deleteByIds(ids);
} }
private void validateInternalWarehouseExists(List<Long> ids) { private void validateInternalWarehouseExists(List<Long> ids) {
List<InternalWarehouseDO> list = internalWarehouseMapper.selectByIds(ids); List<InternalWarehouseDO> list = internalWarehouseMapper.selectByIds(ids);