提交代码
This commit is contained in:
@@ -11,18 +11,34 @@
|
||||
|
||||
<artifactId>pasd-fire</artifactId>
|
||||
<name>pasd-fire</name>
|
||||
<description>
|
||||
消防设施管理模块
|
||||
</description>
|
||||
<url>http://maven.apache.org</url>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis-Plus 核心依赖 -->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis-Plus 注解处理器 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.3</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
@@ -1,26 +1,24 @@
|
||||
package com.ruoyi.fire.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.PageDomain;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.page.TableSupport;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
import com.ruoyi.fire.service.IFireFacilityService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* facilitiesController
|
||||
@@ -28,39 +26,86 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
* @author Junhua
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/fire/facility")
|
||||
public class FireFacilityController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IFireFacilityService fireFacilityService;
|
||||
|
||||
/**
|
||||
* 查询facilities列表
|
||||
* 检查并更新设施状态
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FireFacility fireFacility) {
|
||||
@GetMapping("/check-status/{id}")
|
||||
public AjaxResult checkAndUpdateStatus(@PathVariable Long id) {
|
||||
|
||||
|
||||
|
||||
int result = fireFacilityService.checkAndUpdateStatus(id);
|
||||
|
||||
|
||||
if (result > 0) {
|
||||
return AjaxResult.success("状态已更新");
|
||||
}
|
||||
return AjaxResult.success("状态无需更新");
|
||||
}
|
||||
|
||||
|
||||
/// 获取所有设施列表
|
||||
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FireFacility fireFacility) {
|
||||
// 获取当前分页信息
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
// 传递分页参数到状态更新方法
|
||||
fireFacilityService.checkAndUpdateExpirationStatus(fireFacility, pageNum, pageSize);
|
||||
|
||||
// 执行分页查询
|
||||
startPage();
|
||||
List<FireFacility> list = fireFacilityService.selectFireFacilityList(fireFacility);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询根据id查询设施列表
|
||||
*/
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:list')")
|
||||
@GetMapping("/details")
|
||||
public TableDataInfo getDetails(FireFacility fireFacility) {
|
||||
startPage();
|
||||
List<FireFacility> list = fireFacilityService.getDetails(fireFacility);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出facilities列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:export')")
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:export')")
|
||||
@Log(title = "facilities", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FireFacility fireFacility) {
|
||||
|
||||
List<FireFacility> list = fireFacilityService.selectFireFacilityList(fireFacility);
|
||||
ExcelUtil<FireFacility> util = new ExcelUtil<FireFacility>(FireFacility.class);
|
||||
// 调试:打印前 5 条数据的 remark 值
|
||||
list.stream().limit(5).forEach(f -> {
|
||||
System.out.println("ID: " + f.getId() + ", Remark: " + f.getRemark());
|
||||
});
|
||||
util.exportExcel(response, list, "facilities数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取facilities详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:query')")
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(fireFacilityService.selectFireFacilityById(id));
|
||||
@@ -69,7 +114,7 @@ public class FireFacilityController extends BaseController {
|
||||
/**
|
||||
* 新增facilities
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:add')")
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:add')")
|
||||
@Log(title = "facilities", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FireFacility fireFacility) {
|
||||
@@ -79,7 +124,7 @@ public class FireFacilityController extends BaseController {
|
||||
/**
|
||||
* 修改facilities
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:edit')")
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:edit')")
|
||||
@Log(title = "facilities", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody FireFacility fireFacility) {
|
||||
@@ -89,10 +134,34 @@ public class FireFacilityController extends BaseController {
|
||||
/**
|
||||
* 删除facilities
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire:facility:remove')")
|
||||
// @PreAuthorize("@ss.hasPermi('fire:facility:remove')")
|
||||
@Log(title = "facilities", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(fireFacilityService.deleteFireFacilityByIds(ids));
|
||||
}
|
||||
/**
|
||||
* 导入Excel数据
|
||||
* @param file Excel文件
|
||||
* @param updateSupport 是否支持更新(1=支持,0=不支持)
|
||||
* @return 导入结果
|
||||
*/
|
||||
@Log(title = "消防设施", businessType = BusinessType.IMPORT)
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, @RequestParam(defaultValue = "0") String updateSupport) throws Exception {
|
||||
|
||||
boolean isUpdate = "1".equals(updateSupport); // 1表示支持更新,0表示仅新增
|
||||
String result = fireFacilityService.importFireFacility(file, isUpdate);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载导入模板
|
||||
* @param response 响应对象
|
||||
*/
|
||||
@GetMapping("/importTemplate")
|
||||
public void importTemplate(HttpServletResponse response) {
|
||||
ExcelUtil<FireFacility> util = new ExcelUtil<>(FireFacility.class);
|
||||
util.exportExcel(response, null, "消防设施导入模板");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.fire.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.fire.domain.FireFacilityRepair;
|
||||
import com.ruoyi.fire.service.IFireFacilityRepairService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 消防设施维修记录Controller
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fire_facility_repair/repair")
|
||||
public class FireFacilityRepairController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IFireFacilityRepairService fireFacilityRepairService;
|
||||
|
||||
/**
|
||||
* 查询消防设施维修记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
startPage();
|
||||
List<FireFacilityRepair> list = fireFacilityRepairService.selectFireFacilityRepairList(fireFacilityRepair);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出消防设施维修记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:export')")
|
||||
@Log(title = "消防设施维修记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
List<FireFacilityRepair> list = fireFacilityRepairService.selectFireFacilityRepairList(fireFacilityRepair);
|
||||
ExcelUtil<FireFacilityRepair> util = new ExcelUtil<FireFacilityRepair>(FireFacilityRepair.class);
|
||||
util.exportExcel(response, list, "消防设施维修记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消防设施维修记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(fireFacilityRepairService.selectFireFacilityRepairById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消防设施维修记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:add')")
|
||||
@Log(title = "消防设施维修记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
return toAjax(fireFacilityRepairService.insertFireFacilityRepair(fireFacilityRepair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消防设施维修记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:edit')")
|
||||
@Log(title = "消防设施维修记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
return toAjax(fireFacilityRepairService.updateFireFacilityRepair(fireFacilityRepair));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消防设施维修记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_repair:repair:remove')")
|
||||
@Log(title = "消防设施维修记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(fireFacilityRepairService.deleteFireFacilityRepairByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.fire.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.fire.domain.FireFacilityReplacement;
|
||||
import com.ruoyi.fire.service.IFireFacilityReplacementService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 消防设施更换记录Controller
|
||||
*
|
||||
* @author Junhau
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/fire_facility_replacement/replacement")
|
||||
public class FireFacilityReplacementController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IFireFacilityReplacementService fireFacilityReplacementService;
|
||||
|
||||
/**
|
||||
* 查询消防设施更换记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
startPage();
|
||||
List<FireFacilityReplacement> list = fireFacilityReplacementService.selectFireFacilityReplacementList(fireFacilityReplacement);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出消防设施更换记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:export')")
|
||||
@Log(title = "消防设施更换记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
List<FireFacilityReplacement> list = fireFacilityReplacementService.selectFireFacilityReplacementList(fireFacilityReplacement);
|
||||
ExcelUtil<FireFacilityReplacement> util = new ExcelUtil<FireFacilityReplacement>(FireFacilityReplacement.class);
|
||||
util.exportExcel(response, list, "消防设施更换记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消防设施更换记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(fireFacilityReplacementService.selectFireFacilityReplacementById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消防设施更换记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:add')")
|
||||
@Log(title = "消防设施更换记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
return toAjax(fireFacilityReplacementService.insertFireFacilityReplacement(fireFacilityReplacement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消防设施更换记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:edit')")
|
||||
@Log(title = "消防设施更换记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
return toAjax(fireFacilityReplacementService.updateFireFacilityReplacement(fireFacilityReplacement));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消防设施更换记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('fire_facility_replacement:replacement:remove')")
|
||||
@Log(title = "消防设施更换记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(fireFacilityReplacementService.deleteFireFacilityReplacementByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.ruoyi.fire.controller;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.fire.domain.FireFacilityReport;
|
||||
import com.ruoyi.fire.service.IFireFacilityReportService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/fire/facility-report")
|
||||
public class FireFacilityReportController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IFireFacilityReportService fireFacilityReportService;
|
||||
|
||||
/**
|
||||
* 按设施类型筛选统计数据
|
||||
*/
|
||||
@GetMapping("/report")
|
||||
public AjaxResult getReport(@RequestParam(required = false) String facilityType) {
|
||||
return AjaxResult.success(fireFacilityReportService.getReportData(facilityType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定状态+设施类型的详情数据
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public AjaxResult getDetail(
|
||||
@RequestParam Integer status,
|
||||
@RequestParam(required = false) String facilityType,
|
||||
@RequestParam(defaultValue = "1") int pageNum,
|
||||
@RequestParam(defaultValue = "10") int pageSize) {
|
||||
|
||||
FireFacilityReport query = new FireFacilityReport();
|
||||
query.setFacilityType(facilityType);
|
||||
|
||||
// 1. 查询所有数据
|
||||
List<FireFacilityReport> facilityList = fireFacilityReportService.selectFireFacilityReportList(query);
|
||||
|
||||
// 2. 筛选出所有符合状态条件的数据
|
||||
List<FireFacilityReport> filteredList = facilityList.stream()
|
||||
.map(facility -> {
|
||||
Integer dynamicStatus = fireFacilityReportService.calculateDynamicStatus(
|
||||
facility.getExpiryDate(),
|
||||
facility.getStatus()
|
||||
);
|
||||
facility.setDynamicStatus(dynamicStatus);
|
||||
facility.setStatusText(fireFacilityReportService.getStatusText(dynamicStatus));
|
||||
return facility;
|
||||
})
|
||||
.filter(facility -> Objects.equals(facility.getDynamicStatus(), status))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 3. 计算总条数(关键:用于前端分页控件)
|
||||
int total = filteredList.size();
|
||||
|
||||
// 4. 执行分页逻辑
|
||||
int start = (pageNum - 1) * pageSize;
|
||||
// 处理边界情况:当start超过列表长度时,返回空列表
|
||||
if (start >= filteredList.size()) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", Collections.emptyList());
|
||||
result.put("total", total);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
int end = Math.min(start + pageSize, filteredList.size());
|
||||
List<FireFacilityReport> pagedList = filteredList.subList(start, end);
|
||||
|
||||
// 5. 返回分页数据和总条数
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("list", pagedList);
|
||||
result.put("total", total);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有状态的设施数据(支持按类型筛选)
|
||||
*/
|
||||
@GetMapping("/all")
|
||||
public AjaxResult getAllData(@RequestParam(required = false) String facilityType) {
|
||||
FireFacilityReport query = new FireFacilityReport();
|
||||
query.setFacilityType(facilityType);
|
||||
|
||||
List<FireFacilityReport> list = fireFacilityReportService.selectFireFacilityReportList(query);
|
||||
list.forEach(facility -> {
|
||||
Integer dynamicStatus = fireFacilityReportService.calculateDynamicStatus(
|
||||
facility.getExpiryDate(),
|
||||
facility.getStatus()
|
||||
);
|
||||
facility.setDynamicStatus(dynamicStatus);
|
||||
facility.setStatusText(fireFacilityReportService.getStatusText(dynamicStatus));
|
||||
});
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
|
||||
|
||||
package com.ruoyi.fire.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
@@ -14,154 +18,170 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
||||
* @author Junhua
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
public class FireFacility extends BaseEntity {
|
||||
public class FireFacility extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 设施ID,自增主键
|
||||
*/
|
||||
private transient String statusName;
|
||||
|
||||
public String getStatusName() {
|
||||
return statusName;
|
||||
}
|
||||
|
||||
public void setStatusName(String statusName) {
|
||||
this.statusName = statusName;
|
||||
}
|
||||
|
||||
|
||||
/** 设施ID,自增主键 */
|
||||
@Excel(name = "设施ID,自增主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 位置ID(字符串描述,如"A101")
|
||||
*/
|
||||
@Excel(name = "位置ID", readConverterExp = "字=符串描述,如A101")
|
||||
/** 位置ID(字符串描述,如"A101") */
|
||||
@Excel(name = "位置ID")
|
||||
private String locationId;
|
||||
|
||||
/**
|
||||
* 设施名称(如"干粉灭火器")
|
||||
*/
|
||||
@Excel(name = "设施名称", readConverterExp = "如=干粉灭火器")
|
||||
/** 设施名称(如"干粉灭火器") */
|
||||
@Excel(name = "设施名称")
|
||||
private String facilityName;
|
||||
|
||||
/**
|
||||
* 设施类型(如"灭火器/消防栓")
|
||||
*/
|
||||
@Excel(name = "设施类型", readConverterExp = "如=灭火器/消防栓")
|
||||
/** 设施类型(如"灭火器/消防栓") */
|
||||
@Excel(name = "设施类型")
|
||||
private String facilityType;
|
||||
|
||||
/**
|
||||
* 型号规格
|
||||
*/
|
||||
/** 型号规格 */
|
||||
@Excel(name = "型号规格")
|
||||
private String modelNumber;
|
||||
|
||||
/**
|
||||
* 数量(通常≤10,用tinyint节省空间)
|
||||
*/
|
||||
@Excel(name = "数量", readConverterExp = "通=常≤10,用tinyint节省空间")
|
||||
/** 数量(通常≤10,用tinyint节省空间) */
|
||||
@Excel(name = "数量")
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 入库时间(默认当前日期)
|
||||
*/
|
||||
@Excel(name = "入库时间", readConverterExp = "默=认当前日期")
|
||||
/** 入库时间(默认当前日期) */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "入库时间",width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date entryDate;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
/** 生产日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date productionDate;
|
||||
|
||||
/**
|
||||
* 过期日期
|
||||
*/
|
||||
/** 过期日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "过期日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date expiryDate;
|
||||
|
||||
/**
|
||||
* 状态(0=正常,1=即将过期,2=已过期,3=维修中,4=已更换,5=已报废)
|
||||
*/
|
||||
@Excel(name = "状态", readConverterExp = "0==正常,1=即将过期,2=已过期,3=维修中,4=已更换,5=已报废")
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String remark;
|
||||
|
||||
/** 状态(0=正常,1=即将过期,2=已过期,3=维修中,4=已更换,5=已报废) */
|
||||
@Excel(name = "状态", dictType = "fire_facility_status")
|
||||
private Integer status;
|
||||
|
||||
public void setId(Long id) {
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setLocationId(String locationId) {
|
||||
public void setLocationId(String locationId)
|
||||
{
|
||||
this.locationId = locationId;
|
||||
}
|
||||
|
||||
public String getLocationId() {
|
||||
public String getLocationId()
|
||||
{
|
||||
return locationId;
|
||||
}
|
||||
|
||||
public void setFacilityName(String facilityName) {
|
||||
public void setFacilityName(String facilityName)
|
||||
{
|
||||
this.facilityName = facilityName;
|
||||
}
|
||||
|
||||
public String getFacilityName() {
|
||||
public String getFacilityName()
|
||||
{
|
||||
return facilityName;
|
||||
}
|
||||
|
||||
public void setFacilityType(String facilityType) {
|
||||
public void setFacilityType(String facilityType)
|
||||
{
|
||||
this.facilityType = facilityType;
|
||||
}
|
||||
|
||||
public String getFacilityType() {
|
||||
public String getFacilityType()
|
||||
{
|
||||
return facilityType;
|
||||
}
|
||||
|
||||
public void setModelNumber(String modelNumber) {
|
||||
public void setModelNumber(String modelNumber)
|
||||
{
|
||||
this.modelNumber = modelNumber;
|
||||
}
|
||||
|
||||
public String getModelNumber() {
|
||||
public String getModelNumber()
|
||||
{
|
||||
return modelNumber;
|
||||
}
|
||||
|
||||
public void setQuantity(Integer quantity) {
|
||||
public void setQuantity(Integer quantity)
|
||||
{
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Integer getQuantity() {
|
||||
public Integer getQuantity()
|
||||
{
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setEntryDate(Date entryDate) {
|
||||
public void setEntryDate(Date entryDate)
|
||||
{
|
||||
this.entryDate = entryDate;
|
||||
}
|
||||
|
||||
public Date getEntryDate() {
|
||||
public Date getEntryDate()
|
||||
{
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
public void setProductionDate(Date productionDate) {
|
||||
public void setProductionDate(Date productionDate)
|
||||
{
|
||||
this.productionDate = productionDate;
|
||||
}
|
||||
|
||||
public Date getProductionDate() {
|
||||
public Date getProductionDate()
|
||||
{
|
||||
return productionDate;
|
||||
}
|
||||
|
||||
public void setExpiryDate(Date expiryDate) {
|
||||
public void setExpiryDate(Date expiryDate)
|
||||
{
|
||||
this.expiryDate = expiryDate;
|
||||
}
|
||||
|
||||
public Date getExpiryDate() {
|
||||
public Date getExpiryDate()
|
||||
{
|
||||
return expiryDate;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
public void setStatus(Integer status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
public Integer getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("locationId", getLocationId())
|
||||
.append("facilityName", getFacilityName())
|
||||
@@ -177,4 +197,16 @@ public class FireFacility extends BaseEntity {
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.ruoyi.fire.domain;
|
||||
import java.util.Date;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
|
||||
消防设施维修记录对象 fire_facility_repair
|
||||
@author Junhua
|
||||
@date 2025-07-16
|
||||
*/
|
||||
public class FireFacilityRepair extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 维修 ID,自增主键 */
|
||||
private Long id;
|
||||
/** 设施 ID(逻辑关联 fire_facilities.id) */
|
||||
@Excel (name = "设施 ID")
|
||||
@NotNull (message = "设施 ID 不能为空")
|
||||
private Long facilityId;
|
||||
/** 维修日期 */
|
||||
@JsonFormat (pattern = "yyyy-MM-dd")
|
||||
@Excel (name = "维修日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@NotNull (message = "维修日期不能为空")
|
||||
private Date repairDate;
|
||||
/** 维修内容(详细描述) */
|
||||
@Excel (name = "维修内容")
|
||||
@NotBlank (message = "维修内容不能为空")
|
||||
@Size (max = 500, message = "维修内容不能超过 500 个字符")
|
||||
private String repairContent;
|
||||
/**
|
||||
维修结果(0 = 成功,1 = 失败,2 = 部分解决)
|
||||
通过 dictType 关联数据字典,实现 Excel 导出时的文本映射
|
||||
*/
|
||||
@Excel (name = "维修结果", dictType = "fire_repair_result") // 核心修改:添加 dictType 关联字典
|
||||
@NotNull (message = "维修结果不能为空")
|
||||
private Integer repairResult;
|
||||
/** 操作人员(工号 || 姓名) */
|
||||
@Excel (name = "操作人员")
|
||||
@NotBlank (message = "操作人员不能为空")
|
||||
@Size (max = 20, message = "操作人员姓名不能超过 20 个字符")
|
||||
private String replacePerson;
|
||||
/** 下次检查日期 */
|
||||
@JsonFormat (pattern = "yyyy-MM-dd")
|
||||
@Excel (name = "下次检查日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date nextCheckDate;
|
||||
/** 创建时间 */
|
||||
@JsonFormat (pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel (name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
/** 备注 */
|
||||
@Excel (name = "备注")
|
||||
@Size (max = 200, message = "备注不能超过 200 个字符")
|
||||
private String remark;
|
||||
// 以下为 getter/setter 方法(保持不变)
|
||||
public void setId (Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setFacilityId(Long facilityId)
|
||||
{
|
||||
this.facilityId = facilityId;
|
||||
}
|
||||
public Long getFacilityId()
|
||||
{
|
||||
return facilityId;
|
||||
}
|
||||
public void setRepairDate(Date repairDate)
|
||||
{
|
||||
this.repairDate = repairDate;
|
||||
}
|
||||
public Date getRepairDate()
|
||||
{
|
||||
return repairDate;
|
||||
}
|
||||
public void setRepairContent(String repairContent)
|
||||
{
|
||||
this.repairContent = repairContent;
|
||||
}
|
||||
public String getRepairContent()
|
||||
{
|
||||
return repairContent;
|
||||
}
|
||||
public void setRepairResult(Integer repairResult)
|
||||
{
|
||||
this.repairResult = repairResult;
|
||||
}
|
||||
public Integer getRepairResult()
|
||||
{
|
||||
return repairResult;
|
||||
}
|
||||
public void setReplacePerson(String replacePerson)
|
||||
{
|
||||
this.replacePerson = replacePerson;
|
||||
}
|
||||
public String getReplacePerson()
|
||||
{
|
||||
return replacePerson;
|
||||
}
|
||||
public void setNextCheckDate(Date nextCheckDate)
|
||||
{
|
||||
this.nextCheckDate = nextCheckDate;
|
||||
}
|
||||
public Date getNextCheckDate()
|
||||
{
|
||||
return nextCheckDate;
|
||||
}
|
||||
@Override
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
@Override
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
@Override
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
@Override
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("facilityId", getFacilityId())
|
||||
.append("repairDate", getRepairDate())
|
||||
.append("repairContent", getRepairContent())
|
||||
.append("repairResult", getRepairResult())
|
||||
.append("replacePerson", getReplacePerson())
|
||||
.append("nextCheckDate", getNextCheckDate())
|
||||
.append("remark", getRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.ruoyi.fire.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 消防设施更换记录对象 fire_facility_replacement
|
||||
*
|
||||
* @author system
|
||||
* @date 2025-07-22
|
||||
*/
|
||||
public class FireFacilityReplacement extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 设施ID,自增主键 */
|
||||
@Excel(name = "设施ID,自增主键")
|
||||
private Long id;
|
||||
|
||||
/** 原设施ID(逻辑关联fire_facilities.id) */
|
||||
@Excel(name = "原设施ID")
|
||||
@NotNull(message = "原设施ID不能为空")
|
||||
private Long oldFacilityId;
|
||||
|
||||
/** 新设施ID(逻辑关联fire_facilities.id) */
|
||||
@Excel(name = "新设施ID")
|
||||
@NotNull(message = "新设施ID不能为空")
|
||||
private Long newFacilityId;
|
||||
|
||||
/** 更换日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "更换日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@NotNull(message = "更换日期不能为空")
|
||||
private Date replaceDate;
|
||||
|
||||
/** 更换原因(详细说明) */
|
||||
@Excel(name = "更换原因")
|
||||
@NotBlank(message = "更换原因不能为空")
|
||||
@Size(max = 200, message = "更换原因长度不能超过200个字符")
|
||||
private String replaceReason;
|
||||
|
||||
/** 更换人(操作人员) */
|
||||
@Excel(name = "更换人")
|
||||
@NotBlank(message = "更换人不能为空")
|
||||
@Size(max = 20, message = "更换人姓名长度不能超过20个字符")
|
||||
private String replacePerson;
|
||||
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
@Size(max = 200, message = "备注长度不能超过200个字符")
|
||||
private String remark;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
// 以下为所有字段的getter和setter方法,确保每个字段都能被正确访问和设置
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setOldFacilityId(Long oldFacilityId)
|
||||
{
|
||||
this.oldFacilityId = oldFacilityId;
|
||||
}
|
||||
|
||||
public Long getOldFacilityId()
|
||||
{
|
||||
return oldFacilityId;
|
||||
}
|
||||
|
||||
public void setNewFacilityId(Long newFacilityId)
|
||||
{
|
||||
this.newFacilityId = newFacilityId;
|
||||
}
|
||||
|
||||
public Long getNewFacilityId()
|
||||
{
|
||||
return newFacilityId;
|
||||
}
|
||||
|
||||
public void setReplaceDate(Date replaceDate)
|
||||
{
|
||||
this.replaceDate = replaceDate;
|
||||
}
|
||||
|
||||
public Date getReplaceDate()
|
||||
{
|
||||
return replaceDate;
|
||||
}
|
||||
|
||||
public void setReplaceReason(String replaceReason)
|
||||
{
|
||||
this.replaceReason = replaceReason;
|
||||
}
|
||||
|
||||
public String getReplaceReason()
|
||||
{
|
||||
return replaceReason;
|
||||
}
|
||||
|
||||
public void setReplacePerson(String replacePerson)
|
||||
{
|
||||
this.replacePerson = replacePerson;
|
||||
}
|
||||
|
||||
public String getReplacePerson()
|
||||
{
|
||||
return replacePerson;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRemark(String remark)
|
||||
{
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRemark()
|
||||
{
|
||||
return remark;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(Date createTime)
|
||||
{
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreateTime()
|
||||
{
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("oldFacilityId", getOldFacilityId())
|
||||
.append("newFacilityId", getNewFacilityId())
|
||||
.append("replaceDate", getReplaceDate())
|
||||
.append("replaceReason", getReplaceReason())
|
||||
.append("replacePerson", getReplacePerson())
|
||||
.append("remark", getRemark())
|
||||
.append("createTime", getCreateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.ruoyi.fire.domain;
|
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import java.util.Date;
|
||||
|
||||
public class FireFacilityReport extends BaseEntity {
|
||||
private Long id;
|
||||
private String locationId;
|
||||
private String facilityName;
|
||||
private String facilityType;
|
||||
private String modelNumber;
|
||||
private Integer quantity;
|
||||
private Date entryDate;
|
||||
private Date productionDate;
|
||||
private Date expiryDate;
|
||||
private Integer status;
|
||||
private String remark;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
|
||||
// 动态计算的状态
|
||||
private Integer dynamicStatus;
|
||||
// 状态文本
|
||||
private String statusText;
|
||||
|
||||
// Getters and Setters
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
public String getLocationId() { return locationId; }
|
||||
public void setLocationId(String locationId) { this.locationId = locationId; }
|
||||
public String getFacilityName() { return facilityName; }
|
||||
public void setFacilityName(String facilityName) { this.facilityName = facilityName; }
|
||||
public String getFacilityType() { return facilityType; }
|
||||
public void setFacilityType(String facilityType) { this.facilityType = facilityType; }
|
||||
public String getModelNumber() { return modelNumber; }
|
||||
public void setModelNumber(String modelNumber) { this.modelNumber = modelNumber; }
|
||||
public Integer getQuantity() { return quantity; }
|
||||
public void setQuantity(Integer quantity) { this.quantity = quantity; }
|
||||
public Date getEntryDate() { return entryDate; }
|
||||
public void setEntryDate(Date entryDate) { this.entryDate = entryDate; }
|
||||
public Date getProductionDate() { return productionDate; }
|
||||
public void setProductionDate(Date productionDate) { this.productionDate = productionDate; }
|
||||
public Date getExpiryDate() { return expiryDate; }
|
||||
public void setExpiryDate(Date expiryDate) { this.expiryDate = expiryDate; }
|
||||
public Integer getStatus() { return status; }
|
||||
public void setStatus(Integer status) { this.status = status; }
|
||||
public String getRemark() { return remark; }
|
||||
public void setRemark(String remark) { this.remark = remark; }
|
||||
public Date getCreateTime() { return createTime; }
|
||||
public void setCreateTime(Date createTime) { this.createTime = createTime; }
|
||||
public Date getUpdateTime() { return updateTime; }
|
||||
public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; }
|
||||
public Integer getDynamicStatus() { return dynamicStatus; }
|
||||
public void setDynamicStatus(Integer dynamicStatus) { this.dynamicStatus = dynamicStatus; }
|
||||
public String getStatusText() { return statusText; }
|
||||
public void setStatusText(String statusText) { this.statusText = statusText; }
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.ruoyi.fire.mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* facilitiesMapper接口
|
||||
@@ -10,7 +13,8 @@ import com.ruoyi.fire.domain.FireFacility;
|
||||
* @author Junhua
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
public interface FireFacilityMapper {
|
||||
public interface FireFacilityMapper
|
||||
{
|
||||
/**
|
||||
* 查询facilities
|
||||
*
|
||||
@@ -58,4 +62,21 @@ public interface FireFacilityMapper {
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据位置ID和设施名称查询(用于校验重复)
|
||||
* @param locationId 位置ID
|
||||
* @param facilityName 设施名称
|
||||
* @return 消防设施对象
|
||||
*/
|
||||
FireFacility selectByLocationAndName(
|
||||
@Param("locationId") String locationId,
|
||||
@Param("facilityName") String facilityName);
|
||||
|
||||
/**
|
||||
* 查询根据id查询设施列表
|
||||
*/
|
||||
List<FireFacility> getDetails(FireFacility fireFacility);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.fire.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.fire.domain.FireFacilityRepair;
|
||||
|
||||
/**
|
||||
* 消防设施维修记录Mapper接口
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface FireFacilityRepairMapper
|
||||
{
|
||||
/**
|
||||
* 查询消防设施维修记录
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 消防设施维修记录
|
||||
*/
|
||||
public FireFacilityRepair selectFireFacilityRepairById(Long id);
|
||||
|
||||
/**
|
||||
* 查询消防设施维修记录列表
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 消防设施维修记录集合
|
||||
*/
|
||||
public List<FireFacilityRepair> selectFireFacilityRepairList(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 新增消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFireFacilityRepair(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 修改消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFireFacilityRepair(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 删除消防设施维修记录
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityRepairById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除消防设施维修记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityRepairByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.fire.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.fire.domain.FireFacilityReplacement;
|
||||
|
||||
/**
|
||||
* 消防设施更换记录Mapper接口
|
||||
*
|
||||
* @author Junhau
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
public interface FireFacilityReplacementMapper
|
||||
{
|
||||
/**
|
||||
* 查询消防设施更换记录
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 消防设施更换记录
|
||||
*/
|
||||
public FireFacilityReplacement selectFireFacilityReplacementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询消防设施更换记录列表
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 消防设施更换记录集合
|
||||
*/
|
||||
public List<FireFacilityReplacement> selectFireFacilityReplacementList(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 新增消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 修改消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 删除消防设施更换记录
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityReplacementById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除消防设施更换记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityReplacementByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.fire.mapper;
|
||||
|
||||
// 移除错误的Lettuce导入,改为MyBatis的Param注解
|
||||
import org.apache.ibatis.annotations.Param; // 正确的导入
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.fire.domain.FireFacilityReport;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FireFacilityReportMapper extends BaseMapper<FireFacilityReport> {
|
||||
List<FireFacilityReport> selectFireFacilityReportList(FireFacilityReport fireFacilityReport);
|
||||
|
||||
// 使用MyBatis的@Param注解绑定参数名称
|
||||
int batchUpdateStatus(@Param("ids") List<Long> ids, @Param("newStatus") Integer newStatus);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.fire.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.fire.domain.FireFacilityRepair;
|
||||
|
||||
/**
|
||||
* 消防设施维修记录Service接口
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
public interface IFireFacilityRepairService
|
||||
{
|
||||
/**
|
||||
* 查询消防设施维修记录
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 消防设施维修记录
|
||||
*/
|
||||
public FireFacilityRepair selectFireFacilityRepairById(Long id);
|
||||
|
||||
/**
|
||||
* 查询消防设施维修记录列表
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 消防设施维修记录集合
|
||||
*/
|
||||
public List<FireFacilityRepair> selectFireFacilityRepairList(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 新增消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFireFacilityRepair(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 修改消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFireFacilityRepair(FireFacilityRepair fireFacilityRepair);
|
||||
|
||||
/**
|
||||
* 批量删除消防设施维修记录
|
||||
*
|
||||
* @param ids 需要删除的消防设施维修记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityRepairByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除消防设施维修记录信息
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityRepairById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.ruoyi.fire.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.fire.domain.FireFacilityReplacement;
|
||||
|
||||
/**
|
||||
* 消防设施更换记录Service接口
|
||||
*
|
||||
* @author Junhau
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
public interface IFireFacilityReplacementService
|
||||
{
|
||||
/**
|
||||
* 查询消防设施更换记录
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 消防设施更换记录
|
||||
*/
|
||||
public FireFacilityReplacement selectFireFacilityReplacementById(Long id);
|
||||
|
||||
/**
|
||||
* 查询消防设施更换记录列表
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 消防设施更换记录集合
|
||||
*/
|
||||
public List<FireFacilityReplacement> selectFireFacilityReplacementList(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 新增消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 修改消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement);
|
||||
|
||||
/**
|
||||
* 批量删除消防设施更换记录
|
||||
*
|
||||
* @param ids 需要删除的消防设施更换记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityReplacementByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除消防设施更换记录信息
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityReplacementById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.fire.service;
|
||||
|
||||
import com.ruoyi.fire.domain.FireFacilityReport;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IFireFacilityReportService {
|
||||
List<FireFacilityReport> selectFireFacilityReportList(FireFacilityReport fireFacilityReport);
|
||||
int updateExpiryStatus();
|
||||
List<Map<String, Object>> getReportData(String facilityType);
|
||||
|
||||
|
||||
// 新增:计算动态状态的方法
|
||||
Integer calculateDynamicStatus(Date expiryDate, Integer originalStatus);
|
||||
|
||||
// 新增:状态文本转换方法
|
||||
String getStatusText(Integer status);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,61 +1,92 @@
|
||||
package com.ruoyi.fire.service;
|
||||
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
|
||||
/**
|
||||
* facilitiesService接口
|
||||
* 消防设施Service接口
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
public interface IFireFacilityService {
|
||||
/**
|
||||
* 查询facilities
|
||||
*
|
||||
* @param id facilities主键
|
||||
* @return facilities
|
||||
*/
|
||||
public FireFacility selectFireFacilityById(Long id);
|
||||
|
||||
/**
|
||||
* 查询facilities列表
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* @return facilities集合
|
||||
* 检查并更新设施状态(根据过期时间)
|
||||
* @param id 设施ID
|
||||
* @return 1=更新成功,0=未更新
|
||||
*/
|
||||
public List<FireFacility> selectFireFacilityList(FireFacility fireFacility);
|
||||
int checkAndUpdateStatus(Long id);
|
||||
|
||||
/**
|
||||
* 新增facilities
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* 分页更新设施过期状态
|
||||
* @param fireFacility 查询条件
|
||||
* @param pageNum 页码
|
||||
* @param pageSize 每页条数
|
||||
*/
|
||||
void checkAndUpdateExpirationStatus(FireFacility fireFacility, Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 查询设施
|
||||
* @param id 设施主键
|
||||
* @return 设施
|
||||
*/
|
||||
FireFacility selectFireFacilityById(Long id);
|
||||
|
||||
/**
|
||||
* 查询设施列表
|
||||
* @param fireFacility 设施
|
||||
* @return 设施集合
|
||||
*/
|
||||
List<FireFacility> selectFireFacilityList(FireFacility fireFacility);
|
||||
|
||||
/**
|
||||
* 新增设施
|
||||
* @param fireFacility 设施
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertFireFacility(FireFacility fireFacility);
|
||||
int insertFireFacility(FireFacility fireFacility);
|
||||
|
||||
/**
|
||||
* 修改facilities
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* 修改设施
|
||||
* @param fireFacility 设施
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateFireFacility(FireFacility fireFacility);
|
||||
int updateFireFacility(FireFacility fireFacility);
|
||||
|
||||
/**
|
||||
* 批量删除facilities
|
||||
*
|
||||
* @param ids 需要删除的facilities主键集合
|
||||
* 批量删除设施
|
||||
* @param ids 需要删除的设施主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityByIds(Long[] ids);
|
||||
int deleteFireFacilityByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除facilities信息
|
||||
*
|
||||
* @param id facilities主键
|
||||
* 删除设施信息
|
||||
* @param id 设施主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteFireFacilityById(Long id);
|
||||
int deleteFireFacilityById(Long id);
|
||||
|
||||
/**
|
||||
* 导入消防设施数据
|
||||
* @param file Excel文件
|
||||
* @param updateSupport 是否支持更新
|
||||
* @return 导入结果
|
||||
*/
|
||||
String importFireFacility(MultipartFile file, boolean updateSupport) throws Exception;
|
||||
|
||||
/**
|
||||
* 查询设施详情列表
|
||||
* @param fireFacility 查询条件
|
||||
* @return 设施详情集合
|
||||
*/
|
||||
List<FireFacility> getDetails(FireFacility fireFacility);
|
||||
/**
|
||||
* 根据位置和名称查询设施(用于导入时判断重复)
|
||||
*/
|
||||
|
||||
public FireFacility selectByLocationAndName(String locationId, String facilityName);
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.fire.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.fire.mapper.FireFacilityRepairMapper;
|
||||
import com.ruoyi.fire.domain.FireFacilityRepair;
|
||||
import com.ruoyi.fire.service.IFireFacilityRepairService;
|
||||
|
||||
/**
|
||||
* 消防设施维修记录Service业务层处理
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-16
|
||||
*/
|
||||
@Service
|
||||
public class FireFacilityRepairServiceImpl implements IFireFacilityRepairService
|
||||
{
|
||||
@Autowired
|
||||
private FireFacilityRepairMapper fireFacilityRepairMapper;
|
||||
|
||||
/**
|
||||
* 查询消防设施维修记录
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 消防设施维修记录
|
||||
*/
|
||||
@Override
|
||||
public FireFacilityRepair selectFireFacilityRepairById(Long id)
|
||||
{
|
||||
return fireFacilityRepairMapper.selectFireFacilityRepairById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消防设施维修记录列表
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 消防设施维修记录
|
||||
*/
|
||||
@Override
|
||||
public List<FireFacilityRepair> selectFireFacilityRepairList(FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
return fireFacilityRepairMapper.selectFireFacilityRepairList(fireFacilityRepair);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFireFacilityRepair(FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
fireFacilityRepair.setCreateTime(DateUtils.getNowDate());
|
||||
return fireFacilityRepairMapper.insertFireFacilityRepair(fireFacilityRepair);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消防设施维修记录
|
||||
*
|
||||
* @param fireFacilityRepair 消防设施维修记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFireFacilityRepair(FireFacilityRepair fireFacilityRepair)
|
||||
{
|
||||
return fireFacilityRepairMapper.updateFireFacilityRepair(fireFacilityRepair);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除消防设施维修记录
|
||||
*
|
||||
* @param ids 需要删除的消防设施维修记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityRepairByIds(Long[] ids)
|
||||
{
|
||||
return fireFacilityRepairMapper.deleteFireFacilityRepairByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消防设施维修记录信息
|
||||
*
|
||||
* @param id 消防设施维修记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityRepairById(Long id)
|
||||
{
|
||||
return fireFacilityRepairMapper.deleteFireFacilityRepairById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.ruoyi.fire.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.fire.mapper.FireFacilityReplacementMapper;
|
||||
import com.ruoyi.fire.domain.FireFacilityReplacement;
|
||||
import com.ruoyi.fire.service.IFireFacilityReplacementService;
|
||||
|
||||
/**
|
||||
* 消防设施更换记录Service业务层处理
|
||||
*
|
||||
* @author Junhau
|
||||
* @date 2025-07-17
|
||||
*/
|
||||
@Service
|
||||
public class FireFacilityReplacementServiceImpl implements IFireFacilityReplacementService
|
||||
{
|
||||
@Autowired
|
||||
private FireFacilityReplacementMapper fireFacilityReplacementMapper;
|
||||
|
||||
/**
|
||||
* 查询消防设施更换记录
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 消防设施更换记录
|
||||
*/
|
||||
@Override
|
||||
public FireFacilityReplacement selectFireFacilityReplacementById(Long id)
|
||||
{
|
||||
return fireFacilityReplacementMapper.selectFireFacilityReplacementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询消防设施更换记录列表
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 消防设施更换记录
|
||||
*/
|
||||
@Override
|
||||
public List<FireFacilityReplacement> selectFireFacilityReplacementList(FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
return fireFacilityReplacementMapper.selectFireFacilityReplacementList(fireFacilityReplacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
fireFacilityReplacement.setCreateTime(DateUtils.getNowDate());
|
||||
return fireFacilityReplacementMapper.insertFireFacilityReplacement(fireFacilityReplacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消防设施更换记录
|
||||
*
|
||||
* @param fireFacilityReplacement 消防设施更换记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateFireFacilityReplacement(FireFacilityReplacement fireFacilityReplacement)
|
||||
{
|
||||
return fireFacilityReplacementMapper.updateFireFacilityReplacement(fireFacilityReplacement);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除消防设施更换记录
|
||||
*
|
||||
* @param ids 需要删除的消防设施更换记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityReplacementByIds(Long[] ids)
|
||||
{
|
||||
return fireFacilityReplacementMapper.deleteFireFacilityReplacementByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消防设施更换记录信息
|
||||
*
|
||||
* @param id 消防设施更换记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityReplacementById(Long id)
|
||||
{
|
||||
return fireFacilityReplacementMapper.deleteFireFacilityReplacementById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.ruoyi.fire.service.impl;
|
||||
|
||||
import com.ruoyi.fire.domain.FireFacilityReport;
|
||||
import com.ruoyi.fire.service.IFireFacilityReportService;
|
||||
import com.ruoyi.fire.mapper.FireFacilityReportMapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class FireFacilityReportServiceImpl extends ServiceImpl<FireFacilityReportMapper, FireFacilityReport> implements IFireFacilityReportService {
|
||||
|
||||
// 状态常量定义
|
||||
public static final int STATUS_NORMAL = 0; // 正常
|
||||
public static final int STATUS_WILL_EXPIRE = 1; // 即将过期
|
||||
public static final int STATUS_EXPIRED = 2; // 已过期
|
||||
public static final int STATUS_REPAIRING = 3; // 维修中
|
||||
public static final int STATUS_REPLACED = 4; // 已更换
|
||||
public static final int STATUS_SCRAPPED = 5; // 已报废
|
||||
|
||||
@Override
|
||||
public List<FireFacilityReport> selectFireFacilityReportList(FireFacilityReport fireFacilityReport) {
|
||||
return baseMapper.selectFireFacilityReportList(fireFacilityReport);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public int updateExpiryStatus() {
|
||||
return 0; // 已废弃
|
||||
}
|
||||
|
||||
/**
|
||||
* 支持按设施类型筛选的统计数据
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getReportData(String facilityType) { // 接收设施类型参数
|
||||
// 1. 按设施类型筛选数据
|
||||
FireFacilityReport query = new FireFacilityReport();
|
||||
query.setFacilityType(facilityType); // 应用前端筛选条件
|
||||
List<FireFacilityReport> list = selectFireFacilityReportList(query);
|
||||
|
||||
// 2. 计算动态状态和状态文本
|
||||
for (FireFacilityReport facility : list) {
|
||||
Integer dynamicStatus = calculateDynamicStatus(facility.getExpiryDate(), facility.getStatus());
|
||||
facility.setDynamicStatus(dynamicStatus);
|
||||
facility.setStatusText(getStatusText(dynamicStatus));
|
||||
}
|
||||
|
||||
// 3. 按【动态状态+设施类型】分组统计
|
||||
Map<String, Map<String, Integer>> statsMap = new HashMap<>(16);
|
||||
for (FireFacilityReport facility : list) {
|
||||
String statusKey = String.valueOf(facility.getDynamicStatus());
|
||||
String typeKey = facility.getFacilityType();
|
||||
if (typeKey == null) typeKey = "未知类型"; // 处理空类型
|
||||
|
||||
statsMap.computeIfAbsent(statusKey, k -> new HashMap<>(16));
|
||||
Integer currentTotal = statsMap.get(statusKey).getOrDefault(typeKey, 0);
|
||||
statsMap.get(statusKey).put(typeKey, currentTotal + (facility.getQuantity() == null ? 1 : facility.getQuantity()));
|
||||
}
|
||||
|
||||
// 4. 按优先级排序组装结果
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
Integer[] priorityOrder = {STATUS_REPAIRING, STATUS_REPLACED, STATUS_SCRAPPED, STATUS_NORMAL, STATUS_WILL_EXPIRE, STATUS_EXPIRED};
|
||||
|
||||
for (Integer status : priorityOrder) {
|
||||
Map<String, Integer> typeCountMap = statsMap.get(String.valueOf(status));
|
||||
if (typeCountMap == null || typeCountMap.isEmpty()) continue;
|
||||
|
||||
for (Map.Entry<String, Integer> entry : typeCountMap.entrySet()) {
|
||||
Map<String, Object> reportItem = new HashMap<>(8);
|
||||
reportItem.put("status", status);
|
||||
reportItem.put("statusText", getStatusText(status));
|
||||
reportItem.put("facilityType", entry.getKey());
|
||||
reportItem.put("total", entry.getValue());
|
||||
resultList.add(reportItem);
|
||||
}
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer calculateDynamicStatus(Date expiryDate, Integer originalStatus) {
|
||||
// 优先处理特殊状态
|
||||
if (originalStatus != null) {
|
||||
if (originalStatus == STATUS_REPAIRING || originalStatus == STATUS_REPLACED || originalStatus == STATUS_SCRAPPED) {
|
||||
return originalStatus;
|
||||
}
|
||||
}
|
||||
|
||||
// 无过期日期默认正常
|
||||
if (expiryDate == null) {
|
||||
return STATUS_NORMAL;
|
||||
}
|
||||
|
||||
// 日期转换(处理时区)
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate expiryLocalDate = expiryDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||
long daysDiff = ChronoUnit.DAYS.between(today, expiryLocalDate);
|
||||
|
||||
if (daysDiff < 0) {
|
||||
return STATUS_EXPIRED;
|
||||
} else if (daysDiff <= 30) {
|
||||
return STATUS_WILL_EXPIRE;
|
||||
} else {
|
||||
return STATUS_NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // 实现接口方法
|
||||
public String getStatusText(Integer status) {
|
||||
if (status == null) {
|
||||
return "未知状态";
|
||||
}
|
||||
switch (status) {
|
||||
case STATUS_NORMAL: return "正常";
|
||||
case STATUS_WILL_EXPIRE: return "即将过期";
|
||||
case STATUS_EXPIRED: return "已过期";
|
||||
case STATUS_REPAIRING: return "维修中";
|
||||
case STATUS_REPLACED: return "已更换";
|
||||
case STATUS_SCRAPPED: return "已报废";
|
||||
default: return "未知状态";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +1,174 @@
|
||||
package com.ruoyi.fire.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
import com.ruoyi.fire.mapper.FireFacilityMapper;
|
||||
import com.ruoyi.fire.service.IFireFacilityService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.fire.mapper.FireFacilityMapper;
|
||||
import com.ruoyi.fire.domain.FireFacility;
|
||||
import com.ruoyi.fire.service.IFireFacilityService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* facilitiesService业务层处理
|
||||
* 消防设施服务实现类
|
||||
* 实现接口定义的所有业务逻辑,包含状态动态计算、CRUD操作等
|
||||
*
|
||||
* @author Junhua
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
public class FireFacilityServiceImpl implements IFireFacilityService {
|
||||
// 消防设施状态常量定义
|
||||
private static final Integer STATUS_NORMAL = 0; // 正常
|
||||
private static final Integer STATUS_WILL_EXPIRE = 1; // 即将过期
|
||||
private static final Integer STATUS_EXPIRED = 2; // 已过期
|
||||
private static final Integer STATUS_REPAIRING = 3; // 维修中
|
||||
private static final Integer STATUS_REPLACED = 4; // 已更换
|
||||
private static final Integer STATUS_SCRAPPED = 5; // 已报废
|
||||
|
||||
// 日志记录器
|
||||
private static final Logger log = LoggerFactory.getLogger(FireFacilityServiceImpl.class);
|
||||
|
||||
// 注入数据访问层(Mapper)
|
||||
@Autowired
|
||||
private FireFacilityMapper fireFacilityMapper;
|
||||
|
||||
/**
|
||||
* 查询facilities
|
||||
*
|
||||
* @param id facilities主键
|
||||
* @return facilities
|
||||
* 检查并更新设施状态(核心逻辑)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 事务管理:异常时回滚
|
||||
public int checkAndUpdateStatus(Long id) {
|
||||
// 1. 参数校验
|
||||
if (id == null || id <= 0) {
|
||||
throw new IllegalArgumentException("设施ID无效(必须为正整数)");
|
||||
}
|
||||
|
||||
// 2. 查询设施信息
|
||||
FireFacility facility = fireFacilityMapper.selectFireFacilityById(id);
|
||||
if (facility == null) {
|
||||
throw new RuntimeException("未查询到ID为" + id + "的消防设施");
|
||||
}
|
||||
|
||||
// 3. 计算应有的动态状态
|
||||
Integer dynamicStatus = calculateDynamicStatus(facility.getExpiryDate(), facility.getStatus());
|
||||
Integer currentStatus = facility.getStatus();
|
||||
|
||||
// 4. 特殊状态(维修中/已更换/已报废)不更新
|
||||
if (currentStatus != null && (
|
||||
currentStatus == STATUS_REPAIRING ||
|
||||
currentStatus == STATUS_REPLACED ||
|
||||
currentStatus == STATUS_SCRAPPED)) {
|
||||
log.info("设施[ID:{}]处于特殊状态({}),不执行状态更新", id, currentStatus);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 5. 状态变化时执行更新
|
||||
if (!dynamicStatus.equals(currentStatus)) {
|
||||
facility.setStatus(dynamicStatus);
|
||||
facility.setUpdateTime(new Date()); // 更新时间戳
|
||||
int updateRows = fireFacilityMapper.updateFireFacility(facility);
|
||||
log.info("设施[ID:{}]状态更新:{} → {}", id, currentStatus, dynamicStatus);
|
||||
return updateRows > 0 ? 1 : 0;
|
||||
}
|
||||
|
||||
// 6. 状态未变化
|
||||
log.info("设施[ID:{}]状态未发生变化(当前状态:{})", id, currentStatus);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算动态状态(核心算法)
|
||||
* 根据过期日期和当前状态,自动判断应有的状态
|
||||
*/
|
||||
private Integer calculateDynamicStatus(Date expiryDate, Integer originalStatus) {
|
||||
// 处理原始状态为null的情况(默认正常)
|
||||
if (originalStatus == null) {
|
||||
originalStatus = STATUS_NORMAL;
|
||||
}
|
||||
|
||||
// 特殊状态直接返回(不参与动态计算)
|
||||
if (originalStatus == STATUS_REPAIRING ||
|
||||
originalStatus == STATUS_REPLACED ||
|
||||
originalStatus == STATUS_SCRAPPED) {
|
||||
return originalStatus;
|
||||
}
|
||||
|
||||
// 无过期日期时默认正常
|
||||
if (expiryDate == null) {
|
||||
return STATUS_NORMAL;
|
||||
}
|
||||
|
||||
try {
|
||||
// 转换日期为LocalDate(处理时区问题)
|
||||
LocalDate today = LocalDate.now();
|
||||
LocalDate expiryLocalDate = expiryDate.toInstant()
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDate();
|
||||
|
||||
// 计算与过期日期的天数差
|
||||
long daysDiff = ChronoUnit.DAYS.between(today, expiryLocalDate);
|
||||
|
||||
// 判断状态
|
||||
if (daysDiff < 0) {
|
||||
return STATUS_EXPIRED; // 已过期(过期日期在今天之前)
|
||||
} else if (daysDiff <= 30) {
|
||||
return STATUS_WILL_EXPIRE; // 即将过期(30天内过期)
|
||||
} else {
|
||||
return STATUS_NORMAL; // 正常(30天以上过期)
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("日期转换失败,expiryDate={}", expiryDate, e);
|
||||
throw new RuntimeException("处理过期日期时发生错误,请检查日期格式是否合法");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页更新设施状态(用于列表查询时批量刷新)
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void checkAndUpdateExpirationStatus(FireFacility fireFacility, Integer pageNum, Integer pageSize) {
|
||||
// 1. 分页查询当前页数据
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<FireFacility> facilityList = fireFacilityMapper.selectFireFacilityList(fireFacility);
|
||||
log.info("开始更新第{}页设施状态,共{}条数据", pageNum, facilityList.size());
|
||||
|
||||
// 2. 遍历当前页数据,逐个更新状态
|
||||
Date now = new Date();
|
||||
for (FireFacility facility : facilityList) {
|
||||
// 跳过特殊状态的设施
|
||||
if (facility.getStatus() != null && (
|
||||
facility.getStatus() == STATUS_REPAIRING ||
|
||||
facility.getStatus() == STATUS_REPLACED ||
|
||||
facility.getStatus() == STATUS_SCRAPPED)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 计算新状态并更新
|
||||
Integer newStatus = calculateDynamicStatus(facility.getExpiryDate(), facility.getStatus());
|
||||
if (!newStatus.equals(facility.getStatus())) {
|
||||
facility.setStatus(newStatus);
|
||||
facility.setUpdateTime(now);
|
||||
fireFacilityMapper.updateFireFacility(facility);
|
||||
log.debug("批量更新 - 设施[ID:{}]状态:{} → {}", facility.getId(), facility.getStatus(), newStatus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询设施
|
||||
*/
|
||||
@Override
|
||||
public FireFacility selectFireFacilityById(Long id) {
|
||||
@@ -32,10 +176,7 @@ public class FireFacilityServiceImpl implements IFireFacilityService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询facilities列表
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* @return facilities
|
||||
* 查询设施列表
|
||||
*/
|
||||
@Override
|
||||
public List<FireFacility> selectFireFacilityList(FireFacility fireFacility) {
|
||||
@@ -43,34 +184,31 @@ public class FireFacilityServiceImpl implements IFireFacilityService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增facilities
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* @return 结果
|
||||
* 新增设施
|
||||
*/
|
||||
@Override
|
||||
public int insertFireFacility(FireFacility fireFacility) {
|
||||
fireFacility.setCreateTime(DateUtils.getNowDate());
|
||||
// 设置创建/更新时间
|
||||
Date now = new Date();
|
||||
fireFacility.setCreateTime(now);
|
||||
fireFacility.setUpdateTime(now);
|
||||
// 自动计算初始状态
|
||||
fireFacility.setStatus(calculateDynamicStatus(fireFacility.getExpiryDate(), null));
|
||||
return fireFacilityMapper.insertFireFacility(fireFacility);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改facilities
|
||||
*
|
||||
* @param fireFacility facilities
|
||||
* @return 结果
|
||||
* 修改设施
|
||||
*/
|
||||
@Override
|
||||
public int updateFireFacility(FireFacility fireFacility) {
|
||||
fireFacility.setUpdateTime(DateUtils.getNowDate());
|
||||
// 更新时间戳
|
||||
fireFacility.setUpdateTime(new Date());
|
||||
return fireFacilityMapper.updateFireFacility(fireFacility);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除facilities
|
||||
*
|
||||
* @param ids 需要删除的facilities主键
|
||||
* @return 结果
|
||||
* 批量删除设施
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityByIds(Long[] ids) {
|
||||
@@ -78,13 +216,92 @@ public class FireFacilityServiceImpl implements IFireFacilityService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除facilities信息
|
||||
*
|
||||
* @param id facilities主键
|
||||
* @return 结果
|
||||
* 单个删除设施
|
||||
*/
|
||||
@Override
|
||||
public int deleteFireFacilityById(Long id) {
|
||||
return fireFacilityMapper.deleteFireFacilityById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入设施数据
|
||||
*/
|
||||
@Override
|
||||
public String importFireFacility(MultipartFile file, boolean updateSupport) throws Exception {
|
||||
ExcelUtil<FireFacility> util = new ExcelUtil<>(FireFacility.class);
|
||||
List<FireFacility> facilityList = util.importExcel(file.getInputStream());
|
||||
|
||||
// 校验导入数据
|
||||
if (StringUtils.isEmpty(facilityList)) {
|
||||
throw new Exception("导入数据为空,请检查Excel文件内容");
|
||||
}
|
||||
|
||||
int successNum = 0; // 成功数量
|
||||
int failureNum = 0; // 失败数量
|
||||
StringBuilder failureMsg = new StringBuilder(); // 失败原因
|
||||
Date now = new Date();
|
||||
|
||||
// 遍历处理每条数据
|
||||
for (FireFacility facility : facilityList) {
|
||||
try {
|
||||
// 基础校验:名称和位置ID不能为空
|
||||
if (StringUtils.isEmpty(facility.getFacilityName()) || StringUtils.isEmpty(facility.getLocationId())) {
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、设施名称或位置ID为空");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 检查是否已存在(根据位置+名称判断)
|
||||
FireFacility existFacility = selectByLocationAndName(facility.getLocationId(), facility.getFacilityName());
|
||||
if (existFacility == null) {
|
||||
// 新增
|
||||
facility.setCreateTime(now);
|
||||
facility.setUpdateTime(now);
|
||||
facility.setStatus(calculateDynamicStatus(facility.getExpiryDate(), null));
|
||||
fireFacilityMapper.insertFireFacility(facility);
|
||||
successNum++;
|
||||
} else if (updateSupport) {
|
||||
// 更新已存在的数据
|
||||
facility.setId(existFacility.getId()); // 覆盖ID
|
||||
facility.setCreateTime(existFacility.getCreateTime()); // 保留创建时间
|
||||
facility.setUpdateTime(now); // 更新时间戳
|
||||
fireFacilityMapper.updateFireFacility(facility);
|
||||
successNum++;
|
||||
} else {
|
||||
// 不允许更新,视为失败
|
||||
failureNum++;
|
||||
failureMsg.append("<br/>" + failureNum + "、设施[" + facility.getFacilityName() + "]已存在");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
failureNum++;
|
||||
String facilityName = (facility.getFacilityName() != null) ? facility.getFacilityName() : "未知设施";
|
||||
failureMsg.append("<br/>" + failureNum + "、设施[" + facilityName + "]导入失败:" + e.getMessage());
|
||||
log.error("导入设施失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
// 组装结果
|
||||
if (failureNum > 0) {
|
||||
failureMsg.insert(0, "导入失败,共" + failureNum + "条数据异常:");
|
||||
throw new Exception(failureMsg.toString());
|
||||
} else {
|
||||
return "导入成功,共处理" + successNum + "条数据";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设施详情列表
|
||||
*/
|
||||
@Override
|
||||
public List<FireFacility> getDetails(FireFacility fireFacility) {
|
||||
return fireFacilityMapper.getDetails(fireFacility);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据位置和名称查询设施(用于导入时判断重复)
|
||||
*/
|
||||
@Override
|
||||
public FireFacility selectByLocationAndName(String locationId, String facilityName) {
|
||||
return fireFacilityMapper.selectByLocationAndName(locationId, facilityName);
|
||||
}
|
||||
}
|
||||
@@ -102,4 +102,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<!-- 根据位置ID和设施名称查询 -->
|
||||
<select id="selectByLocationAndName" resultMap="FireFacilityResult">
|
||||
<include refid="selectFireFacilityVo"/>
|
||||
where location_id = #{locationId} and facility_name = #{facilityName}
|
||||
</select>
|
||||
|
||||
|
||||
<!-- * 查询根据id查询设施列表-->
|
||||
|
||||
<select id="getDetails" resultMap="FireFacilityResult">
|
||||
<include refid="selectFireFacilityVo"/>
|
||||
<where>id = #{id} </where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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.fire.mapper.FireFacilityRepairMapper">
|
||||
|
||||
<resultMap type="FireFacilityRepair" id="FireFacilityRepairResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="facilityId" column="facility_id" />
|
||||
<result property="repairDate" column="repair_date" />
|
||||
<result property="repairContent" column="repair_content" />
|
||||
<result property="repairResult" column="repair_result" />
|
||||
<result property="replacePerson" column="replace_person" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="nextCheckDate" column="next_check_date" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFireFacilityRepairVo">
|
||||
select id, facility_id, repair_date, repair_content, repair_result, replace_person, remark, next_check_date, create_time from fire_facility_repair
|
||||
</sql>
|
||||
|
||||
<select id="selectFireFacilityRepairList" parameterType="FireFacilityRepair" resultMap="FireFacilityRepairResult">
|
||||
<include refid="selectFireFacilityRepairVo"/>
|
||||
<where>
|
||||
<if test="facilityId != null "> and facility_id = #{facilityId}</if>
|
||||
<if test="params.beginRepairDate != null and params.beginRepairDate != '' and params.endRepairDate != null and params.endRepairDate != ''"> and repair_date between #{params.beginRepairDate} and #{params.endRepairDate}</if>
|
||||
<if test="repairResult != null "> and repair_result = #{repairResult}</if>
|
||||
<if test="replacePerson != null and replacePerson != ''"> and replace_person = #{replacePerson}</if>
|
||||
<if test="params.beginNextCheckDate != null and params.beginNextCheckDate != '' and params.endNextCheckDate != null and params.endNextCheckDate != ''"> and next_check_date between #{params.beginNextCheckDate} and #{params.endNextCheckDate}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFireFacilityRepairById" parameterType="Long" resultMap="FireFacilityRepairResult">
|
||||
<include refid="selectFireFacilityRepairVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertFireFacilityRepair" parameterType="FireFacilityRepair" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fire_facility_repair
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="facilityId != null">facility_id,</if>
|
||||
<if test="repairDate != null">repair_date,</if>
|
||||
<if test="repairContent != null and repairContent != ''">repair_content,</if>
|
||||
<if test="repairResult != null">repair_result,</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">replace_person,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="nextCheckDate != null">next_check_date,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="facilityId != null">#{facilityId},</if>
|
||||
<if test="repairDate != null">#{repairDate},</if>
|
||||
<if test="repairContent != null and repairContent != ''">#{repairContent},</if>
|
||||
<if test="repairResult != null">#{repairResult},</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">#{replacePerson},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="nextCheckDate != null">#{nextCheckDate},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFireFacilityRepair" parameterType="FireFacilityRepair">
|
||||
update fire_facility_repair
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="facilityId != null">facility_id = #{facilityId},</if>
|
||||
<if test="repairDate != null">repair_date = #{repairDate},</if>
|
||||
<if test="repairContent != null and repairContent != ''">repair_content = #{repairContent},</if>
|
||||
<if test="repairResult != null">repair_result = #{repairResult},</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">replace_person = #{replacePerson},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="nextCheckDate != null">next_check_date = #{nextCheckDate},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFireFacilityRepairById" parameterType="Long">
|
||||
delete from fire_facility_repair where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFireFacilityRepairByIds" parameterType="String">
|
||||
delete from fire_facility_repair where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?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.fire.mapper.FireFacilityReplacementMapper">
|
||||
|
||||
<resultMap type="FireFacilityReplacement" id="FireFacilityReplacementResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="oldFacilityId" column="old_facility_id" />
|
||||
<result property="newFacilityId" column="new_facility_id" />
|
||||
<result property="replaceDate" column="replace_date" />
|
||||
<result property="replaceReason" column="replace_reason" />
|
||||
<result property="replacePerson" column="replace_person" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectFireFacilityReplacementVo">
|
||||
select id, old_facility_id, new_facility_id, replace_date, replace_reason, replace_person, remark, create_time from fire_facility_replacement
|
||||
</sql>
|
||||
|
||||
<select id="selectFireFacilityReplacementList" parameterType="FireFacilityReplacement" resultMap="FireFacilityReplacementResult">
|
||||
<include refid="selectFireFacilityReplacementVo"/>
|
||||
<where>
|
||||
<if test="oldFacilityId != null "> and old_facility_id = #{oldFacilityId}</if>
|
||||
<if test="newFacilityId != null "> and new_facility_id = #{newFacilityId}</if>
|
||||
<if test="params.beginReplaceDate != null and params.beginReplaceDate != '' and params.endReplaceDate != null and params.endReplaceDate != ''"> and replace_date between #{params.beginReplaceDate} and #{params.endReplaceDate}</if>
|
||||
<if test="replacePerson != null and replacePerson != ''"> and replace_person = #{replacePerson}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectFireFacilityReplacementById" parameterType="Long" resultMap="FireFacilityReplacementResult">
|
||||
<include refid="selectFireFacilityReplacementVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertFireFacilityReplacement" parameterType="FireFacilityReplacement" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into fire_facility_replacement
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="oldFacilityId != null">old_facility_id,</if>
|
||||
<if test="newFacilityId != null">new_facility_id,</if>
|
||||
<if test="replaceDate != null">replace_date,</if>
|
||||
<if test="replaceReason != null and replaceReason != ''">replace_reason,</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">replace_person,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="oldFacilityId != null">#{oldFacilityId},</if>
|
||||
<if test="newFacilityId != null">#{newFacilityId},</if>
|
||||
<if test="replaceDate != null">#{replaceDate},</if>
|
||||
<if test="replaceReason != null and replaceReason != ''">#{replaceReason},</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">#{replacePerson},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateFireFacilityReplacement" parameterType="FireFacilityReplacement">
|
||||
update fire_facility_replacement
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="oldFacilityId != null">old_facility_id = #{oldFacilityId},</if>
|
||||
<if test="newFacilityId != null">new_facility_id = #{newFacilityId},</if>
|
||||
<if test="replaceDate != null">replace_date = #{replaceDate},</if>
|
||||
<if test="replaceReason != null and replaceReason != ''">replace_reason = #{replaceReason},</if>
|
||||
<if test="replacePerson != null and replacePerson != ''">replace_person = #{replacePerson},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteFireFacilityReplacementById" parameterType="Long">
|
||||
delete from fire_facility_replacement where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFireFacilityReplacementByIds" parameterType="String">
|
||||
delete from fire_facility_replacement where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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.fire.mapper.FireFacilityReportMapper">
|
||||
|
||||
<select id="selectFireFacilityReportList" resultType="com.ruoyi.fire.domain.FireFacilityReport">
|
||||
SELECT
|
||||
id,
|
||||
location_id AS locationId,
|
||||
facility_name AS facilityName,
|
||||
facility_type AS facilityType,
|
||||
model_number AS modelNumber,
|
||||
quantity,
|
||||
entry_date AS entryDate,
|
||||
production_date AS productionDate,
|
||||
expiry_date AS expiryDate,
|
||||
status,
|
||||
remark,
|
||||
create_time AS createTime,
|
||||
update_time AS updateTime
|
||||
FROM fire_facilities
|
||||
<where>
|
||||
<!-- 支持设施类型为null(不筛选) -->
|
||||
<if test="facilityType != null and facilityType != ''">
|
||||
AND facility_type = #{facilityType}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<update id="batchUpdateStatus">
|
||||
UPDATE fire_facilities
|
||||
SET status = #{newStatus},
|
||||
update_time = NOW()
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user