提交修改

This commit is contained in:
LEED
2025-03-27 17:15:27 +08:00
parent 6a8cbff440
commit 988e68bdc7
47 changed files with 1051 additions and 255 deletions

View File

@@ -8,8 +8,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_name" />
<result property="modelName" column="model_name" />
<result property="proName" column="pro_name" />
<result property="standardId" column="standard_id" />
<result property="standardName" column="standard_name" />
<result property="useOrg" column="use_org" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
<result property="isSys" column="is_sys" />
@@ -27,11 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectCategoryVo">
select category_id, category_name,model_name, standard_id,standard_name,tenant_id, tenant_name, is_sys,order_num, create_time, update_time, remark from iot_category
select category_id, category_name, model_name, pro_name, standard_id,standard_name, use_org, tenant_id, tenant_name, is_sys,order_num, create_time, update_time, remark from iot_category
</sql>
<select id="selectCategoryList" parameterType="com.xinda.iot.domain.Category" resultMap="CategoryResult">
select c.category_id, c.category_name,c.model_name,c.standard_id,c.standard_name, c.tenant_id, c.tenant_name,
select c.category_id, c.category_name,c.model_name, c.pro_name, c.standard_id,c.standard_name,c.use_org, c.tenant_id, c.tenant_name,
c.is_sys,c.order_num, c.create_time, c.update_time, c.remark
from iot_category c
<where>
@@ -54,7 +56,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="categoryName != null and categoryName != ''"> and c.category_name like concat('%', #{categoryName}, '%')</if>
<if test="modelName != null and modelName != ''"> and c.model_name like concat('%', #{modelName}, '%')</if>
<if test="proName != null and proName != ''"> and c.pro_name like concat('%', #{proName}, '%')</if>
<if test="standardId != null and standardId != ''"> and (c.standard_id = #{standardId})</if>
<if test="useOrg != null and useOrg != ''"> and c.use_org like concat('%', #{useOrg}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and (c.tenant_id = #{tenantId} or c.is_sys = 1)</if>
</where>
order by order_num
@@ -85,7 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<if test="categoryName != null and categoryName != ''"> and c.category_name like concat('%', #{categoryName}, '%')</if>
<if test="modelName != null and modelName != ''"> and c.model_name like concat('%', #{modelName}, '%')</if>
<if test="proName != null and proName != ''"> and c.pro_name like concat('%', #{proName}, '%')</if>
<!-- <if test="standardId != null and standardId != ''"> and (m.standard_id = #{standardId})</if>-->
<if test="useOrg != null and useOrg != ''"> and c.use_org like concat('%', #{useOrg}, '%')</if>
<if test="tenantId != null and tenantId != ''"> and (c.tenant_id = #{tenantId} or c.is_sys = 1)</if>
</where>
order by order_num
@@ -101,8 +107,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">category_name,</if>
<if test="modelName != null and modelName != ''">model_name,</if>
<if test="proName != null and proName != ''">pro_name,</if>
<if test="standardId != null">standard_id,</if>
<if test="standardName != null and standardName != ''">standard_name,</if>
<if test="useOrg != null and useOrg != ''"> use_org,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
<if test="isSys != null">is_sys,</if>
@@ -116,8 +124,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
<if test="modelName != null and modelName != ''">#{modelName},</if>
<if test="proName != null and proName != ''">#{proName},</if>
<if test="standardId != null">#{standardId},</if>
<if test="standardName != null and standardName != ''">#{standardName},</if>
<if test="useOrg != null and useOrg != ''"> #{useOrg},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
<if test="isSys != null">#{isSys},</if>
@@ -135,8 +145,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="standardId != null">standard_id = #{standardId},</if>
<if test="standardName != null and standardName != ''">standard_name = #{standardName},</if>
<if test="useOrg != null and useOrg != ''"> use_org = #{useOrg},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
<if test="isSys != null">is_sys = #{isSys},</if>

View File

@@ -358,6 +358,7 @@
group by d.device_id,d.tenant_id
</select>
<select id="selectSerialNumberByProductId" parameterType="Long" resultType="String">
select serial_number
from iot_device
@@ -394,7 +395,7 @@
where device_id = #{deviceId}
</update>
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
<select id="selectDeviceGShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
@@ -413,7 +414,7 @@
<if test="groupId != null and groupId !=0 ">left join iot_device_group g on g.device_id=d.device_id</if>
<where>
and d.gw_dev_code is null and d.del_flag = '0'
<if test="groupId != null and groupId !=0 ">and d.group_id = #{groupId}</if>
<!-- <if test="groupId != null and groupId !=0 ">and d.group_id = #{groupId}</if>-->
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
</if>
<if test="productId != null ">and d.product_id = #{productId}</if>
@@ -425,10 +426,11 @@
<if test="gwDevCode != null and gwDevCode != ''">and d.gw_dev_code = #{gwDevCode}</if>
<if test="status != null ">and d.status = #{status}</if>
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
<if test="agenciesId == null">and d.agencies_id IS NULL</if>
<if test="agenciesId != null">and d.agencies_id = #{agenciesId}</if>
<!-- <if test="groupIdExclude != null">and d.group_id != #{groupIdExclude}</if>-->
<if test="groupIdExclude != null">and d.group_id != #{groupIdExclude}</if>
<if test="deptId != null and deptId != 0 and showChild != null and showChild">
<if test="deptId != null and deptId != 0 and showChild != null and showChild ">
and
( d.tenant_id in (SELECT u.user_id FROM sys_user u
join sys_dept de on u.dept_id = de.dept_id
@@ -450,6 +452,94 @@
order by d.create_time desc
</select>
<!-- <select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">-->
<!-- select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,-->
<!-- d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,-->
<!-- d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,-->
<!-- d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,-->
<!-- case-->
<!-- when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0-->
<!-- else 1-->
<!-- end as is_owner,-->
<!-- (select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,-->
<!-- p.protocol_code,p.transport,p.guid-->
<!-- from iot_device d-->
<!-- left join iot_product p on p.product_id=d.product_id-->
<!-- <if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>-->
<!-- <where>-->
<!-- and d.del_flag = '0'-->
<!-- <if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>-->
<!-- <if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>-->
<!-- <if test="productId != null "> and d.product_id = #{productId}</if>-->
<!-- <if test="deviceType != null "> and p.device_type = #{deviceType}</if>-->
<!-- <if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>-->
<!-- <if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>-->
<!-- <if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>-->
<!-- <if test="status != null "> and d.status = #{status}</if>-->
<!-- <if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>-->
<!--&lt;!&ndash; <if test="deptId != null and deptId != 0 and showChild != null and showChild">&ndash;&gt;-->
<!-- <if test="deptId != null and deptId != 0 ">-->
<!-- and-->
<!-- ( d.agencies_id in (SELECT u.dept_id FROM sys_user u-->
<!-- join sys_dept de on u.dept_id = de.dept_id-->
<!-- WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})-->
<!-- )-->
<!-- </if>-->
<!--&lt;!&ndash; <if test="deptId != null and deptId != 0 and showChild != null and !showChild">&ndash;&gt;-->
<!--&lt;!&ndash; and (&ndash;&gt;-->
<!--&lt;!&ndash; d.tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})&ndash;&gt;-->
<!--&lt;!&ndash; or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})&ndash;&gt;-->
<!--&lt;!&ndash; )&ndash;&gt;-->
<!--&lt;!&ndash; </if>&ndash;&gt;-->
<!-- <if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>-->
<!-- </where>-->
<!-- group by d.device_id,d.tenant_id-->
<!-- order by d.create_time desc-->
<!-- </select>-->
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
case
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
else 1
end as is_owner,
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
p.protocol_code,p.transport,p.guid
from iot_device d
left join iot_product p on p.product_id=d.product_id
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
<where>
and d.del_flag = '0'
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="productId != null "> and d.product_id = #{productId}</if>
<if test="deviceType != null "> and p.device_type = #{deviceType}</if>
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
<if test="deptId != null and deptId != 0 ">
and
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<!-- <if test="deptId != null and deptId != 0 and showChild != null and !showChild">-->
<!-- and (-->
<!-- d.agencies_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})-->
<!-- or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})-->
<!-- )-->
<!-- </if>-->
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.tenant_id
order by d.create_time desc
</select>
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
select d.device_id,
d.device_name,
@@ -502,6 +592,7 @@
(select count(distinct d.device_id,d.tenant_id)
from iot_device d
<where>
d.del_flag = '0'
<if test="deptId != null and deptId != 0">
and d.tenant_id in (SELECT u.user_id FROM sys_user u
join sys_dept de on u.dept_id = de.dept_id

View File

@@ -150,6 +150,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<delete id="cleanOperLog" parameterType="String">
delete from iot_function_log where serial_number = #{serialNumber}
</delete>
<update id="updateFuncLogBatch" parameterType="com.xinda.iot.domain.FunctionLog">
update iot_function_log l
set l.result_msg = #{resultMsg},

View File

@@ -10,6 +10,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="protocolCode" column="protocol_code"/>
<result property="categoryId" column="category_id" />
<result property="categoryName" column="category_name" />
<result property="modelName" column="model_name" />
<result property="proName" column="pro_name" />
<result property="useOrg" column="use_org" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
<result property="isSys" column="is_sys" />
@@ -37,12 +40,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectProductVo">
select product_id, product_name,protocol_code,transport, category_id, category_name, tenant_id, tenant_name, is_sys, is_authorize, mqtt_account,mqtt_password,mqtt_secret ,status, device_type, network_method, vertificate_method, create_time, update_time, img_url,remark,location_way,guid from iot_product
select product_id, product_name,protocol_code,transport, category_id, category_name, model_name, pro_name, use_org, tenant_id, tenant_name, is_sys, is_authorize, mqtt_account,mqtt_password,mqtt_secret ,status, device_type, network_method, vertificate_method, create_time, update_time, img_url,remark,location_way,guid from iot_product
</sql>
<select id="selectProductList" parameterType="com.xinda.iot.domain.Product" resultMap="ProductResult">
select p.product_id, p.product_name,p.protocol_code,p.transport, p.category_id,
p.category_name, p.tenant_id, p.tenant_name, p.is_sys, p.is_authorize,
p.category_name,p.model_name, p.pro_name, p.use_org, p.tenant_id, p.tenant_name, p.is_sys, p.is_authorize,
p.mqtt_account,p.mqtt_password,p.mqtt_secret ,p.status,p.device_type,
p.network_method, p.vertificate_method, p.create_time, p.update_time,
p.img_url,p.remark,p.guid,
@@ -52,27 +55,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
end as is_owner,
p.location_way from iot_product p
<where>
<if test="deptId != null and showSenior and !isAdmin">
and ( p.tenant_id = #{tenantId}
or (p.tenant_id in (
SELECT de.dept_user_id
FROM sys_dept de
WHERE FIND_IN_SET( de.dept_id,(
SELECT d.ancestors
FROM sys_dept d
WHERE d.dept_id = #{deptId} )
)
)
and p.is_sys = 0
)
)
</if>
<if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">
and p.tenant_id = #{tenantId}
</if>
<!-- <if test="deptId != null and showSenior and !isAdmin">-->
<!-- and ( p.tenant_id = #{tenantId}-->
<!-- or (p.tenant_id in (-->
<!-- SELECT de.dept_user_id-->
<!-- FROM sys_dept de-->
<!-- WHERE FIND_IN_SET( de.dept_id,(-->
<!-- SELECT d.ancestors-->
<!-- FROM sys_dept d-->
<!-- WHERE d.dept_id = #{deptId} )-->
<!-- )-->
<!-- )-->
<!-- and p.is_sys = 0-->
<!-- )-->
<!-- )-->
<!-- </if>-->
<!-- <if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">-->
<!-- and p.tenant_id = #{tenantId}-->
<!-- </if>-->
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
<if test="productNameExclude != null and productNameExclude != ''"> and p.product_name != #{productNameExclude}</if>
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
<if test="modelName != null and modelName != ''"> and p.model_name like concat('%', #{modelName}, '%')</if>
<if test="proName != null and proName != ''"> and p.pro_name like concat('%', #{proName}, '%')</if>
<if test="useOrg != null and useOrg != ''"> and p.use_org like concat('%', #{useOrg}, '%')</if>
<if test="status != null "> and p.status = #{status}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
</where>
@@ -118,6 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productName != null and productName != ''">product_name,</if>
<if test="categoryId != null">category_id,</if>
<if test="categoryName != null and categoryName != ''">category_name,</if>
<if test="modelName != null and modelName != ''">model_name,</if>
<if test="proName != null and proName != ''">pro_name,</if>
<if test="useOrg != null and useOrg != ''"> use_org,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
<if test="isSys != null">is_sys,</if>
@@ -145,6 +154,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productName != null and productName != ''">#{productName},</if>
<if test="categoryId != null">#{categoryId},</if>
<if test="categoryName != null and categoryName != ''">#{categoryName},</if>
<if test="modelName != null and modelName != ''">#{modelName},</if>
<if test="proName != null and proName != ''">#{proName},</if>
<if test="useOrg != null and useOrg != ''"> #{useOrg},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
<if test="isSys != null">#{isSys},</if>
@@ -176,6 +188,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productName != null and productName != ''">product_name = #{productName},</if>
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="categoryName != null and categoryName != ''">category_name = #{categoryName},</if>
<if test="modelName != null and modelName != ''">model_name = #{modelName},</if>
<if test="proName != null and proName != ''">pro_name = #{proName},</if>
<if test="useOrg != null and useOrg != ''"> use_org = #{useOrg},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
<if test="isSys != null">is_sys = #{isSys},</if>
@@ -297,7 +312,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTerminalUserProduct" resultType="com.xinda.iot.domain.Product">
select p.product_id, p.product_name,p.protocol_code,p.transport, p.category_id,
p.category_name, p.tenant_id, p.tenant_name, p.is_sys, p.is_authorize,
p.category_name,p.model_name, p.pro_name, p.tenant_id, p.tenant_name, p.is_sys, p.is_authorize,
p.mqtt_account,p.mqtt_password,p.mqtt_secret ,p.status,p.device_type,
p.network_method, p.vertificate_method, p.create_time, p.update_time,
p.img_url,p.remark

View File

@@ -85,6 +85,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where standard_id = #{standardId}
</select>
<select id="checkName" parameterType="String" resultType="java.lang.Boolean">
SELECT COUNT(*) > 0
FROM iot_standard
where standard_name = #{standardName}
</select>
<insert id="insertStandard" parameterType="com.xinda.iot.domain.Standard" useGeneratedKeys="true" keyProperty="standardId">
insert into iot_standard
<trim prefix="(" suffix=")" suffixOverrides=",">
@@ -141,10 +147,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<select id="productCountInStandards" parameterType="String" resultType="int">
select count(*) from iot_product where standard_id in
<foreach item="standardId" collection="array" open="(" separator="," close=")">
#{standardId}
</foreach>
</select>
</mapper>

View File

@@ -15,8 +15,10 @@
<result property="identifier" column="identifier"/>
<result property="type" column="type"/>
<result property="datatype" column="datatype"/>
<result property="places" column="places" />
<result property="formula" column="formula"/>
<result property="specs" column="specs"/>
<result property="isCalc" column="is_calc"/>
<result property="isChart" column="is_chart"/>
<result property="isSharePerm" column="is_share_perm"/>
<result property="isHistory" column="is_history"/>
@@ -56,8 +58,10 @@
identifier,
type,
datatype,
places,
formula,
specs,
is_calc,
is_chart,
is_share_perm,
is_history,
@@ -82,8 +86,8 @@
else m.model_name
end as model_name,
m.model_name as model_name_zh_cn, t.en_us as model_name_en_us,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.formula,
m.specs, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype,m.places, m.formula,
m.specs, m.is_calc, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.create_time, m.update_by, m.update_time, m.remark, m.is_readonly, m.model_order
from iot_things_model m
left join iot_things_model_translate t on m.model_id = t.id
@@ -94,6 +98,9 @@
<if test="type!=null and type==4 ">
and type in(1,2)
</if>
<if test="isCalc != null ">
and is_calc = #{isCalc}
</if>
<if test="isChart != null ">
and is_chart = #{isChart}
</if>
@@ -137,8 +144,8 @@
when #{language} = 'en-US' then t.en_us
else m.model_name
end as model_name,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.formula,
m.specs, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype,m.places, m.formula,
m.specs, m.is_calc, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.create_time, m.update_by, m.update_time, m.remark, m.is_readonly, m.model_order
from iot_things_model m
left join iot_things_model_translate t on m.model_id = t.id
@@ -155,8 +162,8 @@
when #{language} = 'en-US' then t.en_us
else m.model_name
end as model_name,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.formula,
m.specs, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype,m.places, m.formula,
m.specs,m.is_calc, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.create_time, m.update_by, m.update_time, m.remark, m.is_readonly, m.model_order
from iot_things_model m
left join iot_things_model_translate t on m.model_id = t.id
@@ -170,8 +177,8 @@
when #{language} = 'en-US' then t.en_us
else m.model_name
end as model_name,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.formula,
m.specs, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.product_id, m.product_name, m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype,m.places, m.formula,
m.specs,m.is_calc, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.is_app, m.del_flag, m.create_by,
m.create_time, m.update_by, m.update_time, m.remark, m.is_readonly, m.model_order
from iot_things_model m
left join iot_things_model_translate t on m.model_id = t.id
@@ -213,12 +220,16 @@
<if test="datatype != null and datatype != ''">
datatype,
</if>
<if test="places != null">places,</if>
<if test="formula != null">
formula,
</if>
<if test="specs != null and specs != ''">
specs,
</if>
<if test="isCalc != null">
is_calc,
</if>
<if test="isChart != null">
is_chart,
</if>
@@ -284,12 +295,16 @@
<if test="datatype != null and datatype != ''">
#{datatype},
</if>
<if test="places != null and places != ''">#{places},</if>
<if test="formula != null">
#{formula},
</if>
<if test="specs != null and specs != ''">
#{specs},
</if>
<if test="isCalc != null">
#{isCalc},
</if>
<if test="isChart != null">
#{isChart},
</if>
@@ -343,7 +358,9 @@
identifier,
type,
datatype,
places,
specs,
is_calc,
is_chart,
is_share_perm,
is_history,
@@ -352,16 +369,17 @@
is_readonly,
create_by,
create_time,
formula
formula,
model_order
)
VALUES
<foreach item="model" collection="list" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
#{model.modelName},#{model.productId},#{model.productName},#{model.tenantId},
#{model.tenantName},#{model.identifier},#{model.type},#{model.datatype},
#{model.specs},#{model.isChart},#{model.isSharePerm},#{model.isHistory},
#{model.tenantName},#{model.identifier},#{model.type},#{model.datatype},#{model.places},
#{model.specs},#{model.isCalc},#{model.isChart},#{model.isSharePerm},#{model.isHistory},
#{model.isMonitor},#{model.isApp},#{model.isReadonly},#{model.createBy},#{model.createTime},
#{model.formula}
#{model.formula},#{model.modelOrder}
</trim>
</foreach>
</insert>
@@ -393,12 +411,16 @@
<if test="datatype != null and datatype != ''">
datatype = #{datatype},
</if>
<if test="places != null and places != ''">places = #{places},</if>
<if test="formula != null">
formula = #{formula},
</if>
<if test="specs != null and specs != ''">
specs = #{specs},
</if>
<if test="isCalc != null">
is_calc = #{isCalc},
</if>
<if test="isChart != null">
is_chart = #{isChart},
</if>
@@ -458,6 +480,7 @@
<select id="selectThingsModelIsMonitor" parameterType="com.xinda.iot.model.ThingsModels.ThingsItems"
resultType="com.xinda.common.core.iot.response.IdentityAndName">
select m.is_monitor as isMonitor,
m.is_calc as isCalc,
m.is_chart as isChart,
m.is_share_perm as isSharePerm,
m.is_history as isHistory,

View File

@@ -14,7 +14,10 @@
<result property="identifier" column="identifier" />
<result property="type" column="type" />
<result property="datatype" column="datatype" />
<result property="places" column="places" />
<result property="specs" column="specs" />
<result property="isCalc" column="is_calc"/>
<result property="isChart" column="is_chart"/>
<result property="isSys" column="is_sys" />
<result property="isReadonly" column="is_readonly" />
<result property="isSharePerm" column="is_share_perm" />
@@ -32,42 +35,59 @@
</resultMap>
<sql id="selectThingsModelStandardVo">
select template_id, template_name, standard_id, standard_name, tenant_id, tenant_name, identifier, type, datatype, specs, is_sys, is_readonly, is_chart,is_share_perm, is_history, formula, del_flag, create_by, create_time, update_by, update_time, remark, model_order from iot_things_model_standard
select template_id, template_name, standard_id, standard_name, tenant_id, tenant_name, identifier, type, datatype, places, specs, is_calc,
is_chart, is_sys, is_readonly, is_share_perm, is_history, is_monitor, formula, del_flag, create_by, create_time, update_by, update_time, remark, model_order from iot_things_model_standard
</sql>
<select id="selectThingsModelStandardList" parameterType="com.xinda.iot.domain.ThingsModelStandard" resultMap="ThingsModelStandardResult">
select m.template_id,m.template_name,m.standard_id,m.standard_name,
m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.specs, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order, m.is_monitor
m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.places, m.specs, m.is_calc, m.is_chart, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history, m.is_monitor, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order
from iot_things_model_standard m
<where>
<if test="templateName != null and templateName != ''"> and m.template_name like concat('%', #{templateName}, '%')</if>
<if test="type != null "> and m.type = #{type}</if>
<if test="isCalc != null ">
and is_calc = #{isCalc}
</if>
<if test="isChart != null ">
and is_chart = #{isChart}
</if>
<if test="specs != null and specs != ''"> and m.specs = #{specs}</if>
<if test="tenantId != null and tenantId != ''"> and (m.tenant_id = #{tenantId} or m.is_sys = 1)</if>
<if test="standardId != null and standardId != ''"> and (m.standard_id = #{standardId})</if>
</where>
order by m.template_id desc, m.create_time desc
order by m.model_order ASC
</select>
<select id="checkUnique" parameterType="com.xinda.iot.domain.ThingsModelStandard" resultType="java.lang.Boolean">
SELECT COUNT(*) > 0
FROM iot_things_model_standard
<where>
standard_id = #{standardId} and identifier = #{identifier}
<if test="templateId != null and templateId != ''"> and template_id != #{templateId}</if>
</where>
</select>
<select id="selectModelListByStandardId" parameterType="Long" resultMap="ThingsModelStandardResult">
select m.template_id,m.template_name,m.standard_id,m.standard_name,
m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.specs, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order, m.is_monitor
m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.places,m.specs,m.is_calc, m.is_chart, m.is_share_perm, m.is_sys, m.is_readonly, m.is_history, m.is_monitor,m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order
from iot_things_model_standard m
<where>
m.standard_id = #{standardId}
</where>
order by m.template_id desc, m.create_time desc
order by m.model_order ASC
</select>
<select id="selectThingsModelStandardByTemplateId" resultMap="ThingsModelStandardResult">
select m.template_id,m.template_name, m.standard_id, m.standard_name,m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.specs, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order
select m.template_id,m.template_name, m.standard_id, m.standard_name,m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.places,m.specs, m.is_calc, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history,m.is_monitor, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order
from iot_things_model_standard m
where m.template_id = #{templateId}
</select>
<select id="selectThingsModelStandardByTemplateIds" resultMap="ThingsModelStandardResult">
select m.template_id, m.template_name, m.standard_id, m.standard_name,m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.specs, m.is_sys, m.is_readonly, m.is_chart, m.is_share_perm, m.is_history, m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order, m.is_monitor
select m.template_id, m.template_name, m.standard_id, m.standard_name,m.tenant_id, m.tenant_name, m.identifier, m.type, m.datatype, m.places, m.specs,m.is_calc, m.is_chart, m.is_sys, m.is_readonly, m.is_share_perm, m.is_history, m.is_monitor,m.formula, m.del_flag, m.create_by, m.create_time, m.update_by, m.update_time, m.remark, m.model_order
from iot_things_model_standard m
where m.template_id in
<foreach item="templateId" collection="templateIds" open="(" separator="," close=")">
@@ -86,10 +106,12 @@
<if test="identifier != null and identifier != ''">identifier,</if>
<if test="type != null">type,</if>
<if test="datatype != null and datatype != ''">datatype,</if>
<if test="places != null">places,</if>
<if test="specs != null and specs != ''">specs,</if>
<if test="isCalc != null">is_calc,</if>
<if test="isChart != null">is_chart,</if>
<if test="isSys != null">is_sys,</if>
<if test="isReadonly != null">is_readonly,</if>
<if test="isChart != null">is_chart,</if>
<if test="isSharePerm != null">is_share_perm,</if>
<if test="isHistory != null">is_history,</if>
<if test="isMonitor != null">is_monitor,</if>
@@ -112,10 +134,12 @@
<if test="identifier != null and identifier != ''">#{identifier},</if>
<if test="type != null">#{type},</if>
<if test="datatype != null and datatype != ''">#{datatype},</if>
<if test="places != null and places != ''">#{places},</if>
<if test="specs != null and specs != ''">#{specs},</if>
<if test="isCalc != null">#{isCalc},</if>
<if test="isChart != null"> #{isChart},</if>
<if test="isSys != null">#{isSys},</if>
<if test="isReadonly != null">#{isReadonly},</if>
<if test="isChart != null">#{isChart},</if>
<if test="isSharePerm != null">#{isSharePerm},</if>
<if test="isHistory != null">#{isHistory},</if>
<if test="isMonitor != null">#{isMonitor},</if>
@@ -142,10 +166,12 @@
<if test="identifier != null and identifier != ''">identifier = #{identifier},</if>
<if test="type != null">type = #{type},</if>
<if test="datatype != null and datatype != ''">datatype = #{datatype},</if>
<if test="places != null">places = #{places},</if>
<if test="specs != null and specs != ''">specs = #{specs},</if>
<if test="isCalc != null"> is_calc = #{isCalc},</if>
<if test="isChart != null">is_chart = #{isChart},</if>
<if test="isSys != null">is_sys = #{isSys},</if>
<if test="isReadonly != null">is_readonly = #{isReadonly},</if>
<if test="isChart != null">is_chart = #{isChart},</if>
<if test="isSharePerm != null">is_share_perm = #{isSharePerm},</if>
<if test="isHistory != null">is_history = #{isHistory},</if>
<if test="isMonitor != null">is_Monitor = #{isMonitor},</if>
@@ -157,6 +183,7 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="modelOrder != null">model_order = #{modelOrder},</if>
</trim>
where template_id = #{templateId}
</update>
@@ -165,6 +192,9 @@
delete from iot_things_model_standard where template_id = #{templateId}
</delete>
<delete id="deleteThingsModelStandardByStandardId" parameterType="Long">
delete from iot_things_model_standard where standard_id = #{standardId}
</delete>
<delete id="deleteThingsModelStandardByTemplateIds" parameterType="String">
delete from iot_things_model_standard where template_id in
@@ -183,7 +213,10 @@
identifier,
type,
datatype,
places,
specs,
is_calc,
is_chart,
is_sys,
is_readonly,
is_share_perm,
@@ -209,7 +242,10 @@
#{item.identifier},
#{item.type},
#{item.datatype},
#{item.places},
#{item.specs},
#{item.isCalc},
#{item.isChart},
#{item.isSys},
#{item.isReadonly},
#{item.isSharePerm},