Commit 1cfaf2d2 by 杨林龙

1.22.0 完成设备分离报警

1 parent de2fb61b
package cn.com.glsx.stdinterface.modules.controller;
import cn.com.glsx.stdinterface.dto.DevSplitDTO;
import cn.com.glsx.stdinterface.modules.service.DevSplitService;
import cn.hutool.json.JSONUtil;
import com.glsx.plat.common.annotation.SysLog;
import com.glsx.plat.common.enums.OperateType;
import com.glsx.plat.core.web.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 设备分离报警 controller
*
* @author Yanglinlong
* @date 2023/7/19 16:20
*/
@Slf4j
@RestController
@RequestMapping(value = "/devsplit")
@Api(value = "设备分离报警", tags = {"设备分离报警"})
public class DevSplitController {
private final static String MODULE = "设备分离报警";
@Autowired
private DevSplitService devSplitService;
@PostMapping(value = "/save")
@SysLog(module = MODULE, value = "保存设备分离报警", action = OperateType.ADD)
@ApiOperation(value = "保存设备分离报警")
public R save(@RequestBody DevSplitDTO devSplitDTO) {
try {
log.info("保存设备分离报警===" + JSONUtil.toJsonStr(devSplitDTO));
devSplitService.saveDevsplit(devSplitDTO);
} catch (Exception e) {
return R.error();
}
return R.ok();
}
}
package cn.com.glsx.stdinterface.modules.converter;
import cn.com.glsx.stdinterface.dto.DevSplitDTO;
import cn.com.glsx.stdinterface.modules.entity.DevSplit;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 设备分离报警关系映射类
*
* @author yangll
*/
@Mapper
public interface DevSplitConverter {
DevSplitConverter INSTANCE = Mappers.getMapper(DevSplitConverter.class);
/**
* Dto 类转为 entity
*
* @param item dto
* @return
*/
DevSplit syncDto2Entity(DevSplitDTO item);
/**
* entity 类转为 Dto
*
* @param item entity
* @return
*/
DevSplitDTO syncEntity2Dto(DevSplit item);
}
package cn.com.glsx.stdinterface.modules.entity;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@Data
@Table(name = "t_dev_split")
public class DevSplit implements Serializable {
/**
* 主键
*/
@Id
private Integer id;
/**
* 车辆ID
*/
private Integer vid;
/**
* 车架号
*/
private String vin;
/**
* 是否分离 0=未分离 1=分离
*/
@Column(name = "split_flag")
private Byte splitFlag;
/**
* 设备分离报警推送时间
*/
@Column(name = "begin_time")
private Date beginTime;
/**
* 创建时间
*/
@Column(name = "created_date")
private Date createdDate;
/**
* 创建人用户id
*/
@Column(name = "created_by")
private Integer createdBy;
/**
* 更新时间
*/
@Column(name = "updated_date")
private Date updatedDate;
/**
* 更新人用户id
*/
@Column(name = "updated_by")
private Integer updatedBy;
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.stdinterface.modules.mapper;
import cn.com.glsx.stdinterface.modules.entity.DevSplit;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DevSplitMapper extends CommonBaseMapper<DevSplit> {
}
\ No newline at end of file \ No newline at end of file
package cn.com.glsx.stdinterface.modules.service;
import cn.com.glsx.stdinterface.dto.DevSplitDTO;
import cn.com.glsx.stdinterface.modules.converter.DevSplitConverter;
import cn.com.glsx.stdinterface.modules.entity.DevSplit;
import cn.com.glsx.stdinterface.modules.mapper.DevSplitMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* 设备分离报警 service
*
* @author Yanglinlong
* @date 2023/7/19 16:21
*/
@Slf4j
@Service
public class DevSplitService {
@Autowired
private DevSplitMapper devSplitMapper;
/**
* 保存设备分离报警
*
* @param devSplitDTO 设备分离报警
*/
public void saveDevsplit(DevSplitDTO devSplitDTO) {
DevSplit devSplit = DevSplitConverter.INSTANCE.syncDto2Entity(devSplitDTO);
devSplit.setCreatedDate(new Date());
devSplitMapper.insert(devSplit);
}
}
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
<!-- <table tableName="t_alarm_second_data" domainObjectName="AlarmSecondData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="t_alarm_second_data" domainObjectName="AlarmSecondData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!-- <table tableName="t_alarm_second_data_near_rel" domainObjectName="AlarmSecondDataNearRel" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="t_alarm_second_data_near_rel" domainObjectName="AlarmSecondDataNearRel" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<!-- <table tableName="t_alarm_warn_analyse" domainObjectName="AlarmWarnAnalyse" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> <!-- <table tableName="t_alarm_warn_analyse" domainObjectName="AlarmWarnAnalyse" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<table tableName="t_fake_offline_change_frequently" domainObjectName="FakeOfflineChangeFrequently" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> <!-- <table tableName="t_fake_offline_change_frequently" domainObjectName="FakeOfflineChangeFrequently" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>-->
<table tableName="t_dev_split" domainObjectName="DevSplit" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>
</context> </context>
</generatorConfiguration> </generatorConfiguration>
\ No newline at end of file \ No newline at end of file
<?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="cn.com.glsx.stdinterface.modules.mapper.DevSplitMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.stdinterface.modules.entity.DevSplit">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="vid" jdbcType="INTEGER" property="vid" />
<result column="vin" jdbcType="VARCHAR" property="vin" />
<result column="split_flag" jdbcType="TINYINT" property="splitFlag" />
<result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
<result column="created_date" jdbcType="TIMESTAMP" property="createdDate" />
<result column="created_by" jdbcType="INTEGER" property="createdBy" />
<result column="updated_date" jdbcType="TIMESTAMP" property="updatedDate" />
<result column="updated_by" jdbcType="INTEGER" property="updatedBy" />
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, vid, vin, split_flag, begin_time, created_date, created_by, updated_date, updated_by
</sql>
</mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!