Commit 82fb5771 authored by wufeifan's avatar wufeifan

修改了故障管理导出功能

parent aa9868dc
......@@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
......@@ -11,7 +12,7 @@ import java.util.Date;
* 接受故障管理查询结果
*/
@Data
public class EquipmentFaultVO {
public class EquipmentFaultVO implements Serializable {
@ApiModelProperty(value = "id")
private Long id;
......
......@@ -50,19 +50,47 @@ public class EquipmentFaultController {
return psge;
}
// @ApiOperation(value = "导出故障清单", notes = "导出故障清单", produces = "application/octet-stream")
// @PostMapping(value = "/export",produces = "application/json;charset=UTF-8")
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// public void exportDangerList(@RequestBody List<EquipmentFaultVO> equipmentFaultVO, @RequestParam Integer prop, HttpServletResponse response) {
// SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd");
// String format = formatter.format(new Date());
// if(prop==1){//全部导出
// equipmentFaultVO = iEquipmentFaultService.getAll();
// FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
// }
// else {//仅仅导出筛选结果的数据
// FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
// }
// }
// @ApiOperation(value = "导出故障清单", notes = "导出故障清单", produces = "application/octet-stream")
// @PostMapping(value = "/exportData")
// @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
// public void exportDangerList(@RequestParam Integer prop, HttpServletResponse response) {
// SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd");
// String format = formatter.format(new Date());
// List<EquipmentFaultVO> equipmentFaultVO = iEquipmentFaultService.getAll();
// if(prop==1){//全部导出
// FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
// }
// else {//仅仅导出筛选结果的数据
// FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
// }
// }
@ApiOperation(value = "导出故障清单", notes = "导出故障清单", produces = "application/octet-stream")
@PostMapping(value = "/export",produces = "application/json;charset=UTF-8")
@PostMapping(value = "/exportData")
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
public void exportDangerList(@RequestBody List<EquipmentFaultVO> equipmentFaultVO, @RequestParam Integer prop, HttpServletResponse response) {
public void exportDangerList(@RequestParam(required = false) String code,
@RequestParam(required = false)String eqCode,
@RequestParam(required = false)String name,
@RequestParam(required = false)String faultOccurTime, HttpServletResponse response) {
SimpleDateFormat formatter= new SimpleDateFormat("yyyyMMdd");
String format = formatter.format(new Date());
if(prop==1){//全部导出
equipmentFaultVO = iEquipmentFaultService.getAll();
List<EquipmentFaultVO> equipmentFaultVO = iEquipmentFaultService.getAll(code, eqCode, name, faultOccurTime);
FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
}
else {//仅仅导出筛选结果的数据
FileHelper.exportExcel(equipmentFaultVO, "故障清单", "故障清单", EquipmentFaultVO.class, format + ".xls", response);
}
}
}
......@@ -21,6 +21,6 @@ public interface EquipmentFaultMapper extends BaseMapper<EquipmentDetail> {
int selectEquipmentFaultListcount(@Param("code") String code, @Param("eqCode") String eqCode, @Param("name") String name, @Param("faultOccurTime") String faultOccurTime);
List<EquipmentFaultVO> getAll();
List<EquipmentFaultVO> getAll(@Param("code") String code, @Param("eqCode") String eqCode, @Param("name") String name, @Param("faultOccurTime") String faultOccurTime);
}
......@@ -14,5 +14,5 @@ public interface IEquipmentFaultService {
int selectEquipmentFaultListCount(String code, String eqCode, String name, String faultOccurTime);
List<EquipmentFaultVO> getAll();
List<EquipmentFaultVO> getAll(String code, String eqCode, String name, String faultOccurTime);
}
......@@ -48,8 +48,8 @@ public class EquipmentFaultServiceImpl implements IEquipmentFaultService {
}
@Override
public List<EquipmentFaultVO> getAll() {
return equipmentFaultMapper.getAll();
public List<EquipmentFaultVO> getAll(String code, String eqCode, String name, String faultOccurTime) {
return equipmentFaultMapper.getAll(code, eqCode, name, faultOccurTime);
}
}
......@@ -64,6 +64,12 @@
LEFT JOIN wl_equipment_specific wles ON wlep.detail_id = wles.iot_code
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment_category wlec ON wled.code = wlec.code
<where>
<if test="code != null and code != ''"> AND wlec.code LIKE CONCAT(#{code},'%' )</if>
<if test="eqCode != null and eqCode != ''"> AND wled.eq_code LIKE CONCAT('%',#{eqCode},'%' )</if>
<if test="name != null and name != ''"> AND wled.name LIKE CONCAT('%',#{name},'%' )</if>
<if test="faultOccurTime != null and faultOccurTime != ''"> AND wlep.create_date LIKE CONCAT('%',#{faultOccurTime},'%' )</if>
</where>
ORDER BY wlep.create_date DESC
</select>
</mapper>
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