forked from dyf/fys-Multi-tenant
设备类型管理
This commit is contained in:
@ -0,0 +1,19 @@
|
||||
<?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.fuyuanshen.equipment.mapper.DeviceTypeGrantsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.fuyuanshen.equipment.domain.DeviceTypeGrants">
|
||||
<id property="id" column="id" />
|
||||
<result property="deviceTypeId" column="device_type_id" />
|
||||
<result property="customerId" column="customer_id" />
|
||||
<result property="grantorCustomerId" column="grantor_customer_id" />
|
||||
<result property="grantedAt" column="granted_at" />
|
||||
<result property="assignmentId" column="assignment_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,device_type_id,customer_id,grantor_customer_id,granted_at,assignment_id
|
||||
</sql>
|
||||
</mapper>
|
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="com.fuyuanshen.equipment.mapper.DeviceTypeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.fuyuanshen.equipment.domain.DeviceType">
|
||||
<id column="id" property="id"/>
|
||||
<id column="grant_id" property="id"/>
|
||||
<result column="type_name" property="typeName"/>
|
||||
<result column="is_support_ble" property="isSupportBle"/>
|
||||
<result column="locate_mode" property="locateMode"/>
|
||||
@ -19,29 +19,27 @@
|
||||
, type_name, is_support_ble, locate_mode, network_way, create_by, update_by, create_time, update_time,communication_mode
|
||||
</sql>
|
||||
|
||||
|
||||
<!-- 查询所有设备类型 -->
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
SELECT DISTINCT dt.*
|
||||
SELECT DISTINCT dt.* ,dg.id AS grant_id ,dg.create_time AS Dcreate_time
|
||||
FROM device_type dt
|
||||
JOIN device_type_grants dg ON dt.id = dg.device_type_id
|
||||
<where>
|
||||
<if test="criteria.typeName != null and criteria.typeName.trim() != ''">
|
||||
and dt.type_name like concat('%', TRIM(#{criteria.typeName}), '%')
|
||||
</if>
|
||||
<if test="criteria.deviceTypeId != null">
|
||||
and dt.id = #{criteria.deviceTypeId}
|
||||
</if>
|
||||
<if test="criteria.customerId != null">
|
||||
and dt.owner_customer_id = #{criteria.customerId}
|
||||
and dg.customer_id = #{criteria.customerId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY dt.create_time DESC
|
||||
ORDER BY Dcreate_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 获取已经分配的设备类型 -->
|
||||
<select id="getAssignType" resultType="com.fuyuanshen.equipment.domain.DeviceType">
|
||||
SELECT *
|
||||
FROM device_type
|
||||
WHERE owner_customer_id = #{customerId} AND original_device_id = #{deviceType}
|
||||
WHERE owner_customer_id = #{customerId}
|
||||
AND original_device_id = #{deviceType}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user