KuaidiWeightServiceImpl.java 1.6 KB
package com.huaheng.pc.config.weight.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.wcsscanbarcode.domain.Wcsscanbarcode;
import com.huaheng.pc.config.wcsscanbarcode.mapper.WcsscanbarcodeMapper;
import com.huaheng.pc.config.weight.domain.KuaidiWeight;
import com.huaheng.pc.config.weight.mapper.KuaidiWeightMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName KuaidiWeightServiceImpl
 * @Description TODO
 * @Author Administrator
 * @Date 2020/12/716:45
 */

@Service
public class KuaidiWeightServiceImpl extends ServiceImpl<KuaidiWeightMapper, KuaidiWeight> implements KuaidiWeightService {



    @Override
    public int insertWeight(KuaidiWeight kuaidiWeight) {
        boolean tag=this.save(kuaidiWeight);
        if(tag){
            return 0;
        }
        return 1;
    }

    @Override
    public KuaidiWeight selectEntity(KuaidiWeight kuaidiWeight) {
        return this.getOne(new LambdaQueryWrapper<KuaidiWeight>()
                .eq((StringUtils.isNotNull(kuaidiWeight.getId())),KuaidiWeight::getId,kuaidiWeight.getId())
                .eq((StringUtils.isNotEmpty(kuaidiWeight.getTrackCode())),KuaidiWeight::getTrackCode,kuaidiWeight.getTrackCode())
                .eq((StringUtils.isNotEmpty(kuaidiWeight.getWeight())),KuaidiWeight::getWeight,kuaidiWeight.getWeight())
                .last("limit 1"));
    }
}