mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
refactor(多数据源): 报错与关键字修改
This commit is contained in:
@@ -16,7 +16,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="serialNumber" column="serial_number" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="isMonitor" column="is_monitor" />
|
||||
<result property="mode" column="mode" />
|
||||
@@ -31,18 +31,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.fastbee.iot.model.HistoryModel" id="HistoryResult">
|
||||
<result property="value" column="log_value" />
|
||||
<result property="time" column="create_time" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceLogVo">
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identity, create_by, is_monitor,mode, user_id, user_name, tenant_id, tenant_name, create_time, remark from iot_device_log
|
||||
select log_id, log_type, log_value, device_id, device_name,serial_number, identify, create_by, is_monitor,mode, user_id, user_name, tenant_id, tenant_name, create_time, remark from iot_device_log
|
||||
</sql>
|
||||
|
||||
<select id="selectMonitorList" parameterType="com.fastbee.iot.domain.DeviceLog" resultMap="MonitorResult">
|
||||
select log_value, create_time from iot_device_log
|
||||
<where>
|
||||
<if test="1==1"> and is_monitor=1</if>
|
||||
<if test="identity != null and identity != ''"> and identity = #{identity}</if>
|
||||
<if test="identity != null and identity != ''"> and identify = #{identity}</if>
|
||||
<if test="deviceId != null and deviceId !=0"> and device_id = #{deviceId}</if>
|
||||
<if test="serialNumber != null and serialNumber !=''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="beginTime != null and beginTime != '' and endTime != null and endTime != ''"> and create_time between #{beginTime} and #{endTime}</if>
|
||||
@@ -96,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<insert id="saveBatch" parameterType="com.fastbee.iot.domain.DeviceLog">
|
||||
insert into iot_device_log (log_type,log_value,device_id,device_name,serial_number,identity,create_by,
|
||||
insert into iot_device_log (log_type,log_value,device_id,device_name,serial_number,identify,create_by,
|
||||
is_monitor,mode,create_time,remark,user_id,user_name,tenant_id,tenant_name,model_name)
|
||||
values
|
||||
<foreach collection="list" item="item" index="index" separator=",">
|
||||
@@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="deviceName != null and deviceName != ''">device_name = #{deviceName},</if>
|
||||
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
||||
<if test="identity != null">identity = #{identity},</if>
|
||||
<if test="identity != null">identify = #{identity},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="isMonitor != null">is_monitor = #{isMonitor},</if>
|
||||
<if test="mode != null">mode = #{mode},</if>
|
||||
|
||||
@@ -6,7 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<resultMap type="com.fastbee.iot.domain.EventLog" id="EventLogResult">
|
||||
<result property="logId" column="log_id" />
|
||||
<result property="identity" column="identity" />
|
||||
<result property="identity" column="identify" />
|
||||
<result property="modelName" column="model_name" />
|
||||
<result property="logType" column="log_type" />
|
||||
<result property="logValue" column="log_value" />
|
||||
@@ -25,13 +25,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEventLogVo">
|
||||
select log_id, identity, model_name, log_type, log_value, device_id, device_name, serial_number, is_monitor, mode, user_id, user_name, tenant_id, tenant_name, create_by, create_time, remark from iot_event_log
|
||||
select log_id, identify, model_name, log_type, log_value, device_id, device_name, serial_number, is_monitor, mode, user_id, user_name, tenant_id, tenant_name, create_by, create_time, remark from iot_event_log
|
||||
</sql>
|
||||
|
||||
<select id="selectEventLogList" parameterType="com.fastbee.iot.domain.EventLog" resultMap="EventLogResult">
|
||||
<include refid="selectEventLogVo"/>
|
||||
<where>
|
||||
<if test="identity != null and identity != ''"> and identity = #{identity}</if>
|
||||
<if test="identity != null and identity != ''"> and identify = #{identity}</if>
|
||||
<if test="modelName != null and modelName != ''"> and model_name like concat('%', #{modelName}, '%')</if>
|
||||
<if test="logType != null "> and log_type = #{logType}</if>
|
||||
<if test="logValue != null and logValue != ''"> and log_value = #{logValue}</if>
|
||||
@@ -62,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertEventLog" parameterType="com.fastbee.iot.domain.EventLog" useGeneratedKeys="true" keyProperty="logId">
|
||||
insert into iot_event_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="identity != null and identity != ''">identity,</if>
|
||||
<if test="identity != null and identity != ''">identify,</if>
|
||||
<if test="modelName != null">model_name,</if>
|
||||
<if test="logType != null">log_type,</if>
|
||||
<if test="logValue != null and logValue != ''">log_value,</if>
|
||||
@@ -100,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="com.fastbee.iot.domain.EventLog">
|
||||
insert into iot_event_log (identity,model_name,log_type,log_value,device_id,device_name,serial_number,is_monitor,mode,user_id,
|
||||
insert into iot_event_log (identify,model_name,log_type,log_value,device_id,device_name,serial_number,is_monitor,mode,user_id,
|
||||
user_name,tenant_id,tenant_name,create_by,create_time,remark)
|
||||
values
|
||||
<foreach collection="list" separator="," index="index" item="item">
|
||||
@@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateEventLog" parameterType="com.fastbee.iot.domain.EventLog">
|
||||
update iot_event_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="identity != null and identity != ''">identity = #{identity},</if>
|
||||
<if test="identity != null and identity != ''">identify = #{identity},</if>
|
||||
<if test="modelName != null">model_name = #{modelName},</if>
|
||||
<if test="logType != null">log_type = #{logType},</if>
|
||||
<if test="logValue != null and logValue != ''">log_value = #{logValue},</if>
|
||||
|
||||
@@ -21,17 +21,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="status" column="status" />
|
||||
<result property="errorMsg" column="error_msg" />
|
||||
<result property="operTime" column="oper_time" />
|
||||
<result property="costTime" column="cost_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectOperLogVo">
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time
|
||||
select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time
|
||||
from sys_oper_log
|
||||
</sql>
|
||||
|
||||
<insert id="insertOperlog" parameterType="SysOperLog">
|
||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
|
||||
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time)
|
||||
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, CURRENT_TIMESTAMP)
|
||||
</insert>
|
||||
|
||||
<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
|
||||
|
||||
@@ -908,7 +908,7 @@ CREATE TABLE "IOT_DEVICE_JOB"
|
||||
CREATE TABLE "IOT_DEVICE_LOG"
|
||||
(
|
||||
"LOG_ID" BIGINT IDENTITY(1,1) NOT NULL,
|
||||
"IDENTITY" VARCHAR(64) NOT NULL,
|
||||
"IDENTIFY" VARCHAR(64) NOT NULL,
|
||||
"MODEL_NAME" VARCHAR(255) NULL,
|
||||
"LOG_TYPE" TINYINT NOT NULL,
|
||||
"LOG_VALUE" VARCHAR(64) NOT NULL,
|
||||
@@ -962,7 +962,7 @@ CREATE TABLE "IOT_DEVICE_USER"
|
||||
CREATE TABLE "IOT_EVENT_LOG"
|
||||
(
|
||||
"LOG_ID" BIGINT IDENTITY(1,1) NOT NULL,
|
||||
"IDENTITY" VARCHAR(64) NOT NULL,
|
||||
"IDENTIFY" VARCHAR(64) NOT NULL,
|
||||
"MODEL_NAME" VARCHAR(255) NULL,
|
||||
"LOG_TYPE" TINYINT NOT NULL,
|
||||
"LOG_VALUE" VARCHAR(64) NOT NULL,
|
||||
|
||||
@@ -230,7 +230,7 @@ INSERT INTO `iot_device_job` VALUES (5, '告警定时触发', 'DEFAULT', '0 13 1
|
||||
DROP TABLE IF EXISTS `iot_device_log`;
|
||||
CREATE TABLE `iot_device_log` (
|
||||
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '设备监测信息ID',
|
||||
`identity` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识符',
|
||||
`identify` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识符',
|
||||
`model_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物模型名称',
|
||||
`log_type` tinyint(1) NOT NULL COMMENT '类型(1=属性上报,2=调用功能,3=事件上报,4=设备升级,5=设备上线,6=设备离线)',
|
||||
`log_value` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日志值',
|
||||
@@ -327,7 +327,7 @@ INSERT INTO `iot_device_user` VALUES (140, 1, 1, 'admin', '¥视频监控', '15
|
||||
DROP TABLE IF EXISTS `iot_event_log`;
|
||||
CREATE TABLE `iot_event_log` (
|
||||
`log_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '设备事件日志ID',
|
||||
`identity` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识符',
|
||||
`identify` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '标识符',
|
||||
`model_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物模型名称',
|
||||
`log_type` tinyint(1) NOT NULL COMMENT '类型(3=事件上报,5=设备上线,6=设备离线)',
|
||||
`log_value` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '日志值',
|
||||
|
||||
@@ -349,7 +349,7 @@ COMMIT;
|
||||
DROP TABLE IF EXISTS "public"."iot_device_log";
|
||||
CREATE TABLE "public"."iot_device_log" (
|
||||
"log_id" int8 NOT NULL,
|
||||
"identity" varchar(64) NOT NULL,
|
||||
"identify" varchar(64) NOT NULL,
|
||||
"model_name" varchar(255),
|
||||
"log_type" int2 NOT NULL,
|
||||
"log_value" varchar(64) NOT NULL,
|
||||
@@ -368,7 +368,7 @@ CREATE TABLE "public"."iot_device_log" (
|
||||
)
|
||||
;
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."log_id" IS '设备监测信息ID';
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."identity" IS '标识符';
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."identify" IS '标识符';
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."model_name" IS '物模型名称';
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."log_type" IS '类型(1=属性上报,2=调用功能,3=事件上报,4=设备升级,5=设备上线,6=设备离线)';
|
||||
COMMENT ON COLUMN "public"."iot_device_log"."log_value" IS '日志值';
|
||||
@@ -482,7 +482,7 @@ COMMIT;
|
||||
DROP TABLE IF EXISTS "public"."iot_event_log";
|
||||
CREATE TABLE "public"."iot_event_log" (
|
||||
"log_id" int8 NOT NULL,
|
||||
"identity" varchar(64) NOT NULL,
|
||||
"identify" varchar(64) NOT NULL,
|
||||
"model_name" varchar(255),
|
||||
"log_type" int2 NOT NULL,
|
||||
"log_value" varchar(64) NOT NULL,
|
||||
@@ -501,7 +501,7 @@ CREATE TABLE "public"."iot_event_log" (
|
||||
)
|
||||
;
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."log_id" IS '设备事件日志ID';
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."identity" IS '标识符';
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."identify" IS '标识符';
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."model_name" IS '物模型名称';
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."log_type" IS '类型(3=事件上报,5=设备上线,6=设备离线)';
|
||||
COMMENT ON COLUMN "public"."iot_event_log"."log_value" IS '日志值';
|
||||
|
||||
@@ -1093,7 +1093,7 @@ GO
|
||||
|
||||
CREATE TABLE [dbo].[iot_device_log] (
|
||||
[log_id] bigint NOT NULL,
|
||||
[identity] nvarchar(64) NOT NULL,
|
||||
[identify] nvarchar(64) NOT NULL,
|
||||
[model_name] nvarchar(255) NULL,
|
||||
[log_type] tinyint NOT NULL,
|
||||
[log_value] nvarchar(64) NOT NULL,
|
||||
@@ -1123,7 +1123,7 @@ EXEC sp_addextendedproperty
|
||||
'MS_Description', N'标识符',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'iot_device_log',
|
||||
'COLUMN', N'identity'
|
||||
'COLUMN', N'identify'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
@@ -1463,7 +1463,7 @@ GO
|
||||
|
||||
CREATE TABLE [dbo].[iot_event_log] (
|
||||
[log_id] bigint NOT NULL,
|
||||
[identity] nvarchar(64) NOT NULL,
|
||||
[identify] nvarchar(64) NOT NULL,
|
||||
[model_name] nvarchar(255) NULL,
|
||||
[log_type] tinyint NOT NULL,
|
||||
[log_value] nvarchar(64) NOT NULL,
|
||||
@@ -1493,7 +1493,7 @@ EXEC sp_addextendedproperty
|
||||
'MS_Description', N'标识符',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'iot_event_log',
|
||||
'COLUMN', N'identity'
|
||||
'COLUMN', N'identify'
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
|
||||
Reference in New Issue
Block a user