package com.fs.city.mapper;

import java.util.List;
import com.fs.city.domain.FsCity;
import org.apache.ibatis.annotations.Select;

/**
 * 城市Mapper接口
 * 
 * @author fs
 * @date 2026-01-14
 */
public interface FsCityMapper 
{
    /**
     * 查询城市
     * 
     * @param id 城市主键
     * @return 城市
     */
    public FsCity selectFsCityById(Long id);

    /**
     * 查询城市列表
     * 
     * @param fsCity 城市
     * @return 城市集合
     */
    public List<FsCity> selectFsCityList(FsCity fsCity);

    /**
     * 新增城市
     * 
     * @param fsCity 城市
     * @return 结果
     */
    public int insertFsCity(FsCity fsCity);

    /**
     * 修改城市
     * 
     * @param fsCity 城市
     * @return 结果
     */
    public int updateFsCity(FsCity fsCity);

    /**
     * 删除城市
     * 
     * @param id 城市主键
     * @return 结果
     */
    public int deleteFsCityById(Long id);

    /**
     * 批量删除城市
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteFsCityByIds(Long[] ids);



    @Select("SELECT id, city_id, city_name, parent_id, level " +
            "FROM fs_city " +
            "WHERE parent_id = #{parentId} " +
            "ORDER BY sort ASC, id ASC")
    List<FsCity> selectByParentId(String pid);

    @Select("SELECT id, city_id, city_name, parent_id, level FROM fs_city WHERE city_id = #{cityId} LIMIT 1")
    FsCity selectByCityId(String cityId);

}
