CompanyU8Service.java 2 KB
package com.huaheng.pc.config.company.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.Wrappers;
import com.huaheng.pc.config.company.domain.CompanyU8;
import com.huaheng.pc.config.company.mapper.CompanyU8Mapper;
import org.springframework.stereotype.Service;

/**
 * CompanyWuService
 */
@Service
public class CompanyU8Service extends ServiceImpl<CompanyU8Mapper, CompanyU8>{

    public CompanyU8 getByCode(CompanyU8 companyU8){
        LambdaQueryWrapper<CompanyU8> lambdaQueryWrapper = Wrappers.lambdaQuery();
        lambdaQueryWrapper.eq(StringUtils.isNotEmpty(companyU8.getCompanyCode()),CompanyU8::getCompanyCode, companyU8.getCompanyCode());
        lambdaQueryWrapper.like(StringUtils.isNotEmpty(companyU8.getUCompanyCode()),CompanyU8::getUCompanyCode, companyU8.getUCompanyCode());
        lambdaQueryWrapper.last("limit 1");
        return this.getOne(lambdaQueryWrapper);
    }

    public CompanyU8 getCompanyByU8CodeWarehouseCode(String u8Code,String warehouse){
        LambdaQueryWrapper<CompanyU8> queryWrapper = Wrappers.lambdaQuery();
        queryWrapper.eq(CompanyU8::getUCompanyCode,u8Code)
                .eq(CompanyU8::getWarehouseCode,warehouse);
        queryWrapper.last("limit 1");
        CompanyU8 companyU8 = this.getOne(queryWrapper);
        return companyU8;
    }

    public CompanyU8 getCompanyByU8CodeWarehouseCode(String u8Code){
        return getCompanyByU8CodeWarehouseCode(u8Code, "CS0001");
    }
    public CompanyU8 getCompanyByU8CodeWarehouseCodeV(String u8Code,String warehouseCode){
        return getCompanyByU8CodeWarehouseCode(u8Code, warehouseCode);
    }
    public CompanyU8 getCompanyU8ByCode(String code, String warehouCode) {
        return this.getOne(new LambdaQueryWrapper<CompanyU8>()
                .eq(CompanyU8::getCompanyCode,code)
                .eq(CompanyU8::getWarehouseCode,warehouCode));
    }
}