package cn.ysk.cashier.mybatis.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.ysk.cashier.mybatis.mapper.TbPadLayoutMapper;
import cn.ysk.cashier.mybatis.service.TbPadLayoutService;
import cn.ysk.cashier.pojo.product.TbPadLayout;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Pad商品布局版式
 *
 * @author Tankaikai tankaikai@aliyun.com
 * @since 2.0 2024-10-22
 */
@Service
public class TbPadLayoutServiceImpl extends ServiceImpl<TbPadLayoutMapper, TbPadLayout> implements TbPadLayoutService {

    private LambdaQueryWrapper<TbPadLayout> getWrapper(Map<String, Object> params) {
        TbPadLayout param = BeanUtil.toBean(params, TbPadLayout.class);
        LambdaQueryWrapper<TbPadLayout> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(TbPadLayout::getDelFlag, 0);
        wrapper.orderByAsc(TbPadLayout::getSort);
        wrapper.orderByAsc(TbPadLayout::getId);
        return wrapper;
    }



    @Override
    public List<TbPadLayout> findList() {
        return super.list(this.getWrapper(new HashMap<>(1)));
    }
}