map/das/src/main/resources/mapper/SysIotModelMapper.xml
2024-08-12 09:16:24 +08:00

74 lines
3.4 KiB
XML

<?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.das.modules.equipment.mapper.SysIotModelMapper">
<resultMap type="com.das.modules.equipment.domain.excel.SysIotModelServiceExcel" id="SysIotModelServiceMap">
<result property="iotModelName" column="iotModelName" jdbcType="VARCHAR"/>
<result property="serviceCode" column="service_code" jdbcType="VARCHAR"/>
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
<result property="serviceType" column="service_type" jdbcType="INTEGER"/>
<result property="porder" column="porder" jdbcType="INTEGER"/>
</resultMap>
<resultMap type="com.das.modules.equipment.domain.excel.SysIotModelFieldExcel" id="SysIotModelFieldMap">
<result property="iotModelName" column="iotModelName" jdbcType="VARCHAR"/>
<result property="attributeCode" column="attribute_code" jdbcType="VARCHAR"/>
<result property="attributeName" column="attribute_name" jdbcType="VARCHAR"/>
<result property="attributeType" column="attribute_type" jdbcType="INTEGER"/>
<result property="porder" column="porder" jdbcType="INTEGER"/>
</resultMap>
<resultMap type="com.das.modules.equipment.domain.vo.SysIotModelVo" id="SysIotModelMap">
<result property="iotModelName" column="iot_model_name" jdbcType="VARCHAR"/>
<result property="id" column="id" jdbcType="BIGINT"/>
<result property="objectType" column="object_type" jdbcType="INTEGER"/>
<result property="iotModelCode" column="iot_model_code" jdbcType="VARCHAR"/>
</resultMap>
<select id="queryFieldByModelId" resultMap="SysIotModelFieldMap">
select simf.*,sim.iot_model_name as iotModelName from sys_iot_model_field simf left join sys_iot_model sim on simf.iot_model_id = sim.id
where simf.iot_model_id = #{id}
</select>
<select id="queryServiceByModelId" resultMap="SysIotModelServiceMap">
select sims.*,sim.iot_model_name as iotModelName from sys_iot_model_service sims left join sys_iot_model sim on sims.iot_model_id = sim.id
where sims.iot_model_id = #{id}
</select>
<select id="queryIotModelIdByName" resultType="java.lang.Long">
select id from sys_iot_model where name = #{name}
</select>
<select id="getSysIotModelByType" resultMap="SysIotModelMap">
select * from sys_iot_model where object_type = #{objectType}
</select>
<select id="getIotModelFieldCode" resultType="java.lang.String">
select distinct attribute_code from sys_iot_model_field where attribute_type = #{objectType}
</select>
<select id="getIotModelServiceCode" resultType="java.lang.String">
select distinct service_code from sys_iot_model_service where service_type = #{objectType}
</select>
<select id="getAllIotModel" resultType="com.das.modules.equipment.domain.vo.IotModelFieldVo">
select sim.* from sys_iot_model sim
</select>
<select id="getIotModel" resultType="java.lang.String">
select sim.iot_model_code from sys_iot_model sim left join sys_equipment se on sim.id = se.iot_model_id
where se.id = #{id}
</select>
<select id="getAllIotModelField" resultType="java.lang.String">
select simf.attribute_code from sys_iot_model_field simf where simf.iot_model_id = #{id} order by simf.porder
</select>
</mapper>