zhaothird

This commit is contained in:
redamancy-qian
2022-04-16 00:48:53 +08:00
parent 4bc2b41a38
commit f052bda831
42 changed files with 369 additions and 73 deletions

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@@ -48,7 +49,14 @@ public class CategoryController extends BaseController
public TableDataInfo list(Category category)
{
startPage();
List<Category> list = categoryService.selectCategoryList(category);
List<Category> list = new ArrayList<>();
if(category.getTenantName()== null || category.getTenantName()=="")
{
list = categoryService.selectCategoryList(category);
}else {
list = categoryService.selectCategoryList1(category);
}
return getDataTable(list);
}
@@ -58,9 +66,15 @@ public class CategoryController extends BaseController
@PreAuthorize("@ss.hasPermi('iot:category:list')")
@GetMapping("/shortlist")
@ApiOperation("分类简短列表")
public AjaxResult shortlist()
public AjaxResult shortlist(Category category)
{
List<IdAndName> list = categoryService.selectCategoryShortList();
List<IdAndName> list = new ArrayList<>();
if(category.getTenantName()==""||category.getTenantName()==null)
{
list = categoryService.selectCategoryShortList();
}else {
list = categoryService.selectCategoryShortList1(category);
}
return AjaxResult.success(list);
}

View File

@@ -18,6 +18,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
@@ -43,7 +44,16 @@ public class DeviceController extends BaseController
public TableDataInfo list(Device device)
{
startPage();
List<Device> list = deviceService.selectDeviceList(device);
List<Device> list = new ArrayList<>();
if(device.getUserName()==null || device.getUserName()=="" )
{
list = deviceService.selectDeviceList(device);
System.out.print("进入模糊查询");
}else {
// 精确查询
System.out.print("进入精准查询"+device.getUserName());
list = deviceService.selectDeviceList1(device);
}
return getDataTable(list);
}
@@ -56,7 +66,14 @@ public class DeviceController extends BaseController
public TableDataInfo shortList(Device device)
{
startPage();
List<DeviceShortOutput> list = deviceService.selectDeviceShortList(device);
List<DeviceShortOutput> list = new ArrayList<>();
if(device.getUserName()==null || device.getUserName()=="" )
{
list = deviceService.selectDeviceShortList(device);
}else {
// 精确查询
list = deviceService.selectDeviceShortList1(device);
}
return getDataTable(list);
}

View File

@@ -59,6 +59,7 @@ public class FirmwareController extends BaseController
public TableDataInfo list(Firmware firmware)
{
startPage();
System.out.print("租户名称"+firmware.getTenantName()+"hs");
List<Firmware> list = firmwareService.selectFirmwareList(firmware);
return getDataTable(list);
}

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@@ -49,7 +50,16 @@ public class GroupController extends BaseController
public TableDataInfo list(Group group)
{
startPage();
List<Group> list = groupService.selectGroupList(group);
List<Group> list = new ArrayList<>();
if(group.getUserName() == null || group.getUserName() == "")
{
// 搜索查询 ,mapper使用的是模糊查询
list = groupService.selectGroupList(group);
}else {
// 精准查询
list = groupService.selectGroupList1(group);
}
return getDataTable(list);
}

View File

@@ -17,6 +17,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
@@ -42,7 +43,13 @@ public class ProductController extends BaseController
public TableDataInfo list(Product product)
{
startPage();
List<Product> list = productService.selectProductList(product);
List<Product> list = new ArrayList<>();
if(product.getTenantName()=="" ||product.getTenantName()==null)
{
list = productService.selectProductList(product);
}else {
list = productService.selectProductList1(product);
}
return getDataTable(list);
}
@@ -52,9 +59,10 @@ public class ProductController extends BaseController
@PreAuthorize("@ss.hasPermi('iot:product:list')")
@GetMapping("/shortList")
@ApiOperation("产品简短列表")
public AjaxResult shortList()
public AjaxResult shortList(Product product)
{
List<IdAndName> list = productService.selectProductShortList();
List<IdAndName> list = productService.selectProductShortList();
return AjaxResult.success(list);
}

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
@@ -47,8 +48,14 @@ public class ThingsModelTemplateController extends BaseController
public TableDataInfo list(ThingsModelTemplate thingsModelTemplate)
{
startPage();
List<ThingsModelTemplate> list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
return getDataTable(list);
List<ThingsModelTemplate> list = new ArrayList<>();
if (thingsModelTemplate.getTenantName() == ""|| thingsModelTemplate.getTenantName() == null){
list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
}else{
// 精准查询
list = thingsModelTemplateService.selectThingsModelTemplateList1(thingsModelTemplate);
}
return getDataTable(list);
}
/**

View File

@@ -77,4 +77,8 @@ public interface CategoryMapper
* @return 结果
*/
public int productCountInCategorys(Long[] categoryIds);
// 精准查询
List<Category> selectCategoryList1(Category category);
List<IdAndName> selectCategoryShortList1(Category category);
}

View File

@@ -161,6 +161,10 @@ public interface DeviceMapper
* @return
*/
public int deleteDeviceGroupByDeviceIds(Long[] deviceIds);
// 查询简短设备列表
// 查询所有简短设备列表
List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName);
//精准查询
List<Device> selectDeviceList1(Device device);
List<DeviceShortOutput> selectDeviceShortList1(Device device);
}

View File

@@ -83,4 +83,7 @@ public interface GroupMapper
* @return
*/
public int deleteDeviceGroupByGroupIds(Long[] groupIds);
// 精准查询所有
List<Group> selectGroupList1(Group group);
}

View File

@@ -116,4 +116,6 @@ public interface ProductMapper
* @return 结果
*/
public int thingsCountInProduct(Long productId);
// 精准查询
List<Product> selectProductList1(Product product);
}

View File

@@ -68,4 +68,6 @@ public interface ThingsModelTemplateMapper
* @return 结果
*/
public int deleteThingsModelTemplateByTemplateIds(Long[] templateIds);
// 精准查询
List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate);
}

View File

@@ -68,4 +68,9 @@ public interface ICategoryService
* @return 结果
*/
public int deleteCategoryByCategoryId(Long categoryId);
// 精准查询
List<Category> selectCategoryList1(Category category);
List<IdAndName> selectCategoryShortList1(Category category);
}

View File

@@ -154,4 +154,10 @@ public interface IDeviceService
// 获取所有简短设备列表
List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName);
// 精准查询
List<Device> selectDeviceList1(Device device);
// 精准查询所有条件设备的简短信息
List<DeviceShortOutput> selectDeviceShortList1(Device device);
}

View File

@@ -74,4 +74,6 @@ public interface IGroupService
*/
public int deleteGroupByGroupId(Long groupId);
// 精准查询
List<Group> selectGroupList1(Group group);
}

View File

@@ -77,4 +77,7 @@ public interface IProductService
* @return 结果
*/
public int deleteProductByProductId(Long productId);
// 精准查询
List<Product> selectProductList1(Product product);
}

View File

@@ -58,4 +58,7 @@ public interface IThingsModelTemplateService
* @return 结果
*/
public int deleteThingsModelTemplateByTemplateId(Long templateId);
// 精准查询
List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate);
}

View File

@@ -97,6 +97,11 @@ public class CategoryServiceImpl implements ICategoryService
return categoryMapper.updateCategory(category);
}
@Override
public List<IdAndName> selectCategoryShortList1(Category category) {
return categoryMapper.selectCategoryShortList1(category);
}
/**
* 批量删除产品分类
*
@@ -127,4 +132,9 @@ public class CategoryServiceImpl implements ICategoryService
{
return categoryMapper.deleteCategoryByCategoryId(categoryId);
}
@Override
public List<Category> selectCategoryList1(Category category) {
return categoryMapper.selectCategoryList1(category);
}
}

View File

@@ -250,6 +250,12 @@ public class DeviceServiceImpl implements IDeviceService {
return deviceList;
}
// 精准查询所有条件的设备
@Override
public List<DeviceShortOutput> selectDeviceShortList1(Device device) {
return deviceMapper.selectDeviceShortList1(device);
}
/**
* Json物模型集合转换为对象中的分类集合
*
@@ -538,6 +544,11 @@ public class DeviceServiceImpl implements IDeviceService {
public List<DeviceAllShortOutput> selectAllDeviceShortList1(String userName) {
return deviceMapper.selectAllDeviceShortList1(userName);
}
// 精准查询
@Override
public List<Device> selectDeviceList1(Device device) {
return deviceMapper.selectDeviceList1(device);
}
/**

View File

@@ -139,4 +139,10 @@ public class GroupServiceImpl implements IGroupService
return groupMapper.deleteGroupByGroupId(groupId);
}
// 精准查询所有
@Override
public List<Group> selectGroupList1(Group group) {
return groupMapper.selectGroupList1(group);
}
}

View File

@@ -180,6 +180,7 @@ public class ProductServiceImpl implements IProductService
return AjaxResult.error("删除失败");
}
/**
* 删除产品信息
*
@@ -193,4 +194,9 @@ public class ProductServiceImpl implements IProductService
redisCache.deleteObject(tslPreKey+productId);
return productMapper.deleteProductByProductId(productId);
}
// 精准查询
@Override
public List<Product> selectProductList1(Product product) {
return productMapper.selectProductList1(product);
}
}

View File

@@ -108,4 +108,9 @@ public class ThingsModelTemplateServiceImpl implements IThingsModelTemplateServi
{
return thingsModelTemplateMapper.deleteThingsModelTemplateByTemplateId(templateId);
}
// 精准查询
@Override
public List<ThingsModelTemplate> selectThingsModelTemplateList1(ThingsModelTemplate thingsModelTemplate) {
return thingsModelTemplateMapper.selectThingsModelTemplateList1(thingsModelTemplate);
}
}

View File

@@ -34,12 +34,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by order_num
</select>
<select id="selectCategoryList1" parameterType="com.ruoyi.iot.domain.Category" resultMap="CategoryResult">
<include refid="selectCategoryVo"/>
<where>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
</where>
order by order_num
</select>
<select id="selectCategoryShortList" resultMap="CategoryShortResult">
select category_id, category_name
from iot_category
order by order_num
</select>
<select id="selectCategoryShortList1" resultMap="CategoryShortResult">
select category_id, category_name
from iot_category
<where>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
</where>
order by order_num
</select>
<select id="selectCategoryByCategoryId" parameterType="Long" resultMap="CategoryResult">
<include refid="selectCategoryVo"/>

View File

@@ -109,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow ,
is_custom_location, active_time,network_address,longitude,latitude from iot_device
<where>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
</where>
</select>
<select id="selectDeviceList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
@@ -129,6 +129,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by create_time desc
</select>
<select id="selectDeviceList1" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
<include refid="selectDeviceVo"/>
<where>
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name= #{userName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name= #{tenantName}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="status != null "> and status = #{status}</if>
<if test="networkAddress != null and networkAddress != ''"> and network_address = #{networkAddress} </if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
order by create_time desc
</select>
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
select device_id, device_name, product_name, user_name, serial_number, firmware_version, status,rssi,is_shadow ,
@@ -159,6 +176,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by create_time desc
</select>
<select id="selectDeviceShortList1" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceShortResult">
<include refid="selectDeviceShortVo"/>
<where>
<if test="deviceName != null and deviceName != ''"> and device_name = #{deviceName}</if>
<if test="productId != null "> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name = #{productName}</if>
<if test="userId != null "> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name=#{tenantName}</if>
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
<if test="status != null "> and status = #{status}</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
order by create_time desc
</select>
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
<include refid="selectDeviceVo"/>

View File

@@ -23,7 +23,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select firmware_id, firmware_name, product_id, product_name, tenant_id, tenant_name, is_sys, version, file_path, create_time, update_time, remark from iot_firmware
</sql>
<select id="selectFirmwareList" parameterType="com.ruoyi.iot.domain.Firmware" resultMap="FirmwareResult">
<include refid="selectFirmwareVo"/>
<where>

View File

@@ -31,6 +31,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by group_order
</select>
<select id="selectGroupList1" parameterType="com.ruoyi.iot.domain.Group" resultMap="GroupResult">
<include refid="selectGroupVo"/>
<where>
<if test="groupName != null and groupName != ''"> and group_name = #{groupName}</if>
<if test="userName != null and userName != ''"> and user_name = #{userName}</if>
</where>
order by group_order
</select>
<select id="selectGroupByGroupId" parameterType="Long" resultMap="GroupResult">
<include refid="selectGroupVo"/>

View File

@@ -51,10 +51,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by create_time desc
</select>
<select id="selectProductList1" parameterType="com.ruoyi.iot.domain.Product" resultMap="ProductResult">
<include refid="selectProductVo"/>
<where>
<if test="productName != null and productName != ''"> and product_name=#{productName}</if>
<if test="categoryId != null "> and category_id = #{categoryId}</if>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
<if test="isAuthorize != null "> and is_authorize = #{isAuthorize}</if>
<if test="status != null "> and status = #{status}</if>
<if test="deviceType != null "> and device_type = #{deviceType}</if>
<if test="networkMethod != null "> and network_method = #{networkMethod}</if>
</where>
order by create_time desc
</select>
<select id="selectProductShortList" parameterType="Long" resultMap="ProductShortResult">
select product_id,product_name from iot_product
where tenant_id=#{userId}
where tenant_id=#{userId} or is_sys = 1
order by create_time desc
</select>

View File

@@ -34,6 +34,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by create_time desc
</select>
<select id="selectThingsModelTemplateList1" parameterType="com.ruoyi.iot.domain.ThingsModelTemplate" resultMap="ThingsModelTemplateResult">
<include refid="selectThingsModelTemplateVo"/>
<where>
<if test="templateName != null and templateName != ''"> and template_name = #{templateName}</if>
<if test="type != null "> and type = #{type}</if>
<if test="specs != null and specs != ''"> and specs = #{specs}</if>
<if test="tenantName != null and tenantName != ''"> and create_by = #{tenantName} or is_sys = 1</if>
</where>
order by create_time desc
</select>
<select id="selectThingsModelTemplateByTemplateId" parameterType="Long" resultMap="ThingsModelTemplateResult">
<include refid="selectThingsModelTemplateVo"/>