package com.mosty.qwzx.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mosty.base.model.dto.qwzx.TbQwXfbbDkWzDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbQueryByJlDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbStartOrEndBbDto;
import com.mosty.base.model.dto.qwzx.TbQwXfbbVo;
import com.mosty.base.model.entity.qwzx.TbQwXfbb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mosty.base.model.entity.qwzx.TbQwXfpbZq;
import com.mosty.base.model.entity.wzzx.TbWzLswz;
import com.mosty.base.model.query.qwzx.TbQwXfbbQuery;
import com.mosty.base.model.query.sjzx.XfbbTjQuery;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 巡防报备表 Mapper 接口
 * </p>
 *
 * @author zengbo
 * @since 2022-06-27
 */
@Mapper
public interface TbQwXfbbMapper extends BaseMapper<TbQwXfbb> {

    @ApiOperation("删除巡防报备")
    int deleteXfbb(@Param("list") List<String> list);

    @ApiOperation("值班查询")
    IPage<TbQwXfbbVo> queryList(@Param("page") IPage<TbQwXfbbVo> page, @Param("params") TbQwXfbbQuery zfbb);

    @ApiOperation("id查询")
    TbQwXfbbVo queryById(@Param("id") String id);

    @ApiOperation("查询街面巡组计划数")
    Integer selectJhsl(Map<String, Object> map);

    @ApiOperation("查询街面巡组实际数")
    Integer selectSjsl(Map<String, Object> map);

    @ApiOperation("查询巡逻力量和时长里程")
    Map<String, Integer> selectPowerAndDayLength(@Param("ssbmdm") String ssbmdm);

    @ApiOperation("查询周边巡组")
    List<TbQwXfbb> selectNearbyDeck(@Param("t") TbQwXfbb tbQwXfbb);

    @ApiOperation("查询计划巡组列表")
    List<TbQwXfpbZq> selectJhslList(Map<String, Object> map);

    @ApiOperation("查询数据巡组列表")
    List<TbQwXfbb> selectSjslList(Map<String, Object> map);

    @ApiOperation("查询周边巡组或街面巡组数量")
    int getCountZbxz(Map<String, Object> map);

    @ApiOperation("查询周边巡组或街面巡组列表")
    List<TbQwXfbb> getListZbxz(Map<String, Object> map);


    @ApiOperation("查询我今天的报备new")
    TbQwXfbb getMybbTodayNew(@Param("sfzh") String sfzh,
                             @Param("bblx") String bblx);

    @ApiOperation("根据时间查询报备信息")
    List<TbQwXfbb> getMybbTodayByTime(@Param("userId") String userId,
                                      @Param("bblx") String bblx,
                                      @Param("time") String time);

    @ApiOperation("查询范围内的最近的巡组信息")
    TbQwXfbb getBbxxByJi(TbQwXfbbQueryByJlDto dto);

    @ApiOperation("根据设备ID查询该设备所在的巡组")
    List<TbQwXfbb> getBbList(String sbid);

    @ApiOperation("根据车辆gpsid查询该设备所在的巡组")
    List<TbQwXfbb> getClBbList(String sbid);


    @ApiOperation("新增巡防报备")
    void insertEntity(TbQwXfbb xfbb);

    @ApiOperation("巡防时长统计")
    List<Map<String, Object>> getSumXfsc(@Param("kssj") String kssj, @Param("jssj") String jssj);

    @ApiOperation("巡防里程统计")
    List<Map<String, Object>> getSumXflc(@Param("kssj") String kssj, @Param("jssj") String jssj);


    @ApiOperation("查询当前所有报备中的数据")
    List<TbQwXfbb> getBbAll();

    @ApiOperation("修改巡逻状态")
    int updateByXlzt(@Param("xlzt") String xlzt,
                     @Param("id") String id);

    @ApiOperation("修改巡逻时长")
    int updateXfscById(TbQwXfbb xfbb);

    @ApiOperation("部门统计")
    IPage<Object> bmtj(@Param("page") IPage<TbQwXfbbVo> page, @Param("params") XfbbTjQuery query);

    @ApiOperation("部门统计")
    Map<String, Object> bmtjAll(XfbbTjQuery query);

    @ApiOperation("巡区统计")
    IPage<Object> xqtj(@Param("page") IPage<TbQwXfbbVo> page, @Param("params") XfbbTjQuery query);

    @ApiOperation("个人统计")
    IPage<Object> grtj(@Param("page") IPage<TbQwXfbbVo> page, @Param("params") XfbbTjQuery query);

    @ApiOperation("根据设备ID查询该设备所在的巡组")
    List<TbQwXfbb> getBbidByXq(String xqid);

    @ApiOperation("部门统计")
    Map<String, Integer> getScLc(@Param("ssbmdm") String ssbmdm, @Param("time") String time);

    @ApiOperation("根据报备id获取巡逻轨迹")
    List<TbWzLswz> getBbgj(String bbid);

    Boolean updateBbJzwz(TbQwXfbbDkWzDto dto);

    void insertTbWzSblswz(TbWzLswz wz);
}
