package io.modules.item.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import cn.hutool.core.util.StrUtil;
import io.common.service.impl.CrudServiceImpl;
import io.modules.item.dao.CityDao;
import io.modules.item.dto.CityDTO;
import io.modules.item.entity.CityEntity;
import io.modules.item.service.CityService;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 城市信息
 *
 * @author Mark #
 * @since 1.0.0 2025-02-14
 */
@Service
public class CityServiceImpl extends CrudServiceImpl<CityDao, CityEntity, CityDTO> implements CityService {

    @Override
    public QueryWrapper<CityEntity> getWrapper(Map<String, Object> params){
        String cityId = (String)params.get("cityId");
        String father = (String)params.get("father");

        QueryWrapper<CityEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StrUtil.isNotBlank(cityId), "city_id", cityId);
        wrapper.eq(StrUtil.isNotBlank(father), "father", father);

        return wrapper;
    }


}