|
1
2
|
package com.huaheng.pc.config.configValue.service;
|
|
3
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
4
|
import com.huaheng.common.utils.Wrappers;
|
|
5
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
6
|
import com.huaheng.framework.web.domain.AjaxResult;
|
|
7
8
|
import com.huaheng.pc.config.configValue.domain.ConfigValue;
import com.huaheng.pc.config.configValue.mapper.ConfigValueMapper;
|
|
9
|
import org.springframework.stereotype.Service;
|
|
10
|
import org.springframework.transaction.annotation.Transactional;
|
|
11
12
|
import java.util.List;
|
|
13
14
15
|
@Service
public class ConfigValueService extends ServiceImpl<ConfigValueMapper, ConfigValue> {
|
|
16
17
18
19
20
21
|
/**
* 复制系统参数配置表
* @param warehouseCode 原仓库编码
* @param newWarehouseCode 新仓库编码
* @return 是否复制成功
*/
|
|
22
|
@Transactional
|
|
23
24
25
26
27
28
29
30
|
public boolean configValueCopy(String warehouseCode, String newWarehouseCode){
log.trace("开始复制系统参数配置表");
LambdaQueryWrapper<ConfigValue> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, newWarehouseCode);
if (!this.list(lambdaQueryWrapper).isEmpty()){
log.error(newWarehouseCode+"仓库已存在");
return false;
}
|
|
31
32
|
lambdaQueryWrapper = Wrappers.lambdaQuery();
|
|
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, warehouseCode);
List<ConfigValue> configValueList = this.list(lambdaQueryWrapper);
for ( ConfigValue configValue : configValueList) {
configValue.setId(null);
configValue.setWarehouseCode(newWarehouseCode);
}
if ( this.saveBatch(configValueList) ){
log.trace("复制系统参数配置表成功,新仓库编码是:"+newWarehouseCode);
return true;
} else {
return false;
}
}
|
|
48
49
50
51
52
53
54
55
|
public ConfigValue getConfigValueByIdentifer(String identifier , String warehouseCode) {
LambdaQueryWrapper<ConfigValue> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(ConfigValue::getWarehouseCode, warehouseCode)
.eq(ConfigValue::getIdentifier, identifier);
ConfigValue configValue = getOne(lambdaQueryWrapper);
return configValue;
}
|
|
56
|
}
|