企业端设备模块->操作规程,报修记录,维修记录,维修计划

This commit is contained in:
79493 2022-10-28 17:31:58 +08:00
parent 232159a99f
commit d233efcb55
23 changed files with 1375 additions and 73 deletions

View File

@ -0,0 +1,37 @@
package com.rzyc.mapper;
import com.rzyc.model.EntOperatingInstruction;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 操作规程 Mapper 接口
* </p>
*
* @author
* @since 2022-10-28
*/
@Repository
public interface EntOperatingInstructionMapper extends BaseMapper<EntOperatingInstruction> {
/**
* 查询操作规程
* @param name 规程名
* @return list
* */
List<EntOperatingInstruction>selectOperatingInstructions(String name);
/**
* 修改企业操作规程
* @param entOperatingInstruction 操作规程对象
* @return int
* */
int updateEntOperatingInstruction(@Param("data") EntOperatingInstruction entOperatingInstruction);
}

View File

@ -0,0 +1,26 @@
package com.rzyc.mapper;
import com.rzyc.model.EntRepairRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author
* @since 2022-10-28
*/
@Repository
public interface EntRepairRecordMapper extends BaseMapper<EntRepairRecord> {
/**
* 查询维修记录
* @return List<EntRepairRecord>
* */
List<EntRepairRecord>repairRecord();
}

View File

@ -0,0 +1,35 @@
package com.rzyc.mapper;
import com.rzyc.model.EntReportRepair;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author
* @since 2022-10-28
*/
@Repository
public interface EntReportRepairMapper extends BaseMapper<EntReportRepair> {
/**
* 查询报修列表
* @return list
* */
List<EntReportRepair>reportRecord();
/**
* 修改报修列表
* @return int
* @param entReportRepair 报修对象
* */
int updateReportRecord(@Param("data") EntReportRepair entReportRepair);
}

View File

@ -4,7 +4,6 @@ import com.github.pagehelper.Page;
import com.rzyc.bean.organization.dto.OrgBookTypesDto;
import com.rzyc.bean.organization.vo.BookTypesVo;
import com.rzyc.bean.organization.vo.OrgBookTypesVo;
import com.rzyc.config.PageOperation;
import com.rzyc.model.organization.OrgBookType;
import com.rzyc.model.organization.OrgBookTypeExample;
import org.apache.ibatis.annotations.Param;
@ -39,7 +38,6 @@ public interface OrgBookTypeMapper {
* @param orgBookTypesDto
* @return
*/
@PageOperation
public Page<OrgBookTypesVo> orgBookTypesManager(@Param("orgBookTypesDto") OrgBookTypesDto orgBookTypesDto);
/**

View File

@ -0,0 +1,110 @@
package com.rzyc.model;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 操作规程
* </p>
*
* @author
* @since 2022-10-28
*/
@TableName("ent_operating_instruction")
@ApiModel(value="EntOperatingInstruction对象", description="操作规程")
public class EntOperatingInstruction implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "操作规程id")
@TableField("op_instruction_id")
private String opInstructionId;
@ApiModelProperty(value = "操作规程名字")
@TableField("op_instruction_name")
private String opInstructionName;
@ApiModelProperty(value = "操作规程描述")
@TableField("op_instruction_description")
private String opInstructionDescription;
@TableField("create_by")
private String createBy;
@TableField("create_time")
private Date createTime;
@TableField("modify_by")
private String modifyBy;
@TableField("modify_time")
private Date modifyTime;
public String getOpInstructionId() {
return opInstructionId;
}
public void setOpInstructionId(String opInstructionId) {
this.opInstructionId = opInstructionId;
}
public String getOpInstructionName() {
return opInstructionName;
}
public void setOpInstructionName(String opInstructionName) {
this.opInstructionName = opInstructionName;
}
public String getOpInstructionDescription() {
return opInstructionDescription;
}
public void setOpInstructionDescription(String opInstructionDescription) {
this.opInstructionDescription = opInstructionDescription;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
@Override
public String toString() {
return "EntOperatingInstruction{" +
"opInstructionId=" + opInstructionId +
", opInstructionName=" + opInstructionName +
", opInstructionDescription=" + opInstructionDescription +
", createBy=" + createBy +
", createTime=" + createTime +
", modifyBy=" + modifyBy +
", modifyTime=" + modifyTime +
"}";
}
}

View File

@ -0,0 +1,267 @@
package com.rzyc.model;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
*
* </p>
*
* @author
* @since 2022-10-28
*/
@TableName("ent_repair_record")
@ApiModel(value="EntRepairRecord对象", description="")
public class EntRepairRecord implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "维修记录")
@TableId("repair_record_id")
private String repairRecordId;
@TableField("device_id")
private String deviceId;
@ApiModelProperty(value = "维修Code")
@TableField("repair_code")
private String repairCode;
@ApiModelProperty(value = "送修时间")
@TableField("repair_time")
private Date repairTime;
@ApiModelProperty(value = "故障原因 1.自然磨损 2.违章操作 3.配件质量差 4.维护保养不到位 5.其他")
@TableField("cause_of_failure")
private Integer causeOfFailure;
@ApiModelProperty(value = "外委维修单位")
@TableField("external_maintenance_unit")
private String externalMaintenanceUnit;
@ApiModelProperty(value = "外委维修单位人员名称")
@TableField("external_maintenance_person_name")
private String externalMaintenancePersonName;
@ApiModelProperty(value = "1.正在维修 2.待采购件 3.待加工件 4.待停机维修 5.停机维修 6.无法修复 7.待转外委维修 8.已完成")
@TableField("repair_state")
private Integer repairState;
@ApiModelProperty(value = "维修开始时间")
@TableField("repair_start_time")
private Date repairStartTime;
@ApiModelProperty(value = "维修结束时间")
@TableField("repair_end_time")
private Date repairEndTime;
@ApiModelProperty(value = "1.常见故障维修 2.突发性故障维修 3.计划项目维修 4.不正当使用维修")
@TableField("repair_level")
private Integer repairLevel;
@ApiModelProperty(value = "1. 否 2.是")
@TableField("shutdown")
private Integer shutdown;
@ApiModelProperty(value = "停机时间")
@TableField("down_time")
private Double downTime;
@ApiModelProperty(value = "1.否 2.是")
@TableField("affected_generation")
private Integer affectedGeneration;
@ApiModelProperty(value = "维修花费")
@TableField("repair_cost")
private BigDecimal repairCost;
@ApiModelProperty(value = "工作描述")
@TableField("work_description")
private String workDescription;
@TableField("create_by")
private String createBy;
@TableField("create_time")
private Date createTime;
@TableField("modify_by")
private String modifyBy;
@TableField("modify_time")
private Date modifyTime;
public String getRepairRecordId() {
return repairRecordId;
}
public void setRepairRecordId(String repairRecordId) {
this.repairRecordId = repairRecordId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getRepairCode() {
return repairCode;
}
public void setRepairCode(String repairCode) {
this.repairCode = repairCode;
}
public Date getRepairTime() {
return repairTime;
}
public void setRepairTime(Date repairTime) {
this.repairTime = repairTime;
}
public Integer getCauseOfFailure() {
return causeOfFailure;
}
public void setCauseOfFailure(Integer causeOfFailure) {
this.causeOfFailure = causeOfFailure;
}
public String getExternalMaintenanceUnit() {
return externalMaintenanceUnit;
}
public void setExternalMaintenanceUnit(String externalMaintenanceUnit) {
this.externalMaintenanceUnit = externalMaintenanceUnit;
}
public String getExternalMaintenancePersonName() {
return externalMaintenancePersonName;
}
public void setExternalMaintenancePersonName(String externalMaintenancePersonName) {
this.externalMaintenancePersonName = externalMaintenancePersonName;
}
public Integer getRepairState() {
return repairState;
}
public void setRepairState(Integer repairState) {
this.repairState = repairState;
}
public Date getRepairStartTime() {
return repairStartTime;
}
public void setRepairStartTime(Date repairStartTime) {
this.repairStartTime = repairStartTime;
}
public Date getRepairEndTime() {
return repairEndTime;
}
public void setRepairEndTime(Date repairEndTime) {
this.repairEndTime = repairEndTime;
}
public Integer getRepairLevel() {
return repairLevel;
}
public void setRepairLevel(Integer repairLevel) {
this.repairLevel = repairLevel;
}
public Integer getShutdown() {
return shutdown;
}
public void setShutdown(Integer shutdown) {
this.shutdown = shutdown;
}
public Double getDownTime() {
return downTime;
}
public void setDownTime(Double downTime) {
this.downTime = downTime;
}
public Integer getAffectedGeneration() {
return affectedGeneration;
}
public void setAffectedGeneration(Integer affectedGeneration) {
this.affectedGeneration = affectedGeneration;
}
public BigDecimal getRepairCost() {
return repairCost;
}
public void setRepairCost(BigDecimal repairCost) {
this.repairCost = repairCost;
}
public String getWorkDescription() {
return workDescription;
}
public void setWorkDescription(String workDescription) {
this.workDescription = workDescription;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
@Override
public String toString() {
return "EntRepairRecord{" +
"repairRecordId=" + repairRecordId +
", deviceId=" + deviceId +
", repairCode=" + repairCode +
", repairTime=" + repairTime +
", causeOfFailure=" + causeOfFailure +
", externalMaintenanceUnit=" + externalMaintenanceUnit +
", externalMaintenancePersonName=" + externalMaintenancePersonName +
", repairState=" + repairState +
", repairStartTime=" + repairStartTime +
", repairEndTime=" + repairEndTime +
", repairLevel=" + repairLevel +
", shutdown=" + shutdown +
", downTime=" + downTime +
", affectedGeneration=" + affectedGeneration +
", repairCost=" + repairCost +
", workDescription=" + workDescription +
", createBy=" + createBy +
", createTime=" + createTime +
", modifyBy=" + modifyBy +
", modifyTime=" + modifyTime +
"}";
}
}

View File

@ -0,0 +1,146 @@
package com.rzyc.model;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
*
* </p>
*
* @author
* @since 2022-10-28
*/
@TableName("ent_report_repair")
@ApiModel(value="EntReportRepair对象", description="")
public class EntReportRepair implements Serializable {
private static final long serialVersionUID = 1L;
@TableId("report_repair_id")
private String reportRepairId;
@ApiModelProperty(value = "设备id")
@TableField("device_id")
private String deviceId;
@ApiModelProperty(value = "1.紧急 2.一般 3.其它")
@TableField("fault_level")
private Integer faultLevel;
@ApiModelProperty(value = "1.停机 2.带病运行 3.其它")
@TableField("device_state")
private Integer deviceState;
@ApiModelProperty(value = "报修人")
@TableField("report_repair_person")
private String reportRepairPerson;
@ApiModelProperty(value = "故障描述")
@TableField("report_description")
private String reportDescription;
@TableField("create_by")
private String createBy;
@TableField("create_time")
private Date createTime;
@TableField("modify_by")
private String modifyBy;
@TableField("modify_time")
private Date modifyTime;
public String getReportRepairId() {
return reportRepairId;
}
public void setReportRepairId(String reportRepairId) {
this.reportRepairId = reportRepairId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public Integer getFaultLevel() {
return faultLevel;
}
public void setFaultLevel(Integer faultLevel) {
this.faultLevel = faultLevel;
}
public Integer getDeviceState() {
return deviceState;
}
public void setDeviceState(Integer deviceState) {
this.deviceState = deviceState;
}
public String getReportRepairPerson() {
return reportRepairPerson;
}
public void setReportRepairPerson(String reportRepairPerson) {
this.reportRepairPerson = reportRepairPerson;
}
public String getReportDescription() {
return reportDescription;
}
public void setReportDescription(String reportDescription) {
this.reportDescription = reportDescription;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
@Override
public String toString() {
return "EntReportRepair{" +
"reportRepairId=" + reportRepairId +
", deviceId=" + deviceId +
", faultLevel=" + faultLevel +
", deviceState=" + deviceState +
", reportRepairPerson=" + reportRepairPerson +
", reportDescription=" + reportDescription +
", createBy=" + createBy +
", createTime=" + createTime +
", modifyBy=" + modifyBy +
", modifyTime=" + modifyTime +
"}";
}
}

View File

@ -0,0 +1,33 @@
package com.rzyc.model.dto;
public class OperatingInstructionDto {
private String name;
private Integer page;
private Integer pageSize;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,48 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 操作规程Dto
* @author Xuwanxin
* @date 2022/10/28
* */
@ApiModel(value="操作规程Dto", description="操作规程Dto")
public class OperatingInstructionsDto {
@ApiModelProperty(value = "操作规程id")
private String opInstructionId;
@ApiModelProperty(value = "操作规程名字")
private String opInstructionName;
@ApiModelProperty(value = "操作规程描述")
private String opInstructionDescription;
public String getOpInstructionId() {
return opInstructionId;
}
public void setOpInstructionId(String opInstructionId) {
this.opInstructionId = opInstructionId;
}
public String getOpInstructionName() {
return opInstructionName;
}
public void setOpInstructionName(String opInstructionName) {
this.opInstructionName = opInstructionName;
}
public String getOpInstructionDescription() {
return opInstructionDescription;
}
public void setOpInstructionDescription(String opInstructionDescription) {
this.opInstructionDescription = opInstructionDescription;
}
}

View File

@ -0,0 +1,81 @@
package com.rzyc.model.dto;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* 报修记录
* @author Xuwanxin
* @date 2022/10/28
* */
@ApiModel(value="报修记录Dto", description="报修记录Dto")
public class ReportRecordDto {
@ApiModelProperty(value = "主键")
private String reportRepairId;
@ApiModelProperty(value = "设备id")
private String deviceId;
@ApiModelProperty(value = "1.紧急 2.一般 3.其它")
private Integer faultLevel;
@ApiModelProperty(value = "1.停机 2.带病运行 3.其它")
private Integer deviceState;
@ApiModelProperty(value = "报修人")
private String reportRepairPerson;
@ApiModelProperty(value = "故障描述")
private String reportDescription;
public String getReportRepairId() {
return reportRepairId;
}
public void setReportRepairId(String reportRepairId) {
this.reportRepairId = reportRepairId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public Integer getFaultLevel() {
return faultLevel;
}
public void setFaultLevel(Integer faultLevel) {
this.faultLevel = faultLevel;
}
public Integer getDeviceState() {
return deviceState;
}
public void setDeviceState(Integer deviceState) {
this.deviceState = deviceState;
}
public String getReportRepairPerson() {
return reportRepairPerson;
}
public void setReportRepairPerson(String reportRepairPerson) {
this.reportRepairPerson = reportRepairPerson;
}
public String getReportDescription() {
return reportDescription;
}
public void setReportDescription(String reportDescription) {
this.reportDescription = reportDescription;
}
}

View File

@ -0,0 +1,32 @@
<?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.rzyc.mapper.EntOperatingInstructionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.EntOperatingInstruction">
<result column="op_instruction_id" property="opInstructionId" />
<result column="op_instruction_name" property="opInstructionName" />
<result column="op_instruction_description" property="opInstructionDescription" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="modify_by" property="modifyBy" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
op_instruction_id, op_instruction_name, op_instruction_description, create_by, create_time, modify_by, modify_time
</sql>
<select id="selectOperatingInstructions" resultMap="BaseResultMap">
select * from ent_operating_instruction
<if test="null != name and '' != name">
where op_instruction_name like concat('%',#{name},'%')
</if>
</select>
<update id="updateEntOperatingInstruction">
update ent_operating_instruction set op_instruction_name = #{data.opInstructionName},op_instruction_description = #{data.opInstructionDescription},modify_time = #{data.modifyTime},modify_by = #{data.modifyBy}
</update>
</mapper>

View File

@ -0,0 +1,38 @@
<?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.rzyc.mapper.EntRepairRecordMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.EntRepairRecord">
<id column="repair_record_id" property="repairRecordId" />
<result column="device_id" property="deviceId" />
<result column="repair_code" property="repairCode" />
<result column="repair_time" property="repairTime" />
<result column="cause_of_failure" property="causeOfFailure" />
<result column="external_maintenance_unit" property="externalMaintenanceUnit" />
<result column="external_maintenance_person_name" property="externalMaintenancePersonName" />
<result column="repair_state" property="repairState" />
<result column="repair_start_time" property="repairStartTime" />
<result column="repair_end_time" property="repairEndTime" />
<result column="repair_level" property="repairLevel" />
<result column="shutdown" property="shutdown" />
<result column="down_time" property="downTime" />
<result column="affected_generation" property="affectedGeneration" />
<result column="repair_cost" property="repairCost" />
<result column="work_description" property="workDescription" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="modify_by" property="modifyBy" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
repair_record_id, device_id, repair_code, repair_time, cause_of_failure, external_maintenance_unit, external_maintenance_person_name, repair_state, repair_start_time, repair_end_time, repair_level, shutdown, down_time, affected_generation, repair_cost, work_description, create_by, create_time, modify_by, modify_time
</sql>
<select id="repairRecord">
select * from ent_report_repair
</select>
</mapper>

View File

@ -0,0 +1,36 @@
<?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.rzyc.mapper.EntReportRepairMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.EntReportRepair">
<id column="report_repair_id" property="reportRepairId" />
<result column="device_id" property="deviceId" />
<result column="fault_level" property="faultLevel" />
<result column="device_state" property="deviceState" />
<result column="report_repair_person" property="reportRepairPerson" />
<result column="report_description" property="reportDescription" />
<result column="create_by" property="createBy" />
<result column="create_time" property="createTime" />
<result column="modify_by" property="modifyBy" />
<result column="modify_time" property="modifyTime" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
report_repair_id, device_id, fault_level, device_state, report_repair_person, report_description, create_by, create_time, modify_by, modify_time
</sql>
<select id="reportRecord" resultMap="BaseResultMap">
select * from ent_report_repair
</select>
<update id="updateReportRecord">
update ent_report_repair
set fault_level = #{data.faultLevel},device_state = #{data.deviceState},report_repair_person = #{data.report_repair_person} ,
report_description = #{data.reportDescription},modify_by = #{data.modifyBy},modify_time = #{data.modifyTime}
where report_repair_id = #{data.reportRepairId}
</update>
</mapper>

View File

@ -1,3 +1,4 @@
/*
package com.rzyc.advice;
import com.github.pagehelper.PageHelper;
@ -9,12 +10,14 @@ import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
*/
/**
* @Author jilin
* @Date 2021/11/09 11:57
* 分页aop
* 注解写在mapper上aop代理方式需为jdk代理cglib代理无法aop mapper
**/
**//*
@Aspect
@Component
public class PageAspect {
@ -32,3 +35,4 @@ public class PageAspect {
PageHelper.startPage((Integer) page.get(args[0]),(Integer) pageSize.get(args[0]));
}
}
*/

View File

@ -1,15 +1,19 @@
/*
package com.rzyc.advice;
import java.lang.annotation.*;
*/
/**
* @Author jilin
* @Date 2021/11/09 11:59
* 分页aop
**/
**//*
@Target({ElementType.PARAMETER, ElementType.METHOD})
@Retention(RetentionPolicy.CLASS)
@Documented
public @interface PageOperation {
String content() default "";
}
*/

View File

@ -0,0 +1,119 @@
package com.rzyc.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author jilin
* @Date 2021/11/09 11:57
* 分页aop
* 注解写在mapper上aop代理方式需为jdk代理cglib代理无法aop mapper
**/
@Aspect
@Component
public class PageAspect {
@Pointcut("@annotation(com.common.utils.pager.PageOperation)execution(* com.rzyc..*.*(..))")
public void page() {}
@Around("page()")
public Object pageOperation(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Object[] args = joinPoint.getArgs();
String[] paramNames = signature.getParameterNames();
//搜寻参数,设置分页参数
boolean isPage = setPageParams(args, paramNames);
Object proceed = joinPoint.proceed();
if (isPage){
Page page = (Page) proceed;
Pager pager = new Pager();
pager.setRows(page.getResult());
pager.setTotal(page.getTotal());
return packageData(pager);
}
return proceed;
}
private SingleResult packageData( Pager pager){
SingleResult singleResult = new SingleResult();
singleResult.setData(pager);
return singleResult;
}
/**
* 设置参数,返回是否分页
* @param args
* @param paramNames
* @throws Exception
*/
public boolean setPageParams(Object[] args,String[] paramNames) throws Exception {
Integer pageValue = null;
Integer pageSizeValue = null;
for (int i = 0; i < args.length; i++) {
Object arg = args[i];
//自定义对象
if (arg.getClass().getClassLoader()!=null){
if (List.class.isAssignableFrom(arg.getClass())||arg instanceof List){
continue;
}
JSONObject jsonObject = (JSONObject) JSON.toJSON(arg);
//获取page
pageValue= this.getPage(jsonObject);
//获取PageSize
pageSizeValue = this.getPageSize(jsonObject);
}else{
String paramName = paramNames[i];
if ("page".equals(paramName)){
if (arg instanceof Integer){
pageValue = (Integer) arg;
}else{
throw new Exception("page参数类型为:"+arg.getClass().getName());
}
}
if ("pageSize".equals(paramName)){
if (arg instanceof Integer){
pageSizeValue = (Integer) arg;
}else{
throw new Exception("page参数类型为:"+arg.getClass().getName());
}
}
}
}
if (pageValue!=null&&pageValue!=0&&pageSizeValue!=null&&pageSizeValue!=0){
PageHelper.startPage(pageValue,pageSizeValue);
return true;
}
return false;
}
public Integer getPage(JSONObject arg) throws Exception {
Integer page = null;
try{
page = arg.getInteger("page");
}catch (Exception e){
throw new Exception("page参数类型需为 Integer");
}
return page;
}
public Integer getPageSize(JSONObject arg) throws Exception {
Integer pageSize = null;
try{
pageSize = arg.getInteger("pageSize");
}catch (Exception e){
throw new Exception("pageSize参数类型需为 Integer");
}
return pageSize;
}
}

View File

@ -484,7 +484,7 @@ public class BaseController {
@Autowired
protected SparePartMapper sparePartMapper;
//企业巡查记录
//企业设备巡查记录
@Autowired
protected EntInsRecordMapper entInsRecordMapper;
@ -492,7 +492,7 @@ public class BaseController {
@Autowired
protected EntDeviceMaintenancePlanMapper entDeviceMaintenancePlanMapper;
//企业周期巡检
//企业设备周期巡检
@Autowired
protected EntDeviceInsCycleMapper entDeviceInsCycleMapper;
@ -501,15 +501,28 @@ public class BaseController {
protected EntDeviceMaintenanceRecordMapper entDeviceMaintenanceRecordMapper;
//企业送检记录
//企业设备送检记录
@Autowired
protected EntInspectionRecordMapper entInspectionRecordMapper;
//企业维修计划
//企业设备维修计划
@Autowired
protected EntRepairPlanMapper entRepairPlanMapper;
//企业设备维修记录
@Autowired
protected EntRepairRecordMapper entRepairRecordMapper;
//企业设备故障报修
@Autowired
protected EntReportRepairMapper entReportRepairMapper;
//企业设备操作规程
@Autowired
protected EntOperatingInstructionMapper entOperatingInstructionMapper;
/**

View File

@ -1,10 +1,14 @@
package com.rzyc.controller;
import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page;
import com.rzyc.config.MethodAnnotation;
import com.rzyc.model.EntDevice;
import com.rzyc.model.EntDeviceType;
import com.rzyc.model.EntOperatingInstruction;
import com.rzyc.model.dto.*;
import com.rzyc.service.PcBusinessService;
import io.swagger.annotations.Api;
@ -73,8 +77,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表")
@ResponseBody
public SingleResult<List<EntDevice>> entEquipmentList(@NotNull(message = "公司id不能为null") String enterpriseId, String typeId)throws Exception{
return pcBusinessService.entEquipmentList(enterpriseId,typeId);
public Object entEquipmentList(@NotNull(message = "公司id不能为null") String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entEquipmentList(enterpriseId,typeId,page,pageSize);
}
@ -134,13 +138,13 @@ public class EnterpriseEquipmentController extends BaseController {
@ApiOperation(value = "设备周期巡检", notes = "设备周期巡检")
@GetMapping(value = "/deviceInspectionCycle")
@PreAuthorize("hasAnyAuthority('deviceInspectionCycle','deviceInspectionCycle:update')")
@MethodAnnotation(authorizations = {"deviceInspectionCycle","deviceInspectionCycle:update'"},name = "设备维护周期")
@MethodAnnotation(authorizations = {"deviceInspectionCycle","deviceInspectionCycle:update"},name = "设备维护周期")
@ApiImplicitParams({
@ApiImplicitParam(name = "inspectionName", value = "巡检名", required = false, dataType = "string")
})
@ResponseBody
public SingleResult deviceInspectionCycle(String inspectionName)throws Exception{
return pcBusinessService.deviceInspectionCycle(inspectionName);
public Object deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.deviceInspectionCycle(inspectionName,page,pageSize);
}
@ -182,8 +186,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "设备巡检记录")
@ResponseBody
public SingleResult inspectionRecord(String inspectionRecordName)throws Exception{
return pcBusinessService.selectInspectionRecord(inspectionRecordName);
public Object inspectionRecord(String inspectionRecordName,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.selectInspectionRecord(inspectionRecordName,page,pageSize);
}
@ -198,8 +202,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('sparePartList','sparePartList:update')")
@MethodAnnotation(authorizations = {"sparePartList","sparePartList:update"},name = "备件列表")
@ResponseBody
public SingleResult sparePartList(String name)throws Exception{
return pcBusinessService.sparePartList(name);
public Object sparePartList(String name,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.sparePartList(name,page,pageSize);
}
@ -243,8 +247,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan','entDeviceMaintenancePlan:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenancePlan","entDeviceMaintenancePlan:update"},name = "保养计划列表")
@ResponseBody
public SingleResult entDeviceMaintenancePlan()throws Exception{
return pcBusinessService.entDeviceMaintenancePlan();
public Object entDeviceMaintenancePlan(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenancePlan(page,pageSize);
}
@ -276,8 +280,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord','entDeviceMaintenanceRecord:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord","entDeviceMaintenanceRecord:update"},name = "保养记录")
@ResponseBody
public SingleResult entDeviceMaintenanceRecord()throws Exception{
return pcBusinessService.entDeviceMaintenanceRecord();
public SingleResult entDeviceMaintenanceRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenanceRecord(page,pageSize);
}
@ -292,8 +296,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "送检记录")
@ResponseBody
public SingleResult inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime)throws Exception{
return pcBusinessService.inspectionRecord(startTime,endTime);
public Object inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.inspectionRecord(startTime,endTime,page,pageSize);
}
@ -323,8 +327,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('repairPlan','repairPlan:update')")
@MethodAnnotation(authorizations = {"repairPlan","repairPlan:update"},name = "维修计划")
@ResponseBody
public SingleResult repairPlan()throws Exception{
return pcBusinessService.repairPlan();
public Object repairPlan(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.repairPlan(page,pageSize);
}
/**
@ -354,8 +358,8 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('repairRecord','repairRecord:update')")
@MethodAnnotation(authorizations = {"repairRecord","repairRecord:update"},name = "维修记录")
@ResponseBody
public SingleResult repairRecord()throws Exception{
return pcBusinessService.repairRecord();
public Object repairRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.repairRecord(page,pageSize);
}
/**
@ -368,14 +372,55 @@ public class EnterpriseEquipmentController extends BaseController {
@PreAuthorize("hasAnyAuthority('reportRecord','reportRecord:update')")
@MethodAnnotation(authorizations = {"reportRecord","reportRecord:update"},name = "报修记录")
@ResponseBody
public SingleResult reportRecord()throws Exception{
return pcBusinessService.reportRecord();
public Object reportRecord(Integer page,Integer pageSize)throws Exception{
return pcBusinessService.reportRecord(page,pageSize);
}
/**
* 新增报修
* @throws Exception
**/
@ApiOperation(value = "新增报修", notes = "新增报修")
@PostMapping(value = "/addOrUpdateReportRecord")
@PreAuthorize("hasAnyAuthority('reportRecord:update')")
@MethodAnnotation(authorizations = {"reportRecord:update"},name = "新增报修")
@ResponseBody
public SingleResult addOrUpdateReportRecord(@RequestBody ReportRecordDto reportRecordDto)throws Exception{
return pcBusinessService.addOrUpdateReportRecord(reportRecordDto);
}
/**
* 设备安标
*
* */
/**
* 操作规程
*
* */
@ApiOperation(value = "操作规程", notes = "操作规程")
@GetMapping(value = "/operatingInstructions")
@PreAuthorize("hasAnyAuthority('operatingInstructions','operatingInstructions:update')")
@MethodAnnotation(authorizations = {"operatingInstructions","operatingInstructions:update"},name = "操作规程")
@ResponseBody
public Object operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{
return pcBusinessService.operatingInstructions(operatingInstructionDto);
}
/**
* 新增,修改操作规程
*
* */
@ApiOperation(value = "新增,修改操作规程", notes = "新增,修改操作规程")
@PostMapping(value = "/operatingInstructionsAddOrUpdate")
@PreAuthorize("hasAnyAuthority('operatingInstructions:update')")
@MethodAnnotation(authorizations = {"operatingInstructions:update"},name = "新增,修改操作规程")
@ResponseBody
public SingleResult operatingInstructionsAddOrUpdate(@RequestBody OperatingInstructionsDto operatingInstructionsDto)throws Exception{
return pcBusinessService.operatingInstructionsAddOrUpdate(operatingInstructionsDto);
}
}

View File

@ -6,7 +6,10 @@ import com.common.utils.*;
import com.common.utils.encryption.MD5;
import com.common.utils.model.Code;
import com.common.utils.model.Message;
import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page;
import com.rzyc.config.RedisUtil;
import com.rzyc.controller.BaseController;
import com.rzyc.enums.RedisKeys;
@ -301,11 +304,9 @@ public class PcBusinessService extends BaseController {
}
public SingleResult entEquipmentList(String enterpriseId, String typeId){
SingleResult singleResult = new SingleResult();
List<EntDevice> devices = entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId);
singleResult.setData(devices);
return singleResult;
public Object entEquipmentList(String enterpriseId, String typeId,Integer page,Integer pageSize){
Page<EntDevice> devices = (Page<EntDevice>) entDeviceMapper.selectEntEquipmentList(enterpriseId,typeId);
return devices;
}
public SingleResult entEquipmentStatistic(String enterpriseId, String deviceId){
@ -392,11 +393,9 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult deviceInspectionCycle(String inspectionName){
SingleResult singleResult = new SingleResult();
List<EntDeviceInsCycle>list = entDeviceInsCycleMapper.deviceInspectionCycle(inspectionName);
singleResult.setData(list);
return singleResult;
public Object deviceInspectionCycle(String inspectionName,Integer page,Integer pageSize){
Page<EntDeviceInsCycle>list = (Page<EntDeviceInsCycle>) entDeviceInsCycleMapper.deviceInspectionCycle(inspectionName);
return list;
}
public SingleResult addOrUpdateDeviceInspectionCycle(AddOrUpdateDeviceInspectionCycleDto addOrUpdateDeviceInspectionCycleDto){
@ -433,18 +432,14 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult selectInspectionRecord(String inspectionRecordName){
SingleResult singleResult = new SingleResult();
List<EntInsRecord> entInsRecords = entInsRecordMapper.selectInspectionRecord(inspectionRecordName);
singleResult.setData(entInsRecords);
return singleResult;
public Object selectInspectionRecord(String inspectionRecordName,Integer page,Integer pageSize){
Page<EntInsRecord> entInsRecords = (Page<EntInsRecord>) entInsRecordMapper.selectInspectionRecord(inspectionRecordName);
return entInsRecords;
}
public SingleResult sparePartList(String name){
SingleResult singleResult = new SingleResult();
List<SparePart>sparePartList = sparePartMapper.sparePartList(name);
singleResult.setData(sparePartList);
return singleResult;
public Object sparePartList(String name,Integer page,Integer pageSize){
Page<SparePart>sparePartList = (Page<SparePart>) sparePartMapper.sparePartList(name);
return sparePartList;
}
public SingleResult sparePartUpdate(SparePartDto sparePartDto){
@ -481,11 +476,9 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult entDeviceMaintenancePlan(){
SingleResult singleResult = new SingleResult();
List<EntDeviceMaintenancePlan> list = entDeviceMaintenancePlanMapper.selectEntDeviceMaintenancePlanList();
singleResult.setData(list);
return singleResult;
public Object entDeviceMaintenancePlan(Integer page,Integer pageSize){
Page<EntDeviceMaintenancePlan> list = (Page<EntDeviceMaintenancePlan>) entDeviceMaintenancePlanMapper.selectEntDeviceMaintenancePlanList();
return list;
}
public SingleResult entDeviceMaintenanceRecordUpdate(EntDeviceMaintenanceRecordDto entDeviceMaintenanceRecordDto){
@ -505,24 +498,20 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult entDeviceMaintenanceRecord(){
public SingleResult entDeviceMaintenanceRecord(Integer page,Integer pageSize){
SingleResult singleResult = new SingleResult();
List<EntDeviceMaintenanceRecord>list = entDeviceMaintenanceRecordMapper.selectEntDeviceMaintenanceRecord();
singleResult.setData(list);
return singleResult;
}
public SingleResult inspectionRecord(String startTime,String endTime){
SingleResult singleResult = new SingleResult();
List<EntInspectionRecord>inspectionRecords = entInspectionRecordMapper.selectInspectionRecord(startTime,endTime);
singleResult.setData(inspectionRecords);
return singleResult;
public Object inspectionRecord(String startTime,String endTime,Integer page,Integer pageSize){
Page<EntInspectionRecord>inspectionRecords = (Page<EntInspectionRecord>) entInspectionRecordMapper.selectInspectionRecord(startTime,endTime);
return inspectionRecords;
}
public SingleResult repairPlan(){
SingleResult singleResult = new SingleResult();
List<EntRepairPlan>entRepairPlans = entRepairPlanMapper.selectRepairPlan();
singleResult.setData(entRepairPlans);
return singleResult;
public Object repairPlan(Integer page,Integer pageSize){
Page<EntRepairPlan>entRepairPlans = (Page<EntRepairPlan>) entRepairPlanMapper.selectRepairPlan();
return entRepairPlans;
}
public SingleResult repairPlanUpdate(EntRepairPlanDto entRepairPlanDto){
@ -559,15 +548,56 @@ public class PcBusinessService extends BaseController {
return singleResult;
}
public SingleResult repairRecord(){
@PageOperation
public Object repairRecord(Integer page,Integer pageSize){
Page<EntRepairRecord> repairRecords = (Page<EntRepairRecord>) entRepairRecordMapper.repairRecord();
return repairRecords;
}
@PageOperation
public Object reportRecord(Integer page,Integer pageSize){
Page<EntReportRepair>reportRepairs = (Page<EntReportRepair>) entReportRepairMapper.reportRecord();
return reportRepairs;
}
public SingleResult addOrUpdateReportRecord(ReportRecordDto reportRecordDto){
SingleResult singleResult = new SingleResult();
//ent_repair_record
EntReportRepair entReportRepair = new EntReportRepair();
BeanUtils.copyProperties(reportRecordDto,entReportRepair);
int result = 0;
if (null != reportRecordDto && null != entReportRepair.getReportRepairId()){
entReportRepairMapper.updateReportRecord(entReportRepair);
}else {
entReportRepairMapper.insert(entReportRepair);
}
if (result != 1 ){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
return singleResult;
}
@PageOperation
public Object operatingInstructions(OperatingInstructionDto operatingInstructionDto){
Page<EntOperatingInstruction> page = (Page<EntOperatingInstruction>) entOperatingInstructionMapper.selectOperatingInstructions(operatingInstructionDto.getName());
return page;
}
public SingleResult reportRecord(){
public SingleResult operatingInstructionsAddOrUpdate(OperatingInstructionsDto operatingInstructionsDto){
SingleResult singleResult = new SingleResult();
EntOperatingInstruction entOperatingInstruction = new EntOperatingInstruction();
BeanUtils.copyProperties(operatingInstructionsDto,entOperatingInstruction);
int result = 0;
if (null != operatingInstructionsDto && null != entOperatingInstruction.getOpInstructionId()){
result = entOperatingInstructionMapper.updateEntOperatingInstruction(entOperatingInstruction);
}else {
result = entOperatingInstructionMapper.insert(entOperatingInstruction);
}
if (result != 1 ){
singleResult.setCode(Code.ERROR.getCode());
singleResult.setMessage(Message.ERROR);
}
return singleResult;
}

View File

@ -302,8 +302,18 @@
<artifactId>ooxml-schemas</artifactId>
<version>1.4</version>
</dependency>
<!-- 文档 end -->
<!--分页 start-->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.2</version>
<scope>compile</scope>
</dependency>
<!--分页 end-->
</dependencies>
<build>

View File

@ -1,4 +1,4 @@
package com.rzyc.config;
package com.common.utils.pager;
import java.lang.annotation.*;

View File

@ -0,0 +1,147 @@
package com.common.utils.pager;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import java.util.ArrayList;
import java.util.List;
/**
* 后台easyui要求格式
* @author hp
*
* @param <T>
*/
@JsonSerialize(using = PagerSerializer.class)
public class Pager<T> extends ArrayList<T>{
private Integer pageSize = 10;//每页显示多少条
private Integer page = 1;//当前页
private Long total = 0L;
private Integer redlevel; //红色企业数
private Integer orangelevel; //橙色企业数
private Integer yellowlevel; //黄色企业数
private Integer bluelevel; //蓝色企业数
private Integer totalDanger = 0;//总数
private Integer notRectify = 0;//未整改
private Integer rectify = 0;//整改中
private Integer rectifyComplete = 0;//已整改
private Integer unCheck = 0;//审核中
public Integer getUnCheck() {
return unCheck;
}
public void setUnCheck(Integer unCheck) {
this.unCheck = unCheck;
}
public Integer getTotalDanger() {
return totalDanger;
}
public void setTotalDanger(Integer totalDanger) {
this.totalDanger = totalDanger;
}
public Integer getNotRectify() {
return notRectify;
}
public void setNotRectify(Integer notRectify) {
this.notRectify = notRectify;
}
public Integer getRectify() {
return rectify;
}
public void setRectify(Integer rectify) {
this.rectify = rectify;
}
public Integer getRectifyComplete() {
return rectifyComplete;
}
public void setRectifyComplete(Integer rectifyComplete) {
this.rectifyComplete = rectifyComplete;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public Integer getPageSize() {
return pageSize==null?10:pageSize;
}
public void setPageSize(Integer pageSize) {
if(pageSize!=null&&pageSize>0){
this.pageSize = pageSize;
}
}
public Integer getPage() {
return page==null?1:page;
}
public void setPage(Integer page) {
if(page!=null&&page>0){
this.page = page;
}
}
public List<T> getRows() {
List<T> result = new ArrayList<>();
result.addAll(this);
return result;
}
public void setRows(List<T> rows) {
this.clear();
this.addAll(rows);
}
public Integer getRedlevel() {
return redlevel;
}
public void setRedlevel(Integer redlevel) {
this.redlevel = redlevel;
}
public Integer getOrangelevel() {
return orangelevel;
}
public void setOrangelevel(Integer orangelevel) {
this.orangelevel = orangelevel;
}
public Integer getYellowlevel() {
return yellowlevel;
}
public void setYellowlevel(Integer yellowlevel) {
this.yellowlevel = yellowlevel;
}
public Integer getBluelevel() {
return bluelevel;
}
public void setBluelevel(Integer bluelevel) {
this.bluelevel = bluelevel;
}
}

View File

@ -0,0 +1,43 @@
package com.common.utils.pager;
import com.alibaba.fastjson.JSONArray;
import com.common.utils.model.Pager;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.apache.poi.ss.formula.functions.T;
import java.io.IOException;
import java.lang.reflect.Field;
/**
* @author by jilin
* @version 1.0
* @date 2022-10-10-14:58
*/
public class PagerSerializer extends JsonSerializer<Pager<T>> {
@Override
public void serialize(Pager pager, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
Class clazz = pager.getClass();
jsonGenerator.writeStartObject();
for (Field field:clazz.getDeclaredFields()){
field.setAccessible(true);
Class<?> type = field.getType();
Object o = null;
try {
o = field.get(pager);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
ClassLoader classLoader = type.getClassLoader();
if (classLoader==null){
jsonGenerator.writeObjectField(field.getName(),o);
}else{
jsonGenerator.writeStringField(field.getName(), JSONArray.toJSONString(pager.getRows()));
}
}
jsonGenerator.writeObjectField("rows", pager.getRows());
jsonGenerator.writeEndObject();
}
}