添加注释

hyx_2024-10-12_xgfPerson
shanao 2024-09-03 17:08:02 +08:00
parent eba6660198
commit 7f1a65f3f7
3 changed files with 94 additions and 6 deletions

View File

@ -29,6 +29,13 @@ public class AccidentRecordsController extends BaseController {
private final AccidentRecordsService accidentRecordsService;
/**
*
*
* @param page
* @param request
* @return
*/
@RequestMapping(value = "/page")
public Map<String, Object> queryPage(Page page, HttpServletRequest request) {
page.setPd(new PageData(request));
@ -39,6 +46,12 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
* id
*
* @param id id
* @return
*/
@RequestMapping("/{id}")
public Map<String, Object> getById(@PathVariable("id") Long id) {
Map<String, Object> result = new HashMap<>();
@ -47,6 +60,12 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
*
*
* @param request
* @return
*/
@RequestMapping("/save")
public Map<String, Object> save(HttpServletRequest request) {
AccidentRecords accidentRecords = BeanUtil.mapToBean(new PageData(request), AccidentRecords.class, true);
@ -57,6 +76,12 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
*
*
* @param request
* @return
*/
@RequestMapping("/update")
public Map<String, Object> update(HttpServletRequest request) {
AccidentRecords accidentRecords = BeanUtil.mapToBean(new PageData(request), AccidentRecords.class, true);
@ -68,6 +93,12 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
*
*
* @param values id
* @return
*/
@RequestMapping("/delete/{ids}")
public Map<String, Object> delete(@PathVariable("ids") String values) {
String[] split = Optional.of(values).orElseThrow(() -> new RuntimeException("ids不能为空")).split(",");
@ -78,12 +109,22 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
* excel
*
* @param request
* @param response
*/
@RequestMapping("/export/excel")
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
PageData pd = new PageData(request);
accidentRecordsService.exportExcel(pd, response);
accidentRecordsService.exportExcel(new PageData(request), response);
}
/**
* excel
*
* @param file
*/
@RequestMapping("/import/excel")
public void importExcel(@RequestParam("file") MultipartFile file) {
if (file == null || file.isEmpty()) {
@ -92,6 +133,12 @@ public class AccidentRecordsController extends BaseController {
accidentRecordsService.importExcel(file);
}
/**
*
*
* @param file
* @return
*/
@RequestMapping("/import/photos")
public Map<String, Object> importPhotos(@RequestParam("file") MultipartFile file) {
if (file == null || file.isEmpty()) {
@ -103,6 +150,12 @@ public class AccidentRecordsController extends BaseController {
return result;
}
/**
*
*
* @param path
* @param response
*/
@RequestMapping("/view/photos/{path}")
public void viewPhotos(@PathVariable("path") String path, HttpServletResponse response) {
if (StrUtil.isEmpty(path)) {

View File

@ -8,19 +8,54 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AccidentRecordsMapper {
/**
*
*
* @param page
* @return
*/
List<PageData> listPage(Page page);
/**
* id
*
* @param id id
* @return
*/
PageData getById(Long id);
/**
*
*
* @param accidentRecords
* @return
*/
int save(AccidentRecords accidentRecords);
/**
*
*
* @param accidentRecords
* @return
*/
int updateById(AccidentRecords accidentRecords);
/**
*
*
* @param ids
* @return
*/
int delete(@Param("ids") Long[] ids);
/**
* excel
*
* @param pd
* @return
*/
List<AccidentRecordsExcel> listExcel(PageData pd);
void saveExcel(AccidentRecordsExcel records, long id, String username);
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.accident.AccidentRecordsMapper">
<select id="listPage" parameterType="page" resultType="pd">
<select id="listPage" parameterType="com.zcloud.entity.Page" resultType="pd">
select id, CORP_NAME as companyName, location, incident_date, incident_name
from accident_records as ar
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
@ -288,7 +288,7 @@
suggestions,
measures,
ar.creator,
date_format(report_date, '%Y年%m月%d日') as 'reportDate'
date_format(report_date, '%Y年%m月%d日%H时%I分%s秒') as 'reportDate'
from accident_records as ar
left join bus_corp_info as bci on ar.corpinfo_id = bci.CORPINFO_ID
<where>