Commit 9c7f6a51 authored by zhangyingbin's avatar zhangyingbin

适配数据库

parent 76a3c6e3
......@@ -81,4 +81,6 @@ public interface CylinderInfoMapper extends BaseMapper<CylinderInfo> {
List<CylinderInfoDto> listWithRegionCode(Integer regionCode);
Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids);
Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort, List<String> appids);
}
......@@ -83,9 +83,9 @@
tz_cylinder_filling_record r
left join tz_cylinder_unit u on u.app_id = r.app_id
left join tz_cylinder_filling b on b.filling_before_id = r.filling_before_id AND
date_format(`b`.`inspection_date`,'%Y-%m-%d') = date_format(`r`.`filling_startTime`,'%Y-%m-%d')
date_format(b.inspection_date,'%Y-%m-%d') = date_format(r.filling_startTime,'%Y-%m-%d')
left join tz_cylinder_filling_check af on af.filling_check_id = r.filling_check_id AND
date_format(`af`.`inspection_date`,'%Y-%m-%d') = date_format(`r`.`filling_startTime`,'%Y-%m-%d')
date_format(af.inspection_date,'%Y-%m-%d') = date_format(r.filling_startTime,'%Y-%m-%d')
left join tz_cylinder_info i on b.sequence_code = i.sequence_code
WHERE
1= 1
......
......@@ -9,9 +9,9 @@
count( CASE WHEN i.next_inspection_date <![CDATA[ < ]]> now() THEN 1 END ) AS outOfDateNum
FROM
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 (SELECT * FROM `tz_base_unit_licence`
LEFT JOIN tz_cylinder_info AS t ON u.credit_code = t.credit_code and t.app_id = u.app_id
LEFT JOIN tz_cylinder_inspection AS i ON i.sequence_code = t.sequence_code
LEFT JOIN (SELECT * FROM tz_base_unit_licence
GROUP BY unit_code
ORDER BY expiry_date DESC) AS l ON l.unit_code = u.credit_code
WHERE
......@@ -65,7 +65,7 @@
<select id="countOverDateNumber" resultType="java.lang.Integer">
SELECT
count(1)
FROM `tz_cylinder_info` ci
FROM tz_cylinder_info ci
where
ci.early_warning_level = #{earlyWarningLevel}
</select>
......@@ -95,47 +95,47 @@
ci.*,
cu.region_code
FROM
`tz_cylinder_info` ci
tz_cylinder_info ci
LEFT JOIN tz_cylinder_unit cu ON cu.app_id = ci.app_id
WHERE
cu.region_code LIKE CONCAT("%", #{regionCode}, "%")
cu.region_code LIKE concat('%', #{regionCode}, '%')
</select>
<select id="cyinderInfoList" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto">
SELECT
`ci`.`sequence_nbr` AS `sequence_nbr`,
`ci`.`unit_name` AS `unit_name`,
`ci`.`factory_num` AS `factory_num`,
`ci`.`cylinder_status` AS `cylinder_status`,
`ci`.`cylinder_variety` AS `cylinder_variety`,
`ci`.`volume` AS `volume`,
`ci`.`manufacturing_date` AS `manufacturing_date`,
`ci`.`manufacturing_unit` AS `manufacturing_unit`,
`ci`.`unit_inner_code` AS `unit_inner_code`,
`ci`.`sequence_code` AS `sequence_code`,
`ci`.`early_warning_level` AS `early_warning_level`,
`ci`.`early_warning_level_cal_date` AS `early_warning_level_cal_date`,
`ci`.`end_custom_code` AS `end_custom_code`,
`ci`.`rec_date` AS `rec_date`,
`ci`.`rec_user_id` AS `rec_user_id`,
`ci`.`sync_date` AS `sync_date`,
`ci`.`sync_state` AS `sync_state`,
`ci`.`app_id` AS `app_id`,
`ci`.`integrity` AS `integrity`,
`ci`.`longitude` AS `longitude`,
`ci`.`latitude` AS `latitude`,
`ci`.`credit_code` AS `credit_code`,
`ci`.`filling_media` AS `filling_media`,
`ci`.`product_name` AS `product_name`,
`ci`.`product_qualified` AS `product_qualified`,
`ci`.`proof_quality` AS `proof_quality`,
`ci`.`supervision_inspec` AS `supervision_inspec`,
`ci`.`type_experiments` AS `type_experiments`,
`ci`.`valve_manufactur_unit` AS `valve_manufactur_unit`,
`ci`.`nominal_work_pressure` AS `nominal_work_pressure`,
d1.`name` AS filling_media_name,
d2.`name` AS cylinder_variety_name,
d3.`name` AS cylinder_status_str,
ci.sequence_nbr AS sequence_nbr,
ci.unit_name AS unit_name,
ci.factory_num AS factory_num,
ci.cylinder_status AS cylinder_status,
ci.cylinder_variety AS cylinder_variety,
ci.volume AS volume,
ci.manufacturing_date AS manufacturing_date,
ci.manufacturing_unit AS manufacturing_unit,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ci.early_warning_level AS early_warning_level,
ci.early_warning_level_cal_date AS early_warning_level_cal_date,
ci.end_custom_code AS end_custom_code,
ci.rec_date AS rec_date,
ci.rec_user_id AS rec_user_id,
ci.sync_date AS sync_date,
ci.sync_state AS sync_state,
ci.app_id AS app_id,
ci.integrity AS integrity,
ci.longitude AS longitude,
ci.latitude AS latitude,
ci.credit_code AS credit_code,
ci.filling_media AS filling_media,
ci.product_name AS product_name,
ci.product_qualified AS product_qualified,
ci.proof_quality AS proof_quality,
ci.supervision_inspec AS supervision_inspec,
ci.type_experiments AS type_experiments,
ci.valve_manufactur_unit AS valve_manufactur_unit,
ci.nominal_work_pressure AS nominal_work_pressure,
d1.name AS filling_media_name,
d2.name AS cylinder_variety_name,
d3.name AS cylinder_status_str,
ct.qrCode,
ct.electronic_label_code
FROM
......@@ -155,36 +155,89 @@
and ci.app_id = #{cylinderInfoDto.appId}
</if>
<if test="cylinderInfoDto.unitName != null and cylinderInfoDto.unitName != '' ">
and ci.unit_name like concat("%",#{cylinderInfoDto.unitName},"%")
and ci.unit_name like concat('%',#{cylinderInfoDto.unitName},'%')
</if>
<if test="cylinderInfoDto.factoryNum != null and cylinderInfoDto.factoryNum != '' ">
and ci.factory_num like concat("%",#{cylinderInfoDto.factoryNum},"%")
and ci.factory_num like concat('%',#{cylinderInfoDto.factoryNum},'%')
</if>
<if test="cylinderInfoDto.cylinderVariety != null and cylinderInfoDto.cylinderVariety != '' ">
and ci.cylinder_variety = #{cylinderInfoDto.cylinderVariety}
</if>
<if test="cylinderInfoDto.sequenceCode != null and cylinderInfoDto.sequenceCode != '' ">
and ci.sequence_code like concat("%",#{cylinderInfoDto.sequenceCode},"%")
and ci.sequence_code like concat('%',#{cylinderInfoDto.sequenceCode},'%')
</if>
<if test="cylinderInfoDto.unitInnerCode != null and cylinderInfoDto.unitInnerCode != '' ">
and ci.unit_inner_code like concat("%",#{cylinderInfoDto.unitInnerCode},"%")
and ci.unit_inner_code like concat('%',#{cylinderInfoDto.unitInnerCode},'%')
</if>
<if test="cylinderInfoDto.cylinderStatus != null and cylinderInfoDto.cylinderStatus != '' ">
and ci.cylinder_status = #{cylinderInfoDto.cylinderStatus}
</if>
<if test="cylinderInfoDto.manufacturingUnit != null and cylinderInfoDto.manufacturingUnit != '' ">
and ci.manufacturing_unit like concat("%",#{cylinderInfoDto.manufacturingUnit},"%")
and ci.manufacturing_unit like concat('%',#{cylinderInfoDto.manufacturingUnit},'%')
</if>
<if test="cylinderInfoDto.creditCode != null and cylinderInfoDto.creditCode != '' ">
and ci.credit_code like concat("%",#{cylinderInfoDto.creditCode},"%")
and ci.credit_code like concat('%',#{cylinderInfoDto.creditCode},'%')
</if>
<if test="cylinderInfoDto.qrCode != null and cylinderInfoDto.qrCode != '' ">
and ct.qrCode like concat("%",#{cylinderInfoDto.qrCode},"%")
and ct.qrCode like concat('%',#{cylinderInfoDto.qrCode},'%')
</if>
<if test="cylinderInfoDto.electronicLabelCode != null and cylinderInfoDto.electronicLabelCode != '' ">
and ct.electronic_label_code like concat("%",#{cylinderInfoDto.electronicLabelCode},"%")
and ct.electronic_label_code like concat('%',#{cylinderInfoDto.electronicLabelCode},'%')
</if>
ORDER BY ci.sync_date DESC
</where>
</select>
<select id="cyinderOutInfoList" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto">
SELECT
ci.sequence_nbr AS sequence_nbr,
ci.unit_name AS unit_name,
ci.factory_num AS factory_num,
ci.cylinder_status AS cylinder_status,
ci.cylinder_variety AS cylinder_variety,
ci.volume AS volume,
ci.manufacturing_date AS manufacturing_date,
ci.manufacturing_unit AS manufacturing_unit,
ci.unit_inner_code AS unit_inner_code,
ci.sequence_code AS sequence_code,
ci.early_warning_level AS early_warning_level,
ci.early_warning_level_cal_date AS early_warning_level_cal_date,
ci.end_custom_code AS end_custom_code,
ci.rec_date AS rec_date,
ci.rec_user_id AS rec_user_id,
ci.sync_date AS sync_date,
ci.sync_state AS sync_state,
ci.app_id AS app_id,
ci.integrity AS integrity,
ci.longitude AS longitude,
ci.latitude AS latitude,
ci.credit_code AS credit_code,
ci.filling_media AS filling_media,
ci.product_name AS product_name,
ci.product_qualified AS product_qualified,
ci.proof_quality AS proof_quality,
ci.supervision_inspec AS supervision_inspec,
ci.type_experiments AS type_experiments,
ci.valve_manufactur_unit AS valve_manufactur_unit,
ci.nominal_work_pressure AS nominal_work_pressure,
d1.name AS filling_media_name,
d2.name AS cylinder_variety_name,
d3.name AS cylinder_status_str,
ct.qrCode,
ct.electronic_label_code
FROM
tz_cylinder_inspection AS isp
LEFT JOIN tz_cylinder_info AS ci ON ci.sequence_code = isp.sequence_code
LEFT JOIN cb_data_dictionary AS d1 ON d1.type = 'CZJZMC' AND d1.code = ci.filling_media
LEFT JOIN cb_data_dictionary AS d2 ON d2.sequence_nbr = ci.cylinder_variety
LEFT JOIN cb_data_dictionary AS d3 ON d3.sequence_nbr = ci.cylinder_status
LEFT JOIN tz_cylinder_tags AS ct ON ct.sequence_code = ci.sequence_code
WHERE isp.next_inspection_date <![CDATA[ < ]]> now()
<if test="appids != null and appids.size > 0 ">
and ci.app_id in
<foreach collection="appids" index="index" item="item" close=")" open="(" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper>
......@@ -186,9 +186,7 @@
<select id="getTzCylinderCheckItem" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.TzCylinderCheckDto">
SELECT
item,
`explain`,
`result`
*
FROM
tz_cylinder_check_item
WHERE item!=''
......@@ -208,8 +206,8 @@
<select id="getTzCylinderAfterCheckItem" resultType="com.yeejoin.amos.boot.module.tzs.flc.api.dto.TzCylinderCheckDto">
SELECT
after_item AS item,
after_explain AS `explain`,
after_result AS `result`
after_explain AS "explain",
after_result AS "result"
FROM
tz_cylinder_check_item
WHERE after_item!=''
......
......@@ -182,7 +182,7 @@ public class InspectionServiceImpl implements InspectionService {
@Override
public JSONObject getSafetySupervisionCodeMap(String bizTable, String mapKey, String mapValue) {
JSONObject jsonObject = new JSONObject();
String sql = String.format("SELECT `%s`, `%s` FROM %s", mapKey, mapValue, bizTable);
String sql = String.format("SELECT %s, %s FROM %s", mapKey, mapValue, bizTable);
List<Map<String, Object>> list = bizJdbcTemplate.queryForList(sql);
list.forEach(x -> {
jsonObject.put(x.get(mapKey).toString(), x.get(mapValue));
......
......@@ -516,7 +516,7 @@ public class CylinderInfoController extends BaseController {
}
}
}
if(ValidationUtil.isEmpty(cylinderInfoDto.getRegionCode()) && ValidationUtil.isEmpty(cylinderInfoDto.getCreditCode())){
if(ValidationUtil.isEmpty(cylinderInfoDto.getRegionCode()) && ValidationUtil.isEmpty(cylinderInfoDto.getCreditCode()) && cylinderInfoDto.getIsWarn()==0){
return ResponseHelper.buildResponse(new Page<CylinderInfoDto>(Long.valueOf(pageNum),Long.valueOf(pageSize)));
}
QueryWrapper<CylinderInfo> cylinderInfoQueryWrapper = new QueryWrapper<>();
......@@ -541,7 +541,11 @@ public class CylinderInfoController extends BaseController {
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
pageBean = cylinderInfoServiceImpl.cyinderInfoList(pageBean,cylinderInfoDto,sort,appids);
if(cylinderInfoDto.getIsWarn()!=0){
pageBean = cylinderInfoServiceImpl.cyinderOutInfoList(pageBean,cylinderInfoDto,sort,appids);
} else {
pageBean = cylinderInfoServiceImpl.cyinderInfoList(pageBean,cylinderInfoDto,sort,appids);
}
return ResponseHelper.buildResponse(pageBean);
// IPage<CylinderInfo> page;
// if (cylinderInfoDto.getIsWarn() == 0) {
......
......@@ -847,4 +847,8 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
public Page<CylinderInfoDto> cyinderInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){
return cylinderInfoMapper.cyinderInfoList(page,cylinderInfoDto,sort,appids);
}
public Page<CylinderInfoDto> cyinderOutInfoList(Page<CylinderInfoDto> page, CylinderInfoDto cylinderInfoDto, String sort,List<String> appids){
return cylinderInfoMapper.cyinderOutInfoList(page,cylinderInfoDto,sort,appids);
}
}
\ 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