mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 08:25:53 +08:00
后端多租户调整
This commit is contained in:
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.iot.model.IdAndName;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -49,15 +51,7 @@ public class CategoryController extends BaseController
|
||||
public TableDataInfo list(Category category)
|
||||
{
|
||||
startPage();
|
||||
List<Category> list = new ArrayList<>();
|
||||
if(category.getTenantName()== null || category.getTenantName()=="")
|
||||
{
|
||||
list = categoryService.selectCategoryList(category);
|
||||
}else {
|
||||
list = categoryService.selectCategoryListAccurate(category);
|
||||
}
|
||||
|
||||
return getDataTable(list);
|
||||
return getDataTable(categoryService.selectCategoryList(category));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,15 +44,7 @@ public class DeviceController extends BaseController
|
||||
public TableDataInfo list(Device device)
|
||||
{
|
||||
startPage();
|
||||
List<Device> list = new ArrayList<>();
|
||||
if(device.getUserId() == null)
|
||||
{
|
||||
list = deviceService.selectDeviceList(device);
|
||||
}else {
|
||||
// 精确查询
|
||||
list = deviceService.selectDeviceListAccurate(device);
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(deviceService.selectDeviceList(device));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,15 +56,7 @@ public class DeviceController extends BaseController
|
||||
public TableDataInfo shortList(Device device)
|
||||
{
|
||||
startPage();
|
||||
List<DeviceShortOutput> list = new ArrayList<>();
|
||||
if(device.getUserId() == null)
|
||||
{
|
||||
list = deviceService.selectDeviceShortList(device);
|
||||
}else {
|
||||
// 精确查询
|
||||
list = deviceService.selectDeviceShortListAccurate(device);
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(deviceService.selectDeviceShortList(device));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,9 +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);
|
||||
return getDataTable(firmwareService.selectFirmwareList(firmware));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,17 +50,7 @@ public class GroupController extends BaseController
|
||||
public TableDataInfo list(Group group)
|
||||
{
|
||||
startPage();
|
||||
List<Group> list = new ArrayList<>();
|
||||
if(group.getUserName() == null || group.getUserName().equals(""))
|
||||
{
|
||||
// 搜索查询 ,mapper使用的是模糊查询
|
||||
list = groupService.selectGroupList(group);
|
||||
|
||||
}else {
|
||||
// 精准查询
|
||||
list = groupService.selectGroupListAccurate(group);
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(groupService.selectGroupList(group));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,14 +43,7 @@ public class ProductController extends BaseController
|
||||
public TableDataInfo list(Product product)
|
||||
{
|
||||
startPage();
|
||||
List<Product> list = new ArrayList<>();
|
||||
if(product.getTenantName()=="" ||product.getTenantName()==null)
|
||||
{
|
||||
list = productService.selectProductList(product);
|
||||
}else {
|
||||
list = productService.selectProductListAccurate(product);
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(productService.selectProductList(product));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@@ -25,6 +27,8 @@ import com.ruoyi.iot.service.IThingsModelTemplateService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
import static com.ruoyi.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
/**
|
||||
* 通用物模型Controller
|
||||
*
|
||||
@@ -48,14 +52,7 @@ public class ThingsModelTemplateController extends BaseController
|
||||
public TableDataInfo list(ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
startPage();
|
||||
List<ThingsModelTemplate> list = new ArrayList<>();
|
||||
if (thingsModelTemplate.getTenantName().equals("")|| thingsModelTemplate.getTenantName() == null){
|
||||
list = thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate);
|
||||
}else{
|
||||
// 精准查询
|
||||
list = thingsModelTemplateService.selectThingsModelTemplateListAccurate(thingsModelTemplate);
|
||||
}
|
||||
return getDataTable(list);
|
||||
return getDataTable(thingsModelTemplateService.selectThingsModelTemplateList(thingsModelTemplate));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -77,8 +77,6 @@ public interface CategoryMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int productCountInCategorys(Long[] categoryIds);
|
||||
// 精准查询
|
||||
List<Category> selectCategoryListAccurate(Category category);
|
||||
|
||||
List<IdAndName> selectCategoryShortListAccurate(Category category);
|
||||
}
|
||||
|
||||
@@ -180,5 +180,4 @@ public interface DeviceMapper
|
||||
*/
|
||||
List<Device> selectDeviceListAccurate(Device device);
|
||||
|
||||
List<DeviceShortOutput> selectDeviceShortListAccurate(Device device);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,4 @@ public interface GroupMapper
|
||||
*/
|
||||
public int deleteDeviceGroupByGroupIds(Long[] groupIds);
|
||||
|
||||
// 精准查询所有
|
||||
List<Group> selectGroupListAccurate(Group group);
|
||||
}
|
||||
|
||||
@@ -116,6 +116,4 @@ public interface ProductMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int thingsCountInProduct(Long productId);
|
||||
// 精准查询
|
||||
List<Product> selectProductListAccurate(Product product);
|
||||
}
|
||||
|
||||
@@ -68,6 +68,5 @@ public interface ThingsModelTemplateMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteThingsModelTemplateByTemplateIds(Long[] templateIds);
|
||||
// 精准查询
|
||||
List<ThingsModelTemplate> selectThingsModelTemplateListAccurate(ThingsModelTemplate thingsModelTemplate);
|
||||
|
||||
}
|
||||
|
||||
@@ -69,8 +69,5 @@ public interface ICategoryService
|
||||
*/
|
||||
public int deleteCategoryByCategoryId(Long categoryId);
|
||||
|
||||
// 精准查询
|
||||
List<Category> selectCategoryListAccurate(Category category);
|
||||
|
||||
List<IdAndName> selectCategoryShortListAccurate(Category category);
|
||||
}
|
||||
|
||||
@@ -172,10 +172,4 @@ public interface IDeviceService
|
||||
*/
|
||||
List<Device> selectDeviceListAccurate(Device device);
|
||||
|
||||
/**
|
||||
* 精准查询所有条件设备的简短信息
|
||||
* @param device
|
||||
* @return
|
||||
*/
|
||||
List<DeviceShortOutput> selectDeviceShortListAccurate(Device device);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,4 @@ public interface IGroupService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteGroupByGroupId(Long groupId);
|
||||
|
||||
// 精准查询
|
||||
List<Group> selectGroupListAccurate(Group group);
|
||||
}
|
||||
|
||||
@@ -78,6 +78,4 @@ public interface IProductService
|
||||
*/
|
||||
public int deleteProductByProductId(Long productId);
|
||||
|
||||
// 精准查询
|
||||
List<Product> selectProductListAccurate(Product product);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,4 @@ public interface IThingsModelTemplateService
|
||||
*/
|
||||
public int deleteThingsModelTemplateByTemplateId(Long templateId);
|
||||
|
||||
// 精准查询
|
||||
List<ThingsModelTemplate> selectThingsModelTemplateListAccurate(ThingsModelTemplate thingsModelTemplate);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,12 @@ public class CategoryServiceImpl implements ICategoryService
|
||||
@Override
|
||||
public List<Category> selectCategoryList(Category category)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
category.setTenantId(user.getUserId());
|
||||
}
|
||||
return categoryMapper.selectCategoryList(category);
|
||||
}
|
||||
|
||||
@@ -132,9 +138,4 @@ public class CategoryServiceImpl implements ICategoryService
|
||||
{
|
||||
return categoryMapper.deleteCategoryByCategoryId(categoryId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Category> selectCategoryListAccurate(Category category) {
|
||||
return categoryMapper.selectCategoryListAccurate(category);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.ruoyi.iot.service.impl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
@@ -218,6 +219,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
*/
|
||||
@Override
|
||||
public List<Device> selectDeviceList(Device device) {
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
for(int i=0;i<roles.size();i++){
|
||||
if(roles.get(i).getRoleKey().equals("tenant")){
|
||||
// 租户查看产品下所有设备
|
||||
device.setTenantId(user.getUserId());
|
||||
}else if (roles.get(i).getRoleKey().equals("general")){
|
||||
// 用户查看自己设备
|
||||
device.setUserId(user.getUserId());
|
||||
}
|
||||
}
|
||||
return deviceMapper.selectDeviceList(device);
|
||||
}
|
||||
|
||||
@@ -241,6 +253,20 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
public List<DeviceShortOutput> selectDeviceShortList(Device device) {
|
||||
// TODO 关联设备用户表
|
||||
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
for(int i=0;i<roles.size();i++){
|
||||
if(roles.get(i).getRoleKey().equals("tenant")){
|
||||
// 租户查看产品下所有设备
|
||||
device.setTenantId(user.getUserId());
|
||||
break;
|
||||
}else if (roles.get(i).getRoleKey().equals("general")){
|
||||
// 用户查看自己设备
|
||||
device.setUserId(user.getUserId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<DeviceShortOutput> deviceList = deviceMapper.selectDeviceShortList(device);
|
||||
for (int i = 0; i < deviceList.size(); i++) {
|
||||
JSONObject thingsModelObject = JSONObject.parseObject(thingsModelService.getCacheThingsModelByProductId(deviceList.get(i).getProductId()));
|
||||
@@ -254,11 +280,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
// 精准查询所有条件的设备
|
||||
@Override
|
||||
public List<DeviceShortOutput> selectDeviceShortListAccurate(Device device) {
|
||||
return deviceMapper.selectDeviceShortListAccurate(device);
|
||||
}
|
||||
|
||||
/**
|
||||
* Json物模型集合转换为对象中的分类集合
|
||||
|
||||
@@ -46,6 +46,12 @@ public class FirmwareServiceImpl implements IFirmwareService
|
||||
@Override
|
||||
public List<Firmware> selectFirmwareList(Firmware firmware)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
firmware.setTenantId(user.getUserId());
|
||||
}
|
||||
return firmwareMapper.selectFirmwareList(firmware);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.ruoyi.iot.service.impl;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.SysRole;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.iot.domain.Group;
|
||||
@@ -63,6 +64,15 @@ public class GroupServiceImpl implements IGroupService
|
||||
@Override
|
||||
public List<Group> selectGroupList(Group group)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
for(int i=0;i<roles.size();i++){
|
||||
if (roles.get(i).getRoleKey().equals("general")){
|
||||
// 用户查看自己设备
|
||||
group.setUserId(user.getUserId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
return groupMapper.selectGroupList(group);
|
||||
}
|
||||
|
||||
@@ -140,9 +150,4 @@ public class GroupServiceImpl implements IGroupService
|
||||
return groupMapper.deleteGroupByGroupId(groupId);
|
||||
}
|
||||
|
||||
// 精准查询所有
|
||||
@Override
|
||||
public List<Group> selectGroupListAccurate(Group group) {
|
||||
return groupMapper.selectGroupListAccurate(group);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,12 @@ public class ProductServiceImpl implements IProductService
|
||||
@Override
|
||||
public List<Product> selectProductList(Product product)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
product.setTenantId(user.getUserId());
|
||||
}
|
||||
return productMapper.selectProductList(product);
|
||||
}
|
||||
|
||||
@@ -194,9 +200,4 @@ public class ProductServiceImpl implements IProductService
|
||||
redisCache.deleteObject(tslPreKey+productId);
|
||||
return productMapper.deleteProductByProductId(productId);
|
||||
}
|
||||
// 精准查询
|
||||
@Override
|
||||
public List<Product> selectProductListAccurate(Product product) {
|
||||
return productMapper.selectProductListAccurate(product);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,12 @@ public class ThingsModelTemplateServiceImpl implements IThingsModelTemplateServi
|
||||
@Override
|
||||
public List<ThingsModelTemplate> selectThingsModelTemplateList(ThingsModelTemplate thingsModelTemplate)
|
||||
{
|
||||
SysUser user = getLoginUser().getUser();
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
thingsModelTemplate.setTenantId(user.getUserId());
|
||||
}
|
||||
return thingsModelTemplateMapper.selectThingsModelTemplateList(thingsModelTemplate);
|
||||
}
|
||||
|
||||
@@ -108,9 +114,4 @@ public class ThingsModelTemplateServiceImpl implements IThingsModelTemplateServi
|
||||
{
|
||||
return thingsModelTemplateMapper.deleteThingsModelTemplateByTemplateId(templateId);
|
||||
}
|
||||
// 精准查询
|
||||
@Override
|
||||
public List<ThingsModelTemplate> selectThingsModelTemplateListAccurate(ThingsModelTemplate thingsModelTemplate) {
|
||||
return thingsModelTemplateMapper.selectThingsModelTemplateListAccurate(thingsModelTemplate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,17 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectCategoryVo"/>
|
||||
<where>
|
||||
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
<if test="isSys != null "> and is_sys = #{isSys}</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
<select id="selectCategoryListAccurate" 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>
|
||||
<if test="tenantId != null and tenantId != ''"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
</where>
|
||||
order by order_num
|
||||
</select>
|
||||
|
||||
@@ -121,7 +121,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantId != null "> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</if>
|
||||
<if test="serialNumber != null and serialNumber != ''"> and serial_number = #{serialNumber}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
@@ -131,24 +131,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceListAccurate" 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 ,
|
||||
is_custom_location, active_time,network_address,longitude,latitude from iot_device
|
||||
|
||||
@@ -28,8 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="firmwareName != null and firmwareName != ''"> and firmware_name like concat('%', #{firmwareName}, '%')</if>
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%') or is_sys = 1</if>
|
||||
<if test="isSys != null "> and is_sys = #{isSys}</if>
|
||||
<if test="tenantId != null and tenantId != ''"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@@ -28,14 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<where>
|
||||
<if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
|
||||
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
|
||||
</where>
|
||||
order by group_order
|
||||
</select>
|
||||
<select id="selectGroupListAccurate" 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>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
</where>
|
||||
order by group_order
|
||||
</select>
|
||||
|
||||
@@ -41,29 +41,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="categoryId != null "> and category_id = #{categoryId}</if>
|
||||
<if test="categoryName != null and categoryName != ''"> and category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="tenantName != null and tenantName != ''"> and tenant_name like concat('%', #{tenantName}, '%')</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="selectProductListAccurate" 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>
|
||||
<if test="tenantId != null and tenantId != 0"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@@ -31,16 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="specs != null and specs != ''"> and specs = #{specs}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="selectThingsModelTemplateListAccurate" 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>
|
||||
<if test="tenantId != null and tenantId != ''"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user