package com.fs.his.mapper;

import java.util.List;
import com.fs.his.domain.FsAdv;
import com.fs.his.param.FsAdvUParam;
import org.apache.ibatis.annotations.Select;

/**
 * 广告Mapper接口
 *
 * @author fs
 * @date 2023-06-08
 */
public interface FsAdvMapper
{
    /**
     * 查询广告
     *
     * @param advId 广告主键
     * @return 广告
     */
    public FsAdv selectFsAdvByAdvId(String advId);

    /**
     * 查询广告列表
     *
     * @param fsAdv 广告
     * @return 广告集合
     */
    public List<FsAdv> selectFsAdvList(FsAdv fsAdv);

    /**
     * 新增广告
     *
     * @param fsAdv 广告
     * @return 结果
     */
    public int insertFsAdv(FsAdv fsAdv);

    /**
     * 修改广告
     *
     * @param fsAdv 广告
     * @return 结果
     */
    public int updateFsAdv(FsAdv fsAdv);

    /**
     * 删除广告
     *
     * @param advId 广告主键
     * @return 结果
     */
    public int deleteFsAdvByAdvId(String advId);

    /**
     * 批量删除广告
     *
     * @param advIds 需要删除的数据主键集合
     * @return 结果
     */

    public int deleteFsAdvByAdvIds(String[] advIds);

    @Select("select * from fs_adv where status = 1 and adv_type = 11 and show_type = 4 ")
    List<FsAdv> selectFsAppAdvList();
    @Select({"<script> " +
            "select * from fs_adv "+
            "where status = 1" +
            "            <if test=\"advTitle != null  and advTitle != ''\"> adv_title like concat('%', #{advTitle}, '%')</if>\n" +
            "            <if test=\"imageUrl != null  and imageUrl != ''\"> and image_url = #{imageUrl}</if>\n" +
            "            <if test=\"advUrl != null  and advUrl != ''\"> and adv_url = #{advUrl}</if>\n" +
            "            <if test=\"content != null  and content != ''\"> and content = #{content}</if>\n" +
            "            <if test=\"sort != null  and sort != ''\"> and sort = #{sort}</if>\n" +
            "            <if test=\"advType != null \"> and adv_type = #{advType}</if>\n" +
            "            <if test=\"showType != null \"> and show_type = #{showType}</if>\n" +
            "    order by status desc,sort,adv_id desc "+
            "</script>"})
    List<FsAdv> selectFsAdvListUVO(FsAdvUParam map);
}
