Commit 2078683c authored by zhangsen's avatar zhangsen

根据换流站统计消防车辆API

parent 8ced8dc8
...@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.ccs.api.mapper; ...@@ -2,6 +2,10 @@ package com.yeejoin.amos.boot.module.ccs.api.mapper;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireVehicle; import com.yeejoin.amos.boot.module.ccs.api.entity.FireVehicle;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 消防车辆信息 Mapper 接口 * 消防车辆信息 Mapper 接口
...@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +15,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface FireVehicleMapper extends BaseMapper<FireVehicle> { public interface FireVehicleMapper extends BaseMapper<FireVehicle> {
List<CarInfoVO> getCarInfoByStationCode(@Param("stationCode") String stationCode);
} }
package com.yeejoin.amos.boot.module.ccs.api.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class CarInfoVO implements Serializable {
private Integer total;
private String carType;
private String strCarNumber;
private List<String> carList;
}
...@@ -2,4 +2,17 @@ ...@@ -2,4 +2,17 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireVehicleMapper"> <mapper namespace="com.yeejoin.amos.boot.module.ccs.api.mapper.FireVehicleMapper">
<select id="getCarInfoByStationCode" resultType="com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO">
SELECT
count(*) as total,
`type` as carType,
group_concat( `number` ) AS strCarNumber
FROM
ast_fire_vehicle
WHERE
station_code = #{stationCode,jdbcType=VARCHAR}
GROUP BY
`type`,
`number`
</select>
</mapper> </mapper>
...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern; ...@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto; import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum; import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import com.yeejoin.amos.boot.module.ccs.biz.service.impl.FireStationInfoServiceImpl; import com.yeejoin.amos.boot.module.ccs.biz.service.impl.FireStationInfoServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -105,4 +106,11 @@ public class FireStationInfoController extends BaseController { ...@@ -105,4 +106,11 @@ public class FireStationInfoController extends BaseController {
@ApiParam(value = "换流站编号") @RequestParam(required = false) String stationCode) { @ApiParam(value = "换流站编号") @RequestParam(required = false) String stationCode) {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getAlarmTrendByDatePeriod(stationCode, beginDate, endDate)); return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getAlarmTrendByDatePeriod(stationCode, beginDate, endDate));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据换流站code统计消防车", notes = "根据换流站code统计消防车")
@GetMapping(value = "/getCarInfoByStationCode")
public ResponseModel<List<CarInfoVO>> getCarInfoByStationCode(@ApiParam(value = "换流站编号") @RequestParam(required = true) String stationCode) {
return ResponseHelper.buildResponse(fireStationInfoServiceImpl.getCarInfoByStationCode(stationCode));
}
} }
...@@ -9,10 +9,13 @@ import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto; ...@@ -9,10 +9,13 @@ import com.yeejoin.amos.boot.module.ccs.api.dto.FireStationInfoDto;
import com.yeejoin.amos.boot.module.ccs.api.entity.FireStationInfo; import com.yeejoin.amos.boot.module.ccs.api.entity.FireStationInfo;
import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum; import com.yeejoin.amos.boot.module.ccs.api.enums.StationOrderByTypeEnum;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireStationInfoMapper; import com.yeejoin.amos.boot.module.ccs.api.mapper.FireStationInfoMapper;
import com.yeejoin.amos.boot.module.ccs.api.mapper.FireVehicleMapper;
import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService; import com.yeejoin.amos.boot.module.ccs.api.service.IFireStationInfoService;
import com.yeejoin.amos.boot.module.ccs.api.vo.AlarmCountVO; import com.yeejoin.amos.boot.module.ccs.api.vo.AlarmCountVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.CarInfoVO;
import com.yeejoin.amos.boot.module.ccs.api.vo.DateAlarmCountVO; import com.yeejoin.amos.boot.module.ccs.api.vo.DateAlarmCountVO;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...@@ -28,6 +31,9 @@ import java.util.stream.Collectors; ...@@ -28,6 +31,9 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, FireStationInfo, FireStationInfoMapper> implements IFireStationInfoService { public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, FireStationInfo, FireStationInfoMapper> implements IFireStationInfoService {
@Autowired
private FireVehicleMapper fireVehicleMapper;
/** /**
* 列表查询 示例 * 列表查询 示例
* *
...@@ -136,4 +142,15 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto, ...@@ -136,4 +142,15 @@ public class FireStationInfoServiceImpl extends BaseService<FireStationInfoDto,
resultMap.put("alarmNum", alarmNumList); resultMap.put("alarmNum", alarmNumList);
return resultMap; return resultMap;
} }
public List<CarInfoVO> getCarInfoByStationCode(String stationCode) {
List<CarInfoVO> carInfoByStationCode = fireVehicleMapper.getCarInfoByStationCode(stationCode);
carInfoByStationCode.forEach(item -> {
if (StrUtil.isNotEmpty(item.getStrCarNumber())) {
List<String> list = Arrays.asList(item.getStrCarNumber().split(","));
item.setCarList(list);
}
});
return carInfoByStationCode;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment