mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 08:25:53 +08:00
设备列表重复问题处理
This commit is contained in:
@@ -74,7 +74,7 @@ public class DeviceUserController extends BaseController
|
||||
/**
|
||||
* 新增设备用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:share')")
|
||||
@Log(title = "设备用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("添加设备用户")
|
||||
@@ -86,10 +86,10 @@ public class DeviceUserController extends BaseController
|
||||
/**
|
||||
* 新增多个设备用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:add')")
|
||||
@PreAuthorize("@ss.hasPermi('iot:device:share')")
|
||||
@Log(title = "设备用户", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/addDeviceUsers")
|
||||
@ApiOperation("添加设备用户")
|
||||
@ApiOperation("批量添加设备用户")
|
||||
public AjaxResult addDeviceUsers(@RequestBody List<DeviceUser> deviceUsers)
|
||||
{
|
||||
return toAjax(deviceUserService.insertDeviceUserList(deviceUsers));
|
||||
|
||||
@@ -61,7 +61,7 @@ public class DeviceUserServiceImpl implements IDeviceUserService
|
||||
public int insertDeviceUser(DeviceUser deviceUser)
|
||||
{
|
||||
List<DeviceUser> deviceUsers = selectDeviceUserList(deviceUser);
|
||||
if (!deviceUsers.isEmpty()) throw new RuntimeException("该用户已添加, 禁止重复添加");
|
||||
if (!deviceUsers.isEmpty()) { throw new RuntimeException("该用户已添加, 禁止重复添加");}
|
||||
deviceUser.setCreateTime(DateUtils.getNowDate());
|
||||
deviceUser.setIsOwner(0);
|
||||
SysUser sysUser = getLoginUser().getUser();
|
||||
|
||||
@@ -166,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="networkAddress != null and networkAddress != ''"> and d.network_address like concat('%', #{networkAddress}, '%')</if>
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
</where>
|
||||
group by d.device_id,d.user_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
@@ -179,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
|
||||
<if test="productId != null "> and d.product_id = #{productId}</if>
|
||||
</where>
|
||||
group by d.device_id,d.user_id
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
|
||||
@@ -210,6 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null "> and d.status = #{status}</if>
|
||||
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
|
||||
</where>
|
||||
group by d.device_id,d.user_id
|
||||
order by d.create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user