package com.sonic.frog.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sonic.frog.dao.ImageStyleDictDao;
import com.sonic.frog.domain.entity.ImageStyleDict;
import com.sonic.frog.service.ImageStyleDictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 形象风格图片表 服务实现类
 * </p>
 *
 * @author mzc
 * @since 2024-11-28
 */
@Service
@Slf4j
public class ImageStyleDictServiceImpl extends ServiceImpl<ImageStyleDictDao, ImageStyleDict> implements ImageStyleDictService {

    @Override
    public List<ImageStyleDict> getAllImageStyleDictList() {
        return list(Wrappers.<ImageStyleDict>lambdaQuery().eq(ImageStyleDict::getIsDelete, false).orderByAsc(ImageStyleDict::getSort));
    }

    @Override
    public ImageStyleDict getImageStyleDictByCode(String imageStyleCode) {
        return getOne(Wrappers.<ImageStyleDict>lambdaQuery().eq(ImageStyleDict::getCode, imageStyleCode).last("limit 1"));
    }
}
