过滤设备MAC

This commit is contained in:
墨大叔 2024-09-10 09:19:46 +08:00
parent eda9715196
commit 5284c604f7
6 changed files with 29 additions and 8 deletions

View File

@ -70,4 +70,7 @@ public class DeviceQuery extends Device {
@ApiModelProperty("是否过期") @ApiModelProperty("是否过期")
private Boolean isArrears; private Boolean isArrears;
@ApiModelProperty("MAC列表")
private List<String> macList;
} }

View File

@ -167,7 +167,7 @@ public interface DeviceMapper
/** /**
* 获取所有MAC * 获取所有MAC
*/ */
List<String> selectAllMac(); List<String> selectMacList(DeviceQuery query);
/** /**
* 查询一个 * 查询一个

View File

@ -73,6 +73,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="macList != null and macList.size() > 0">
and sd.mac in
<foreach collection="macList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
</if>
<if test="deleted == null">and sd.deleted = false</if> <if test="deleted == null">and sd.deleted = false</if>
<if test="deleted != null">and sd.deleted = #{deleted}</if> <if test="deleted != null">and sd.deleted = #{deleted}</if>
</sql> </sql>
@ -225,10 +231,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where sd.device_no = #{deviceNo} and sd.deleted = false where sd.device_no = #{deviceNo} and sd.deleted = false
</select> </select>
<select id="selectAllMac" resultType="java.lang.String"> <select id="selectMacList" resultType="java.lang.String">
select distinct mac select distinct sd.mac
from sm_device sd from sm_device sd
where sd.deleted = false <where>
<include refid="searchCondition"/>
</where>
</select> </select>
<select id="selectOne" resultMap="SmDeviceResult"> <select id="selectOne" resultMap="SmDeviceResult">

View File

@ -234,7 +234,7 @@ public interface DeviceService
/** /**
* 获取所有MAC * 获取所有MAC
*/ */
List<String> selectAllMac(); List<String> selectMacList(DeviceQuery query);
/** /**
* 查询一个 * 查询一个
@ -306,4 +306,5 @@ public interface DeviceService
* 电量归零并关闭订单 * 电量归零并关闭订单
*/ */
int resetEleWithBill(Long deviceId); int resetEleWithBill(Long deviceId);
} }

View File

@ -333,8 +333,8 @@ public class DeviceServiceImpl implements DeviceService
} }
@Override @Override
public List<String> selectAllMac() { public List<String> selectMacList(DeviceQuery query) {
return deviceMapper.selectAllMac(); return deviceMapper.selectMacList(query);
} }
@Override @Override

View File

@ -197,7 +197,16 @@ public class AppDeviceController extends BaseController {
@GetMapping("/listAllMac") @GetMapping("/listAllMac")
@DeviceAdminRequired @DeviceAdminRequired
public AjaxResult getAllMac() { public AjaxResult getAllMac() {
return success(smDeviceService.selectAllMac()); return success(smDeviceService.selectMacList(new DeviceQuery()));
}
@ApiOperation("管理员过滤已录入的设备MAC列表")
@DeviceAdminRequired
@GetMapping("/getExistMac/{mac}")
public AjaxResult getExistMac(@PathVariable @ApiParam("设备mac") List<String> mac) {
DeviceQuery query = new DeviceQuery();
query.setMacList(mac);
return success(smDeviceService.selectMacList(query));
} }
@ApiOperation("获取正在使用中的设备列表") @ApiOperation("获取正在使用中的设备列表")