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

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

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