package com.zcxk.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcxk.dao.MapSettingMapper;
import com.zcxk.entity.MapSetting;
import org.springframework.stereotype.Service;

/**
 * 地图设置服务接口
 *
 * @author yjy
 * @since 2020-12-4
 */
@Service
public class MapSettingService extends ServiceImpl<MapSettingMapper,MapSetting> {

    /**
     * 根据机构查询单条数据
     *
     * @param sceneTypeName 一级场景类型名称
     * @return 单条数据
     */
    public MapSetting selectMap(String sceneTypeName,Integer userId){
        MapSetting res=new MapSetting();
        if(userId != null) {
            res = this.getOne(new QueryWrapper<MapSetting>().eq("USER_ID", userId).eq("SCENE_TYPE_NAME",sceneTypeName));
        }
        return res;
    }
    /**
     * 保存数据
     *
     * @param MapSetting 地图设置信息
     * @return
     */
    public boolean saveMap(MapSetting MapSetting) {
        return this.saveOrUpdate(MapSetting);
    }

}