From 7adb23a079e915118dc1f90834f00f6f68da0d07 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 28 一月 2026 14:49:12 +0800
Subject: [PATCH] 安全生产--事故上报记录
---
src/main/java/com/ruoyi/safe/service/impl/SafeAccidentServiceImpl.java | 30 ++++++
src/main/java/com/ruoyi/safe/pojo/SafeAccident.java | 106 +++++++++++++++++++++
src/main/java/com/ruoyi/safe/mapper/SafeAccidentMapper.java | 22 ++++
src/main/resources/mapper/safe/SafeAccidentMapper.xml | 48 +++++++++
src/main/java/com/ruoyi/safe/service/SafeAccidentService.java | 19 +++
src/main/java/com/ruoyi/safe/controller/SafeAccidentController.java | 55 +++++++++++
6 files changed, 280 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/ruoyi/safe/controller/SafeAccidentController.java b/src/main/java/com/ruoyi/safe/controller/SafeAccidentController.java
new file mode 100644
index 0000000..615514a
--- /dev/null
+++ b/src/main/java/com/ruoyi/safe/controller/SafeAccidentController.java
@@ -0,0 +1,55 @@
+package com.ruoyi.safe.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.framework.web.domain.R;
+import com.ruoyi.safe.pojo.SafeAccident;
+import com.ruoyi.safe.pojo.SafeContingencyPlan;
+import com.ruoyi.safe.service.SafeAccidentService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-01-28 02:40:31
+ */
+@RestController
+@RequestMapping("/safeAccident")
+@Api(tags = "瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍")
+public class SafeAccidentController {
+
+ @Autowired
+ private SafeAccidentService safeAccidentService;
+
+ @GetMapping("/page")
+ @ApiOperation("鍒嗛〉鏌ヨ")
+ public R page(Page page, SafeAccident safeAccident) {
+ return R.ok(safeAccidentService.pageSafeAccident(page, safeAccident));
+ }
+
+ @ApiOperation("鏂板浜嬫晠涓婃姤璁板綍")
+ @PostMapping()
+ public R add(@RequestBody SafeAccident safeAccident) {
+ return R.ok(safeAccidentService.save(safeAccident));
+ }
+
+ @ApiOperation("淇敼浜嬫晠涓婃姤璁板綍")
+ @PutMapping ()
+ public R update(@RequestBody SafeAccident safeAccident) {
+ return R.ok(safeAccidentService.updateById(safeAccident));
+ }
+
+ @ApiOperation("鍒犻櫎浜嬫晠涓婃姤璁板綍")
+ @DeleteMapping("/{ids}")
+ public R delSafeCertification(@RequestBody List<Integer> ids) {
+ return R.ok(safeAccidentService.removeBatchByIds(ids));
+ }
+
+}
diff --git a/src/main/java/com/ruoyi/safe/mapper/SafeAccidentMapper.java b/src/main/java/com/ruoyi/safe/mapper/SafeAccidentMapper.java
new file mode 100644
index 0000000..4309dc8
--- /dev/null
+++ b/src/main/java/com/ruoyi/safe/mapper/SafeAccidentMapper.java
@@ -0,0 +1,22 @@
+package com.ruoyi.safe.mapper;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.safe.pojo.SafeAccident;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * <p>
+ * 瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-01-28 02:40:31
+ */
+@Mapper
+public interface SafeAccidentMapper extends BaseMapper<SafeAccident> {
+
+ IPage<SafeAccident> pageSafeAccident(Page page, @Param("c") SafeAccident safeAccident);
+}
diff --git a/src/main/java/com/ruoyi/safe/pojo/SafeAccident.java b/src/main/java/com/ruoyi/safe/pojo/SafeAccident.java
new file mode 100644
index 0000000..8bbc898
--- /dev/null
+++ b/src/main/java/com/ruoyi/safe/pojo/SafeAccident.java
@@ -0,0 +1,106 @@
+package com.ruoyi.safe.pojo;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * <p>
+ * 瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-01-28 02:40:31
+ */
+@Getter
+@Setter
+@TableName("safe_accident")
+@ApiModel(value = "SafeAccident瀵硅薄", description = "瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍")
+public class SafeAccident implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @TableId(value = "id", type = IdType.AUTO)
+ private Integer id;
+
+ @ApiModelProperty("浜嬫晠缂栧彿")
+ private String accidentCode;
+
+ @ApiModelProperty("浜嬫晠鍚嶇О")
+ private String accidentName;
+
+ @ApiModelProperty("浜嬫晠绫诲瀷")
+ private String accidentType;
+
+ @ApiModelProperty("浜嬫晠鍙戠敓鏃堕棿")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime happenTime;
+
+ @ApiModelProperty("浜嬫晠鍙戠敓浣嶇疆")
+ private String happenLocation;
+
+ @ApiModelProperty("浜嬫晠绛夌骇")
+ private String accidentGrade;
+
+ @ApiModelProperty("浜嬫晠鐩存帴鍘熷洜")
+ private String accidentCause;
+
+ @ApiModelProperty("浜嬫晠鏍规湰鍘熷洜")
+ private String rootCause;
+
+ @ApiModelProperty("浜哄憳鎹熷け鎯呭喌")
+ private String personLoss;
+
+ @ApiModelProperty("鐩存帴璐骇鎹熷け锛堝厓锛� ")
+ private BigDecimal assetLoss;
+
+ @ApiModelProperty("鐢熶骇褰卞搷鎯呭喌")
+ private String productionLoss;
+
+ @ApiModelProperty("鐜板満搴旀�ュ缃帾鏂�")
+ private String handleMeasures;
+
+ @ApiModelProperty("浜嬫晠璐d换浜�")
+ private String responsiblePerson;
+
+ @ApiModelProperty("澶囨敞")
+ private String remark;
+
+ @ApiModelProperty("涓婃姤鏃堕棿")
+ @TableField(fill = FieldFill.INSERT)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("涓婃姤浜篿d")
+ @TableField(fill = FieldFill.INSERT)
+ private Integer createUser;
+
+ @ApiModelProperty("涓婃姤浜�")
+ @TableField(exist = false)
+ private String createUserName;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @TableField(fill = FieldFill.INSERT_UPDATE)
+ private Integer updateUser;
+
+ @TableField(fill = FieldFill.INSERT)
+ private Integer tenantId;
+}
diff --git a/src/main/java/com/ruoyi/safe/service/SafeAccidentService.java b/src/main/java/com/ruoyi/safe/service/SafeAccidentService.java
new file mode 100644
index 0000000..6919f7a
--- /dev/null
+++ b/src/main/java/com/ruoyi/safe/service/SafeAccidentService.java
@@ -0,0 +1,19 @@
+package com.ruoyi.safe.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.safe.pojo.SafeAccident;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍 鏈嶅姟绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-01-28 02:40:31
+ */
+public interface SafeAccidentService extends IService<SafeAccident> {
+
+ IPage<SafeAccident> pageSafeAccident(Page page, SafeAccident safeAccident);
+}
diff --git a/src/main/java/com/ruoyi/safe/service/impl/SafeAccidentServiceImpl.java b/src/main/java/com/ruoyi/safe/service/impl/SafeAccidentServiceImpl.java
new file mode 100644
index 0000000..131ba24
--- /dev/null
+++ b/src/main/java/com/ruoyi/safe/service/impl/SafeAccidentServiceImpl.java
@@ -0,0 +1,30 @@
+package com.ruoyi.safe.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.safe.pojo.SafeAccident;
+import com.ruoyi.safe.mapper.SafeAccidentMapper;
+import com.ruoyi.safe.service.SafeAccidentService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 瀹夊叏鐢熶骇--浜嬫晠涓婃姤璁板綍 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author 鑺杞欢锛堟睙鑻忥級鏈夐檺鍏徃
+ * @since 2026-01-28 02:40:31
+ */
+@Service
+public class SafeAccidentServiceImpl extends ServiceImpl<SafeAccidentMapper, SafeAccident> implements SafeAccidentService {
+
+ @Autowired
+ private SafeAccidentMapper safeAccidentMapper;
+
+ @Override
+ public IPage<SafeAccident> pageSafeAccident(Page page, SafeAccident safeAccident) {
+ return safeAccidentMapper.pageSafeAccident(page, safeAccident);
+ }
+}
diff --git a/src/main/resources/mapper/safe/SafeAccidentMapper.xml b/src/main/resources/mapper/safe/SafeAccidentMapper.xml
new file mode 100644
index 0000000..159e7cd
--- /dev/null
+++ b/src/main/resources/mapper/safe/SafeAccidentMapper.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.safe.mapper.SafeAccidentMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.safe.pojo.SafeAccident">
+ <id column="id" property="id" />
+ <result column="accident_code" property="accidentCode" />
+ <result column="accident_name" property="accidentName" />
+ <result column="accident_type" property="accidentType" />
+ <result column="happen_time" property="happenTime" />
+ <result column="happen_location" property="happenLocation" />
+ <result column="accident_grade" property="accidentGrade" />
+ <result column="accident_cause" property="accidentCause" />
+ <result column="root_cause" property="rootCause" />
+ <result column="person_loss" property="personLoss" />
+ <result column="asset_loss" property="assetLoss" />
+ <result column="production_loss" property="productionLoss" />
+ <result column="handle_measures" property="handleMeasures" />
+ <result column="responsible_person" property="responsiblePerson" />
+ <result column="remark" property="remark" />
+ <result column="create_time" property="createTime" />
+ <result column="create_user" property="createUser" />
+ <result column="update_time" property="updateTime" />
+ <result column="update_user" property="updateUser" />
+ <result column="tenant_id" property="tenantId" />
+ </resultMap>
+ <select id="pageSafeAccident" resultType="com.ruoyi.safe.pojo.SafeAccident">
+ select sa.*,
+ su.nick_name createUserName,
+ from safe_accident sa
+ left join sys_user su on sa.create_user = su.user_id
+ where 1=1
+ <if test="c.accidentCode != null and c.accidentCode != ''">
+ and sa.accident_code like concat('%', #{c.accidentCode}, '%')
+ </if>
+ <if test="c.accidentName != null and c.accidentName != ''">
+ and sa.accident_name like concat('%', #{accidentName}, '%')
+ </if>
+ <if test="c.accidentType != null and c.accidentType != ''">
+ and sa.accident_type like concat('%', #{accidentType}, '%')
+ </if>
+ <if test="c.accidentGrade != null and c.accidentGrade != ''">
+ and sa.accident_grade like concat('%', #{accidentGrade}, '%')
+ </if>
+ </select>
+
+</mapper>
--
Gitblit v1.9.3