ZoneServiceImpl.java
1.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.huaheng.pc.config.zone.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.pc.config.zone.domain.Zone;
import com.huaheng.pc.config.zone.mapper.ZoneMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@Service("zone")
public class ZoneServiceImpl extends ServiceImpl<ZoneMapper, Zone> implements ZoneService {
@Resource
private ZoneMapper zoneMapper;
@Override
public List<Map<String, Object>> getZoneCodeList() {
LambdaQueryWrapper<Zone> lambda = Wrappers.lambdaQuery();
lambda.select(Zone::getId, Zone::getCode, Zone::getName)
.eq(Zone::getWarehouseCode, ShiroUtils.getWarehouseCode());
return this.listMaps(lambda);
}
@Override
@Transactional
public boolean zoneCopy(String warehouseCode, String newWarehouseCode) {
int i = 0;
//复制流程主表
i = zoneMapper.zoneCopy(warehouseCode,newWarehouseCode);
if(i < 1){
throw new ServiceException("复制菜单数据失败");
}
return true;
}
@Override
public boolean exists(String code,String warehouseCode)
{
LambdaQueryWrapper<Zone> lambda = Wrappers.lambdaQuery();
lambda.eq(Zone::getCode,code)
.eq(Zone::getWarehouseCode, warehouseCode);
return this.listMaps(lambda).size() != 0;
}
}