添加注释
parent
eba6660198
commit
7f1a65f3f7
|
@ -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)) {
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue