hyx_2024-10-12_xgfPerson
parent
a5b76b25df
commit
5197b10d4e
|
@ -140,7 +140,7 @@ public class AccidentRecordsController extends BaseController {
|
||||||
* @return 是否成功
|
* @return 是否成功
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/import/photos")
|
@RequestMapping("/import/photos")
|
||||||
public Map<String, Object> importPhotos(@RequestParam("file") MultipartFile file) {
|
public Map<String, Object> importPhotos(@RequestParam MultipartFile file) {
|
||||||
if (file == null || file.isEmpty()) {
|
if (file == null || file.isEmpty()) {
|
||||||
throw new RuntimeException("文件不能为空");
|
throw new RuntimeException("文件不能为空");
|
||||||
}
|
}
|
||||||
|
@ -150,6 +150,23 @@ public class AccidentRecordsController extends BaseController {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除图片
|
||||||
|
*
|
||||||
|
* @param path 文件路径
|
||||||
|
* @return 是否成功
|
||||||
|
*/
|
||||||
|
@RequestMapping("/delete/photos/{path}")
|
||||||
|
public Map<String, Object> deletePhotos(@PathVariable("path") String path) {
|
||||||
|
if (StrUtil.isEmpty(path)) {
|
||||||
|
throw new RuntimeException("路径不能为空");
|
||||||
|
}
|
||||||
|
accidentRecordsService.deletePhotos(path);
|
||||||
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
result.put("result", "success"); // 路径
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看图片
|
* 查看图片
|
||||||
*
|
*
|
||||||
|
|
|
@ -77,4 +77,11 @@ public interface AccidentRecordsService {
|
||||||
* @param response 响应
|
* @param response 响应
|
||||||
*/
|
*/
|
||||||
void viewPhotos(String path, HttpServletResponse response);
|
void viewPhotos(String path, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除图片
|
||||||
|
*
|
||||||
|
* @param path 路径
|
||||||
|
*/
|
||||||
|
void deletePhotos(String path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,4 +179,9 @@ public class AccidentRecordsServiceImpl implements AccidentRecordsService {
|
||||||
}
|
}
|
||||||
ServletUtil.write(response, FileUtil.touch(path));
|
ServletUtil.write(response, FileUtil.touch(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deletePhotos(String path) {
|
||||||
|
FileUtil.del("./image/" + path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,26 +34,26 @@
|
||||||
|
|
||||||
<select id="getById" resultType="com.zcloud.entity.PageData">
|
<select id="getById" resultType="com.zcloud.entity.PageData">
|
||||||
select id,
|
select id,
|
||||||
incident_number,
|
incident_number as incidentNumber,
|
||||||
incident_name,
|
incident_name as incidentName,
|
||||||
incident_type,
|
incident_type as incidentName,
|
||||||
incident_level,
|
incident_level as incidentLevel,
|
||||||
CORP_NAME as companyName,
|
CORP_NAME as companyName,
|
||||||
incident_nature,
|
incident_nature as incidentNature,
|
||||||
`location`,
|
`location` as location,
|
||||||
incident_date,
|
incident_date as incidentDate,
|
||||||
direct_loss,
|
direct_loss as directLoss,
|
||||||
injured,
|
injured as injured,
|
||||||
fatalities,
|
fatalities as fatalities,
|
||||||
seriously_injured,
|
seriously_injured as seriouslyInjured,
|
||||||
cause,
|
cause as cause,
|
||||||
summary,
|
summary as summary,
|
||||||
photos,
|
photos as photos,
|
||||||
analysis,
|
analysis as analysis,
|
||||||
suggestions,
|
suggestions as suggestions,
|
||||||
measures,
|
measures as measures,
|
||||||
ar.creator,
|
ar.creator as creator,
|
||||||
report_date
|
report_date as reportDate
|
||||||
from accident_records as ar
|
from accident_records as ar
|
||||||
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
||||||
where ar.id = #{id}
|
where ar.id = #{id}
|
||||||
|
|
Loading…
Reference in New Issue