package com.fs.hisStore.mapper;

import java.util.List;
import com.fs.hisStore.domain.FsShippingTemplatesFreeScrm;
import com.fs.hisStore.dto.TemplateDTO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 免邮费Mapper接口
 * 
 * @author fs
 * @date 2022-03-15
 */
public interface FsShippingTemplatesFreeScrmMapper 
{
    /**
     * 查询免邮费
     * 
     * @param id 免邮费ID
     * @return 免邮费
     */
    public FsShippingTemplatesFreeScrm selectFsShippingTemplatesFreeById(Long id);

    /**
     * 查询免邮费列表
     * 
     * @param fsShippingTemplatesFree 免邮费
     * @return 免邮费集合
     */
    public List<FsShippingTemplatesFreeScrm> selectFsShippingTemplatesFreeList(FsShippingTemplatesFreeScrm fsShippingTemplatesFree);

    /**
     * 新增免邮费
     * 
     * @param fsShippingTemplatesFree 免邮费
     * @return 结果
     */
    public int insertFsShippingTemplatesFree(FsShippingTemplatesFreeScrm fsShippingTemplatesFree);

    /**
     * 修改免邮费
     * 
     * @param fsShippingTemplatesFree 免邮费
     * @return 结果
     */
    public int updateFsShippingTemplatesFree(FsShippingTemplatesFreeScrm fsShippingTemplatesFree);

    /**
     * 删除免邮费
     * 
     * @param id 免邮费ID
     * @return 结果
     */
    public int deleteFsShippingTemplatesFreeById(Long id);

    /**
     * 批量删除免邮费
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteFsShippingTemplatesFreeByIds(Long[] ids);

    @Delete("delete from fs_shipping_templates_free where temp_id=#{tempId}")
    int deleteFsShippingTemplatesFreeByTempId(Long tempId);
    @Select({"<script> " +
            "select count(1) from fs_shipping_templates_free " +
            "where 1=1 " +

            "<if test = 'maps.tempId != null    '> " +
            "and temp_id =#{maps.tempId} " +
            "</if>" +
            "<if test = 'maps.cityId != null    '> " +
            "and city_id =#{maps.cityId} " +
            "</if>" +
            "<if test = 'maps.cityId != null    '> " +
            "and city_id =#{maps.cityId} " +
            "</if>" +
            "<if test = 'maps.price != null    '> " +
            "and price &lt;=  #{maps.price} " +
            "</if>" +
            "<if test = 'maps.number != null    '> " +
            "and number &lt;=  #{maps.number} " +
            "</if>" +
            "</script>"})
    int selectCountByTemplateDTO(@Param("maps") TemplateDTO mapValue);
}
