hyx_2024-10-12_xgfPerson
shanao 2024-09-08 22:06:08 +08:00
parent a5b76b25df
commit 5197b10d4e
4 changed files with 49 additions and 20 deletions

View File

@ -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;
}
/** /**
* *
* *

View File

@ -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);
} }

View File

@ -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);
}
} }

View File

@ -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}