修改获取平台证书接口;创建设备操作日志表

This commit is contained in:
2024-12-30 14:32:03 +08:00
parent aa97a61285
commit d7cd539478
13 changed files with 674 additions and 148 deletions

View File

@ -0,0 +1,71 @@
package com.fastbee.iot.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.fastbee.common.annotation.Excel;
import com.fastbee.common.core.domain.BaseEntity;
/**
* 设备操作记录对象 ng_device_operation_records
*
* @author kerwincui
* @date 2024-12-30
*/
@ApiModel(value = "NgDeviceOperationRecords",description = "设备操作记录 ng_device_operation_records")
@Data
@EqualsAndHashCode(callSuper = true)
public class NgDeviceOperationRecords extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键自增 */
private Long id;
/** 用户id */
@Excel(name = "用户id")
@ApiModelProperty("用户id")
private Long userId;
/** 机构id */
@Excel(name = "机构id")
@ApiModelProperty("机构id")
private Long deptId;
/** 操作报文内容 */
@Excel(name = "操作报文内容")
@ApiModelProperty("操作报文内容")
private String operationMessage;
/** cmd的值如700110 */
@Excel(name = "cmd的值如700110")
@ApiModelProperty("cmd的值如700110")
private Long operationType;
/** 操作内容,如开阀/关阀 */
@Excel(name = "操作内容,如开阀/关阀")
@ApiModelProperty("操作内容,如开阀/关阀")
private String operationContent;
/** 操作时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
@ApiModelProperty("操作时间")
private Date operationTime;
/** 0=成功1=失败 */
@Excel(name = "0=成功1=失败")
@ApiModelProperty("0=成功1=失败")
private Integer operationResult;
/** 失败原因 */
@Excel(name = "失败原因")
@ApiModelProperty("失败原因")
private String failureReason;
}

View File

@ -0,0 +1,63 @@
package com.fastbee.iot.mapper;
import java.util.List;
import com.fastbee.iot.domain.NgDeviceOperationRecords;
import org.springframework.stereotype.Repository;
/**
* 设备操作记录Mapper接口
*
* @author kerwincui
* @date 2024-12-30
*/
@Repository
public interface NgDeviceOperationRecordsMapper
{
/**
* 查询设备操作记录
*
* @param id 设备操作记录主键
* @return 设备操作记录
*/
public NgDeviceOperationRecords selectNgDeviceOperationRecordsById(Long id);
/**
* 查询设备操作记录列表
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 设备操作记录集合
*/
public List<NgDeviceOperationRecords> selectNgDeviceOperationRecordsList(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 新增设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
public int insertNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 修改设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
public int updateNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 删除设备操作记录
*
* @param id 设备操作记录主键
* @return 结果
*/
public int deleteNgDeviceOperationRecordsById(Long id);
/**
* 批量删除设备操作记录
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteNgDeviceOperationRecordsByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.fastbee.iot.service;
import java.util.List;
import com.fastbee.iot.domain.NgDeviceOperationRecords;
/**
* 设备操作记录Service接口
*
* @author kerwincui
* @date 2024-12-30
*/
public interface INgDeviceOperationRecordsService
{
/**
* 查询设备操作记录
*
* @param id 设备操作记录主键
* @return 设备操作记录
*/
public NgDeviceOperationRecords selectNgDeviceOperationRecordsById(Long id);
/**
* 查询设备操作记录列表
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 设备操作记录集合
*/
public List<NgDeviceOperationRecords> selectNgDeviceOperationRecordsList(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 新增设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
public int insertNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 修改设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
public int updateNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords);
/**
* 批量删除设备操作记录
*
* @param ids 需要删除的设备操作记录主键集合
* @return 结果
*/
public int deleteNgDeviceOperationRecordsByIds(Long[] ids);
/**
* 删除设备操作记录信息
*
* @param id 设备操作记录主键
* @return 结果
*/
public int deleteNgDeviceOperationRecordsById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.fastbee.iot.service.impl;
import java.util.List;
import com.fastbee.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fastbee.iot.mapper.NgDeviceOperationRecordsMapper;
import com.fastbee.iot.domain.NgDeviceOperationRecords;
import com.fastbee.iot.service.INgDeviceOperationRecordsService;
/**
* 设备操作记录Service业务层处理
*
* @author kerwincui
* @date 2024-12-30
*/
@Service
public class NgDeviceOperationRecordsServiceImpl implements INgDeviceOperationRecordsService
{
@Autowired
private NgDeviceOperationRecordsMapper ngDeviceOperationRecordsMapper;
/**
* 查询设备操作记录
*
* @param id 设备操作记录主键
* @return 设备操作记录
*/
@Override
public NgDeviceOperationRecords selectNgDeviceOperationRecordsById(Long id)
{
return ngDeviceOperationRecordsMapper.selectNgDeviceOperationRecordsById(id);
}
/**
* 查询设备操作记录列表
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 设备操作记录
*/
@Override
public List<NgDeviceOperationRecords> selectNgDeviceOperationRecordsList(NgDeviceOperationRecords ngDeviceOperationRecords)
{
return ngDeviceOperationRecordsMapper.selectNgDeviceOperationRecordsList(ngDeviceOperationRecords);
}
/**
* 新增设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
@Override
public int insertNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords)
{
ngDeviceOperationRecords.setCreateTime(DateUtils.getNowDate());
return ngDeviceOperationRecordsMapper.insertNgDeviceOperationRecords(ngDeviceOperationRecords);
}
/**
* 修改设备操作记录
*
* @param ngDeviceOperationRecords 设备操作记录
* @return 结果
*/
@Override
public int updateNgDeviceOperationRecords(NgDeviceOperationRecords ngDeviceOperationRecords)
{
ngDeviceOperationRecords.setUpdateTime(DateUtils.getNowDate());
return ngDeviceOperationRecordsMapper.updateNgDeviceOperationRecords(ngDeviceOperationRecords);
}
/**
* 批量删除设备操作记录
*
* @param ids 需要删除的设备操作记录主键
* @return 结果
*/
@Override
public int deleteNgDeviceOperationRecordsByIds(Long[] ids)
{
return ngDeviceOperationRecordsMapper.deleteNgDeviceOperationRecordsByIds(ids);
}
/**
* 删除设备操作记录信息
*
* @param id 设备操作记录主键
* @return 结果
*/
@Override
public int deleteNgDeviceOperationRecordsById(Long id)
{
return ngDeviceOperationRecordsMapper.deleteNgDeviceOperationRecordsById(id);
}
}

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.fastbee.iot.mapper.NgDeviceOperationRecordsMapper">
<resultMap type="NgDeviceOperationRecords" id="NgDeviceOperationRecordsResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="operationMessage" column="operation_message" />
<result property="operationType" column="operation_type" />
<result property="operationContent" column="operation_content" />
<result property="operationTime" column="operation_time" />
<result property="operationResult" column="operation_result" />
<result property="failureReason" column="failure_reason" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectNgDeviceOperationRecordsVo">
select id, user_id, dept_id, operation_message, operation_type, operation_content, operation_time, operation_result, failure_reason, remark, create_time, update_time, create_by, update_by from ng_device_operation_records
</sql>
<select id="selectNgDeviceOperationRecordsList" parameterType="NgDeviceOperationRecords" resultMap="NgDeviceOperationRecordsResult">
<include refid="selectNgDeviceOperationRecordsVo"/>
<where>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="operationMessage != null and operationMessage != ''"> and operation_message = #{operationMessage}</if>
<if test="operationType != null "> and operation_type = #{operationType}</if>
<if test="operationContent != null and operationContent != ''"> and operation_content = #{operationContent}</if>
<if test="operationTime != null "> and operation_time = #{operationTime}</if>
<if test="operationResult != null "> and operation_result = #{operationResult}</if>
<if test="failureReason != null and failureReason != ''"> and failure_reason = #{failureReason}</if>
</where>
</select>
<select id="selectNgDeviceOperationRecordsById" parameterType="Long" resultMap="NgDeviceOperationRecordsResult">
<include refid="selectNgDeviceOperationRecordsVo"/>
where id = #{id}
</select>
<insert id="insertNgDeviceOperationRecords" parameterType="NgDeviceOperationRecords" useGeneratedKeys="true" keyProperty="id">
insert into ng_device_operation_records
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="operationMessage != null">operation_message,</if>
<if test="operationType != null">operation_type,</if>
<if test="operationContent != null">operation_content,</if>
<if test="operationTime != null">operation_time,</if>
<if test="operationResult != null">operation_result,</if>
<if test="failureReason != null">failure_reason,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="operationMessage != null">#{operationMessage},</if>
<if test="operationType != null">#{operationType},</if>
<if test="operationContent != null">#{operationContent},</if>
<if test="operationTime != null">#{operationTime},</if>
<if test="operationResult != null">#{operationResult},</if>
<if test="failureReason != null">#{failureReason},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
<update id="updateNgDeviceOperationRecords" parameterType="NgDeviceOperationRecords">
update ng_device_operation_records
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="operationMessage != null">operation_message = #{operationMessage},</if>
<if test="operationType != null">operation_type = #{operationType},</if>
<if test="operationContent != null">operation_content = #{operationContent},</if>
<if test="operationTime != null">operation_time = #{operationTime},</if>
<if test="operationResult != null">operation_result = #{operationResult},</if>
<if test="failureReason != null">failure_reason = #{failureReason},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteNgDeviceOperationRecordsById" parameterType="Long">
delete from ng_device_operation_records where id = #{id}
</delete>
<delete id="deleteNgDeviceOperationRecordsByIds" parameterType="String">
delete from ng_device_operation_records where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>