package com.younike.service.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.younike.service.mapper.StoreCategoryMapper;
import com.younike.service.pojo.StoreCategory;
import com.younike.service.pojo.vo.StoreCategoryVo;
import com.younike.service.service.IStoreCategoryService;
import com.younike.common.core.page.PageParam;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 门店分类Service业务层处理
 *
 * @author dail
 * @date 2022-05-24
 */
@Service
@Transactional
public class StoreCategoryServiceImpl extends ServiceImpl<StoreCategoryMapper, StoreCategory>  implements IStoreCategoryService {


    /**
     * 自定义分页逻辑 这里就省略掉
     * @param pageParam
     * @return
     */
    @Override
    public PageParam<StoreCategory> page(PageParam<StoreCategory> pageParam) {

        PageParam<StoreCategory> page = this.page(pageParam, new LambdaQueryWrapper<StoreCategory>()
                //.like(Printer::getName,pageParam.getParam().getName())
                // 查询逻辑 适合单表 多表 重写XML查询
        );

        return page;
    }

    /**
     * 获取门店分类树状图
     * @return
     */
    @Override
    public List<StoreCategoryVo> getStoreCategoryTree(StoreCategory storeCategory) {
        List<StoreCategoryVo> storeCategoryTree = baseMapper.getStoreCategoryTree(storeCategory);
        return storeCategoryTree;
    }

}
