SupplierServiceImpl.java
1.9 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
package com.huaheng.pc.config.supplier.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.common.utils.security.ShiroUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.pc.config.supplier.mapper.SupplierMapper;
import com.huaheng.pc.config.supplier.domain.Supplier;
import java.util.List;
import java.util.Map;
@Service("SupplierService")
public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService{
@Override
public List<Map<String, Object>> getCode(){
LambdaQueryWrapper<Supplier> lambda = new LambdaQueryWrapper<>();
lambda.select(Supplier::getCode, Supplier::getId, Supplier::getName)
// .eq(Supplier::getWarehouseCode, ShiroUtils.getWarehouseCode())
.eq(Supplier::getDeleted,false);
// .eq(Supplier::getEnable,true);
return this.listMaps(lambda);
}
@Override
public String getSuppierNameByCode(String code, String warehouseCode){
if(StringUtils.isNotEmpty(code)){
LambdaQueryWrapper<Supplier> lambda = new LambdaQueryWrapper<>();
lambda.eq(Supplier::getCode, code);
// lambda.eq(Supplier::getWarehouseCode, warehouseCode);
lambda.last("limit 1");
Supplier supplier= this.getOne(lambda);
if(supplier!=null){
return supplier.getName();
}
}
return null;
}
public Supplier getSuppierByCode(String code){
LambdaQueryWrapper<Supplier> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Supplier::getCode,code);
lambdaQueryWrapper.last("limit 1");
return this.getOne(lambdaQueryWrapper);
}
}