Blame view

src/main/java/com/huaheng/pc/config/customer/service/CustomerServiceImpl.java 1.48 KB
1
2
package com.huaheng.pc.config.customer.service;
3
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
周鸿 authored
4
import com.huaheng.common.utils.Wrappers;
5
import com.baomidou.mybatisplus.extension.service.IService;
6
import com.huaheng.common.utils.security.ShiroUtils;
7
8
9
10
11
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;
12
13
14
15
import java.util.List;
import java.util.Map;

@Service("CustomerService")
16
17
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements IService<Customer> {
18
19
20
21
22
23
24

    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);
    }
25
26
27
28
29
30
31
32
33
34
35
36
37

    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));
    }
38
}