Compare commits
3 Commits
2de1f22e16
...
da6303841e
Author | SHA1 | Date | |
---|---|---|---|
da6303841e | |||
cc428bbd76 | |||
e3ecf5cafe |
@ -0,0 +1,67 @@
|
|||||||
|
package com.jdc.jdcproject.controller;
|
||||||
|
|
||||||
|
import com.jdc.jdcproject.entity.Equipment;
|
||||||
|
import com.jdc.jdcproject.entity.FangpaishuiUnit;
|
||||||
|
import com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo;
|
||||||
|
import com.jdc.jdcproject.service.EquipmentService;
|
||||||
|
import com.jdc.jdcproject.service.FangpaishuiUnitService;
|
||||||
|
import com.jdc.jdcproject.utils.Result;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/fangpaishuiUnitController")
|
||||||
|
public class FangpaishuiUnitController {
|
||||||
|
@Autowired
|
||||||
|
private FangpaishuiUnitService fangpaishuiUnitService;
|
||||||
|
|
||||||
|
@Operation(summary = "查询所有机组")
|
||||||
|
@GetMapping("findAllUnit")
|
||||||
|
public Result findAllUnit() {
|
||||||
|
List<FangpaishuiUnitVo> vos = fangpaishuiUnitService.findAllUnit();
|
||||||
|
return Result.successResult().data("unitVos", vos);
|
||||||
|
}
|
||||||
|
@Operation(summary = "根据id查询机组信息")
|
||||||
|
@GetMapping("findUnitById/{id}")
|
||||||
|
public Result findEquipmentById(@PathVariable int id) {
|
||||||
|
FangpaishuiUnitVo vo = fangpaishuiUnitService.findUnitById(id);
|
||||||
|
return Result.successResult().data("vo", vo);
|
||||||
|
}
|
||||||
|
@Operation(summary = "修改机组信息")
|
||||||
|
@PostMapping("updateUnit")
|
||||||
|
public Result updateUnit(@RequestBody FangpaishuiUnit fangpaishuiUnit) {
|
||||||
|
boolean updateflag = fangpaishuiUnitService.updateById(fangpaishuiUnit);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除机组信息")
|
||||||
|
@DeleteMapping("deleteUnit/{id}")
|
||||||
|
public Result deleteUnit(@PathVariable int id) {
|
||||||
|
boolean updateflag = fangpaishuiUnitService.removeById(id);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新增机组信息")
|
||||||
|
@PostMapping("addUnit")
|
||||||
|
public Result addUnit(@RequestBody FangpaishuiUnit fangpaishuiUnit) {
|
||||||
|
System.out.println(fangpaishuiUnit);
|
||||||
|
|
||||||
|
boolean updateflag = fangpaishuiUnitService.save(fangpaishuiUnit);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package com.jdc.jdcproject.controller;
|
package com.jdc.jdcproject.controller;
|
||||||
|
|
||||||
import com.jdc.jdcproject.entity.DicekePrecipitation;
|
import com.jdc.jdcproject.entity.DicekePrecipitation;
|
||||||
|
import com.jdc.jdcproject.entity.Equipment;
|
||||||
import com.jdc.jdcproject.entity.FangpaishuiWatertreatmentrecord;
|
import com.jdc.jdcproject.entity.FangpaishuiWatertreatmentrecord;
|
||||||
import com.jdc.jdcproject.entity.VO.FangpaishuiWatertreatmentrecordVo;
|
import com.jdc.jdcproject.entity.VO.FangpaishuiWatertreatmentrecordVo;
|
||||||
import com.jdc.jdcproject.service.FangpaishuiWatertreatmentrecordService;
|
import com.jdc.jdcproject.service.FangpaishuiWatertreatmentrecordService;
|
||||||
@ -8,14 +9,12 @@ import com.jdc.jdcproject.utils.LastDayOfMonth;
|
|||||||
import com.jdc.jdcproject.utils.Result;
|
import com.jdc.jdcproject.utils.Result;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -53,4 +52,51 @@ public class FangpaishuiWatertreatmentrecordController {
|
|||||||
|
|
||||||
return Result.successResult().data("fangpaishuiWatertreatmentrecordVo",fangpaishuiWatertreatmentrecordVo);
|
return Result.successResult().data("fangpaishuiWatertreatmentrecordVo",fangpaishuiWatertreatmentrecordVo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据时间段查询处理水量和拉泥车数详细数据")
|
||||||
|
@GetMapping("findWatertreatmentrecordDetailByMonth/{dateTime}")
|
||||||
|
public Result findWatertreatmentrecordDetailByMonth(@PathVariable String dateTime) throws ParseException {
|
||||||
|
String[] s = dateTime.split("到");
|
||||||
|
List<FangpaishuiWatertreatmentrecord> fangpaishuiWatertreatmentrecords = new ArrayList<>();
|
||||||
|
if (s.length!=0&&!s[0].isEmpty()&&!s[1].isEmpty()) {
|
||||||
|
fangpaishuiWatertreatmentrecords = fangpaishuiWatertreatmentrecordService.findByDate(s[0], s[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result.successResult().data("fangpaishuiWatertreatmentrecords",fangpaishuiWatertreatmentrecords);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "修改处理水量和拉泥车信息")
|
||||||
|
@PostMapping("updateWatertreatmentrecord")
|
||||||
|
public Result updateEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) {
|
||||||
|
boolean updateflag = fangpaishuiWatertreatmentrecordService.updateById(fangpaishuiWatertreatmentrecord);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "删除处理水量和拉泥车信息")
|
||||||
|
@DeleteMapping("deleteWatertreatmentrecord/{id}")
|
||||||
|
public Result deleteEquipment(@PathVariable String id) {
|
||||||
|
boolean updateflag = fangpaishuiWatertreatmentrecordService.removeById(id);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "新增处理水量和拉泥车信息")
|
||||||
|
@PostMapping("addWatertreatmentrecord")
|
||||||
|
public Result addEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) {
|
||||||
|
System.out.println(fangpaishuiWatertreatmentrecord);
|
||||||
|
boolean updateflag = fangpaishuiWatertreatmentrecordService.save(fangpaishuiWatertreatmentrecord);
|
||||||
|
if (updateflag) {
|
||||||
|
return Result.successResult();
|
||||||
|
} else {
|
||||||
|
return Result.errorResult();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
87
src/main/java/com/jdc/jdcproject/entity/FangpaishuiUnit.java
Normal file
87
src/main/java/com/jdc/jdcproject/entity/FangpaishuiUnit.java
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
package com.jdc.jdcproject.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机组表;
|
||||||
|
* @TableName fangpaishui_unit
|
||||||
|
*/
|
||||||
|
@TableName(value ="fangpaishui_unit")
|
||||||
|
@Data
|
||||||
|
public class FangpaishuiUnit implements Serializable {
|
||||||
|
/**
|
||||||
|
* 主键,唯一标识机组
|
||||||
|
*/
|
||||||
|
@TableId(value = "UnitID")
|
||||||
|
private Integer unitID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 外键,关联所属设备
|
||||||
|
*/
|
||||||
|
@TableField(value = "EquipmentId")
|
||||||
|
private Integer equipmentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 机组编号(如“4#多级泵(200)”)
|
||||||
|
*/
|
||||||
|
@TableField(value = "UnitCode")
|
||||||
|
private String unitCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 额定排水量(固定属性)
|
||||||
|
*/
|
||||||
|
@TableField(value = "RatedCapacity")
|
||||||
|
private Integer ratedCapacity;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object that) {
|
||||||
|
if (this == that) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (that == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != that.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FangpaishuiUnit other = (FangpaishuiUnit) that;
|
||||||
|
return (this.getUnitID() == null ? other.getUnitID() == null : this.getUnitID().equals(other.getUnitID()))
|
||||||
|
&& (this.getEquipmentId() == null ? other.getEquipmentId() == null : this.getEquipmentId().equals(other.getEquipmentId()))
|
||||||
|
&& (this.getUnitCode() == null ? other.getUnitCode() == null : this.getUnitCode().equals(other.getUnitCode()))
|
||||||
|
&& (this.getRatedCapacity() == null ? other.getRatedCapacity() == null : this.getRatedCapacity().equals(other.getRatedCapacity()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((getUnitID() == null) ? 0 : getUnitID().hashCode());
|
||||||
|
result = prime * result + ((getEquipmentId() == null) ? 0 : getEquipmentId().hashCode());
|
||||||
|
result = prime * result + ((getUnitCode() == null) ? 0 : getUnitCode().hashCode());
|
||||||
|
result = prime * result + ((getRatedCapacity() == null) ? 0 : getRatedCapacity().hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(getClass().getSimpleName());
|
||||||
|
sb.append(" [");
|
||||||
|
sb.append("Hash = ").append(hashCode());
|
||||||
|
sb.append(", unitID=").append(unitID);
|
||||||
|
sb.append(", equipmentId=").append(equipmentId);
|
||||||
|
sb.append(", unitCode=").append(unitCode);
|
||||||
|
sb.append(", ratedCapacity=").append(ratedCapacity);
|
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID);
|
||||||
|
sb.append("]");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.jdc.jdcproject.entity.VO;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
@Data
|
||||||
|
public class FangpaishuiUnitVo {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
@TableId("UnitID")
|
||||||
|
private int UnitID;
|
||||||
|
|
||||||
|
@Schema(description = "设备ID")
|
||||||
|
private int EquipmentId;
|
||||||
|
|
||||||
|
@Schema(description = "设备名称")
|
||||||
|
private String equipmentName;
|
||||||
|
|
||||||
|
@Schema(description = "机组编号")
|
||||||
|
private String UnitCode;
|
||||||
|
|
||||||
|
@Schema(description = "额定排水量")
|
||||||
|
private int ratedCapacity;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "FangpaishuiUnit{" +
|
||||||
|
"UnitID = " + UnitID +
|
||||||
|
", EquipmentId = " + EquipmentId +
|
||||||
|
", equipmentName = " + equipmentName +
|
||||||
|
", UnitCode = " + UnitCode +
|
||||||
|
", ratedCapacity = " + ratedCapacity +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.jdc.jdcproject.mapper;
|
||||||
|
|
||||||
|
import com.jdc.jdcproject.entity.FangpaishuiUnit;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||||
|
import com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 95262
|
||||||
|
* @description 针对表【fangpaishui_unit(机组表;)】的数据库操作Mapper
|
||||||
|
* @createDate 2025-05-07 09:47:44
|
||||||
|
* @Entity com.jdc.jdcproject.entity.FangpaishuiUnit
|
||||||
|
*/
|
||||||
|
public interface FangpaishuiUnitMapper extends BaseMapper<FangpaishuiUnit> {
|
||||||
|
|
||||||
|
List<FangpaishuiUnitVo> findAllUnit();
|
||||||
|
|
||||||
|
FangpaishuiUnitVo findUnitById(int id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
<?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.jdc.jdcproject.mapper.FangpaishuiUnitMapper">
|
||||||
|
|
||||||
|
<!-- 关联设备表获取设备名称 -->
|
||||||
|
<select id="findAllUnit" resultType="com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo">
|
||||||
|
select fn.*,
|
||||||
|
e.equipmentName
|
||||||
|
FROM fangpaishui_unit fn
|
||||||
|
LEFT JOIN equipment e ON e.EquipmentId = fn.EquipmentId
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findUnitById" resultType="com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo">
|
||||||
|
select fn.*,
|
||||||
|
e.equipmentName
|
||||||
|
FROM fangpaishui_unit fn
|
||||||
|
LEFT JOIN equipment e ON e.EquipmentId = fn.EquipmentId
|
||||||
|
where fn.UnitID = #{id}
|
||||||
|
</select>
|
||||||
|
</mapper>
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.jdc.jdcproject.service;
|
||||||
|
|
||||||
|
import com.jdc.jdcproject.entity.FangpaishuiUnit;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.jdc.jdcproject.entity.VO.DicekeMininglossVo;
|
||||||
|
import com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 95262
|
||||||
|
* @description 针对表【fangpaishui_unit(机组表;)】的数据库操作Service
|
||||||
|
* @createDate 2025-05-07 09:47:44
|
||||||
|
*/
|
||||||
|
public interface FangpaishuiUnitService extends IService<FangpaishuiUnit> {
|
||||||
|
|
||||||
|
List<FangpaishuiUnitVo> findAllUnit();
|
||||||
|
|
||||||
|
FangpaishuiUnitVo findUnitById(int id);
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
package com.jdc.jdcproject.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.jdc.jdcproject.entity.FangpaishuiUnit;
|
||||||
|
import com.jdc.jdcproject.entity.VO.FangpaishuiUnitVo;
|
||||||
|
import com.jdc.jdcproject.service.FangpaishuiUnitService;
|
||||||
|
import com.jdc.jdcproject.mapper.FangpaishuiUnitMapper;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 95262
|
||||||
|
* @description 针对表【fangpaishui_unit(机组表;)】的数据库操作Service实现
|
||||||
|
* @createDate 2025-05-07 09:47:44
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class FangpaishuiUnitServiceImpl extends ServiceImpl<FangpaishuiUnitMapper, FangpaishuiUnit>
|
||||||
|
implements FangpaishuiUnitService{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FangpaishuiUnitVo> findAllUnit() {
|
||||||
|
return baseMapper.findAllUnit();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FangpaishuiUnitVo findUnitById(int id) {
|
||||||
|
return baseMapper.findUnitById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user