forked from dyf/fys-Multi-tenant
Merge remote-tracking branch 'origin/dyf-device'
This commit is contained in:
@ -0,0 +1,7 @@
|
||||
<?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.UserAppMapper">
|
||||
|
||||
</mapper>
|
@ -38,7 +38,7 @@
|
||||
|
||||
<!-- 分页查询设备 -->
|
||||
<select id="findAll" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
select d.* ,t.type_name
|
||||
select d.* , t.type_name
|
||||
FROM device d
|
||||
LEFT JOIN device_type t ON d.device_type = t.id
|
||||
<where>
|
||||
@ -52,22 +52,23 @@
|
||||
<if test="criteria.deviceImei != null">
|
||||
and d.device_imei = #{criteria.deviceImei}
|
||||
</if>
|
||||
<if test="criteria.deviceTypeId != null">
|
||||
and d.device_type = #{criteria.deviceTypeId}
|
||||
<if test="criteria.deviceType != null">
|
||||
and d.device_type = #{criteria.deviceType}
|
||||
</if>
|
||||
<if test="criteria.deviceStatus != null">
|
||||
-- and da.active = #{criteria.deviceStatus}
|
||||
and d.device_status = #{criteria.deviceStatus}
|
||||
</if>
|
||||
<if test="criteria.currentOwnerId != null">
|
||||
d.current_owner_id = #{criteria.currentOwnerId}
|
||||
and d.current_owner_id = #{criteria.currentOwnerId}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() != 0">
|
||||
and d.create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
<if test="criteria.params.beginTime != null and criteria.params.endTime != null">
|
||||
and d.create_time between #{criteria.params.beginTime} and #{criteria.params.endTime}
|
||||
</if>
|
||||
<if test="criteria.tenantId != null">
|
||||
AND tenant_id = #{criteria.tenantId}
|
||||
</if>
|
||||
</where>
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="findAllDevices" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
@ -100,4 +101,20 @@
|
||||
where d.binding_user_id = #{criteria.bindingUserId}
|
||||
</select>
|
||||
|
||||
<!-- 获取分配设备的客户 -->
|
||||
<select id="getAssignCustomer" resultType="com.fuyuanshen.equipment.domain.Device">
|
||||
SELECT *
|
||||
FROM device
|
||||
WHERE original_device_id = #{customerId}
|
||||
AND device_status = 1
|
||||
</select>
|
||||
|
||||
<!-- 获取设备链 -->
|
||||
<select id="findByOriginalDeviceId" resultType="com.fuyuanshen.equipment.domain.Device"
|
||||
parameterType="java.lang.Long">
|
||||
SELECT id, original_device_id
|
||||
FROM device
|
||||
WHERE original_device_id = #{originalDeviceId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -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,22 +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}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user