package org.jeecg.modules.bytedance.common.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.bytedance.common.entity.MaterialInfo;
import org.jeecg.modules.bytedance.common.mapper.MaterialInfoMapper;
import org.jeecg.modules.bytedance.common.service.IMaterialInfoService;
import org.springframework.stereotype.Service;

/**
 * 素材信息
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2019-10-11
 */
@Slf4j
@Service
public class MaterialInfoServiceImpl extends ServiceImpl<MaterialInfoMapper, MaterialInfo> implements IMaterialInfoService {

    @Override
    public MaterialInfo getParams(String signature, Integer status) {
        QueryWrapper<MaterialInfo>queryWrapper = new QueryWrapper<>();
        if(null!=signature&&!"".equals(signature.trim())){
            queryWrapper.eq("code",signature);
        }
        if(null!=status){
            queryWrapper.eq("status",status);
        }
        queryWrapper.orderByDesc("create_time").last("limit 1");
        return this.getOne(queryWrapper);
    }
}





