Commit 980abfad authored by 刘林's avatar 刘林

fix(cylinder):气瓶区域信息查询

parent 6ac5532b
...@@ -15,18 +15,20 @@ ...@@ -15,18 +15,20 @@
</select> </select>
<select id="getCylinderDataByLevel" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto"> <select id="getCylinderDataByLevel" resultType="com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto">
SELECT SELECT SUBSTRING_INDEX ( SUBSTRING_INDEX ( cu.region_code, '#', #{level} ), '#', - 1 ) AS regionCode,
SUBSTRING_INDEX(SUBSTRING_INDEX(cu.region_code, '#', #{level}), '#', -1) AS regionCode, COUNT ( DISTINCT cu.sequence_nbr ) AS stationCount,
COUNT(DISTINCT cu.sequence_nbr) AS stationCount, COUNT ( ci.app_id ) AS cylindersCount,
COUNT(ci.app_id) AS cylindersCount,
CASE CASE
WHEN (SELECT COUNT(1) FROM tz_cylinder_inspection ins WHERE ins.app_id = cu.app_id WHEN EXISTS (SELECT 1 FROM tz_cylinder_inspection ins
AND LENGTH(ins.next_inspection_date) >= 10 WHERE ins.app_id = cu.app_id
AND TO_DAYS(ins.next_inspection_date) - TO_DAYS(NOW()) &lt;= 30) > 0 THEN 1 AND LENGTH ( ins.next_inspection_date ) >= 10
WHEN (SELECT COUNT(1) FROM view_unit_outofdate v WHERE v.credit_code = cu.credit_code) > 0 THEN 1 AND TO_DAYS ( ins.next_inspection_date ) - TO_DAYS (NOW()) &lt;= 30)
ELSE 0 THEN 1
END AS "isAlarm" WHEN EXISTS ( SELECT 1 FROM view_unit_outofdate v WHERE v.credit_code = cu.credit_code )
FROM tz_cylinder_unit cu LEFT JOIN tz_cylinder_info ci ON cu.app_id = ci.app_id GROUP BY regionCode THEN 1 ELSE 0
END AS isAlarm
FROM tz_cylinder_unit cu LEFT JOIN tz_cylinder_info ci ON cu.app_id = ci.app_id
GROUP BY regionCode
</select> </select>
<select id="getWarnNum" resultType="java.lang.Integer"> <select id="getWarnNum" resultType="java.lang.Integer">
......
...@@ -84,7 +84,7 @@ public class CylinderUnitController extends BaseController { ...@@ -84,7 +84,7 @@ public class CylinderUnitController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个气瓶企业信息", notes = "根据sequenceNbr查询单个气瓶企业信息") @ApiOperation(httpMethod = "GET", value = "根据sequenceNbr查询单个气瓶企业信息", notes = "根据sequenceNbr查询单个气瓶企业信息")
public ResponseModel<CylinderUnitDto> selectOne(@RequestParam Long id) { public ResponseModel<CylinderUnitDto> selectOne(@RequestParam Long id) {
CylinderUnitDto unit = cylinderUnitServiceImpl.queryBySeq(id); CylinderUnitDto unit = cylinderUnitServiceImpl.queryBySeq(id);
unit.setEvaluate("★★★★★"); unit.setEvaluate("5");
// 查询气瓶数量以及过期数量 // 查询气瓶数量以及过期数量
Map<String, String> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr()); Map<String, String> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr());
......
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