CustomerServiceImpl.java
1.48 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
package com.huaheng.pc.config.customer.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huaheng.common.utils.Wrappers;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.pc.config.customer.domain.Customer;
import com.huaheng.pc.config.customer.mapper.CustomerMapper;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.List;
import java.util.Map;
@Service("CustomerService")
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements IService<Customer> {
public List<Map<String, Object>> getCode(){
LambdaQueryWrapper<Customer> lambda = Wrappers.lambdaQuery();
lambda.select(Customer::getCode, Customer::getId, Customer::getName)
.eq(Customer::getWarehouseCode, ShiroUtils.getWarehouseCode());
return this.listMaps(lambda);
}
public Customer getCustomerByCode(String code){
return this.getOne(new LambdaQueryWrapper<Customer>()
.eq(Customer::getCode,code)
.eq(Customer::getWarehouseCode,ShiroUtils.getWarehouseCode()));
}
public Customer getCustomerByCode(String code,String warehouseCode){
return this.getOne(new LambdaQueryWrapper<Customer>()
.eq(Customer::getCode,code)
.eq(Customer::getWarehouseCode,warehouseCode));
}
}