package com.fs.his.mapper;

import java.util.List;
import com.fs.his.domain.FsStoreProductCategory;
import com.fs.his.vo.FsStoreProductCategoryVO;
import com.fs.his.vo.FsStoreProductCategorysVO;
import com.fs.his.vo.OptionsVO;
import org.apache.ibatis.annotations.Select;

/**
 * 商品分类Mapper接口
 *
 * @author fs
 * @date 2023-06-08
 */
public interface FsStoreProductCategoryMapper
{
    /**
     * 查询商品分类
     *
     * @param cateId 商品分类主键
     * @return 商品分类
     */
    public FsStoreProductCategory selectFsStoreProductCategoryByCateId(Long cateId);

    /**
     * 查询商品分类列表
     *
     * @param fsStoreProductCategory 商品分类
     * @return 商品分类集合
     */
    public List<FsStoreProductCategory> selectFsStoreProductCategoryList(FsStoreProductCategory fsStoreProductCategory);

    /**
     * 新增商品分类
     *
     * @param fsStoreProductCategory 商品分类
     * @return 结果
     */
    public int insertFsStoreProductCategory(FsStoreProductCategory fsStoreProductCategory);

    /**
     * 修改商品分类
     *
     * @param fsStoreProductCategory 商品分类
     * @return 结果
     */
    public int updateFsStoreProductCategory(FsStoreProductCategory fsStoreProductCategory);

    /**
     * 删除商品分类
     *
     * @param cateId 商品分类主键
     * @return 结果
     */
    public int deleteFsStoreProductCategoryByCateId(Long cateId);

    /**
     * 批量删除商品分类
     *
     * @param cateIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsStoreProductCategoryByCateIds(Long[] cateIds);
@Select("select cate_id dict_value, cate_name dict_label,is_del status from fs_store_product_category WHERE pid = 0 and is_del=0 ")
    List<OptionsVO> selectFsStoreProductPidList();
    @Select({"<script> " +
            "SELECT f1.*,f2.cate_name pname FROM fs_store_product_category f1 LEFT JOIN fs_store_product_category f2 on f1.pid=f2.cate_id \n" +
            "WHERE   f1.is_del=0 "+
            " <if test=\"pid != null \"> and f1.pid = #{pid}</if>\n" +
            "            <if test=\"cateName != null  and cateName != ''\"> and f1.cate_name like concat('%', #{cateName}, '%')</if>\n" +
            "            <if test=\"sort != null \"> and f1.sort = #{sort}</if>\n" +
            "            <if test=\"pic != null  and pic != ''\"> f1.and pic = #{pic}</if>\n" +
            "            <if test=\"isShow != null \"> and f1.is_show = #{isShow}</if>\n" +
            "            <if test=\"isDel != null  and isDel != ''\"> and f1.is_del = #{isDel}</if>\n" +
            "       order by f1.sort,f1.cate_id desc"+
            "</script>"})
    List<FsStoreProductCategoryVO> selectFsStoreProductCategoryListVO(FsStoreProductCategory fsStoreProductCategory);


    @Select("select doctor_id id,doctor_name name from fs_doctor where doctor_type =1")
    List<OptionsVO> selectFsStoreProductCategoryOptionsVO();
@Select("select * from fs_store_product_category ")
    List<FsStoreProductCategorysVO> selectFsStoreProductCategorysVOList();
    @Select("select * from fs_store_product_category where pid=0")
    List<FsStoreProductCategory> getPid();
}
