|
|
|
@ -72,9 +72,6 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater |
|
|
|
|
|
|
|
@Override |
|
|
|
public QueryWrapper getWrapper(Map<String, Object> params){ |
|
|
|
QueryColumn is_default = column("is_default"); |
|
|
|
QueryColumn tenant_code = column("tenant_code"); |
|
|
|
|
|
|
|
QueryWrapper wrapper = new QueryWrapper(); |
|
|
|
wrapper.leftJoin("iot_visual_group").on("iot_visual_material.group_id = iot_visual_group.id"); |
|
|
|
|
|
|
|
@ -88,14 +85,14 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater |
|
|
|
} |
|
|
|
|
|
|
|
String type = (String) params.get("type"); |
|
|
|
wrapper.like("type", type,StringUtils.isNotBlank(type)); |
|
|
|
wrapper.like("iot_visual_material.type", type,StringUtils.isNotBlank(type)); |
|
|
|
String name = (String) params.get("name"); |
|
|
|
wrapper.like( "name", name,StringUtils.isNotBlank(name)); |
|
|
|
wrapper.like( "iot_visual_material.name", name,StringUtils.isNotBlank(name)); |
|
|
|
ArrayList ids = MapUtil.get(params, "ids",ArrayList.class); |
|
|
|
if (ObjectUtil.isNotNull(ids)&& !ids.isEmpty()) { |
|
|
|
wrapper.in("id", ids); |
|
|
|
wrapper.in("iot_visual_material.id", ids); |
|
|
|
} |
|
|
|
wrapper.and(is_default.eq(0).or(tenant_code.eq(UserContext.getTenantCode()))); |
|
|
|
wrapper.and("( iot_visual_material.is_default = 0 or iot_visual_material.tenant_code = "+UserContext.getTenantCode()+")"); |
|
|
|
wrapper.orderBy("iot_visual_group.sort,iot_visual_group.bs_sort,iot_visual_material.sort",true); |
|
|
|
return wrapper; |
|
|
|
} |
|
|
|
@ -200,7 +197,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater |
|
|
|
public Result saveBatch(IotVisualMaterialDTO[] dtos) { |
|
|
|
try { |
|
|
|
for (IotVisualMaterialDTO dto : dtos) { |
|
|
|
this.saveIotSourceMaterialDTO(dto); |
|
|
|
this.saveIotSourceMaterialDTO(dto); |
|
|
|
} |
|
|
|
} catch (SysException e) { |
|
|
|
return new Result().error("批量新增失败"); |
|
|
|
@ -214,7 +211,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater |
|
|
|
QueryWrapper wrapper = new QueryWrapper(); |
|
|
|
wrapper.select(max(IOT_VISUAL_MATERIAL_ENTITY.SORT).as("sort")) |
|
|
|
.from(IOT_VISUAL_MATERIAL_ENTITY).eq(IotVisualMaterialEntity::getGroupId,groupId); |
|
|
|
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq("1"))); |
|
|
|
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(1))); |
|
|
|
Integer number = this.mapper.selectOneByQueryAs(wrapper,Integer.class); |
|
|
|
if(ObjectUtils.isEmpty(number)){ |
|
|
|
return 1; |
|
|
|
@ -305,7 +302,7 @@ public class IotVisualMaterialServiceImpl extends BaseServiceImpl<IotVisualMater |
|
|
|
QueryWrapper wrapper = new QueryWrapper(); |
|
|
|
wrapper.eq("group_id",groupId); |
|
|
|
wrapper.orderBy("sort",true); |
|
|
|
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq("1"))); |
|
|
|
wrapper.and(IOT_VISUAL_MATERIAL_ENTITY.TENANT_CODE.eq(tenantCode).or(IOT_VISUAL_MATERIAL_ENTITY.IS_DEFAULT.eq(1))); |
|
|
|
return this.listAs(wrapper,ComponentSortInfo.class); |
|
|
|
} |
|
|
|
|