Commit dea7726b authored by zhangyingbin's avatar zhangyingbin

气瓶总览页面-地图接口修改

parent d658de41
......@@ -86,4 +86,18 @@ public class CylinderUnitDto extends BaseDto {
@ApiModelProperty(value = "所属区域")
private String regionName;
/**
* 气瓶数量
*/
private String cylinderNumber;
/**
* 检验过期气瓶数
*/
private String cylinderOutOfDate;
/**
* 许可有限期
*/
private String fillingPermitDate;
}
......@@ -22,7 +22,7 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
* @param sequenceNbr
* @return
*/
Map<String, Long> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr);
Map<String, String> queryNumAndOutOfDateNum(@Param("sequenceNbr") Long sequenceNbr);
/**
* 获取上个月气瓶总量
......
......@@ -16,5 +16,5 @@ public interface ICylinderInfoService {
* @param unitId
* @return
*/
Map<String, Long> queryNumAndOutOfDateNum(Long unitId);
Map<String, String> queryNumAndOutOfDateNum(Long unitId);
}
......@@ -4,21 +4,18 @@
<select id="queryNumAndOutOfDateNum" resultType="java.util.Map">
SELECT
count( t.sequence_nbr ) AS cylinderNum,
count( CASE WHEN i.next_inspection_date <![CDATA[ < ]]> now() THEN 1 ELSE 0 END ) AS outOfDateNum
count( t.sequence_nbr ) AS cylinderNum,
l.expiry_date AS fillingPermitDate,
count( CASE WHEN i.next_inspection_date <![CDATA[ < ]]> now() THEN 1 ELSE 0 END ) AS outOfDateNum
FROM
tz_cylinder_info t
LEFT JOIN tz_cylinder_inspection AS i ON i.sequence_code=t.sequence_code
tz_cylinder_unit U
LEFT JOIN tz_cylinder_info AS t ON u.credit_code = t.credit_code
LEFT JOIN tz_cylinder_inspection AS i ON i.sequence_code = t.sequence_code and t.app_id = u.app_id
LEFT JOIN tz_base_unit_licence AS l ON l.unit_code = u.credit_code
WHERE
t.sequence_nbr IN ( SELECT max( tt.sequence_nbr ) FROM tz_cylinder_info tt GROUP BY tt.sequence_code )
AND t.app_id = (
SELECT
u.app_id
FROM
tz_cylinder_unit u
WHERE
u.sequence_nbr = #{sequenceNbr}
)
t.sequence_nbr IN ( SELECT max( tt.sequence_nbr ) FROM tz_cylinder_info tt GROUP BY tt.sequence_code )
AND u.sequence_nbr = #{sequenceNbr}
GROUP BY t.sequence_nbr
</select>
<sql id="selectAPPIdByRegionCode">
......
......@@ -79,13 +79,16 @@ public class CylinderUnitController extends BaseController {
public ResponseModel<CylinderUnitDto> selectOne(@RequestParam Long id) {
CylinderUnitDto unit = cylinderUnitServiceImpl.queryBySeq(id);
// 查询气瓶数量以及过期数量
Map<String, Long> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr());
Map<String, String> cylinderInfo = iCylinderInfoService.queryNumAndOutOfDateNum(unit.getSequenceNbr());
if(cylinderInfo != null) {
if(cylinderInfo.get("cylinderNum") != null) {
// unit.setCylinderNumber(cylinderInfo.get("cylinderNum"));
unit.setCylinderNumber(String.valueOf(cylinderInfo.get("cylinderNum")));
}
if(cylinderInfo.get("outOfDateNum") != null) {
// unit.setCylinderOutOfDate(cylinderInfo.get("outOfDateNum"));
unit.setCylinderOutOfDate(String.valueOf(cylinderInfo.get("outOfDateNum")));
}
if(cylinderInfo.get("fillingPermitDate") != null){
unit.setFillingPermitDate(String.valueOf(cylinderInfo.get("fillingPermitDate")));
}
}
return ResponseHelper.buildResponse(unit);
......
......@@ -126,7 +126,7 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
}
@Override
public Map<String, Long> queryNumAndOutOfDateNum(Long unitId) {
public Map<String, String> queryNumAndOutOfDateNum(Long unitId) {
return baseMapper.queryNumAndOutOfDateNum(unitId);
}
......
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