1. 根据mac号查询设备是否被绑定

This commit is contained in:
邱贞招 2024-04-07 13:54:28 +08:00
parent b24f2abc2d
commit 9c0da4a34e
8 changed files with 45 additions and 2 deletions

View File

@ -361,5 +361,14 @@ public class AppController extends BaseController
Boolean collection = asUserCollectionService.isCollection(plantId, userId); Boolean collection = asUserCollectionService.isCollection(plantId, userId);
return AjaxResult.success(collection); return AjaxResult.success(collection);
} }
/**
* 根据mac号查询设备是否被绑定
*/
@GetMapping("/device/isBand/{mac}")
public AjaxResult isBand(@PathVariable String mac)
{
Boolean isBand = asDeviceService.isBand(mac);
return AjaxResult.success(isBand);
}
} }

View File

@ -69,4 +69,12 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
* @return 结果 * @return 结果
*/ */
public int deleteAsDeviceByDeviceIds(Long[] deviceIds); public int deleteAsDeviceByDeviceIds(Long[] deviceIds);
/**
* 根据mac号查询设备是否被绑定
*
* @param mac 设备mac
* @return 结果
*/
int isBandByMac(String mac);
} }

View File

@ -94,6 +94,14 @@ public interface IAsDeviceService
*/ */
Boolean settingNetwork(Long deviceId); Boolean settingNetwork(Long deviceId);
/**
* 根据mac号查询设备是否被绑定
*
* @param mac 设备mac
* @return 结果
*/
Boolean isBand(String mac);
// /** // /**
// * 构建命令 // * 构建命令

View File

@ -358,4 +358,16 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
int i = asDeviceMapper.updateAsDevice(device); int i = asDeviceMapper.updateAsDevice(device);
return i>0; return i>0;
} }
/**
* 根据mac号查询设备是否被绑定
*
* @param mac 设备mac
* @return 结果
*/
@Override
public Boolean isBand(String mac) {
int i = asDeviceMapper.isBandByMac(mac);
return i>0;
}
} }

View File

@ -67,6 +67,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where mac = #{mac} where mac = #{mac}
</select> </select>
<select id="isBandByMac" resultType="java.lang.Integer">
select count(1) from as_device
where mac = #{mac} and user_id IS NOT NULL and is_network = 1
</select>
<insert id="insertAsDevice" parameterType="AsDevice" useGeneratedKeys="true" keyProperty="deviceId"> <insert id="insertAsDevice" parameterType="AsDevice" useGeneratedKeys="true" keyProperty="deviceId">
insert into as_device insert into as_device
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -23,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="isExist != null and isExist != ''"> and is_exist= #{isExist}</if> <if test="isExist != null and isExist != ''"> and is_exist= #{isExist}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectAsPlantAnalysisLogById" parameterType="Long" resultMap="AsPlantAnalysisLogResult"> <select id="selectAsPlantAnalysisLogById" parameterType="Long" resultMap="AsPlantAnalysisLogResult">

View File

@ -19,8 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAsPlantIdentifyLogList" parameterType="AsPlantIdentifyLog" resultMap="AsPlantIdentifyLogResult"> <select id="selectAsPlantIdentifyLogList" parameterType="AsPlantIdentifyLog" resultMap="AsPlantIdentifyLogResult">
<include refid="selectAsPlantIdentifyLogVo"/> <include refid="selectAsPlantIdentifyLogVo"/>
<where> order by create_time desc
</where>
</select> </select>
<select id="selectAsPlantIdentifyLogById" parameterType="Long" resultMap="AsPlantIdentifyLogResult"> <select id="selectAsPlantIdentifyLogById" parameterType="Long" resultMap="AsPlantIdentifyLogResult">

View File

@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="beam != null and beam != ''"> and beam like concat('%', #{beam}, '%')</if> <if test="beam != null and beam != ''"> and beam like concat('%', #{beam}, '%')</if>
<if test="sproutCycle != null and sproutCycle != ''"> and sprout_cycle = #{sproutCycle}</if> <if test="sproutCycle != null and sproutCycle != ''"> and sprout_cycle = #{sproutCycle}</if>
</where> </where>
order by create_time desc
</select> </select>
<select id="selectAsPlantByPlantId" parameterType="Long" resultMap="AsPlantResult"> <select id="selectAsPlantByPlantId" parameterType="Long" resultMap="AsPlantResult">