初始化
This commit is contained in:
38
pasd-SafetyDeclaration/.gitignore
vendored
Normal file
38
pasd-SafetyDeclaration/.gitignore
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
28
pasd-SafetyDeclaration/pom.xml
Normal file
28
pasd-SafetyDeclaration/pom.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>3.8.8</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pasd-SafetyDeclaration</artifactId>
|
||||
|
||||
<description>
|
||||
system系统模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.SafetyDeclaration.controller.sidebarApp;
|
||||
|
||||
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.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.service.ISafetyDeclarationTableService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sidebarApp/safetyDeclaration")
|
||||
public class SafetyDeclarationAppController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISafetyDeclarationTableService safetyDeclarationTableService;
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
startPage();
|
||||
List<SafetyDeclarationTable> list = safetyDeclarationTableService.selectSafetyDeclarationTableList(safetyDeclarationTable);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出水电校园安全不良事件
|
||||
列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:export')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
List<SafetyDeclarationTable> list = safetyDeclarationTableService.selectSafetyDeclarationTableList(safetyDeclarationTable);
|
||||
ExcelUtil<SafetyDeclarationTable> util = new ExcelUtil<SafetyDeclarationTable>(SafetyDeclarationTable.class);
|
||||
util.exportExcel(response, list, "水电校园安全不良事件 数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取水电校园安全不良事件
|
||||
详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(safetyDeclarationTableService.selectSafetyDeclarationTableById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增水电校园安全不良事件
|
||||
|
||||
*/
|
||||
//@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:add')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.insertSafetyDeclarationTable(safetyDeclarationTable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:edit')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.updateSafetyDeclarationTable(safetyDeclarationTable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:remove')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.deleteSafetyDeclarationTableByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.SafetyDeclaration.controller.sidebarPc;
|
||||
|
||||
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.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.service.ISafetyDeclarationTableService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sidebarPc/safetyDeclaration")
|
||||
public class SafetyDeclarationPcController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISafetyDeclarationTableService safetyDeclarationTableService;
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
startPage();
|
||||
List<SafetyDeclarationTable> list = safetyDeclarationTableService.selectSafetyDeclarationTableList(safetyDeclarationTable);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出水电校园安全不良事件
|
||||
列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:export')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
List<SafetyDeclarationTable> list = safetyDeclarationTableService.selectSafetyDeclarationTableList(safetyDeclarationTable);
|
||||
ExcelUtil<SafetyDeclarationTable> util = new ExcelUtil<SafetyDeclarationTable>(SafetyDeclarationTable.class);
|
||||
util.exportExcel(response, list, "水电校园安全不良事件 数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取水电校园安全不良事件
|
||||
详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(safetyDeclarationTableService.selectSafetyDeclarationTableById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:add')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.insertSafetyDeclarationTable(safetyDeclarationTable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:edit')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.updateSafetyDeclarationTable(safetyDeclarationTable));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('sidebar:safetyDeclaration:remove')")
|
||||
@Log(title = "水电校园安全不良事件 ", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(safetyDeclarationTableService.deleteSafetyDeclarationTableByIds(ids));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.ruoyi.SafetyDeclaration.controller.sidebarPc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.SafetyDeclaration.domain.BeCurrentTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.VoCircularDiagram;
|
||||
import com.ruoyi.SafetyDeclaration.domain.VoHistogramTable;
|
||||
import com.ruoyi.SafetyDeclaration.service.IVisualizationService;
|
||||
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.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 水电校园安全数据可视化
|
||||
Controller
|
||||
*
|
||||
* @date 2024-08-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/sidebar/Visualization")
|
||||
public class VisualizationController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IVisualizationService iVisualizationService;
|
||||
|
||||
/*
|
||||
* 柱状图数据
|
||||
* */
|
||||
@GetMapping("/histogram")
|
||||
public AjaxResult histogram()
|
||||
{
|
||||
List<VoHistogramTable> list=new ArrayList<>();
|
||||
List<BeCurrentTable> tables = iVisualizationService.selectHistogram();
|
||||
|
||||
// 使用Map按name进行分组
|
||||
Map<String, VoHistogramTable> seriesMap = new HashMap<>();
|
||||
for (BeCurrentTable item : tables) {
|
||||
VoHistogramTable series = seriesMap.computeIfAbsent(item.getName(), k -> new VoHistogramTable(k));
|
||||
series.addData(item.getValue());
|
||||
}
|
||||
// 将Map转换为List<ChartSeries>
|
||||
List<VoHistogramTable> chartSeriesList = new ArrayList<>(seriesMap.values());
|
||||
return AjaxResult.success(chartSeriesList);
|
||||
}
|
||||
|
||||
/*折线图*/
|
||||
@GetMapping("/lineChart")
|
||||
public AjaxResult lineChart()
|
||||
{
|
||||
List<Double> list=new ArrayList<>();
|
||||
List<BeCurrentTable> tables = iVisualizationService.selectLineChart();
|
||||
for (BeCurrentTable item : tables) {
|
||||
list.add((double)item.getValue());
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/*圆环图*/
|
||||
@GetMapping("/circularDiagram")
|
||||
public AjaxResult circularDiagram(SafetyDeclarationTable table)
|
||||
{
|
||||
VoCircularDiagram tables = iVisualizationService.SelectCircularDiagram(table);
|
||||
return AjaxResult.success(tables);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.ruoyi.SafetyDeclaration.domain;
|
||||
|
||||
/**
|
||||
* 通用返回表
|
||||
* */
|
||||
|
||||
public class BeCurrentTable {
|
||||
private String name;// 名称
|
||||
|
||||
private int value;// 数值
|
||||
|
||||
private String month;// 月份
|
||||
|
||||
private String declarationType;// 声明类型
|
||||
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getMonth() {
|
||||
return month;
|
||||
}
|
||||
|
||||
public void setMonth(String month) {
|
||||
this.month = month;
|
||||
}
|
||||
|
||||
public String getDeclarationType() {
|
||||
return declarationType;
|
||||
}
|
||||
|
||||
public void setDeclarationType(String declarationType) {
|
||||
this.declarationType = declarationType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "HistogramTable{" +
|
||||
"name='" + name + '\'' +
|
||||
", value=" + value +
|
||||
", month='" + month + '\'' +
|
||||
", declarationType='" + declarationType + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package com.ruoyi.SafetyDeclaration.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;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
对象 safety_declaration_table
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
public class SafetyDeclarationTable extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 申报类别 */
|
||||
@Excel(name = "申报类别")
|
||||
private String declarationType;
|
||||
|
||||
/** 巡检要求 */
|
||||
@Excel(name = "巡检要求")
|
||||
private String requirementDescription;
|
||||
|
||||
/** 申报图片 */
|
||||
@Excel(name = "申报图片")
|
||||
private String declarationImg;
|
||||
|
||||
/** 申请人 */
|
||||
private String applyUser;
|
||||
|
||||
/** 发生时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "发生时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date occurTime;
|
||||
|
||||
/** 解决人员 */
|
||||
private String solveUser;
|
||||
|
||||
/** 解决时间 */
|
||||
private Date solveTime;
|
||||
|
||||
/** 当前状态 */
|
||||
@Excel(name = "当前状态")
|
||||
private String currentState;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setDeclarationType(String declarationType)
|
||||
{
|
||||
this.declarationType = declarationType;
|
||||
}
|
||||
|
||||
public String getDeclarationType()
|
||||
{
|
||||
return declarationType;
|
||||
}
|
||||
public void setRequirementDescription(String requirementDescription)
|
||||
{
|
||||
this.requirementDescription = requirementDescription;
|
||||
}
|
||||
|
||||
public String getRequirementDescription()
|
||||
{
|
||||
return requirementDescription;
|
||||
}
|
||||
public void setDeclarationImg(String declarationImg)
|
||||
{
|
||||
this.declarationImg = declarationImg;
|
||||
}
|
||||
|
||||
public String getDeclarationImg()
|
||||
{
|
||||
return declarationImg;
|
||||
}
|
||||
public void setApplyUser(String applyUser)
|
||||
{
|
||||
this.applyUser = applyUser;
|
||||
}
|
||||
|
||||
public String getApplyUser()
|
||||
{
|
||||
return applyUser;
|
||||
}
|
||||
public void setOccurTime(Date occurTime)
|
||||
{
|
||||
this.occurTime = occurTime;
|
||||
}
|
||||
|
||||
public Date getOccurTime()
|
||||
{
|
||||
return occurTime;
|
||||
}
|
||||
public void setSolveUser(String solveUser)
|
||||
{
|
||||
this.solveUser = solveUser;
|
||||
}
|
||||
|
||||
public String getSolveUser()
|
||||
{
|
||||
return solveUser;
|
||||
}
|
||||
public void setSolveTime(Date solveTime)
|
||||
{
|
||||
this.solveTime = solveTime;
|
||||
}
|
||||
|
||||
public Date getSolveTime()
|
||||
{
|
||||
return solveTime;
|
||||
}
|
||||
public void setCurrentState(String currentState)
|
||||
{
|
||||
this.currentState = currentState;
|
||||
}
|
||||
|
||||
public String getCurrentState()
|
||||
{
|
||||
return currentState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("declarationType", getDeclarationType())
|
||||
.append("requirementDescription", getRequirementDescription())
|
||||
.append("declarationImg", getDeclarationImg())
|
||||
.append("applyUser", getApplyUser())
|
||||
.append("occurTime", getOccurTime())
|
||||
.append("solveUser", getSolveUser())
|
||||
.append("solveTime", getSolveTime())
|
||||
.append("currentState", getCurrentState())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.SafetyDeclaration.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VoCircularDiagram {
|
||||
|
||||
List<BeCurrentTable> beCurrentTableList;
|
||||
private Integer total;
|
||||
private Integer monthTotal;
|
||||
|
||||
public VoCircularDiagram(){
|
||||
this.beCurrentTableList=new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addBeCurrentTableList(BeCurrentTable beCurrentTable){
|
||||
this.beCurrentTableList.add(beCurrentTable);
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VoCircularDiagram{" +
|
||||
"beCurrentTableList=" + beCurrentTableList +
|
||||
", total=" + total +
|
||||
", monthTotal=" + monthTotal +
|
||||
'}';
|
||||
}
|
||||
|
||||
public List<BeCurrentTable> getBeCurrentTableList() {
|
||||
return beCurrentTableList;
|
||||
}
|
||||
|
||||
public void setBeCurrentTableList(List<BeCurrentTable> beCurrentTableList) {
|
||||
this.beCurrentTableList = beCurrentTableList;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(Integer total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public Integer getMonthTotal() {
|
||||
return monthTotal;
|
||||
}
|
||||
|
||||
public void setMonthTotal(Integer monthTotal) {
|
||||
this.monthTotal = monthTotal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.SafetyDeclaration.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VoHistogramTable {
|
||||
private String name;
|
||||
private String type="bar";
|
||||
private List<Double> data;
|
||||
|
||||
public VoHistogramTable(String name) {
|
||||
this.name = name;
|
||||
this.data = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addData(int value) {
|
||||
this.data.add((double) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VoHistogramTable{" +
|
||||
"name='" + name + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<Double> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<Double> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.ruoyi.SafetyDeclaration.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class VoLineChartTable {
|
||||
|
||||
private String name;
|
||||
private List<Double> data;
|
||||
|
||||
public VoLineChartTable() {
|
||||
this.data = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addData(int value){
|
||||
this.data.add((double) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VoLineChart{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
|
||||
public List<Double> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<Double> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.ruoyi.SafetyDeclaration.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
public interface SafetyDeclarationTableMapper
|
||||
{
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param id 水电校园安全不良事件
|
||||
主键
|
||||
* @return 水电校园安全不良事件
|
||||
|
||||
*/
|
||||
public SafetyDeclarationTable selectSafetyDeclarationTableById(Long id);
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
列表
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 水电校园安全不良事件
|
||||
集合
|
||||
*/
|
||||
public List<SafetyDeclarationTable> selectSafetyDeclarationTableList(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 新增水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 修改水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 删除水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param id 水电校园安全不良事件
|
||||
主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSafetyDeclarationTableById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSafetyDeclarationTableByIds(Long[] ids);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ruoyi.SafetyDeclaration.mapper;
|
||||
|
||||
import com.ruoyi.SafetyDeclaration.domain.BeCurrentTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VisualizationMapper
|
||||
{
|
||||
////柱状图
|
||||
List<BeCurrentTable> selectHistogram();
|
||||
|
||||
////折线图
|
||||
List<BeCurrentTable> selectLineChart();
|
||||
////圆环图
|
||||
List<BeCurrentTable> SelectCircularDiagram(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
int selectTotal();
|
||||
|
||||
int selectMonthTotal(SafetyDeclarationTable safetyDeclarationTable);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.ruoyi.SafetyDeclaration.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
public interface ISafetyDeclarationTableService
|
||||
{
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param id 水电校园安全不良事件
|
||||
主键
|
||||
* @return 水电校园安全不良事件
|
||||
|
||||
*/
|
||||
public SafetyDeclarationTable selectSafetyDeclarationTableById(Long id);
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
列表
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 水电校园安全不良事件
|
||||
集合
|
||||
*/
|
||||
public List<SafetyDeclarationTable> selectSafetyDeclarationTableList(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 新增水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 修改水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
/**
|
||||
* 批量删除水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param ids 需要删除的水电校园安全不良事件
|
||||
主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSafetyDeclarationTableByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除水电校园安全不良事件
|
||||
信息
|
||||
*
|
||||
* @param id 水电校园安全不良事件
|
||||
主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSafetyDeclarationTableById(Long id);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.SafetyDeclaration.service;
|
||||
|
||||
import com.ruoyi.SafetyDeclaration.domain.BeCurrentTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.VoCircularDiagram;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IVisualizationService {
|
||||
List<BeCurrentTable> selectHistogram();
|
||||
|
||||
List<BeCurrentTable> selectLineChart();
|
||||
|
||||
VoCircularDiagram SelectCircularDiagram(SafetyDeclarationTable safetyDeclarationTable);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.ruoyi.SafetyDeclaration.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.SafetyDeclaration.mapper.SafetyDeclarationTableMapper;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.service.ISafetyDeclarationTableService;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
|
||||
/**
|
||||
* 水电校园安全不良事件
|
||||
Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-08-04
|
||||
*/
|
||||
@Service
|
||||
public class SafetyDeclarationTableServiceImpl implements ISafetyDeclarationTableService
|
||||
{
|
||||
@Autowired
|
||||
private SafetyDeclarationTableMapper safetyDeclarationTableMapper;
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param id 水电校园安全不良事件主键
|
||||
* @return 水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@Override
|
||||
public SafetyDeclarationTable selectSafetyDeclarationTableById(Long id)
|
||||
{
|
||||
return safetyDeclarationTableMapper.selectSafetyDeclarationTableById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询水电校园安全不良事件
|
||||
列表
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 水电校园安全不良事件
|
||||
|
||||
*/
|
||||
@Override
|
||||
public List<SafetyDeclarationTable> selectSafetyDeclarationTableList(SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return safetyDeclarationTableMapper.selectSafetyDeclarationTableList(safetyDeclarationTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
safetyDeclarationTable.setCurrentState("0");
|
||||
//获取当前系统时间
|
||||
safetyDeclarationTable.setOccurTime(DateUtils.getNowDate());
|
||||
return safetyDeclarationTableMapper.insertSafetyDeclarationTable(safetyDeclarationTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param safetyDeclarationTable 水电校园安全不良事件
|
||||
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSafetyDeclarationTable(SafetyDeclarationTable safetyDeclarationTable)
|
||||
{
|
||||
return safetyDeclarationTableMapper.updateSafetyDeclarationTable(safetyDeclarationTable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除水电校园安全不良事件
|
||||
|
||||
*
|
||||
* @param ids 需要删除的水电校园安全不良事件
|
||||
主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSafetyDeclarationTableByIds(Long[] ids)
|
||||
{
|
||||
return safetyDeclarationTableMapper.deleteSafetyDeclarationTableByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除水电校园安全不良事件
|
||||
信息
|
||||
*
|
||||
* @param id 水电校园安全不良事件
|
||||
主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSafetyDeclarationTableById(Long id)
|
||||
{
|
||||
return safetyDeclarationTableMapper.deleteSafetyDeclarationTableById(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.ruoyi.SafetyDeclaration.service.impl;
|
||||
|
||||
import com.ruoyi.SafetyDeclaration.domain.BeCurrentTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.SafetyDeclarationTable;
|
||||
import com.ruoyi.SafetyDeclaration.domain.VoCircularDiagram;
|
||||
import com.ruoyi.SafetyDeclaration.mapper.VisualizationMapper;
|
||||
import com.ruoyi.SafetyDeclaration.service.IVisualizationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class VisualizationServiceImpl implements IVisualizationService {
|
||||
|
||||
@Autowired
|
||||
private VisualizationMapper visualizationMapper;
|
||||
|
||||
@Override
|
||||
public List<BeCurrentTable> selectHistogram() {
|
||||
return visualizationMapper.selectHistogram();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BeCurrentTable> selectLineChart() {
|
||||
return visualizationMapper.selectLineChart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoCircularDiagram SelectCircularDiagram(SafetyDeclarationTable safetyDeclarationTable) {
|
||||
// 创建一个 VoCircularDiagram 对象,用于存储查询结果
|
||||
VoCircularDiagram voCircularDiagram = new VoCircularDiagram();
|
||||
|
||||
// 调用 visualizationMapper 的 SelectCircularDiagram 方法,传入 safetyDeclarationTable 对象,返回一个 List<BeCurrentTable> 类型的列表
|
||||
List<BeCurrentTable> list = visualizationMapper.SelectCircularDiagram(safetyDeclarationTable);
|
||||
|
||||
// 调用 visualizationMapper 的 selectTotal 方法,返回一个表示总数的整数
|
||||
int total = visualizationMapper.selectTotal();
|
||||
|
||||
// 调用 visualizationMapper 的 selectMonthTotal 方法,传入 safetyDeclarationTable 对象,返回一个表示月度总数的整数
|
||||
int monthTotal = visualizationMapper.selectMonthTotal(safetyDeclarationTable);
|
||||
|
||||
// 遍历查询结果列表,将每个 BeCurrentTable 对象添加到 voCircularDiagram 的列表中
|
||||
list.forEach(item -> {
|
||||
voCircularDiagram.addBeCurrentTableList(item);
|
||||
});
|
||||
|
||||
// 设置 voCircularDiagram 的 total 属性
|
||||
voCircularDiagram.setTotal(total);
|
||||
|
||||
// 设置 voCircularDiagram 的 monthTotal 属性
|
||||
voCircularDiagram.setMonthTotal(monthTotal);
|
||||
|
||||
// 返回构建好的 VoCircularDiagram 对象
|
||||
return voCircularDiagram;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?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.SafetyDeclaration.mapper.SafetyDeclarationTableMapper">
|
||||
|
||||
<resultMap type="SafetyDeclarationTable" id="SafetyDeclarationTableResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="declarationType" column="declaration_type" />
|
||||
<result property="requirementDescription" column="requirement_description" />
|
||||
<result property="declarationImg" column="declaration_img" />
|
||||
<result property="applyUser" column="apply_user" />
|
||||
<result property="occurTime" column="occur_time" />
|
||||
<result property="solveTime" column="solve_time" />
|
||||
<result property="currentState" column="current_state" />
|
||||
<result property="remark" column="remark" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectSafetyDeclarationTableVo">
|
||||
select id, declaration_type, requirement_description, declaration_img, apply_user, occur_time, solve_time, current_state, remark from safety_declaration_table
|
||||
</sql>
|
||||
|
||||
<select id="selectSafetyDeclarationTableList" parameterType="SafetyDeclarationTable" resultMap="SafetyDeclarationTableResult">
|
||||
<include refid="selectSafetyDeclarationTableVo"/>
|
||||
<where>
|
||||
<if test="declarationType != null and declarationType != ''"> and declaration_type = #{declarationType}</if>
|
||||
<if test="params.beginOccurTime != null and params.beginOccurTime != '' and params.endOccurTime != null and params.endOccurTime != ''"> and occur_time between #{params.beginOccurTime} and #{params.endOccurTime}</if>
|
||||
</where>
|
||||
ORDER BY occur_time desc -- 添加升序排序
|
||||
</select>
|
||||
|
||||
<select id="selectSafetyDeclarationTableById" parameterType="Long" resultMap="SafetyDeclarationTableResult">
|
||||
<include refid="selectSafetyDeclarationTableVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSafetyDeclarationTable" parameterType="SafetyDeclarationTable" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into safety_declaration_table
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="declarationType != null">declaration_type,</if>
|
||||
<if test="requirementDescription != null">requirement_description,</if>
|
||||
<if test="declarationImg != null">declaration_img,</if>
|
||||
<if test="applyUser != null">apply_user,</if>
|
||||
<if test="occurTime != null">occur_time,</if>
|
||||
<if test="solveTime != null">solve_time,</if>
|
||||
<if test="currentState != null and currentState != ''">current_state,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="declarationType != null">#{declarationType},</if>
|
||||
<if test="requirementDescription != null">#{requirementDescription},</if>
|
||||
<if test="declarationImg != null">#{declarationImg},</if>
|
||||
<if test="applyUser != null">#{applyUser},</if>
|
||||
<if test="occurTime != null">#{occurTime},</if>
|
||||
<if test="solveUser != null">#{solveUser},</if>
|
||||
<if test="solveTime != null">#{solveTime},</if>
|
||||
<if test="currentState != null and currentState != ''">#{currentState},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSafetyDeclarationTable" parameterType="SafetyDeclarationTable">
|
||||
update safety_declaration_table
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="declarationType != null">declaration_type = #{declarationType},</if>
|
||||
<if test="requirementDescription != null">requirement_description = #{requirementDescription},</if>
|
||||
<if test="declarationImg != null">declaration_img = #{declarationImg},</if>
|
||||
<if test="applyUser != null">apply_user = #{applyUser},</if>
|
||||
<if test="occurTime != null">occur_time = #{occurTime},</if>
|
||||
<if test="solveTime != null">solve_time = #{solveTime},</if>
|
||||
<if test="currentState != null and currentState != ''">current_state = #{currentState},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSafetyDeclarationTableById" parameterType="Long">
|
||||
delete from safety_declaration_table where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSafetyDeclarationTableByIds" parameterType="String">
|
||||
delete from safety_declaration_table where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,111 @@
|
||||
<?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.SafetyDeclaration.mapper.VisualizationMapper">
|
||||
|
||||
<resultMap type="BeCurrentTable" id="HistogramTableResult">
|
||||
<result property="name" column="dict_label" />
|
||||
<result property="value" column="event_count" />
|
||||
<result property="declarationType" column="declaration_type" />
|
||||
<result property="month" column="month" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="BeCurrentTable" id="LineChartResult">
|
||||
<result property="month" column="month" />
|
||||
<result property="value" column="total_declarations" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectHistogram" resultMap="HistogramTableResult">
|
||||
SELECT
|
||||
MONTH(sdt.occur_time) AS month, -- 直接在列名上调用 MONTH 函数
|
||||
sdd.dict_label,
|
||||
sdt.declaration_type,
|
||||
COUNT(*) AS event_count -- 通常使用 COUNT(*) 来计数行,除非您只想对特定列的非空值计数
|
||||
FROM
|
||||
safety_declaration_table sdt
|
||||
LEFT JOIN sys_dict_data sdd ON sdt.declaration_type = sdd.dict_value AND sdd.dict_type = 'hs_declaration_type' -- 确保这里的 'declaration_type' 是正确的类型代码
|
||||
WHERE
|
||||
YEAR(sdt.occur_time) = YEAR(CURDATE())
|
||||
GROUP BY
|
||||
MONTH(sdt.occur_time), -- 直接在列名上分组
|
||||
sdd.dict_label,
|
||||
sdt.declaration_type
|
||||
ORDER BY
|
||||
sdt.declaration_type,
|
||||
MONTH(sdt.occur_time); -- 直接在列名上排序
|
||||
</select>
|
||||
|
||||
<select id="selectLineChart" resultMap="LineChartResult">
|
||||
SELECT
|
||||
months.month,
|
||||
IFNULL(COUNT(sdt.occur_time), 0) AS total_declarations
|
||||
FROM
|
||||
(SELECT 1 AS month UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9 UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL SELECT 12) AS months
|
||||
LEFT JOIN
|
||||
safety_declaration_table sdt
|
||||
ON MONTH(sdt.occur_time) = months.month
|
||||
AND YEAR(sdt.occur_time) = YEAR(CURDATE())
|
||||
GROUP BY
|
||||
months.month
|
||||
ORDER BY
|
||||
months.month;
|
||||
</select>
|
||||
|
||||
<select id="SelectCircularDiagram" resultMap="HistogramTableResult" parameterType="SafetyDeclarationTable">
|
||||
SELECT
|
||||
MONTH(sdt.occur_time) AS month, -- 直接在列名上调用 MONTH 函数
|
||||
sdd.dict_label,
|
||||
sdt.declaration_type,
|
||||
COUNT(*) AS event_count -- 通常使用 COUNT(*) 来计数行,除非您只想对特定列的非空值计数
|
||||
FROM
|
||||
safety_declaration_table sdt
|
||||
LEFT JOIN sys_dict_data sdd ON sdt.declaration_type = sdd.dict_value AND sdd.dict_type = 'hs_declaration_type' -- 确保这里的 'declaration_type' 是正确的类型代码
|
||||
<where>
|
||||
<if test="params.beginOccurTime != null and params.beginOccurTime != '' and params.endOccurTime != null and params.endOccurTime != ''">
|
||||
<!-- 当beginOccurTime和endOccurTime不等于空时,使用它们作为时间范围 -->
|
||||
and sdt.occur_time between #{params.beginOccurTime} and #{params.endOccurTime}
|
||||
</if>
|
||||
<if test="declarationType != null and declarationType != ''">
|
||||
and sdt.declaration_type = #{declarationType}
|
||||
</if>
|
||||
<if test="params.beginOccurTime == null or params.beginOccurTime == '' or params.endOccurTime == null or params.endOccurTime == ''">
|
||||
<!-- 默认查询本月数据 -->
|
||||
and YEAR(sdt.occur_time) = YEAR(CURDATE()) and MONTH(sdt.occur_time) = MONTH(CURDATE())
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
MONTH(sdt.occur_time), -- 直接在列名上分组
|
||||
sdd.dict_label,
|
||||
sdt.declaration_type
|
||||
ORDER BY
|
||||
sdt.declaration_type,
|
||||
MONTH(sdt.occur_time);
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="selectTotal" resultType="int">
|
||||
SELECT COUNT(*) AS total_rows FROM safety_declaration_table;
|
||||
</select>
|
||||
|
||||
<select id="selectMonthTotal" resultType="int" parameterType="SafetyDeclarationTable">
|
||||
SELECT COUNT(*) AS conditional_rows
|
||||
FROM safety_declaration_table
|
||||
<where>
|
||||
<if test="params.beginOccurTime != null and params.beginOccurTime != '' and params.endOccurTime != null and params.endOccurTime != ''">
|
||||
<!-- 当beginOccurTime和endOccurTime不等于空时,使用它们作为时间范围 -->
|
||||
and occur_time between #{params.beginOccurTime} and #{params.endOccurTime}
|
||||
</if>
|
||||
<if test="declarationType != null and declarationType != ''">
|
||||
and declaration_type = #{declarationType}
|
||||
</if>
|
||||
<if test="params.beginOccurTime == null or params.beginOccurTime == '' or params.endOccurTime == null or params.endOccurTime == ''">
|
||||
<!-- 默认查询本月数据 -->
|
||||
and YEAR(occur_time) = YEAR(CURDATE()) and MONTH(occur_time) = MONTH(CURDATE())
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user