package com.fs.his.mapper;

import java.util.List;
import com.fs.his.domain.FsFamousPrescribe;
import com.fs.his.param.FsFamousPrescribeListUParam;
import com.fs.his.vo.FsFamousPrescribeListUVO;
import com.fs.his.vo.FsFamousPrescribeListVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 经典名方Mapper接口
 *
 * @author fs
 * @date 2023-10-23
 */
public interface FsFamousPrescribeMapper
{
    /**
     * 查询经典名方
     *
     * @param id 经典名方主键
     * @return 经典名方
     */
    public FsFamousPrescribe selectFsFamousPrescribeById(Long id);

    /**
     * 查询经典名方列表
     *
     * @param fsFamousPrescribe 经典名方
     * @return 经典名方集合
     */
    public List<FsFamousPrescribe> selectFsFamousPrescribeList(FsFamousPrescribe fsFamousPrescribe);

    /**
     * 新增经典名方
     *
     * @param fsFamousPrescribe 经典名方
     * @return 结果
     */
    public int insertFsFamousPrescribe(FsFamousPrescribe fsFamousPrescribe);

    /**
     * 修改经典名方
     *
     * @param fsFamousPrescribe 经典名方
     * @return 结果
     */
    public int updateFsFamousPrescribe(FsFamousPrescribe fsFamousPrescribe);

    /**
     * 删除经典名方
     *
     * @param id 经典名方主键
     * @return 结果
     */
    public int deleteFsFamousPrescribeById(Long id);

    /**
     * 批量删除经典名方
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsFamousPrescribeByIds(Long[] ids);

    @Select({"<script> " +
            "select * from fs_famous_prescribe"+
            "<where>\n" +
            "            <if test=\"prescribeName != null  and prescribeName != ''\"> and prescribe_name like concat('%', #{prescribeName}, '%')</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=\"prescribeType != null  and prescribeType != ''\"> and prescribe_type = #{prescribeType}</if>\n" +
            "            <if test=\"indication != null  and indication != ''\"> and indication = #{indication}</if>\n" +
            "            <if test=\"belongBook != null  and belongBook != ''\"> and belong_book = #{belongBook}</if>\n" +
            "            <if test=\"descs != null  and descs != ''\"> and descs = #{descs}</if>\n" +
            "            <if test=\"action != null  and action != ''\"> and action = #{action}</if>\n" +
            "            <if test=\"usageMethod != null  and usageMethod != ''\"> and usage_method = #{usageMethod}</if>\n" +
            "            <if test=\"msg != null  and msg != ''\"> and msg = #{msg}</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<FsFamousPrescribeListVO> selectFsFamousPrescribeListVO(FsFamousPrescribe fsFamousPrescribe);
    @Select({"<script> " +
            "select p.* from fs_famous_prescribe p   " +
            "where p.status=1  " +
            "<if test = 'maps.keyword != null     '> " +
            "and p.prescribe_name like CONCAT('%',#{maps.keyword},'%') " +
            "</if>"+
            "<if test = 'maps.prescribeType != null and maps.prescribeType!=0    '> " +
            "and p.prescribe_type = #{maps.prescribeType} " +
            "</if>" +
            "<if test = 'maps.indication != null and maps.indication !=\"\"  '> " +
            "and p.indication = #{maps.indication} " +
            "</if>" +
            "<if test = 'maps.belongBook != null and maps.belongBook !=\"\"   '> " +
            "and p.belong_book = #{maps.belongBook} " +
            "</if>" +
            " order by p.create_time desc "+
            "</script>"})
    List<FsFamousPrescribeListUVO> selectFsFamousPrescribeListUVO(@Param("maps")FsFamousPrescribeListUParam param);
}
