初始化

This commit is contained in:
2025-07-28 14:58:32 +08:00
commit fca0460190
566 changed files with 67468 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
package com.ruoyi.inspection.controller;
import com.beust.ah.A;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.inspection.domain.VoAttendanceReport;
import com.ruoyi.inspection.service.IAttendanceReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
import static com.ruoyi.common.utils.PageUtils.startPage;
/**
* 可视化巡检记录Controller
*
* @author ruoyi
* @date 2024-10-15
*/
@RestController
@RequestMapping("/inspection/report")
public class AttendanceReportController extends BaseController {
@Autowired
private IAttendanceReportService attendanceReportService;
// 柱形图可视化统计
@GetMapping("/ColumnList")
public AjaxResult getEchartsData(VoAttendanceReport voAttendanceReport) {
try {
Map<String, Object> echartsData = attendanceReportService.getEchartsData(voAttendanceReport);
return AjaxResult.success("data",echartsData);
} catch (Exception e) {
return AjaxResult.error();
}
}
// 圆形图可视化统计
@GetMapping("/RoundList")
public AjaxResult getEchartsPieChartData(VoAttendanceReport voAttendanceReport) {
try {
Map<String, Object> echartsData = attendanceReportService.getEchartsPieChartData(voAttendanceReport);
return AjaxResult.success("data",echartsData);
} catch (Exception e) {
return AjaxResult.error();
}
}
// 总条数
@GetMapping("/total")
public AjaxResult getTotal(){
int total = attendanceReportService.tatol();
return AjaxResult.success("总条数",total);
}
// 本月总条数
@GetMapping("monthTotal")
public AjaxResult getmonthTotal(VoAttendanceReport voAttendanceReport){
int monthTotal = attendanceReportService.monthTota(voAttendanceReport);
return AjaxResult.success(monthTotal);
}
}

View File

@@ -0,0 +1,96 @@
package com.ruoyi.inspection.controller;
import java.util.List;
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.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.inspection.domain.InspectionManageTable;
import com.ruoyi.inspection.service.IInspectionManageTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
/**
* 巡检点管理Controller
*
* @author ruoyi
* @date 2024-08-29
*/
@RestController
@RequestMapping("/inspection/manage")
public class InspectionManageTableController extends BaseController {
@Autowired
private IInspectionManageTableService inspectionManageTableService;
/**
* 查询巡检点管理列表
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:list')")
@GetMapping("/list")
public TableDataInfo list(InspectionManageTable inspectionManageTable) {
startPage();
List<InspectionManageTable> list = inspectionManageTableService.selectInspectionManageTableList(inspectionManageTable);
return getDataTable(list);
}
/**
* 导出巡检点管理列表
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:export')")
@Log(title = "巡检点管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InspectionManageTable inspectionManageTable) {
List<InspectionManageTable> list = inspectionManageTableService.selectInspectionManageTableList(inspectionManageTable);
ExcelUtil<InspectionManageTable> util = new ExcelUtil<InspectionManageTable>(InspectionManageTable.class);
util.exportExcel(response, list, "巡检点管理数据");
}
/**
* 获取巡检点管理详细信息
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(inspectionManageTableService.selectInspectionManageTableById(id));
}
/**
* 新增巡检点管理
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:add')")
@Log(title = "巡检点管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InspectionManageTable inspectionManageTable) {
return toAjax(inspectionManageTableService.insertInspectionManageTable(inspectionManageTable));
}
/**
* 修改巡检点管理
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:edit')")
@Log(title = "巡检点管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InspectionManageTable inspectionManageTable) {
return toAjax(inspectionManageTableService.updateInspectionManageTable(inspectionManageTable));
}
/**
* 删除巡检点管理
*/
@PreAuthorize("@ss.hasPermi('inspection:manage:remove')")
@Log(title = "巡检点管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(inspectionManageTableService.deleteInspectionManageTableByIds(ids));
}
}

View File

@@ -0,0 +1,111 @@
package com.ruoyi.inspection.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.utils.QRCodeReader;
import com.ruoyi.inspection.domain.VoReturnInspectionRecordTable;
import com.ruoyi.inspection.domain.VoViewInspectionRecordTable;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
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.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.service.IInspectionRecordTableService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 巡检记录Controller
*
* @author ruoyi
* @date 2024-09-05
*/
@RestController
@RequestMapping("/inspection/record")
public class InspectionRecordTableController extends BaseController {
@Autowired
private IInspectionRecordTableService inspectionRecordTableService;
/**
* 查询巡检记录列表
*/
@PreAuthorize("@ss.hasPermi('inspection:record:list')")
@GetMapping("/list")
public TableDataInfo list(InspectionRecordTable inspectionRecordTable) {
startPage();
List<InspectionRecordTable> list = inspectionRecordTableService.selectInspectionRecordTableList(inspectionRecordTable);
return getDataTable(list);
}
/**
* 导出巡检记录列表
*/
@PreAuthorize("@ss.hasPermi('inspection:record:export')")
@Log(title = "巡检记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, InspectionRecordTable inspectionRecordTable) {
List<InspectionRecordTable> list = inspectionRecordTableService.selectInspectionRecordTableLists(inspectionRecordTable);
ExcelUtil<InspectionRecordTable> util = new ExcelUtil<InspectionRecordTable>(InspectionRecordTable.class);
util.exportExcel(response, list, "巡检记录数据");
}
/**
* 获取巡检记录详细信息
*/
@PreAuthorize("@ss.hasPermi('inspection:record:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(inspectionRecordTableService.selectInspectionRecordTableById(id));
}
/**
* 新增巡检记录
*/
@PreAuthorize("@ss.hasPermi('inspection:record:add')")
@Log(title = "巡检记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody InspectionRecordTable inspectionRecordTable) {
System.out.println("巡检记录数据");
System.out.println(inspectionRecordTable);
Date now = new Date(); // 获取当前时间
inspectionRecordTable.setInspectionTime(now);
return toAjax(inspectionRecordTableService.insertInspectionRecordTable(inspectionRecordTable));
}
/**
* 修改巡检记录
*/
@PreAuthorize("@ss.hasPermi('inspection:record:edit')")
@Log(title = "巡检记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody InspectionRecordTable inspectionRecordTable) {
return toAjax(inspectionRecordTableService.updateInspectionRecordTable(inspectionRecordTable));
}
/**
* 删除巡检记录
*/
@PreAuthorize("@ss.hasPermi('inspection:record:remove')")
@Log(title = "巡检记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(inspectionRecordTableService.deleteInspectionRecordTableByIds(ids));
}
/**
* 查询巡检记录列表
*/
@PreAuthorize("@ss.hasPermi('inspection:record:query')")
@GetMapping("/view")
public AjaxResult view(VoViewInspectionRecordTable voViewInspectionRecordTable) {
return success(inspectionRecordTableService.selectInspectionRecordView(voViewInspectionRecordTable));
}
}

View File

@@ -0,0 +1,106 @@
package com.ruoyi.inspection.domain;
import lombok.Data;
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;
/**
* 巡检点管理对象 inspection_manage_table
*
* @author ruoyi
* @date 2024-08-29
*/
public class InspectionManageTable extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 巡检点 */
@Excel(name = "巡检点")
private String inspectionPoint;
/** 巡检要求 */
@Excel(name = "巡检要求")
private String inspectionRequirements;
/** 巡检点状态 */
@Excel(name = "巡检点状态")
private String inspectionStatus;
private int inspectionCount;
public int getInspectionCount() {
return inspectionCount;
}
public void setInspectionCount(int inspectionCount) {
this.inspectionCount = inspectionCount;
}
/** 巡检二维码 */
private String inspectionQrCode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setInspectionPoint(String inspectionPoint)
{
this.inspectionPoint = inspectionPoint;
}
public String getInspectionPoint()
{
return inspectionPoint;
}
public void setInspectionRequirements(String inspectionRequirements)
{
this.inspectionRequirements = inspectionRequirements;
}
public String getInspectionRequirements()
{
return inspectionRequirements;
}
public void setInspectionStatus(String inspectionStatus)
{
this.inspectionStatus = inspectionStatus;
}
public String getInspectionStatus()
{
return inspectionStatus;
}
public void setInspectionQrCode(String inspectionQrCode)
{
this.inspectionQrCode = inspectionQrCode;
}
public String getInspectionQrCode()
{
return inspectionQrCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("inspectionPoint", getInspectionPoint())
.append("inspectionRequirements", getInspectionRequirements())
.append("inspectionStatus", getInspectionStatus())
.append("inspectionQrCode", getInspectionQrCode())
.toString();
}
}

View File

@@ -0,0 +1,76 @@
package com.ruoyi.inspection.domain;
import java.time.LocalDate;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
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 org.springframework.format.annotation.DateTimeFormat;
/**
* 巡检记录对象 inspection_record_table
*
* @author ruoyi
* @date 2024-09-05
*/
@Data
public class InspectionRecordTable extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 序号
*/
//@Excel(name = "序号")
private Long id;
/**
* 巡检点地址
*/
@Excel(name = "巡检点地址")
private String inspectionPoint;
/**
* 巡检点地址id
*/
//@Excel(name = "巡检点地址id")
private String inspectionPointId;
/**
* 巡检人
*/
@Excel(name = "巡检人")
private String inspectorId;
/**
* 巡检类型
*/
private Integer inspectionType;
@Excel(name = "巡检类型")
private String inspectionTypeName;
/**
* 巡检时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "巡检时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date inspectionTime;
/**
* 巡检图片
*/
//@Excel(name = "巡检图片")
private String inspectionImg;
/**
* 备注
*/
@Excel(name = "备注")
private String remark;
}

View File

@@ -0,0 +1,79 @@
package com.ruoyi.inspection.domain;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
@Data
public class VoAttendanceReport {
@Excel(name = "序号")
private Long id;
/**
* 巡检点地址
*/
@Excel(name = "巡检点地址")
private String inspectionPoint;
/**
* 巡检点地址id
*/
@Excel(name = "巡检点地址id")
private String inspectionPointId;
/**
* 巡检人
*/
@Excel(name = "巡检人")
private String inspectorId;
/**
* 开始时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始时间")
private LocalDate startTime;
/**
* 结束时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束时间")
private LocalDate endTime;
/**
* 本月一号
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "本月一号")
private String defaultStartTime;
/**
* 当前时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "当前时间")
private String defaultEndTime;
/**
* 地点巡检次数
*/
private int count;
/**
* 个人巡检次数
*/
private int userCount;
/**
* 本月巡检次数
*/
private int monthTotal;
/**
* 所有条数
*/
private int total;
}

View File

@@ -0,0 +1,44 @@
package com.ruoyi.inspection.domain;
import java.util.List;
public class VoReturnInspectionRecordTable {
private int clockIn;//打卡次数
private String clockState="已打卡";//打卡状态
private List<InspectionRecordTable> inspectionRecordTables;//巡检记录表
@Override
public String toString() {
return "VoReturnInspectionRecordTable{" +
"clockIn=" + clockIn +
", clockState='" + clockState + '\'' +
", inspectionRecordTables=" + inspectionRecordTables +
'}';
}
public String getClockState() {
return clockState;
}
public void setClockState(String clockState) {
this.clockState = clockState;
}
public int getClockIn() {
return clockIn;
}
public void setClockIn(int clockIn) {
this.clockIn = clockIn;
}
public List<InspectionRecordTable> getInspectionRecordTables() {
return inspectionRecordTables;
}
public void setInspectionRecordTables(List<InspectionRecordTable> inspectionRecordTables) {
this.inspectionRecordTables = inspectionRecordTables;
}
}

View File

@@ -0,0 +1,70 @@
package com.ruoyi.inspection.domain;
public class VoViewInspectionRecordTable {
//月份
private int month;
//巡检员
private String inspectorUser;
//周次
private int weekType;
//开始
private int startNum;
//结束
private int endNum;
@Override
public String toString() {
return "VoViewInspectionRecordTable{" +
"month=" + month +
", inspectorUser='" + inspectorUser + '\'' +
", weekType=" + weekType +
", startNum=" + startNum +
", endNum=" + endNum +
'}';
}
public int getMonth() {
return month;
}
public void setMonth(int month) {
this.month = month;
}
public String getInspectorUser() {
return inspectorUser;
}
public void setInspectorUser(String inspectorUser) {
this.inspectorUser = inspectorUser;
}
public int getWeekType() {
return weekType;
}
public void setWeekType(int weekType) {
this.weekType = weekType;
}
public int getStartNum() {
return startNum;
}
public void setStartNum(int startNum) {
this.startNum = startNum;
}
public int getEndNum() {
return endNum;
}
public void setEndNum(int endNum) {
this.endNum = endNum;
}
}

View File

@@ -0,0 +1,18 @@
package com.ruoyi.inspection.mapper;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoAttendanceReport;
import java.util.List;
public interface AttendanceReportMapper {
// 可视化巡检记录(柱形图)
List<VoAttendanceReport> ColumnVisualization(VoAttendanceReport voAttendanceReport );
List<VoAttendanceReport> RoundListVisualization(VoAttendanceReport voAttendanceReport);
int total();
List<VoAttendanceReport> monthTotal(VoAttendanceReport voAttendanceReport);
}

View File

@@ -0,0 +1,62 @@
package com.ruoyi.inspection.mapper;
import java.util.List;
import com.ruoyi.inspection.domain.InspectionManageTable;
/**
* 巡检点管理Mapper接口
*
* @author ruoyi
* @date 2024-08-29
*/
public interface InspectionManageTableMapper
{
/**
* 查询巡检点管理
*
* @param id 巡检点管理主键
* @return 巡检点管理
*/
public InspectionManageTable selectInspectionManageTableById(Long id);
/**
* 查询巡检点管理列表
*
* @param inspectionManageTable 巡检点管理
* @return 巡检点管理集合
*/
public List<InspectionManageTable> selectInspectionManageTableList(InspectionManageTable inspectionManageTable);
/**
* 新增巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
public int insertInspectionManageTable(InspectionManageTable inspectionManageTable);
/**
* 修改巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
public int updateInspectionManageTable(InspectionManageTable inspectionManageTable);
/**
* 删除巡检点管理
*
* @param id 巡检点管理主键
* @return 结果
*/
public int deleteInspectionManageTableById(Long id);
/**
* 批量删除巡检点管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInspectionManageTableByIds(Long[] ids);
}

View File

@@ -0,0 +1,71 @@
package com.ruoyi.inspection.mapper;
import java.util.List;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoViewInspectionRecordTable;
/**
* 巡检记录Mapper接口
*
* @author ruoyi
* @date 2024-09-05
*/
public interface InspectionRecordTableMapper
{
/**
* 查询巡检记录
*
* @param id 巡检记录主键
* @return 巡检记录
*/
public InspectionRecordTable selectInspectionRecordTableById(Long id);
/**
* 查询巡检记录列表
*
* @param inspectionRecordTable 巡检记录
* @return 巡检记录集合
*/
public List<InspectionRecordTable> selectInspectionRecordTableList(InspectionRecordTable inspectionRecordTable);
/**
* 新增巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
public int insertInspectionRecordTable(InspectionRecordTable inspectionRecordTable);
/**
* 修改巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
public int updateInspectionRecordTable(InspectionRecordTable inspectionRecordTable);
/**
* 删除巡检记录
*
* @param id 巡检记录主键
* @return 结果
*/
public int deleteInspectionRecordTableById(Long id);
/**
* 批量删除巡检记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteInspectionRecordTableByIds(Long[] ids);
// 查询巡检记录视图列表
public List<InspectionRecordTable>selectInspectionRecordViewList(VoViewInspectionRecordTable voViewInspectionRecordTable);
// 查询巡检记录视图数量
public int selectInspectionRecordViewCount(VoViewInspectionRecordTable voViewInspectionRecordTable);
}

View File

@@ -0,0 +1,21 @@
package com.ruoyi.inspection.service;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoAttendanceReport;
import java.util.List;
import java.util.Map;
public interface IAttendanceReportService {
// 可视化柱形图
public List<VoAttendanceReport> ColumnVisualization(VoAttendanceReport VoAttendanceReport );
List<VoAttendanceReport> RoundListVisualization(VoAttendanceReport voAttendanceReport);
Map<String, Object> getEchartsData(VoAttendanceReport voAttendanceReport);
Map<String, Object> getEchartsPieChartData(VoAttendanceReport voAttendanceReport);
int tatol();
int monthTota(VoAttendanceReport voAttendanceReport);
}

View File

@@ -0,0 +1,66 @@
package com.ruoyi.inspection.service;
import java.util.List;
import com.ruoyi.inspection.domain.InspectionManageTable;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoViewInspectionRecordTable;
/**
* 巡检点管理Service接口
*
* @author ruoyi
* @date 2024-08-29
*/
public interface IInspectionManageTableService
{
/**
* 查询巡检点管理
*
* @param id 巡检点管理主键
* @return 巡检点管理
*/
public InspectionManageTable selectInspectionManageTableById(Long id);
/**
* 查询巡检点管理列表
*
* @param inspectionManageTable 巡检点管理
* @return 巡检点管理集合
*/
public List<InspectionManageTable> selectInspectionManageTableList(InspectionManageTable inspectionManageTable);
/**
* 新增巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
public int insertInspectionManageTable(InspectionManageTable inspectionManageTable);
/**
* 修改巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
public int updateInspectionManageTable(InspectionManageTable inspectionManageTable);
/**
* 批量删除巡检点管理
*
* @param ids 需要删除的巡检点管理主键集合
* @return 结果
*/
public int deleteInspectionManageTableByIds(Long[] ids);
/**
* 删除巡检点管理信息
*
* @param id 巡检点管理主键
* @return 结果
*/
public int deleteInspectionManageTableById(Long id);
}

View File

@@ -0,0 +1,75 @@
package com.ruoyi.inspection.service;
import java.util.List;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoReturnInspectionRecordTable;
import com.ruoyi.inspection.domain.VoViewInspectionRecordTable;
/**
* 巡检记录Service接口
*
* @author ruoyi
* @date 2024-09-05
*/
public interface IInspectionRecordTableService
{
/**
* 查询巡检记录
*
* @param id 巡检记录主键
* @return 巡检记录
*/
public InspectionRecordTable selectInspectionRecordTableById(Long id);
/**
* 查询巡检记录列表
*
* @param inspectionRecordTable 巡检记录
* @return 巡检记录集合
*/
public List<InspectionRecordTable> selectInspectionRecordTableList(InspectionRecordTable inspectionRecordTable);
/**
* 新增巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
public int insertInspectionRecordTable(InspectionRecordTable inspectionRecordTable);
/**
* 修改巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
public int updateInspectionRecordTable(InspectionRecordTable inspectionRecordTable);
/**
* 批量删除巡检记录
*
* @param ids 需要删除的巡检记录主键集合
* @return 结果
*/
public int deleteInspectionRecordTableByIds(Long[] ids);
/**
* 删除巡检记录信息
*
* @param id 巡检记录主键
* @return 结果
*/
public int deleteInspectionRecordTableById(Long id);
// 查询巡检记录视图列表
public VoReturnInspectionRecordTable selectInspectionRecordView(VoViewInspectionRecordTable voViewInspectionRecordTable);
/**
* 查询巡检记录列表用于导出数据调整
*
* @param inspectionRecordTable 巡检记录
* @return 巡检记录
*/
public List<InspectionRecordTable> selectInspectionRecordTableLists(InspectionRecordTable inspectionRecordTable);
}

View File

@@ -0,0 +1,131 @@
package com.ruoyi.inspection.service.impl;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.domain.VoAttendanceReport;
import com.ruoyi.inspection.mapper.AttendanceReportMapper;
import com.ruoyi.inspection.service.IAttendanceReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class AttendanceReportService implements IAttendanceReportService {
@Autowired
private AttendanceReportMapper attendanceReportMapper;
// 可视化柱形统计图
@Override
public List<VoAttendanceReport> ColumnVisualization(VoAttendanceReport voAttendanceReport) {
// if (voAttendanceReport.getStartTime() == null || voAttendanceReport.getEndTime() == null){
// LocalDate now = LocalDate.now();
// LocalDate firstDayOfMonth = now.withDayOfMonth(1);
// LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
//
// voAttendanceReport.setDefaultStartTime(firstDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// voAttendanceReport.setDefaultEndTime(lastDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// }
return attendanceReportMapper.ColumnVisualization(voAttendanceReport);
}
/**
* 构造 ECharts 柱状图所需的数据格式
*
* @param voAttendanceReport 查询参数
* @return ECharts 数据格式
*/
public Map<String, Object> getEchartsData(VoAttendanceReport voAttendanceReport) {
List<VoAttendanceReport> list = ColumnVisualization(voAttendanceReport); // 获取柱状图数据列表
// 构建 柱形图 需要的数据格式
Map<String, Object> echartsData = new HashMap<>();
List<String> xAxisData = new ArrayList<>();
List<Integer> seriesData = new ArrayList<>();
int monthTotal = 0 ;
for (VoAttendanceReport report : list) {
xAxisData.add(report.getInspectionPoint());
seriesData.add(report.getCount());
monthTotal += report.getCount();
}
echartsData.put("xAxis", xAxisData);
echartsData.put("seriesData", seriesData);
echartsData.put("monthTotal", monthTotal);
return echartsData;
}
// 可视化圆形统计图
@Override
public List<VoAttendanceReport> RoundListVisualization(VoAttendanceReport voAttendanceReport) {
// if (voAttendanceReport.getStartTime() == null || voAttendanceReport.getEndTime() == null){
// LocalDate now = LocalDate.now();
// LocalDate firstDayOfMonth = now.withDayOfMonth(1);
// LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
//
// voAttendanceReport.setDefaultStartTime(firstDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// voAttendanceReport.setDefaultEndTime(lastDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// }
return attendanceReportMapper.RoundListVisualization(voAttendanceReport);
}
/**
* 构造 ECharts 饼图所需的数据格式
*
* @return ECharts 数据格式
*/
public Map<String, Object> getEchartsPieChartData(VoAttendanceReport voAttendanceReport) {
List<VoAttendanceReport> list = RoundListVisualization(voAttendanceReport); // 获取饼图数据列表
// 构建 圆形图 需要的数据格式
Map<String, Object> echartsData = new HashMap<>();
List<Map<String, Object>> seriesData = new ArrayList<>();
for (VoAttendanceReport data : list) {
Map<String, Object> item = new HashMap<>();
item.put("name", data.getInspectorId());
item.put("value", data.getUserCount());
seriesData.add(item);
}
echartsData.put("seriesData", seriesData);
return echartsData;
}
// 总条数
@Override
public int tatol() {
return attendanceReportMapper.total();
}
@Override
public int monthTota(VoAttendanceReport voAttendanceReport) {
if (voAttendanceReport.getStartTime() == null || voAttendanceReport.getEndTime() == null){
LocalDate now = LocalDate.now();
LocalDate firstDayOfMonth = now.withDayOfMonth(1);
LocalDate lastDayOfMonth = now.withDayOfMonth(now.lengthOfMonth());
voAttendanceReport.setDefaultStartTime(firstDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
voAttendanceReport.setDefaultEndTime(lastDayOfMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
}
int monthTotal = 0;
List<VoAttendanceReport> list = attendanceReportMapper.monthTotal(voAttendanceReport);
for (VoAttendanceReport T : list){
monthTotal += T.getCount();
}
return monthTotal+1;
}
}

View File

@@ -0,0 +1,107 @@
package com.ruoyi.inspection.service.impl;
import java.util.List;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.mapper.InspectionManageTableMapper;
import com.ruoyi.inspection.domain.InspectionManageTable;
import com.ruoyi.inspection.mapper.InspectionRecordTableMapper;
import com.ruoyi.inspection.service.IInspectionManageTableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 巡检点管理Service业务层处理
*
* @author ruoyi
* @date 2024-08-29
*/
@Service
public class InspectionManageTableServiceImpl implements IInspectionManageTableService
{
@Autowired
private InspectionManageTableMapper inspectionManageTableMapper;
@Autowired
private InspectionRecordTableMapper inspectionRecordTableMapper;
/**
* 查询巡检点管理
*
* @param id 巡检点管理主键
* @return 巡检点管理
*/
@Override
public InspectionManageTable selectInspectionManageTableById(Long id)
{
return inspectionManageTableMapper.selectInspectionManageTableById(id);
}
/**
* 查询巡检点管理列表
*
* @param inspectionManageTable 巡检点管理
* @return 巡检点管理
*/
@Override
public List<InspectionManageTable> selectInspectionManageTableList(InspectionManageTable inspectionManageTable)
{
List<InspectionManageTable> result=inspectionManageTableMapper.selectInspectionManageTableList(inspectionManageTable);
result.forEach(item ->{
InspectionRecordTable recordTable = new InspectionRecordTable();
List<InspectionRecordTable> recordTables = inspectionRecordTableMapper.selectInspectionRecordTableList(recordTable);
item.setInspectionCount(recordTables.size());
});
// inspectionCount
return result ;
}
/**
* 新增巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
@Override
public int insertInspectionManageTable(InspectionManageTable inspectionManageTable)
{
return inspectionManageTableMapper.insertInspectionManageTable(inspectionManageTable);
}
/**
* 修改巡检点管理
*
* @param inspectionManageTable 巡检点管理
* @return 结果
*/
@Override
public int updateInspectionManageTable(InspectionManageTable inspectionManageTable)
{
return inspectionManageTableMapper.updateInspectionManageTable(inspectionManageTable);
}
/**
* 批量删除巡检点管理
*
* @param ids 需要删除的巡检点管理主键
* @return 结果
*/
@Override
public int deleteInspectionManageTableByIds(Long[] ids)
{
return inspectionManageTableMapper.deleteInspectionManageTableByIds(ids);
}
/**
* 删除巡检点管理信息
*
* @param id 巡检点管理主键
* @return 结果
*/
@Override
public int deleteInspectionManageTableById(Long id)
{
return inspectionManageTableMapper.deleteInspectionManageTableById(id);
}
}

View File

@@ -0,0 +1,181 @@
package com.ruoyi.inspection.service.impl;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.inspection.domain.VoReturnInspectionRecordTable;
import com.ruoyi.inspection.domain.VoViewInspectionRecordTable;
import com.ruoyi.system.mapper.SysDictDataMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inspection.mapper.InspectionRecordTableMapper;
import com.ruoyi.inspection.domain.InspectionRecordTable;
import com.ruoyi.inspection.service.IInspectionRecordTableService;
/**
* 巡检记录Service业务层处理
*
* @author ruoyi
* @date 2024-09-05
*/
@Service
public class InspectionRecordTableServiceImpl implements IInspectionRecordTableService
{
@Autowired
private InspectionRecordTableMapper inspectionRecordTableMapper;
@Autowired
private InspectionManageTableServiceImpl inspectionManageTableService;
//巡检类型
@Autowired
private SysDictDataMapper sysDictDataMapper;
/**
* 查询巡检记录
*
* @param id 巡检记录主键
* @return 巡检记录
*/
@Override
public InspectionRecordTable selectInspectionRecordTableById(Long id)
{
return inspectionRecordTableMapper.selectInspectionRecordTableById(id);
}
/**
* 查询巡检记录列表
*
* @param inspectionRecordTable 巡检记录
* @return 巡检记录
*/
@Override
public List<InspectionRecordTable> selectInspectionRecordTableList(InspectionRecordTable inspectionRecordTable)
{
return inspectionRecordTableMapper.selectInspectionRecordTableList(inspectionRecordTable);
}
/**
* 新增巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
@Override
public int insertInspectionRecordTable(InspectionRecordTable inspectionRecordTable)
{
return inspectionRecordTableMapper.insertInspectionRecordTable(inspectionRecordTable);
}
/**
* 修改巡检记录
*
* @param inspectionRecordTable 巡检记录
* @return 结果
*/
@Override
public int updateInspectionRecordTable(InspectionRecordTable inspectionRecordTable)
{
return inspectionRecordTableMapper.updateInspectionRecordTable(inspectionRecordTable);
}
/**
* 批量删除巡检记录
*
* @param ids 需要删除的巡检记录主键
* @return 结果
*/
@Override
public int deleteInspectionRecordTableByIds(Long[] ids)
{
return inspectionRecordTableMapper.deleteInspectionRecordTableByIds(ids);
}
/**
* 删除巡检记录信息
*
* @param id 巡检记录主键
* @return 结果
*/
@Override
public int deleteInspectionRecordTableById(Long id)
{
return inspectionRecordTableMapper.deleteInspectionRecordTableById(id);
}
/**
* 查询巡检记录
*
* @param voViewInspectionRecordTable 巡检记录
* @return 巡检记录
*/
@Override
public VoReturnInspectionRecordTable selectInspectionRecordView(VoViewInspectionRecordTable voViewInspectionRecordTable) {
VoViewInspectionRecordTable voViewInspectionRecordTable1=handleWeekType(voViewInspectionRecordTable);
List<InspectionRecordTable> tables= inspectionRecordTableMapper.selectInspectionRecordViewList(voViewInspectionRecordTable1);
int count= inspectionRecordTableMapper.selectInspectionRecordViewCount(voViewInspectionRecordTable1);
VoReturnInspectionRecordTable voReturnInspectionRecordTable=new VoReturnInspectionRecordTable();
voReturnInspectionRecordTable.setInspectionRecordTables(tables);
voReturnInspectionRecordTable.setClockIn(count);
return voReturnInspectionRecordTable;
}
/**
* 处理周类型
* @param voViewInspectionRecordTable
* @return
*/
private VoViewInspectionRecordTable handleWeekType(VoViewInspectionRecordTable voViewInspectionRecordTable) {
VoViewInspectionRecordTable Table= new VoViewInspectionRecordTable();
switch (voViewInspectionRecordTable.getWeekType()) {
case 0:
Table.setStartNum(0);
Table.setEndNum(0);
break;
case 1:
Table.setStartNum(1);
Table.setEndNum(7);
break;
case 2:
Table.setStartNum(8);
Table.setEndNum(15);
break;
case 3:
Table.setStartNum(16);
Table.setEndNum(23);
break;
case 4:
Table.setStartNum(24);
Table.setEndNum(31);
break;
}
Table.setMonth(voViewInspectionRecordTable.getMonth());
Table.setInspectorUser(voViewInspectionRecordTable.getInspectorUser());
return Table;
}
/**
* 查询巡检记录列表用于导出数据调整
*
* @param inspectionRecordTable 巡检记录
* @return 巡检记录
*/
@Override
public List<InspectionRecordTable> selectInspectionRecordTableLists(InspectionRecordTable inspectionRecordTable)
{
List<SysDictData> dictList = sysDictDataMapper.selectDictData();
List<InspectionRecordTable> list = inspectionRecordTableMapper.selectInspectionRecordTableList(inspectionRecordTable);
//循环遍历list集合将集合中的inspectionType(类型为Integer)对应值与dictList集合中dictValue(类型为String)对应的值相比较如果相等就将dictList集合中dictLabel对应的值赋值给list集合中的inspectionTypeName
for (InspectionRecordTable inspectionRecordTable1 : list) {
for (SysDictData sysDictData : dictList) {
if (sysDictData.getDictValue().equals(inspectionRecordTable1.getInspectionType().toString())) {
inspectionRecordTable1.setInspectionTypeName(sysDictData.getDictLabel());
}
}
}
return list;
}
}

View File

@@ -0,0 +1,63 @@
<?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.inspection.mapper.AttendanceReportMapper">
<resultMap type="VoAttendanceReport" id="VoAttendanceReportResult">
<result property="inspectionPoint" column="inspection_point"/>
<result property="count" column="count"/>
<result property="inspectorId" column="inspector_id"/>
<result property="userCount" column="userCount"/>
</resultMap>
<!-- 可视化柱形图 -->
<select id="ColumnVisualization" parameterType="VoAttendanceReport" resultMap="VoAttendanceReportResult">
SELECT inspection_point,COUNT(*) AS count
FROM inspection_record_table
<where>
<if test="startTime != null and endTime != null">
AND inspection_time BETWEEN #{startTime} AND #{endTime}
</if>
<!-- <if test="startTime == null or endTime == null">-->
<!-- AND inspection_time BETWEEN #{defaultStartTime} AND #{defaultEndTime}-->
<!-- </if>-->
</where>
GROUP BY inspection_point
</select>
<select id="RoundListVisualization" parameterType="VoAttendanceReport" resultMap="VoAttendanceReportResult">
SELECT inspector_id,COUNT(*) AS userCount
FROM inspection_record_table
<where>
<if test="startTime != null and endTime != null">
AND inspection_time BETWEEN #{startTime} AND #{endTime}
</if>
<!-- <if test="startTime == null or endTime == null">-->
<!-- AND inspection_time BETWEEN #{defaultStartTime} AND #{defaultEndTime}-->
<!-- </if>-->
</where>
GROUP BY inspector_id
</select>
<select id="total" resultType="int">
SELECT COUNT(*) AS inspector_id
FROM inspection_record_table;
</select>
<select id="monthTotal" parameterType="VoAttendanceReport" resultMap="VoAttendanceReportResult">
SELECT inspection_point, COUNT(*) AS count
FROM inspection_record_table
<where>
<if test="startTime != null and endTime != null">
(inspection_time BETWEEN #{startTime} AND #{endTime})
</if>
<if test="startTime == null or endTime == null">
AND (inspection_time BETWEEN #{defaultStartTime} AND #{defaultEndTime})
</if>
</where>
GROUP BY inspection_point
</select>
</mapper>

View File

@@ -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.inspection.mapper.InspectionManageTableMapper">
<resultMap type="InspectionManageTable" id="InspectionManageTableResult">
<result property="id" column="id" />
<result property="inspectionPoint" column="Inspection_point" />
<result property="inspectionRequirements" column="Inspection_requirements" />
<result property="inspectionStatus" column="Inspection_status" />
<result property="inspectionQrCode" column="Inspection_qr_code" />
</resultMap>
<sql id="selectInspectionManageTableVo">
select id, Inspection_point, Inspection_requirements, Inspection_status, Inspection_qr_code from inspection_manage_table
</sql>
<select id="selectInspectionManageTableList" parameterType="InspectionManageTable" resultMap="InspectionManageTableResult">
<include refid="selectInspectionManageTableVo"/>
<where>
<if test="inspectionPoint != null and inspectionPoint != ''"> and Inspection_point = #{inspectionPoint}</if>
</where>
</select>
<select id="selectInspectionManageTableById" parameterType="Long" resultMap="InspectionManageTableResult">
<include refid="selectInspectionManageTableVo"/>
where id = #{id}
</select>
<insert id="insertInspectionManageTable" parameterType="InspectionManageTable">
insert into inspection_manage_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="inspectionPoint != null and inspectionPoint != ''">Inspection_point,</if>
<if test="inspectionRequirements != null and inspectionRequirements != ''">Inspection_requirements,</if>
<if test="inspectionStatus != null and inspectionStatus != ''">Inspection_status,</if>
<if test="inspectionQrCode != null">Inspection_qr_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="inspectionPoint != null and inspectionPoint != ''">#{inspectionPoint},</if>
<if test="inspectionRequirements != null and inspectionRequirements != ''">#{inspectionRequirements},</if>
<if test="inspectionStatus != null and inspectionStatus != ''">#{inspectionStatus},</if>
<if test="inspectionQrCode != null">#{inspectionQrCode},</if>
</trim>
</insert>
<update id="updateInspectionManageTable" parameterType="InspectionManageTable">
update inspection_manage_table
<trim prefix="SET" suffixOverrides=",">
<if test="inspectionPoint != null and inspectionPoint != ''">Inspection_point = #{inspectionPoint},</if>
<if test="inspectionRequirements != null and inspectionRequirements != ''">Inspection_requirements = #{inspectionRequirements},</if>
<if test="inspectionStatus != null and inspectionStatus != ''">Inspection_status = #{inspectionStatus},</if>
<if test="inspectionQrCode != null">Inspection_qr_code = #{inspectionQrCode},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInspectionManageTableById" parameterType="Long">
delete from inspection_manage_table where id = #{id}
</delete>
<delete id="deleteInspectionManageTableByIds" parameterType="String">
delete from inspection_manage_table where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 可视化柱形图-->
<select id="ColumnVisualization" parameterType="InspectionManageTable" resultMap="InspectionManageTableResult">
SELECT * FROM inspection_record_table
<where>
<if test="startTime != null and endTime != null">
inspection_time BETWEEN #{startTime} AND #{endTime}
</if>
<if test="startTime == null or endTime == null">
inspection_time BETWEEN #{defaultStartTime} AND #{defaultEndTime}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,107 @@
<?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.inspection.mapper.InspectionRecordTableMapper">
<resultMap type="InspectionRecordTable" id="InspectionRecordTableResult">
<result property="id" column="id" />
<result property="inspectionPoint" column="inspection_point" />
<result property="inspectionPointId" column="inspection_point_id" />
<result property="inspectorId" column="inspector_id" />
<result property="inspectionType" column="inspection_type" />
<result property="inspectionTime" column="inspection_time" />
<result property="inspectionImg" column="inspection_img" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectInspectionRecordTableVo">
select id, inspection_point, inspector_id, inspection_point_id,inspection_type, inspection_time, inspection_img,remark from inspection_record_table
</sql>
<select id="selectInspectionRecordTableList" parameterType="InspectionRecordTable" resultMap="InspectionRecordTableResult">
<include refid="selectInspectionRecordTableVo"/>
<where>
<if test="inspectionPoint != null and inspectionPoint != ''"> and inspection_point = #{inspectionPoint}</if>
<if test="inspectorId != null "> and inspector_id = #{inspectorId}</if>
<if test="params.beginInspectionTime != null and params.beginInspectionTime != '' and params.endInspectionTime != null and params.endInspectionTime != ''"> and inspection_time between #{params.beginInspectionTime} and #{params.endInspectionTime}</if>
</where>
order by inspection_time desc
</select>
<select id="selectInspectionRecordTableById" parameterType="Long" resultMap="InspectionRecordTableResult">
<include refid="selectInspectionRecordTableVo"/>
where id = #{id}
</select>
<insert id="insertInspectionRecordTable" parameterType="InspectionRecordTable">
insert into inspection_record_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="inspectionPoint != null and inspectionPoint != ''">inspection_point,</if>
<if test="inspectionPointId != null and inspectionPointId != ''">inspection_point_id,</if>
<if test="inspectorId != null">inspector_id,</if>
<if test="inspectionType != null">inspection_type,</if>
<if test="inspectionTime != null">inspection_time,</if>
<if test="inspectionImg != null and inspectionImg != ''">inspection_img,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="inspectionPoint != null and inspectionPoint != ''">#{inspectionPoint},</if>
<if test="inspectionPointId != null and inspectionPointId != ''">#{inspectionPointId},</if>
<if test="inspectorId != null">#{inspectorId},</if>
<if test="inspectionType != null">#{inspectionType},</if>
<if test="inspectionTime != null">#{inspectionTime},</if>
<if test="inspectionImg != null and inspectionImg != ''">#{inspectionImg},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateInspectionRecordTable" parameterType="InspectionRecordTable">
update inspection_record_table
<trim prefix="SET" suffixOverrides=",">
<if test="inspectionPoint != null and inspectionPoint != ''">inspection_point = #{inspectionPoint},</if>
<if test="inspectionPointId != null and inspectionPointId != ''">inspection_point_id = #{inspectionPointId},</if>
<if test="inspectorId != null">inspector_id = #{inspectorId},</if>
<if test="inspectionType != null and inspectionType != ''">inspection_type = #{inspectionType},</if>
<if test="inspectionTime != null">inspection_time = #{inspectionTime},</if>
<if test="inspectionImg != null and inspectionImg != ''">inspection_img = #{inspectionImg},</if>
<if test="remark != null and remark != ''">remark=#{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteInspectionRecordTableById" parameterType="Long">
delete from inspection_record_table where id = #{id}
</delete>
<delete id="deleteInspectionRecordTableByIds" parameterType="String">
delete from inspection_record_table where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectInspectionRecordViewList" parameterType="VoViewInspectionRecordTable" resultMap="InspectionRecordTableResult">
SELECT *
FROM inspection_record_table
<where>
YEAR(inspection_time) = YEAR(CURDATE()) -- 确保是今年的数据
AND MONTH(inspection_time) = #{month} -- 确保是当前月份的数据
<if test="startNum != 0 and endNum != 0">AND DAY(inspection_time) BETWEEN #{startNum} AND #{endNum} -- 筛选这个月的第一天到第七天的数据</if>
AND inspector_id=#{inspectorUser}
</where>
ORDER BY inspection_time DESC -- 添加升序排序
</select>
<select id="selectInspectionRecordViewCount" parameterType="VoViewInspectionRecordTable" resultType="int">
SELECT COUNT(*) AS total_records
FROM inspection_record_table
WHERE YEAR(inspection_time) = YEAR(CURDATE())
AND MONTH(inspection_time) = #{month}
AND inspector_id=#{inspectorUser}
</select>
</mapper>