机组和部件功能完成70%
This commit is contained in:
parent
47a3e7e764
commit
bd28cd577a
|
@ -17,4 +17,6 @@ public class Message implements Serializable {
|
|||
public static final String IMAGE_ID_IS_NOT_EXIST = "图像id不存在";
|
||||
public static final String DEFECT_ID_IS_NOT_EXIST = "缺陷id不存在";
|
||||
public static final String PROJECT_ID_IS_NOT_EXIST = "项目id不存在";
|
||||
public static final String TURBINE_ID_IS_NOT_EXIST = "机组id不存在";
|
||||
public static final String PART_ID_IS_NOT_EXIST = "部件id不存在";
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package com.dite.znpt.converts;
|
||||
|
||||
import com.dite.znpt.domain.entity.DefectEntity;
|
||||
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.*;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
|
@ -31,4 +28,12 @@ public interface Converts {
|
|||
ProjectResp toProjectResp(ProjectEntity entity);
|
||||
|
||||
ProjectEntity toProjectEntity(ProjectReq req);
|
||||
|
||||
TurbineEntity toTurbineEntity(TurbineReq req);
|
||||
|
||||
TurbineResp toTurbineResp(TurbineEntity entity);
|
||||
|
||||
PartEntity toPartEntity(PartReq req);
|
||||
|
||||
PartResp toPartResp(PartEntity entity);
|
||||
}
|
||||
|
|
|
@ -28,11 +28,6 @@ public class PartEntity extends AuditableEntity implements Serializable {
|
|||
@TableId(value = "part_id", type = IdType.ASSIGN_UUID)
|
||||
private String partId;
|
||||
|
||||
@ExcelProperty("项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
@TableField("project_id")
|
||||
private String projectId;
|
||||
|
||||
@ExcelProperty("机组id")
|
||||
@ApiModelProperty("机组id")
|
||||
@TableField("turbine_id")
|
||||
|
@ -48,8 +43,8 @@ public class PartEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("part_code")
|
||||
private String partCode;
|
||||
|
||||
@ExcelProperty("类型,字典part_type")
|
||||
@ApiModelProperty("类型,字典part_type")
|
||||
@ExcelProperty("类型,枚举PartTypeEnum")
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
@TableField("part_type")
|
||||
private String partType;
|
||||
|
||||
|
@ -60,12 +55,12 @@ public class PartEntity extends AuditableEntity implements Serializable {
|
|||
|
||||
@ExcelProperty("厂商")
|
||||
@ApiModelProperty("厂商")
|
||||
@TableField("manufacturer")
|
||||
private String manufacturer;
|
||||
@TableField("part_manufacturer")
|
||||
private String partManufacturer;
|
||||
|
||||
@ExcelProperty("型号")
|
||||
@ApiModelProperty("型号")
|
||||
@TableField("model")
|
||||
private String model;
|
||||
@TableField("part_model")
|
||||
private String partModel;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,11 @@ public class TurbineEntity extends AuditableEntity implements Serializable {
|
|||
@TableField("turbine_name")
|
||||
private String turbineName;
|
||||
|
||||
@ExcelProperty("机组编码")
|
||||
@ApiModelProperty("机组编码")
|
||||
@TableField("turbine_code")
|
||||
private String turbineCode;
|
||||
|
||||
@ExcelProperty("机组描述")
|
||||
@ApiModelProperty("机组描述")
|
||||
@TableField("turbine_desc")
|
||||
|
@ -45,17 +50,17 @@ public class TurbineEntity extends AuditableEntity implements Serializable {
|
|||
|
||||
@ExcelProperty("机组厂商")
|
||||
@ApiModelProperty("机组厂商")
|
||||
@TableField("manufacturer")
|
||||
private String manufacturer;
|
||||
@TableField("turbine_manufacturer")
|
||||
private String turbineManufacturer;
|
||||
|
||||
@ExcelProperty("机组型号")
|
||||
@ApiModelProperty("机组型号")
|
||||
@TableField("model")
|
||||
private String model;
|
||||
@TableField("turbine_model")
|
||||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("封面图")
|
||||
@TableField("cover_url")
|
||||
private String coverUrl;
|
||||
@TableField("turbine_cover_url")
|
||||
private String turbineCoverUrl;
|
||||
|
||||
@ApiModelProperty("状态:0待施工,1施工中,2已完工,3已审核,4已验收")
|
||||
@TableField("status")
|
||||
|
|
|
@ -12,7 +12,7 @@ import lombok.Data;
|
|||
* @Description: 请求实体
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("列表请求实体")
|
||||
@ApiModel("部件列表请求实体")
|
||||
public class PartListReq implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 118135700439578757L;
|
||||
|
@ -20,32 +20,20 @@ public class PartListReq implements Serializable {
|
|||
@ApiModelProperty("查询关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("Id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
@ApiModelProperty(name = "项目id", required = true)
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组id")
|
||||
@ApiModelProperty(name = "机组id", required = true)
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String partName;
|
||||
|
||||
@ApiModelProperty("编号")
|
||||
private String partCode;
|
||||
|
||||
@ApiModelProperty("类型,字典part_type")
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
private String partType;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String partDesc;
|
||||
|
||||
@ApiModelProperty("厂商")
|
||||
private String manufacturer;
|
||||
private String partManufacturer;
|
||||
|
||||
@ApiModelProperty("型号")
|
||||
private String model;
|
||||
private String partModel;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 21:50
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("部件列表响应实体")
|
||||
public class PartListResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -8081226536055269084L;
|
||||
|
||||
@ApiModelProperty("部件id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("机组id")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String partName;
|
||||
|
||||
@ApiModelProperty("编号")
|
||||
private String partCode;
|
||||
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
private String partType;
|
||||
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
private String partTypeLabel;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 21:51
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("部件请求实体")
|
||||
public class PartReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -585044340118904985L;
|
||||
|
||||
@ApiModelProperty("机组id")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String partName;
|
||||
|
||||
@ApiModelProperty("编号")
|
||||
private String partCode;
|
||||
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
private String partType;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String partDesc;
|
||||
|
||||
@ApiModelProperty("厂商")
|
||||
private String PartManufacturer;
|
||||
|
||||
@ApiModelProperty("型号")
|
||||
private String PartModel;
|
||||
}
|
|
@ -1,9 +1,11 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -11,8 +13,46 @@ import com.dite.znpt.domain.entity.PartEntity;
|
|||
* @Description: 响应实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("响应实体")
|
||||
public class PartResp extends PartEntity {
|
||||
@ApiModel("部件响应实体")
|
||||
public class PartResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = -4457194361289992312L;
|
||||
|
||||
@ApiModelProperty("部件id")
|
||||
private String partId;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("机组id")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String partName;
|
||||
|
||||
@ApiModelProperty("编号")
|
||||
private String partCode;
|
||||
|
||||
@ApiModelProperty("类型,枚举PartTypeEnum")
|
||||
private String partType;
|
||||
|
||||
@ApiModelProperty("类型描述")
|
||||
private String partTypeLabel;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String partDesc;
|
||||
|
||||
@ApiModelProperty("厂商")
|
||||
private String partManufacturer;
|
||||
|
||||
@ApiModelProperty("型号")
|
||||
private String partModel;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 22:17
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("机组明细响应实体")
|
||||
public class TurbineInfoResp extends TurbineResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 5493448541358665068L;
|
||||
|
||||
@ApiModelProperty("部件信息")
|
||||
private List<PartResp> partRespList;
|
||||
}
|
|
@ -12,31 +12,25 @@ import lombok.Data;
|
|||
* @Description: 机组-项目关联请求实体
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("机组-项目关联列表请求实体")
|
||||
@ApiModel("机组列表请求实体")
|
||||
public class TurbineListReq implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 141552424945497346L;
|
||||
|
||||
@ApiModelProperty("查询关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("机组-项目关联Id")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
@ApiModelProperty(name = "项目id", required = true)
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
@ApiModelProperty("查询关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("机组描述")
|
||||
private String turbineDesc;
|
||||
|
||||
@ApiModelProperty("机组厂商")
|
||||
private String manufacturer;
|
||||
private String turbineManufacturer;
|
||||
|
||||
@ApiModelProperty("机组型号")
|
||||
private String model;
|
||||
private String turbineModel;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
* @Description: 机组-项目关联响应实体
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("机组列表响应实体")
|
||||
public class TurbineListResp implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 8391079826638511248L;
|
||||
|
||||
@ApiModelProperty("机组号")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
|
||||
@ApiModelProperty("机组编码")
|
||||
private String turbineCode;
|
||||
|
||||
@ApiModelProperty("机组描述")
|
||||
private String turbineDesc;
|
||||
|
||||
@ApiModelProperty("机组厂商")
|
||||
private String turbineManufacturer;
|
||||
|
||||
@ApiModelProperty("机组型号")
|
||||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("封面图")
|
||||
private String turbineCoverUrl;
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 21:44
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("机组请求实体")
|
||||
public class TurbineReq implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 115092978850852080L;
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
|
||||
@ApiModelProperty("机组编码")
|
||||
private String turbineCode;
|
||||
|
||||
@ApiModelProperty("机组描述")
|
||||
private String turbineDesc;
|
||||
|
||||
@ApiModelProperty("机组厂商")
|
||||
private String turbineManufacturer;
|
||||
|
||||
@ApiModelProperty("机组型号")
|
||||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("封面图")
|
||||
private String turbineCoverUrl;
|
||||
|
||||
}
|
|
@ -1,61 +1,48 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
* @Description: 机组-项目关联响应实体
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 21:44
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("机组-项目关联响应实体")
|
||||
public class TurbineResp extends TurbineEntity {
|
||||
@ApiModel("机组响应实体")
|
||||
public class TurbineResp implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = -1403719853347580858L;
|
||||
|
||||
@ApiModelProperty("部件")
|
||||
private List<PartEntity> partsList;
|
||||
@ApiModelProperty("机组号")
|
||||
private String turbineId;
|
||||
|
||||
@ApiModelProperty("内部工作状态, -1不存在,0未开始、1开始施工、2已提交报告、3审核通过")
|
||||
private String antiThunderWorkStatus;
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("外部工作状态, -1不存在,0未开始、1开始施工、2已提交报告、3审核通过")
|
||||
private String inWorkStatus;
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("防雷工作状态, -1不存在,0未开始、1开始施工、2已提交报告、3审核通过")
|
||||
private String outWorkStatus;
|
||||
@ApiModelProperty("机组名称")
|
||||
private String turbineName;
|
||||
|
||||
@ApiModelProperty("数据报告工作状态, -1不存在,0未开始、1开始施工、2已提交报告、3审核通过")
|
||||
private String summaryWorkStatus;
|
||||
@ApiModelProperty("机组编码")
|
||||
private String turbineCode;
|
||||
|
||||
@ApiModelProperty("内部工作安全员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String antiThunderWorkSafetyStatus;
|
||||
@ApiModelProperty("机组描述")
|
||||
private String turbineDesc;
|
||||
|
||||
@ApiModelProperty("外部工作安全员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String inWorkSafetyStatus;
|
||||
@ApiModelProperty("机组厂商")
|
||||
private String turbineManufacturer;
|
||||
|
||||
@ApiModelProperty("防雷工作安全员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String outWorkSafetyStatus;
|
||||
@ApiModelProperty("机组型号")
|
||||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("内部工作质量员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String antiThunderWorkQualityStatus;
|
||||
@ApiModelProperty("封面图")
|
||||
private String turbineCoverUrl;
|
||||
|
||||
@ApiModelProperty("外部工作质量员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String inWorkQualityStatus;
|
||||
|
||||
@ApiModelProperty("防雷工作质量员审核状态, -1不存在,0未审核、1审核通过")
|
||||
private String outWorkQualityStatus;
|
||||
|
||||
@ApiModelProperty("防雷是否不合格,1不合格,0合格")
|
||||
private Boolean lightningUnqualified;
|
||||
|
||||
@ApiModelProperty("来源, app,backend后台,不传参默认后台")
|
||||
private String source;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package com.dite.znpt.enums;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: gaoxiong
|
||||
* @Date: 2025/5/7 21:22
|
||||
* @Description:
|
||||
*/
|
||||
@Getter
|
||||
public enum PartTypeEnum {
|
||||
CABIN("CABIN", "机舱"),
|
||||
VANE_1("VANE-1", "叶片1"),
|
||||
VANE_2("VANE-2", "叶片2"),
|
||||
VANE_3("VANE-3", "叶片3"),
|
||||
TOWER("TOWER", "塔筒");
|
||||
|
||||
private final String code;
|
||||
private final String desc;
|
||||
|
||||
PartTypeEnum(String code, String desc){
|
||||
this.code = code;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
public static PartTypeEnum getByCode(String code){
|
||||
for (PartTypeEnum e : PartTypeEnum.values() ) {
|
||||
if(e.code.equals(code)){
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getDescByCode(String code){
|
||||
PartTypeEnum e = getByCode(code);
|
||||
return null == e ? null : e.desc;
|
||||
}
|
||||
|
||||
public static List<JSONObject> listAll(){
|
||||
List<JSONObject> list = new ArrayList<>(PartTypeEnum.values().length);
|
||||
for (PartTypeEnum e : PartTypeEnum.values() ) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.set(e.code, e.desc);
|
||||
list.add(jsonObject);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package com.dite.znpt.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.domain.vo.PartListReq;
|
||||
import com.dite.znpt.domain.vo.PartListResp;
|
||||
import com.dite.znpt.domain.vo.PartResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -14,6 +15,6 @@ import java.util.List;
|
|||
* @Description: 表数据库访问层
|
||||
*/
|
||||
public interface PartMapper extends BaseMapper<PartEntity> {
|
||||
List<PartResp> queryBySelective(PartListReq partReq);
|
||||
List<PartListResp> queryBySelective(PartListReq partReq);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ package com.dite.znpt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
import com.dite.znpt.domain.vo.TurbineInfoResp;
|
||||
import com.dite.znpt.domain.vo.TurbineListReq;
|
||||
import com.dite.znpt.domain.vo.TurbineResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.dite.znpt.domain.vo.TurbineListResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,6 +14,8 @@ import java.util.List;
|
|||
* @Description: 机组-项目关联表数据库访问层
|
||||
*/
|
||||
public interface TurbineMapper extends BaseMapper<TurbineEntity> {
|
||||
List<TurbineResp> queryBySelective(TurbineListReq turbineReq);
|
||||
List<TurbineListResp> queryBySelective(TurbineListReq turbineReq);
|
||||
List<TurbineInfoResp> listTurbineInfo(TurbineListReq turbineReq);
|
||||
TurbineInfoResp getTurbineInfo(String turbineId);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.dite.znpt.service;
|
|||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.domain.vo.PartListReq;
|
||||
import com.dite.znpt.domain.vo.PartListResp;
|
||||
import com.dite.znpt.domain.vo.PartReq;
|
||||
import com.dite.znpt.domain.vo.PartResp;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -15,14 +17,24 @@ import java.util.List;
|
|||
public interface PartService extends IService<PartEntity> {
|
||||
|
||||
/**
|
||||
* 功能描述:查询列表
|
||||
* 功能描述:分页查询列表
|
||||
*
|
||||
* @param partReq
|
||||
* @return {@link List }<{@link PartEntity }>
|
||||
* @return {@link List }<{@link PartListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<PartResp> selectList(PartListReq partReq);
|
||||
List<PartListResp> page(PartListReq partReq);
|
||||
|
||||
/**
|
||||
* 功能描述:查询列表
|
||||
*
|
||||
* @param partReq
|
||||
* @return {@link List }<{@link PartListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<PartListResp> list(PartListReq partReq);
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条
|
||||
|
@ -32,25 +44,25 @@ public interface PartService extends IService<PartEntity> {
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
PartResp selectById(String partId);
|
||||
PartResp detail(String partId);
|
||||
|
||||
/**
|
||||
* 功能描述:新增
|
||||
*
|
||||
* @param part
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void saveData(PartEntity part);
|
||||
void save(PartReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:更新
|
||||
*
|
||||
* @param part
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void updateData(PartEntity part);
|
||||
void update(String partId, PartReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:删除
|
||||
|
@ -60,5 +72,15 @@ public interface PartService extends IService<PartEntity> {
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void deleteById(String partId);
|
||||
|
||||
/**
|
||||
* 功能描述:删除
|
||||
*
|
||||
* @param turbineIds 机组id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void deleteByTurbineIds(List<String> turbineIds);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ package com.dite.znpt.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
import com.dite.znpt.domain.vo.TurbineListReq;
|
||||
import com.dite.znpt.domain.vo.TurbineResp;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -15,50 +14,90 @@ import java.util.List;
|
|||
public interface TurbineService extends IService<TurbineEntity> {
|
||||
|
||||
/**
|
||||
* 功能描述:查询机组-项目关联列表
|
||||
* 功能描述:分页查询机组列表
|
||||
*
|
||||
* @param turbineReq 机组-项目关联
|
||||
* @return {@link List }<{@link TurbineEntity }>
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<TurbineResp> selectList(TurbineListReq turbineReq);
|
||||
List<TurbineListResp> page(TurbineListReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条机组-项目关联
|
||||
* 功能描述:查询机组列表
|
||||
*
|
||||
* @param turbineId 机组-项目关联Id
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<TurbineListResp> list(TurbineListReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:查询机组明细列表
|
||||
*
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineInfoResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<TurbineInfoResp> listInfo(TurbineListReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:查询指定机组详情
|
||||
*
|
||||
* @param turbineId 机组Id
|
||||
* @return {@link TurbineResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
TurbineResp selectById(String turbineId);
|
||||
TurbineResp detail(String turbineId);
|
||||
|
||||
/**
|
||||
* 功能描述:新增机组-项目关联
|
||||
* 功能描述:查询指定机组明细内信息
|
||||
*
|
||||
* @param turbine 机组-项目关联
|
||||
* @param turbineId 机组Id
|
||||
* @return {@link TurbineListResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void saveData(TurbineEntity turbine);
|
||||
TurbineInfoResp info(String turbineId);
|
||||
|
||||
/**
|
||||
* 功能描述:更新机组-项目关联
|
||||
* 功能描述:新增机组
|
||||
*
|
||||
* @param turbine 机组-项目关联
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void updateData(TurbineEntity turbine);
|
||||
void save(TurbineReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组-项目关联
|
||||
* 功能描述:更新机组
|
||||
*
|
||||
* @param turbineId 机组-项目关联Id
|
||||
* @param turbineId
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void update(String turbineId, TurbineReq req);
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组
|
||||
*
|
||||
* @param turbineId 机组Id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void deleteById(String turbineId);
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void deleteByProjectId(String projectId);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,16 +1,29 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
import com.dite.znpt.domain.vo.PartListReq;
|
||||
import com.dite.znpt.domain.vo.PartListResp;
|
||||
import com.dite.znpt.domain.vo.PartReq;
|
||||
import com.dite.znpt.domain.vo.PartResp;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import com.dite.znpt.enums.PartTypeEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.PartMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.TurbineService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -22,22 +35,42 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class PartServiceImpl extends ServiceImpl<PartMapper, PartEntity> implements PartService {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private TurbineService turbineService;
|
||||
|
||||
/**
|
||||
* 功能描述:查询列表
|
||||
* 功能描述:分页查询列表
|
||||
*
|
||||
* @param partReq 信息
|
||||
* @return {@link List }<{@link PartResp }>
|
||||
* @param req 信息
|
||||
* @return {@link List }<{@link PartListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<PartResp> selectList(PartListReq partReq) {
|
||||
public List<PartListResp> page(PartListReq req) {
|
||||
PageUtil.startPage();
|
||||
List<PartResp> partList= this.baseMapper.queryBySelective(partReq);
|
||||
partList.forEach(resp -> {
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询列表
|
||||
*
|
||||
* @param req 信息
|
||||
* @return {@link List }<{@link PartListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<PartListResp> list(PartListReq req) {
|
||||
PageUtil.startPage();
|
||||
List<PartListResp> list= this.baseMapper.queryBySelective(req);
|
||||
list.forEach(resp -> {
|
||||
resp.setPartTypeLabel(PartTypeEnum.getDescByCode(resp.getPartType()));
|
||||
});
|
||||
return partList;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -49,38 +82,55 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, PartEntity> impleme
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public PartResp selectById(String partId) {
|
||||
PartListReq partReq = new PartListReq();
|
||||
partReq.setPartId(partId);
|
||||
|
||||
List<PartResp> list = selectList(partReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new PartResp();
|
||||
public PartResp detail(String partId) {
|
||||
PartEntity entity = this.baseMapper.selectById(partId);
|
||||
PartResp resp = Converts.INSTANCE.toPartResp(entity);
|
||||
if(StrUtil.isNotEmpty(resp.getTurbineId())){
|
||||
TurbineEntity turbine = turbineService.getById(resp.getTurbineId());
|
||||
if(null != turbine){
|
||||
resp.setTurbineId(turbine.getTurbineName());
|
||||
if(StrUtil.isNotEmpty(turbine.getProjectId())){
|
||||
ProjectEntity project = projectService.getById(turbine.getProjectId());
|
||||
if(null != project){
|
||||
resp.setProjectName(project.getProjectName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:新增
|
||||
*
|
||||
* @param part
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void saveData(PartEntity part) {
|
||||
// todo 校验
|
||||
save(part);
|
||||
public void save(PartReq req) {
|
||||
PartEntity entity = Converts.INSTANCE.toPartEntity(req);
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:更新
|
||||
*
|
||||
* @param part
|
||||
* @param partId
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateData(PartEntity part) {
|
||||
// todo 校验
|
||||
updateById(part);
|
||||
public void update(String partId, PartReq req) {
|
||||
if(null == this.baseMapper.selectById(partId)){
|
||||
throw new ServiceException(Message.PART_ID_IS_NOT_EXIST);
|
||||
}
|
||||
PartEntity entity = Converts.INSTANCE.toPartEntity(req);
|
||||
entity.setPartId(partId);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,10 +140,25 @@ public class PartServiceImpl extends ServiceImpl<PartMapper, PartEntity> impleme
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteById(String partId) {
|
||||
// todo 校验
|
||||
removeById(partId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:删除
|
||||
*
|
||||
* @param turbineIds 机组id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteByTurbineIds(List<String> turbineIds) {
|
||||
this.baseMapper.delete(Wrappers.<PartEntity>lambdaQuery().in(PartEntity::getTurbineId, turbineIds));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,17 +1,27 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
import com.dite.znpt.domain.vo.TurbineListReq;
|
||||
import com.dite.znpt.domain.vo.TurbineResp;
|
||||
import com.dite.znpt.service.TurbineService;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.mapper.TurbineMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.service.PartService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.service.TurbineService;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -22,78 +32,147 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class TurbineServiceImpl extends ServiceImpl<TurbineMapper, TurbineEntity> implements TurbineService {
|
||||
|
||||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@Resource
|
||||
private PartService partService;
|
||||
|
||||
/**
|
||||
* 功能描述:查询机组-项目关联列表
|
||||
* 功能描述:分页查询机组列表
|
||||
*
|
||||
* @param turbineReq 机组-项目关联信息
|
||||
* @return {@link List }<{@link TurbineResp }>
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineListResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<TurbineResp> selectList(TurbineListReq turbineReq) {
|
||||
public List<TurbineListResp> page(TurbineListReq req) {
|
||||
PageUtil.startPage();
|
||||
List<TurbineResp> turbineList= this.baseMapper.queryBySelective(turbineReq);
|
||||
turbineList.forEach(resp -> {
|
||||
|
||||
});
|
||||
return turbineList;
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条机组-项目关联
|
||||
* 功能描述:查询机组列表
|
||||
*
|
||||
* @param turbineId 机组-项目关联Id
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineEntity }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<TurbineListResp> list(TurbineListReq req) {
|
||||
List<TurbineListResp> list= this.baseMapper.queryBySelective(req);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询机组明细列表
|
||||
*
|
||||
* @param req
|
||||
* @return {@link List }<{@link TurbineInfoResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<TurbineInfoResp> listInfo(TurbineListReq req) {
|
||||
List<TurbineInfoResp> list= this.baseMapper.listTurbineInfo(req);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条机组
|
||||
*
|
||||
* @param turbineId 机组Id
|
||||
* @return {@link TurbineResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public TurbineResp selectById(String turbineId) {
|
||||
TurbineListReq turbineReq = new TurbineListReq();
|
||||
turbineReq.setTurbineId(turbineId);
|
||||
|
||||
List<TurbineResp> list = selectList(turbineReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new TurbineResp();
|
||||
public TurbineResp detail(String turbineId) {
|
||||
TurbineEntity entity = this.baseMapper.selectById(turbineId);
|
||||
TurbineResp resp = Converts.INSTANCE.toTurbineResp(entity);
|
||||
if(null != resp && StrUtil.isNotEmpty(resp.getProjectId())){
|
||||
ProjectEntity project = projectService.getById(resp.getProjectId());
|
||||
resp.setProjectName(project.getProjectName());
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:新增机组-项目关联
|
||||
* 功能描述:查询指定机组明细内信息
|
||||
*
|
||||
* @param turbine 机组-项目关联
|
||||
* @param turbineId 机组Id
|
||||
* @return {@link TurbineListResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public void saveData(TurbineEntity turbine) {
|
||||
// todo 校验
|
||||
save(turbine);
|
||||
public TurbineInfoResp info(String turbineId) {
|
||||
return this.baseMapper.getTurbineInfo(turbineId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:更新机组-项目关联
|
||||
* 功能描述:新增机组
|
||||
*
|
||||
* @param turbine 机组-项目关联
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void updateData(TurbineEntity turbine) {
|
||||
// todo 校验
|
||||
updateById(turbine);
|
||||
public void save(TurbineReq req) {
|
||||
TurbineEntity entity = Converts.INSTANCE.toTurbineEntity(req);
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组-项目关联
|
||||
* 功能描述:更新机组
|
||||
*
|
||||
* @param turbineId
|
||||
* @param req
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String turbineId, TurbineReq req) {
|
||||
if(null == this.baseMapper.selectById(turbineId)){
|
||||
throw new ServiceException(Message.TURBINE_ID_IS_NOT_EXIST);
|
||||
}
|
||||
TurbineEntity entity = Converts.INSTANCE.toTurbineEntity(req);
|
||||
entity.setTurbineId(turbineId);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组
|
||||
*
|
||||
* @param turbineId 机组-项目关联Id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteById(String turbineId) {
|
||||
// todo 校验
|
||||
removeById(turbineId);
|
||||
partService.deleteByTurbineIds(Arrays.asList(turbineId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:删除机组
|
||||
*
|
||||
* @param projectId 项目id
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteByProjectId(String projectId) {
|
||||
List<TurbineEntity> turbineList = this.baseMapper.selectList(Wrappers.<TurbineEntity>lambdaQuery().eq(TurbineEntity::getProjectId, projectId));
|
||||
List<String> turbineIds = turbineList.stream().map(TurbineEntity::getTurbineId).collect(Collectors.toList());
|
||||
this.baseMapper.deleteByIds(turbineIds);
|
||||
partService.deleteByTurbineIds(turbineIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,46 +2,31 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.PartMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.part_id, a.project_id, a.turbine_id, a.part_name,
|
||||
a.part_code, a.part_type, a.part_desc, a.manufacturer,
|
||||
a.model
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.PartResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from part a
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.PartListResp">
|
||||
SELECT
|
||||
pa.part_id, t.project_id, pr.project_name, t.turbine_id, t.turbine_name, pa.part_name, pa.part_code, pa.part_type, pa.part_desc
|
||||
FROM part pa
|
||||
LEFT JOIN turbine t ON pa.turbine_id = t.turbine_id
|
||||
LEFT JOIN project pr ON t.project_id = pr.project_id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
# and (a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="partId != null and partId != ''">
|
||||
and a.part_id like concat ('%', #{partId}, '%')
|
||||
# and (pa.part_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or pa.part_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and a.project_id like concat ('%', #{projectId}, '%')
|
||||
and t.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="turbineId != null and turbineId != ''">
|
||||
and a.turbine_id like concat ('%', #{turbineId}, '%')
|
||||
</if>
|
||||
<if test="partName != null and partName != ''">
|
||||
and a.part_name like concat ('%', #{partName}, '%')
|
||||
</if>
|
||||
<if test="partCode != null and partCode != ''">
|
||||
and a.part_code like concat ('%', #{partCode}, '%')
|
||||
and t.turbine_id = #{turbineId}
|
||||
</if>
|
||||
<if test="partType != null and partType != ''">
|
||||
and a.part_type like concat ('%', #{partType}, '%')
|
||||
and a.part_type = #{partType}
|
||||
</if>
|
||||
<if test="partDesc != null and partDesc != ''">
|
||||
and a.part_desc like concat ('%', #{partDesc}, '%')
|
||||
<if test="partManufacturer != null and partManufacturer != ''">
|
||||
and a.part_manufacturer like concat ('%', #{partManufacturer}, '%')
|
||||
</if>
|
||||
<if test="manufacturer != null and manufacturer != ''">
|
||||
and a.manufacturer like concat ('%', #{manufacturer}, '%')
|
||||
</if>
|
||||
<if test="model != null and model != ''">
|
||||
and a.model like concat ('%', #{model}, '%')
|
||||
<if test="partModel != null and partModel != ''">
|
||||
and a.part_model like concat ('%', #{partModel}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
@ -2,38 +2,89 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.TurbineMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.turbine_id, a.project_id, a.turbine_name, a.turbine_desc,
|
||||
a.manufacturer, a.model
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.TurbineResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from turbine a
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.TurbineListResp">
|
||||
SELECT
|
||||
t.turbine_id, t.project_id, p.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url
|
||||
FROM turbine t
|
||||
LEFT JOIN project p ON t.project_id = p.project_id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
# and (a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="turbineId != null and turbineId != ''">
|
||||
and a.turbine_id like concat ('%', #{turbineId}, '%')
|
||||
and (t.turbine_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or t.turbine_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and a.project_id like concat ('%', #{projectId}, '%')
|
||||
</if>
|
||||
<if test="turbineName != null and turbineName != ''">
|
||||
and a.turbine_name like concat ('%', #{turbineName}, '%')
|
||||
and t.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="turbineDesc != null and turbineDesc != ''">
|
||||
and a.turbine_desc like concat ('%', #{turbineDesc}, '%')
|
||||
and t.turbine_desc like concat ('%', #{turbineDesc}, '%')
|
||||
</if>
|
||||
<if test="manufacturer != null and manufacturer != ''">
|
||||
and a.manufacturer like concat ('%', #{manufacturer}, '%')
|
||||
and t.turbine_manufacturer like concat ('%', #{manufacturer}, '%')
|
||||
</if>
|
||||
<if test="model != null and model != ''">
|
||||
and a.model like concat ('%', #{model}, '%')
|
||||
and t.turbine_model like concat ('%', #{model}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<resultMap id="turbineInfoMap" type="com.dite.znpt.domain.vo.TurbineInfoResp">
|
||||
<id property="turbineId" column="turbine_id"></id>
|
||||
<result property="projectId" column="project_id"></result>
|
||||
<result property="projectName" column="project_name"></result>
|
||||
<result property="turbineName" column="turbine_name"></result>
|
||||
<result property="turbineCode" column="turbine_code"></result>
|
||||
<result property="turbineDesc" column="turbine_desc"></result>
|
||||
<result property="turbineManufacturer" column="turbine_manufacturer"></result>
|
||||
<result property="turbineModel" column="turbine_model"></result>
|
||||
<result property="turbineCoverUrl" column="turbine_coverUrl"></result>
|
||||
<collection property="partRespList" ofType="com.dite.znpt.domain.vo.PartResp">
|
||||
<id property="partId" column="part_id"></id>
|
||||
<result property="projectId" column="project_id"></result>
|
||||
<result property="projectName" column="project_name"></result>
|
||||
<result property="turbineId" column="turbine_id"></result>
|
||||
<result property="turbineName" column="turbine_name"></result>
|
||||
<result property="partName" column="part_name"></result>
|
||||
<result property="partCode" column="part_code"></result>
|
||||
<result property="partType" column="part_type"></result>
|
||||
<result property="partDesc" column="part_desc"></result>
|
||||
<result property="partManufacturer" column="part_manufacturer"></result>
|
||||
<result property="partModel" column="part_model"></result>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<select id="listTurbineInfo" resultMap="turbineInfoMap">
|
||||
SELECT
|
||||
t.turbine_id, t.project_id, pr.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url,
|
||||
pa.part_id, pa.part_name, pa.part_code, pa.part_type, pa.part_desc, pa.part_manufacturer, pa.part_model
|
||||
FROM turbine t
|
||||
LEFT JOIN project pr ON t.project_id = pr.project_id
|
||||
LEFT JOIN part pa ON t.turbine_id = pa.turbine_id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
and (t.turbine_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or t.turbine_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and t.project_id = #{projectId}
|
||||
</if>
|
||||
<if test="turbineDesc != null and turbineDesc != ''">
|
||||
and t.turbine_desc like concat ('%', #{turbineDesc}, '%')
|
||||
</if>
|
||||
<if test="turbineManufacturer != null and turbineManufacturer != ''">
|
||||
and t.turbine_manufacturer like concat ('%', #{manufacturer}, '%')
|
||||
</if>
|
||||
<if test="turbineModel != null and turbineModel != ''">
|
||||
and t.turbine_model like concat ('%', #{model}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getTurbineInfo" resultMap="turbineInfoMap">
|
||||
SELECT
|
||||
t.turbine_id, t.project_id, pr.project_name, t.turbine_name, t.turbine_code, t.turbine_desc, t.turbine_manufacturer, t.turbine_model, t.turbine_cover_url,
|
||||
pa.part_id, pa.part_name, pa.part_code, pa.part_type, pa.part_desc, pa.part_manufacturer, pa.part_model
|
||||
FROM turbine t
|
||||
LEFT JOIN project pr ON t.project_id = pr.project_id
|
||||
LEFT JOIN part pa ON t.turbine_id = pa.turbine_id
|
||||
WHERE t.turbine_id = #{turbineId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.dite.znpt.web.controller;
|
|||
|
||||
import com.dite.znpt.domain.Constants;
|
||||
import com.dite.znpt.domain.vo.PartListReq;
|
||||
import com.dite.znpt.domain.vo.PartListResp;
|
||||
import com.dite.znpt.domain.vo.PartReq;
|
||||
import com.dite.znpt.domain.vo.PartResp;
|
||||
import com.dite.znpt.domain.entity.PartEntity;
|
||||
import com.dite.znpt.service.PartService;
|
||||
|
@ -30,29 +32,35 @@ public class PartController {
|
|||
@Resource
|
||||
private PartService partService;
|
||||
|
||||
@ApiOperation(value = "获取列表", httpMethod = "GET")
|
||||
@ApiOperation(value = "分页获取部件列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<PartListResp> page(PartListReq partReq) {
|
||||
return PageResult.ok(partService.page(partReq));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取部件列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public PageResult<PartResp> list(PartListReq partReq) {
|
||||
return PageResult.ok(partService.selectList(partReq));
|
||||
public Result<List<PartListResp>> list(PartListReq partReq) {
|
||||
return Result.ok(partService.list(partReq));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据Id获取详细信息", httpMethod = "GET")
|
||||
@GetMapping("/{partId}")
|
||||
public Result<PartResp> getInfo(@PathVariable String partId) {
|
||||
return Result.ok(partService.selectById(partId));
|
||||
@GetMapping("/detail/{partId}")
|
||||
public Result<PartResp> detail(@PathVariable String partId) {
|
||||
return Result.ok(partService.detail(partId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public Result<Object> add(@RequestBody PartEntity part) {
|
||||
partService.saveData(part);
|
||||
public Result<Object> add(@RequestBody PartReq req) {
|
||||
partService.save(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改", httpMethod = "PUT")
|
||||
@PutMapping
|
||||
public Result<Object> edit(@RequestBody PartEntity part) {
|
||||
partService.updateData(part);
|
||||
@PutMapping("/{partId}")
|
||||
public Result<Object> edit(@PathVariable String partId, @RequestBody PartReq req) {
|
||||
partService.update(partId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
@ -63,14 +71,14 @@ public class PartController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出", httpMethod = "GET")
|
||||
@ApiOperation(value = "导出部件-需求待明确", httpMethod = "GET")
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel(name = "")
|
||||
public List<PartResp> export(PartListReq partReq) {
|
||||
return partService.selectList(partReq);
|
||||
@ResponseExcel(name = "部件")
|
||||
public List<PartListResp> export(PartListReq partReq) {
|
||||
return partService.list(partReq);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入", httpMethod = "POST")
|
||||
@ApiOperation(value = "导入部件-需求待明确", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public Result<Object> importData(@RequestExcel List<PartEntity> dataList, BindingResult bindingResult) {
|
||||
// JSR 303 校验通用校验获取失败的数据
|
||||
|
|
|
@ -2,10 +2,8 @@ package com.dite.znpt.web.controller;
|
|||
|
||||
|
||||
import com.dite.znpt.domain.Constants;
|
||||
import com.dite.znpt.domain.vo.TurbineListReq;
|
||||
import com.dite.znpt.domain.vo.TurbineResp;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import com.dite.znpt.domain.entity.TurbineEntity;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.service.TurbineService;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
|
@ -18,61 +16,78 @@ import org.springframework.validation.BindingResult;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
*/
|
||||
@Api(tags = "机组-项目关联")
|
||||
@Api(tags = "机组信息")
|
||||
@RestController
|
||||
@RequestMapping("/turbine")
|
||||
public class TurbineController {
|
||||
@Resource
|
||||
private TurbineService turbineService;
|
||||
|
||||
@ApiOperation(value = "获取机组-项目关联列表", httpMethod = "GET")
|
||||
@GetMapping({"/list", "/getByProjectId"})
|
||||
public PageResult<TurbineResp> list(TurbineListReq turbineReq) {
|
||||
return PageResult.ok(turbineService.selectList(turbineReq));
|
||||
@ApiOperation(value = "分页查询机组列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<TurbineListResp> page(TurbineListReq req) {
|
||||
return PageResult.ok(turbineService.page(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据机组-项目关联Id获取详细信息", httpMethod = "GET")
|
||||
@GetMapping("/{turbineCode}")
|
||||
public Result<TurbineResp> getInfo(@PathVariable String turbineCode) {
|
||||
return Result.ok(turbineService.selectById(turbineCode));
|
||||
@ApiOperation(value = "查询机组列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result<List<TurbineListResp>> list(TurbineListReq req) {
|
||||
return Result.ok(turbineService.list(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增机组-项目关联", httpMethod = "POST")
|
||||
@ApiOperation(value = "查询机组明细列表", httpMethod = "GET")
|
||||
@GetMapping("/list/info")
|
||||
public Result<List<TurbineInfoResp>> listInfo( TurbineListReq req) {
|
||||
return Result.ok(turbineService.listInfo(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取指定机组详情", httpMethod = "GET")
|
||||
@GetMapping("/detail/{turbineId}")
|
||||
public Result<TurbineResp> detail(@PathVariable String turbineId) {
|
||||
return Result.ok(turbineService.detail(turbineId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取指定机组明细详情", httpMethod = "GET")
|
||||
@GetMapping("/info/{turbineId}")
|
||||
public Result<TurbineInfoResp> info(@PathVariable String turbineId) {
|
||||
return Result.ok(turbineService.info(turbineId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增机组", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public Result<Object> add(@RequestBody TurbineEntity turbine) {
|
||||
turbineService.saveData(turbine);
|
||||
public Result<Object> add(@RequestBody TurbineReq req) {
|
||||
turbineService.save(req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改机组-项目关联", httpMethod = "PUT")
|
||||
@PutMapping
|
||||
public Result<Object> edit(@RequestBody TurbineEntity turbine) {
|
||||
turbineService.updateData(turbine);
|
||||
@ApiOperation(value = "修改机组", httpMethod = "PUT")
|
||||
@PutMapping("/{turbineId}")
|
||||
public Result edit(@PathVariable String turbineId, @RequestBody TurbineReq req) {
|
||||
turbineService.update(turbineId, req);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除机组-项目关联", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{turbineCode}")
|
||||
public Result<Object> remove(@PathVariable String turbineCode) {
|
||||
turbineService.deleteById(turbineCode);
|
||||
@ApiOperation(value = "删除机组", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{turbineId}")
|
||||
public Result<Object> remove(@PathVariable String turbineId) {
|
||||
turbineService.deleteById(turbineId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出机组-项目关联", httpMethod = "GET")
|
||||
@ApiOperation(value = "导出机组-需求待明确", httpMethod = "GET")
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel(name = "机组-项目关联")
|
||||
public List<TurbineResp> export(TurbineListReq turbineReq) {
|
||||
return turbineService.selectList(turbineReq);
|
||||
@ResponseExcel(name = "机组")
|
||||
public List<TurbineListResp> export(TurbineListReq turbineReq) {
|
||||
return turbineService.list(turbineReq);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入机组-项目关联", httpMethod = "POST")
|
||||
@ApiOperation(value = "导入机组-需求待明确", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public Result<Object> importData(@RequestExcel List<TurbineEntity> dataList, BindingResult bindingResult) {
|
||||
// JSR 303 校验通用校验获取失败的数据
|
||||
|
|
Loading…
Reference in New Issue