package com.platform.service.custom;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.platform.entity.TmBrandType;
import com.platform.service.impl.TmBrandTypeServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 2 * @Author: Abner
 * 3 * @Date: 2020/11/9 15:31
 * 4
 */
@Service
@Slf4j
public class TmBrandTypeService extends TmBrandTypeServiceImpl {

    public List<TmBrandType> getAllList(){

        QueryWrapper<TmBrandType> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enable" , 1);

        return getBaseMapper().selectList(queryWrapper);
    }

    public TmBrandType getByBrandType(int type){
        QueryWrapper<TmBrandType> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("enable" , 1);
        queryWrapper.eq("brand_type" , type);
        queryWrapper.last("limit 1");
        return getBaseMapper().selectOne(queryWrapper);
    }
}
