package com.fs.store.mapper;

import com.fs.store.domain.FsVessel;
import com.fs.store.param.FsVesselListUParam;
import com.fs.store.vo.FsVesselListUVO;
import com.fs.store.vo.FsVesselListVO;
import com.fs.store.vo.OptionsVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 经络管理Mapper接口
 *
 * @author fs
 * @date 2023-10-23
 */
public interface FsVesselMapper
{
    /**
     * 查询经络管理
     *
     * @param id 经络管理主键
     * @return 经络管理
     */
    public FsVessel selectFsVesselById(Long id);

    /**
     * 查询经络管理列表
     *
     * @param fsVessel 经络管理
     * @return 经络管理集合
     */
    public List<FsVessel> selectFsVesselList(FsVessel fsVessel);

    /**
     * 新增经络管理
     *
     * @param fsVessel 经络管理
     * @return 结果
     */
    public int insertFsVessel(FsVessel fsVessel);

    /**
     * 修改经络管理
     *
     * @param fsVessel 经络管理
     * @return 结果
     */
    public int updateFsVessel(FsVessel fsVessel);

    /**
     * 删除经络管理
     *
     * @param id 经络管理主键
     * @return 结果
     */
    public int deleteFsVesselById(Long id);

    /**
     * 批量删除经络管理
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsVesselByIds(Long[] ids);
    @Select({"<script> " +
            "select * from fs_vessel"+
            "<where>\n" +
            "            <if test=\"vesselName != null  and vesselName != ''\"> and vessel_name like concat('%', #{vesselName}, '%')</if>\n" +
            "            <if test=\"imgUrl != null  and imgUrl != ''\"> and img_url = #{imgUrl}</if>\n" +
            "            <if test=\"sort != null \"> and sort = #{sort}</if>\n" +
            "            <if test=\"vessel != null  and vessel != ''\"> and vessel = #{vessel}</if>\n" +
            "            <if test=\"region != null  and region != ''\"> and region = #{region}</if>\n" +
            "            <if test=\"descs != null  and descs != ''\"> and descs like concat('%', #{descs}, '%')</if>\n" +
            "            <if test=\"createTime != null \"> and date(create_time) = date(#{createTime})</if>\n" +
            "            <if test=\"status != null \"> and status = #{status}</if>\n" +
            "        </where>\n" +
            "        order by sort,id desc"+
            "</script>"})
    List<FsVesselListVO> selectFsVesselListVO(FsVessel fsVessel);
    @Select("select id dictValue,vessel_name dictLabel from fs_vessel")
    List<OptionsVO> selectFsVesselListOptions();
    @Select({"<script> " +
            "select v.* from fs_vessel v    " +
            "where v.status=1  " +
            "<if test = 'maps.keyword != null and maps.keyword != \"\"     '> " +
            "and v.vessel_name like CONCAT('%',#{maps.keyword},'%')" +
            "</if>"+
            "<if test = 'maps.vessel != null and maps.vessel != \"\"     '> " +
            "and v.vessel = #{maps.vessel} " +
            "</if>" +
            "<if test = 'maps.region != null and maps.region != \"\"     '> " +
            "and v.region = #{maps.region} " +
            "</if>" +
            " order by v.id desc "+
            "</script>"})
    List<FsVesselListUVO> selectFsVesselListUVO(@Param("maps")FsVesselListUParam param);
}
