hyx_2024-10-12_xgfPerson
parent
a5b76b25df
commit
5197b10d4e
|
@ -140,7 +140,7 @@ public class AccidentRecordsController extends BaseController {
|
|||
* @return 是否成功
|
||||
*/
|
||||
@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()) {
|
||||
throw new RuntimeException("文件不能为空");
|
||||
}
|
||||
|
@ -150,6 +150,23 @@ public class AccidentRecordsController extends BaseController {
|
|||
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 响应
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePhotos(String path) {
|
||||
FileUtil.del("./image/" + path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,26 +34,26 @@
|
|||
|
||||
<select id="getById" resultType="com.zcloud.entity.PageData">
|
||||
select id,
|
||||
incident_number,
|
||||
incident_name,
|
||||
incident_type,
|
||||
incident_level,
|
||||
incident_number as incidentNumber,
|
||||
incident_name as incidentName,
|
||||
incident_type as incidentName,
|
||||
incident_level as incidentLevel,
|
||||
CORP_NAME as companyName,
|
||||
incident_nature,
|
||||
`location`,
|
||||
incident_date,
|
||||
direct_loss,
|
||||
injured,
|
||||
fatalities,
|
||||
seriously_injured,
|
||||
cause,
|
||||
summary,
|
||||
photos,
|
||||
analysis,
|
||||
suggestions,
|
||||
measures,
|
||||
ar.creator,
|
||||
report_date
|
||||
incident_nature as incidentNature,
|
||||
`location` as location,
|
||||
incident_date as incidentDate,
|
||||
direct_loss as directLoss,
|
||||
injured as injured,
|
||||
fatalities as fatalities,
|
||||
seriously_injured as seriouslyInjured,
|
||||
cause as cause,
|
||||
summary as summary,
|
||||
photos as photos,
|
||||
analysis as analysis,
|
||||
suggestions as suggestions,
|
||||
measures as measures,
|
||||
ar.creator as creator,
|
||||
report_date as reportDate
|
||||
from accident_records as ar
|
||||
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
|
||||
where ar.id = #{id}
|
||||
|
|
Loading…
Reference in New Issue