Merge branch 'dev' into test
* dev: 增加快照发布配置 数据库唯一校验
This commit is contained in:
12
pom.xml
12
pom.xml
@@ -19,7 +19,7 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>3.0.46</revision>
|
||||
<revision>3.0.47-SNAPSHOT</revision>
|
||||
<!-- Maven 相关 -->
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
@@ -167,11 +167,11 @@
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||
</repository>
|
||||
<!-- <snapshotRepository>-->
|
||||
<!-- <id>ZT</id>-->
|
||||
<!-- <name>中铜 ZStack 私服</name>-->
|
||||
<!-- <url>https://your-nexus.example.com/repository/maven-snapshots/</url>-->
|
||||
<!-- </snapshotRepository>-->
|
||||
<snapshotRepository>
|
||||
<id>ZT-snap</id>
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test-snap/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<profiles>
|
||||
|
||||
@@ -35,8 +35,8 @@ public interface InternalWarehouseMapper extends BaseMapperX<InternalWarehouseDO
|
||||
.eqIfPresent(InternalWarehouseDO::getCompanyNameCustom, reqVO.getCompanyNameCustom())
|
||||
.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
|
||||
Long selectCountByNumber(String number);
|
||||
InternalWarehouseDO selectInternalWarehouseDOByNumber(String number);
|
||||
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import com.zt.plat.framework.common.pojo.PageParam;
|
||||
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.util.collection.CollectionUtils.convertList;
|
||||
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);
|
||||
//校验所绑定的库位是否已经存在
|
||||
validateInternalWarehouseExists(createReqVO.getNumber());
|
||||
validateInternalWarehouseExists(createReqVO.getNumber(), "insert", null);
|
||||
internalWarehouseMapper.insert(internalWarehouse);
|
||||
// 返回
|
||||
return BeanUtils.toBean(internalWarehouse, InternalWarehouseRespVO.class);
|
||||
}
|
||||
|
||||
|
||||
public void validateInternalWarehouseExists(String number){
|
||||
if (internalWarehouseMapper.selectCountByNumber(number)>0) {
|
||||
public void validateInternalWarehouseExists(String number, String type, Long id) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInternalWarehouse(InternalWarehouseSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateInternalWarehouseExists(updateReqVO.getId());
|
||||
// 校验所绑定的库位是否已经存在
|
||||
validateInternalWarehouseExists(updateReqVO.getNumber(), "update", updateReqVO.getId());
|
||||
// 更新
|
||||
InternalWarehouseDO updateObj = BeanUtils.toBean(updateReqVO, InternalWarehouseDO.class);
|
||||
internalWarehouseMapper.updateById(updateObj);
|
||||
@@ -77,12 +82,12 @@ public class InternalWarehouseServiceImpl implements InternalWarehouseService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteInternalWarehouseListByIds(List<Long> ids) {
|
||||
public void deleteInternalWarehouseListByIds(List<Long> ids) {
|
||||
// 校验存在
|
||||
validateInternalWarehouseExists(ids);
|
||||
// 删除
|
||||
internalWarehouseMapper.deleteByIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateInternalWarehouseExists(List<Long> ids) {
|
||||
List<InternalWarehouseDO> list = internalWarehouseMapper.selectByIds(ids);
|
||||
|
||||
Reference in New Issue
Block a user