/*
 * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.dao;

import java.util.List;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.shop.bean.dto.ListCategoryDTO;
import com.yami.shop.bean.model.Category;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.bean.vo.ListCategoryForUserVO;
import com.yami.shop.bean.vo.ListCategoryVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface CategoryMapper extends BaseMapper<Category> {

	List<Category> listByParentId(@Param("parentId") Long parentId);

    List<Category> listThreeByParentId(@Param("parentId") Long parentId);
    @Select("SELECT * FROM tz_category WHERE category_name = #{name} AND parent_id = #{parentId} AND shop_id = #{shopId}")
    Category selectByNameAndParentId(
            @Param("name") String name,
            @Param("parentId") Long parentId,
            @Param("shopId") Long shopId
    );

    IPage<ListCategoryVO> listCategory(Page<ListCategoryVO> page, @Param("listCategoryDTO")ListCategoryDTO listCategoryDTO);
    List<ListCategoryVO> listCategoryChildren(@Param("listCategoryDTO")ListCategoryDTO listCategoryDTO);
}
