Commit c403cf5a authored by 李秀明's avatar 李秀明

fix: 设备平台-消防系统配置-系统分组接口开发

parent 3b807bba
...@@ -24,7 +24,7 @@ public class FireFightingSystemGroupEntity extends BaseEntity { ...@@ -24,7 +24,7 @@ public class FireFightingSystemGroupEntity extends BaseEntity {
private String groupCode; private String groupCode;
@ApiModelProperty(value = "展示类型:0-系统部件 1-安措") @ApiModelProperty(value = "展示类型:0-系统部件 1-安措")
private Integer showType; private Integer displayType;
@ApiModelProperty(value = "系统ID") @ApiModelProperty(value = "系统ID")
private String systemIds; private String systemIds;
......
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class CoreEquipmentsDto {
@ApiModelProperty(value = "装备ID")
private String id;
@ApiModelProperty(value = "装备名称")
private String name;
@ApiModelProperty(value = "装备排序")
private Integer sort;
@ApiModelProperty(value = "所属类型")
private Integer type;
}
package com.yeejoin.equipmanage.common.entity.dto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.publics.BaseDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
public class FireFightingSystemGroupModalDto extends BaseDTO<FireFightingSystemGroupEntity> {
@ApiModelProperty(value = "分组名称")
private String groupName;
@ApiModelProperty(value = "展示类型:0-安措 1-保护区域")
private Integer displayType;
@ApiModelProperty(value = "分组排序")
private Integer sort;
@ApiModelProperty(value = "系统装备列表")
private List<SystemEquipmentsDto> systems;
@ApiModelProperty(value = "业务组织编码")
private String bizOrgCode;
@ApiModelProperty(value = "业务组织名称")
private String bizOrgName;
}
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@Accessors(chain = true)
public class SystemEquipmentsDto {
@ApiModelProperty(value = "系统ID")
private String id;
@ApiModelProperty(value = "系统名称")
private String name;
@ApiModelProperty(value = "系统排序")
private Integer sort;
@ApiModelProperty(value = "装备列表")
private List<CoreEquipmentsDto> equipments;
}
...@@ -22,4 +22,6 @@ public class EquipCountBySystemVO { ...@@ -22,4 +22,6 @@ public class EquipCountBySystemVO {
private Integer equipmentNum; private Integer equipmentNum;
@ApiModelProperty(value = "单位") @ApiModelProperty(value = "单位")
private String unitName; private String unitName;
@ApiModelProperty(value = "图标")
private String img;
} }
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
...@@ -132,6 +134,16 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -132,6 +134,16 @@ public class FireFightingSystemController extends AbstractBaseController {
return fireFightingSystemService.getEquipCountBySystemId(systemId); return fireFightingSystemService.getEquipCountBySystemId(systemId);
} }
@RequestMapping(value = "/getEquipCountPageBySystemId", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("根据系统id查询分组设备数量")
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@RequestParam("systemId") Long systemId,
@RequestParam(value = "pageNumber", required = false) Integer pageNumber,
@RequestParam(value = "pageSize", required = false) Integer pageSize
) {
return fireFightingSystemService.getEquipCountPageBySystemId(systemId, pageNumber, pageSize);
}
@RequestMapping(value = "/getOneById", method = RequestMethod.GET) @RequestMapping(value = "/getOneById", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("通过id查询消防系统信息") @ApiOperation("通过id查询消防系统信息")
...@@ -855,6 +867,24 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -855,6 +867,24 @@ public class FireFightingSystemController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统列表查询(不分页)", notes = "下拉使用")
@GetMapping(value = "/systems")
public List<FireFightingSystemEntity> systems(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
Wrapper<FireFightingSystemEntity> wrapper = Wrappers.<FireFightingSystemEntity>lambdaQuery()
.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode)
.isNotNull(FireFightingSystemEntity::getName)
.isNotNull(FireFightingSystemEntity::getSystemType);
return fireFightingSystemService.list(wrapper);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "消防系统树和消防建筑树", notes = "树菜单") @ApiOperation(value = "消防系统树和消防建筑树", notes = "树菜单")
@GetMapping(value = "/getBuildingTreeAndSystemTree") @GetMapping(value = "/getBuildingTreeAndSystemTree")
public Map<String, List> getBuildingTreeAndSystemTree(RequestBaseDto dto) { public Map<String, List> getBuildingTreeAndSystemTree(RequestBaseDto dto) {
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto; import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil; import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.FireFightingSystemGroupService; import com.yeejoin.equipmanage.service.FireFightingSystemGroupService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -16,49 +21,56 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -16,49 +21,56 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@RestController @RestController
@Api(tags = "消防系统分组") @Api(tags = "消防系统分组")
@RequestMapping(value = "/fire-fighting-system") @RequestMapping(value = "/fire-fighting-system-group")
public class FireFightingSystemGroupController extends BaseController { public class FireFightingSystemGroupController extends BaseController {
@Autowired @Autowired
private FireFightingSystemGroupService fireFightingSystemGroupService; private FireFightingSystemGroupService fireFightingSystemGroupService;
@PutMapping(value = "/save") @ApiOperation(value = "消防系统列表查询(未绑定分组的系统)", notes = "下拉使用")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "PUT", value = "添加分组", notes = "添加分组") @GetMapping(value = "/systems")
public ResponseModel save(@RequestBody FireFightingSystemGroupDto dto) { public ResponseModel systems(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
if (!(Objects.nonNull(dto.getGroupName()) && Objects.nonNull(dto.getShowType()) && Objects.nonNull(dto.getSystemIds()) && !dto.getSystemEquipmentRelations().isEmpty())) { if (StringUtils.isEmpty(bizOrgCode)) {
return CommonResponseUtil.failure("非法参数"); ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
} }
ReginParams reginParams = getSelectedOrgInfo(); return CommonResponseUtil.success(fireFightingSystemGroupService.selectUnboundSystems(bizOrgCode));
dto.setBizOrgCode(reginParams.getCompany().getOrgCode());
dto.setBizOrgCode(reginParams.getCompany().getCompanyName());
return CommonResponseUtil.success(fireFightingSystemGroupService.saveOrUpdate(dto));
} }
@PostMapping(value = "/update") @RequestMapping(value = "/save-or-update", method = {RequestMethod.PUT, RequestMethod.POST})
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "更新分组", notes = "更新分组") @ApiOperation(httpMethod = "PUT", value = "添加/更新分组", notes = "添加/更新分组")
public ResponseModel update(@RequestBody FireFightingSystemGroupDto dto) { public ResponseModel save(@RequestBody FireFightingSystemGroupModalDto dto) {
if (!(Objects.nonNull(dto.getId()) && Objects.nonNull(dto.getGroupName()) && Objects.nonNull(dto.getShowType()) && Objects.nonNull(dto.getSystemIds()) && !dto.getSystemEquipmentRelations().isEmpty())) { if (!(Objects.nonNull(dto.getGroupName()) && Objects.nonNull(dto.getDisplayType()) && Objects.nonNull(dto.getSystems()))) {
return CommonResponseUtil.failure("非法参数"); return CommonResponseUtil.failure("非法参数");
} }
ReginParams reginParams = getSelectedOrgInfo();
dto.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
dto.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
return CommonResponseUtil.success(fireFightingSystemGroupService.saveOrUpdate(dto)); return CommonResponseUtil.success(fireFightingSystemGroupService.saveOrUpdate(dto));
} }
@PostMapping(value = "/update-group-sort") @PutMapping(value = "/update-group-sort")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "更新分组展示顺序", notes = "更新分组展示顺序") @ApiOperation(httpMethod = "PUT", value = "更新分组展示顺序", notes = "更新分组展示顺序")
public ResponseModel updateGroupSort(@RequestBody List<Long> groupIds) { public ResponseModel updateGroupSort(@RequestParam("groupIds") String groupIds) {
if (Objects.isNull(groupIds) || groupIds.isEmpty()) { if (Objects.isNull(groupIds) || groupIds.isEmpty()) {
return CommonResponseUtil.failure("非法参数"); return CommonResponseUtil.failure("非法参数");
} }
fireFightingSystemGroupService.updateGroupSort(groupIds); List<Long> ids = Arrays.stream(groupIds.split(",")).map(Long::valueOf).mapToLong(Long::longValue).boxed().collect(Collectors.toList());
fireFightingSystemGroupService.updateGroupSort(ids);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
...@@ -78,8 +90,17 @@ public class FireFightingSystemGroupController extends BaseController { ...@@ -78,8 +90,17 @@ public class FireFightingSystemGroupController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询分组列表", notes = "查询分组列表") @ApiOperation(httpMethod = "GET", value = "查询分组列表", notes = "查询分组列表")
public ResponseModel list(@RequestParam(required = false) String bizOrgCode) { public ResponseModel list(@RequestParam(required = false) String bizOrgCode) {
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
bizOrgCode = getOrgCode(); ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getCompanyBizOrgCode();
} }
return CommonResponseUtil.success(fireFightingSystemGroupService.listGroup(bizOrgCode)); return CommonResponseUtil.success(fireFightingSystemGroupService.listGroup(bizOrgCode));
} }
@DeleteMapping(value = "/{id}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "DELETE", value = "删除分组", notes = "删除分组")
public ResponseModel deteleGroup(@PathVariable("id") Long id) {
fireFightingSystemGroupService.deleteGroup(id);
return CommonResponseUtil.success();
}
} }
...@@ -29,7 +29,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -29,7 +29,7 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
int getEquipmentSpeCount(Map<String, Object> map); int getEquipmentSpeCount(Map<String, Object> map);
List<Map<String, Object>> getEquipmentSpecificCount(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getEquipmentCount(@Param("bizOrgCode") String bizOrgCode);
IPage<ComplementCodeVO> selectEquipmentSpecific(Page page, EquipmentSpecificDTO equipmentSpecificDTO); IPage<ComplementCodeVO> selectEquipmentSpecific(Page page, EquipmentSpecificDTO equipmentSpecificDTO);
...@@ -336,4 +336,5 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -336,4 +336,5 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> selectZJEquipmentSpecificWWXByIds(String bussIds); List<Map<String, Object>> selectZJEquipmentSpecificWWXByIds(String bussIds);
Integer selectEquipmentCountBySystemId(@Param("systemId") Long systemId);
} }
...@@ -53,6 +53,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -53,6 +53,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/ */
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId); List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(@Param("page") Page<Object> page, @Param("systemId") Long systemId);
/** /**
* 保存 * 保存
* *
......
...@@ -2,19 +2,23 @@ package com.yeejoin.equipmanage.service; ...@@ -2,19 +2,23 @@ package com.yeejoin.equipmanage.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity; import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import java.util.List; import java.util.List;
public interface FireFightingSystemGroupService extends IService<FireFightingSystemGroupEntity> { public interface FireFightingSystemGroupService extends IService<FireFightingSystemGroupEntity> {
/** /**
* 获取未绑定分组的系统列表
*/
JSONArray selectUnboundSystems(String bizOrgCode);
/**
* 保存分组 * 保存分组
* *
* @param fireFightingSystemGroupDto 分组信息 * @param fireFightingSystemGroupModalDto 分组信息
*/ */
Boolean saveOrUpdate(FireFightingSystemGroupDto fireFightingSystemGroupDto); Boolean saveOrUpdate(FireFightingSystemGroupModalDto fireFightingSystemGroupModalDto);
/** /**
* 更新分组排序 * 更新分组排序
...@@ -33,4 +37,9 @@ public interface FireFightingSystemGroupService extends IService<FireFightingSys ...@@ -33,4 +37,9 @@ public interface FireFightingSystemGroupService extends IService<FireFightingSys
* @return 分组列表 * @return 分组列表
*/ */
JSONArray listGroup(String bizOrgCode); JSONArray listGroup(String bizOrgCode);
/**
* 删除分组
*/
void deleteGroup(Long groupId);
} }
...@@ -60,6 +60,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -60,6 +60,14 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId); List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId);
/** /**
* 根据系统id查询分组设备数量
*
* @param systemId
* @return
*/
Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize);
/**
* 保存 * 保存
* *
* @param vo * @param vo
......
...@@ -2,19 +2,21 @@ package com.yeejoin.equipmanage.service.impl; ...@@ -2,19 +2,21 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.component.robot.BadRequest; import com.yeejoin.amos.component.robot.BadRequest;
import com.yeejoin.equipmanage.common.dto.FireFightingSystemGroupDto;
import com.yeejoin.equipmanage.common.dto.SystemEquipmentRelationDto;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity; import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity; import com.yeejoin.equipmanage.common.entity.FireFightingSystemGroupEntity;
import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity; import com.yeejoin.equipmanage.common.entity.SystemEquipmentRelationEntity;
import com.yeejoin.equipmanage.common.enums.SystemGroupShowTypeEnum; import com.yeejoin.equipmanage.common.entity.dto.CoreEquipmentsDto;
import com.yeejoin.equipmanage.common.entity.dto.FireFightingSystemGroupModalDto;
import com.yeejoin.equipmanage.common.entity.dto.SystemEquipmentsDto;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper; import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemGroupMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemGroupMapper;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.FireFightingSystemGroupService; import com.yeejoin.equipmanage.service.FireFightingSystemGroupService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.SystemEquipmentRelationService; import com.yeejoin.equipmanage.service.SystemEquipmentRelationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,70 +37,113 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -35,70 +37,113 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
private FireFightingSystemMapper fireFightingSystemMapper; private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired @Autowired
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired
private IFireFightingSystemService fireFightingSystemService;
/**
* 获取未绑定分组的系统列表
*
* @param bizOrgCode
*/
@Override
public JSONArray selectUnboundSystems(String bizOrgCode) {
Wrapper<FireFightingSystemEntity> wrapper = Wrappers.<FireFightingSystemEntity>lambdaQuery()
.likeRight(FireFightingSystemEntity::getBizOrgCode, bizOrgCode)
.isNotNull(FireFightingSystemEntity::getName)
.isNotNull(FireFightingSystemEntity::getSystemType);
List<FireFightingSystemEntity> systems = fireFightingSystemService.list(wrapper);
List<Long> systemIds = systems.stream().map(FireFightingSystemEntity::getId).collect(Collectors.toList());
if (!systemIds.isEmpty()) {
List<FireFightingSystemGroupEntity> entities = this.list();
List<String> list = entities.stream().map(FireFightingSystemGroupEntity::getSystemIds).collect(Collectors.toList());
List<Long> boundedSystemIds = list.stream().flatMap(s -> Arrays.stream(s.split(","))).map(Long::parseLong).collect(Collectors.toList());
systemIds.removeAll(boundedSystemIds);
}
JSONArray result = new JSONArray();
for (FireFightingSystemEntity system : systems) {
Map<String, Object> jsonObject = new HashMap<>();
jsonObject.put("id", system.getId());
jsonObject.put("name", system.getName());
if (!systemIds.contains(system.getId())) {
jsonObject.put("isBound", true);
} else {
jsonObject.put("isBound", false);
}
result.add(jsonObject);
}
return result;
}
/** /**
* 保存分组 * 保存分组
* *
* @param fireFightingSystemGroupDto 分组信息 * @param fireFightingSystemGroupModalDto 分组信息
* @return 分组信息 * @return 分组信息
*/ */
@Override @Override
@Transactional @Transactional
public Boolean saveOrUpdate(FireFightingSystemGroupDto fireFightingSystemGroupDto) { public Boolean saveOrUpdate(FireFightingSystemGroupModalDto fireFightingSystemGroupModalDto) {
if (!(Objects.nonNull(fireFightingSystemGroupDto.getGroupName()) && Objects.nonNull(fireFightingSystemGroupDto.getShowType()) && Objects.nonNull(fireFightingSystemGroupDto.getSystemIds()) && !fireFightingSystemGroupDto.getSystemEquipmentRelations().isEmpty())) { if (!(Objects.nonNull(fireFightingSystemGroupModalDto.getGroupName()) && Objects.nonNull(fireFightingSystemGroupModalDto.getDisplayType()) && Objects.nonNull(fireFightingSystemGroupModalDto.getSystems()))) {
throw new BadRequest("无效参数!"); throw new BadRequest("无效参数!");
} }
// 分组名称唯一性校验 // 分组名称唯一性校验
Integer count = fireFightingSystemGroupMapper.selectCount( if (Objects.isNull(fireFightingSystemGroupModalDto.getId())) {
Wrappers.<FireFightingSystemGroupEntity>lambdaQuery() Integer count = fireFightingSystemGroupMapper.selectCount(
.eq(FireFightingSystemGroupEntity::getGroupName, fireFightingSystemGroupDto.getGroupName())
);
if (count > 0) {
throw new BadRequest("当前分组已存在!");
}
// 消防系统-部件校验
List<Long> systemIds = Arrays.stream(fireFightingSystemGroupDto.getSystemIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
List<SystemEquipmentRelationDto> systemEquipmentRelations = fireFightingSystemGroupDto.getSystemEquipmentRelations();
List<SystemEquipmentRelationEntity> systemEquipmentRelationEntities = new ArrayList<>(systemEquipmentRelations.size());
for (Long systemId : systemIds) {
if (systemEquipmentRelations.stream().noneMatch(systemEquipmentRelationDto -> systemEquipmentRelationDto.getSystemId().equals(systemId))) {
throw new BadRequest("当前系统-部件关系无效!");
}
count = fireFightingSystemGroupMapper.selectCount(
Wrappers.<FireFightingSystemGroupEntity>lambdaQuery() Wrappers.<FireFightingSystemGroupEntity>lambdaQuery()
.like(FireFightingSystemGroupEntity::getSystemIds, systemId) .eq(FireFightingSystemGroupEntity::getGroupName, fireFightingSystemGroupModalDto.getGroupName())
); );
if (count > 0) { if (count > 0) {
throw new BadRequest("当前系统已分配在其他分组中,无法继续分组!"); throw new BadRequest("当前分组已存在!");
} }
systemEquipmentRelations.stream().filter(relation -> relation.getSystemId().equals(systemId)).findFirst().ifPresent(relation -> {
SystemEquipmentRelationEntity relationEntity = SystemEquipmentRelationEntity.builder()
.systemId(relation.getSystemId())
.equipmentId(relation.getEquipmentId())
.sort(Objects.nonNull(relation.getSort()) ? relation.getSort() : 0)
.build();
systemEquipmentRelationEntities.add(relationEntity);
});
} }
// 入库
// 更新时先删除系统-装备关系数据再入库 List<SystemEquipmentsDto> systems = fireFightingSystemGroupModalDto.getSystems();
if (Objects.nonNull(fireFightingSystemGroupDto.getId())) {
// 更新数据前先清理解绑的系统与相关关系表的数据
if (Objects.nonNull(fireFightingSystemGroupModalDto.getId())) {
FireFightingSystemGroupEntity entity = fireFightingSystemGroupMapper.selectById(fireFightingSystemGroupModalDto.getId());
String[] systemIds = entity.getSystemIds().split(",");
systemEquipmentRelationService.remove( systemEquipmentRelationService.remove(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery() Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
.in(SystemEquipmentRelationEntity::getSystemId, systemIds) .in(SystemEquipmentRelationEntity::getSystemId, (Object) systemIds)
); );
systemEquipmentRelationService.saveBatch(systemEquipmentRelationEntities);
} }
String[] sortedSystemIds = new String[systems.size()];
for (SystemEquipmentsDto system : systems) {
// 系统重排序
sortedSystemIds[system.getSort()] = system.getId();
// 构建系统与装备关系
List<CoreEquipmentsDto> equipments = system.getEquipments();
List<SystemEquipmentRelationEntity> relationEntities = equipments.stream()
.map(equipment -> SystemEquipmentRelationEntity.builder()
.systemId(Long.valueOf(system.getId()))
.equipmentId(Long.valueOf(equipment.getId()))
.type(equipment.getType())
.sort(equipment.getSort())
.build()
).collect(Collectors.toList());
if (!systemEquipmentRelationService.saveBatch(relationEntities)) {
throw new BadRequest("保存分组关系失败!");
}
}
// 分组信息入库
FireFightingSystemGroupEntity fireFightingSystemGroupEntity = FireFightingSystemGroupEntity.builder() FireFightingSystemGroupEntity fireFightingSystemGroupEntity = FireFightingSystemGroupEntity.builder()
.groupName(fireFightingSystemGroupDto.getGroupName()) .groupName(fireFightingSystemGroupModalDto.getGroupName())
.groupCode(System.currentTimeMillis() + "") .groupCode(System.currentTimeMillis() + "") // TODO
.showType(fireFightingSystemGroupDto.getShowType()) .displayType(fireFightingSystemGroupModalDto.getDisplayType())
.systemIds(fireFightingSystemGroupDto.getSystemIds()) .systemIds(String.join(",", sortedSystemIds))
.remarks(fireFightingSystemGroupDto.getRemarks()) .remarks("")
.sort(Objects.nonNull(fireFightingSystemGroupDto.getSort()) ? fireFightingSystemGroupDto.getSort() : 0) .sort(Objects.nonNull(fireFightingSystemGroupModalDto.getSort()) ? fireFightingSystemGroupModalDto.getSort() : 0)
.bizOrgName(fireFightingSystemGroupDto.getGroupCode()) .bizOrgName(fireFightingSystemGroupModalDto.getBizOrgName())
.bizOrgCode(fireFightingSystemGroupDto.getBizOrgName()) .bizOrgCode(fireFightingSystemGroupModalDto.getBizOrgCode())
.build(); .build();
if (Objects.nonNull(fireFightingSystemGroupModalDto.getId())) {
fireFightingSystemGroupEntity.setId(Long.valueOf(fireFightingSystemGroupModalDto.getId()));
}
return this.saveOrUpdate(fireFightingSystemGroupEntity); return this.saveOrUpdate(fireFightingSystemGroupEntity);
} }
...@@ -114,9 +159,9 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -114,9 +159,9 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
throw new BadRequest("无效参数!"); throw new BadRequest("无效参数!");
} }
Collection<FireFightingSystemGroupEntity> entities = this.listByIds(groupIds); Collection<FireFightingSystemGroupEntity> entities = this.listByIds(groupIds);
int sort = 0; for (int i = 0; i < groupIds.size(); i++) {
for (FireFightingSystemGroupEntity entity : entities) { final int sort = i;
entity.setSort(++sort); entities.stream().filter(entity -> entity.getId().equals(groupIds.get(sort))).findFirst().ifPresent(entity -> entity.setSort(sort));
} }
this.updateBatchById(entities); this.updateBatchById(entities);
} }
...@@ -151,11 +196,12 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -151,11 +196,12 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
public JSONArray listGroup(String bizOrgCode) { public JSONArray listGroup(String bizOrgCode) {
List<FireFightingSystemGroupEntity> groupEntities = fireFightingSystemGroupMapper.selectList( List<FireFightingSystemGroupEntity> groupEntities = fireFightingSystemGroupMapper.selectList(
Wrappers.<FireFightingSystemGroupEntity>lambdaQuery() Wrappers.<FireFightingSystemGroupEntity>lambdaQuery()
.eq(FireFightingSystemGroupEntity::getBizOrgCode, bizOrgCode) .likeRight(FireFightingSystemGroupEntity::getBizOrgCode, bizOrgCode)
.orderByAsc(FireFightingSystemGroupEntity::getSort) .orderByAsc(FireFightingSystemGroupEntity::getSort, FireFightingSystemGroupEntity::getCreateDate)
); );
List<Long> systemIds = groupEntities.stream().map(FireFightingSystemGroupEntity::getSystemIds).map(s -> s.split(",")).flatMap(Arrays::stream).map(Long::parseLong).collect(Collectors.toList()); List<Long> systemIds = groupEntities.stream().map(FireFightingSystemGroupEntity::getSystemIds).map(s -> s.split(",")).flatMap(Arrays::stream).map(Long::parseLong).collect(Collectors.toList());
// List to Map -> key: systemId, value: FireFightingSystemEntity
Map<Long, FireFightingSystemEntity> systemMap = fireFightingSystemMapper.selectList( Map<Long, FireFightingSystemEntity> systemMap = fireFightingSystemMapper.selectList(
Wrappers.<FireFightingSystemEntity>lambdaQuery() Wrappers.<FireFightingSystemEntity>lambdaQuery()
.in(FireFightingSystemEntity::getId, systemIds) .in(FireFightingSystemEntity::getId, systemIds)
...@@ -163,6 +209,7 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -163,6 +209,7 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
put(fireFightingSystemEntity.getId(), fireFightingSystemEntity); put(fireFightingSystemEntity.getId(), fireFightingSystemEntity);
}}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next())); }}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next()));
// List to Map -> key: equipmentId, value: List<SystemEquipmentRelationEntity>
Map<Long, List<SystemEquipmentRelationEntity>> systemEquipmentMap = new HashMap<>(); Map<Long, List<SystemEquipmentRelationEntity>> systemEquipmentMap = new HashMap<>();
List<SystemEquipmentRelationEntity> systemEquipmentRelationEntities = systemEquipmentRelationService.list( List<SystemEquipmentRelationEntity> systemEquipmentRelationEntities = systemEquipmentRelationService.list(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery() Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
...@@ -178,45 +225,82 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting ...@@ -178,45 +225,82 @@ public class FireFightingSystemGroupServiceImpl extends ServiceImpl<FireFighting
} }
} }
List<Map<String, Object>> equipmentSpecificCountList = equipmentSpecificMapper.getEquipmentSpecificCount(bizOrgCode); // List to Map -> key: equipmentId, value: 装备定义数量
Map<Long, Map<String, Object>> equipmentCountMap = equipmentSpecificCountList.stream().map(map -> new HashMap<Long, Map<String, Object>>() {{ List<Map<String, Object>> equipmentCountList = equipmentSpecificMapper.getEquipmentCount(bizOrgCode);
put(Long.valueOf(map.get("id").toString()), map); Map<Long, Map<String, Object>> equipmentCountMap = equipmentCountList.stream().map(map -> new HashMap<Long, Map<String, Object>>() {{
put(Long.valueOf(map.get("equipmentId").toString()), map);
}}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next())); }}).collect(Collectors.toMap(map -> map.keySet().iterator().next(), map -> map.values().iterator().next()));
JSONArray groups = new JSONArray(); JSONArray groups = new JSONArray();
for (FireFightingSystemGroupEntity groupEntity : groupEntities) { for (FireFightingSystemGroupEntity groupEntity : groupEntities) {
JSONArray group = new JSONArray(); JSONObject group = new JSONObject();
JSONArray systems = new JSONArray();
group.put("id", groupEntity.getId());
group.put("groupName", groupEntity.getGroupName());
group.put("displayType", groupEntity.getDisplayType());
group.put("sort", groupEntity.getSort());
group.put("systems", systems);
List<Long> entitySystemIds = Arrays.stream(groupEntity.getSystemIds().split(",")).map(Long::parseLong).collect(Collectors.toList()); List<Long> entitySystemIds = Arrays.stream(groupEntity.getSystemIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
for (Long systemId : entitySystemIds) { int size = entitySystemIds.size();
for (int i = 0; i < size; i++) {
Long systemId = entitySystemIds.get(i);
JSONObject system = new JSONObject(); JSONObject system = new JSONObject();
FireFightingSystemEntity systemEntity = systemMap.get(systemId); FireFightingSystemEntity systemEntity = systemMap.get(systemId);
List<SystemEquipmentRelationEntity> relationEntities = systemEquipmentMap.get(systemId); List<SystemEquipmentRelationEntity> relationEntities = Objects.nonNull(systemEquipmentMap.get(systemId)) ? systemEquipmentMap.get(systemId) : new ArrayList<>();
system.put("id", systemId); system.put("id", systemId);
system.put("code", systemEntity.getCode());
system.put("typeCode", systemEntity.getSystemTypeCode());
system.put("name", systemEntity.getName()); system.put("name", systemEntity.getName());
system.put("systemState", systemEntity.getSystemStatus()); system.put("systemState", systemEntity.getSystemStatus());
system.put("systemRunState", systemEntity.getSystemRunState()); system.put("systemRunState", systemEntity.getSystemRunState());
system.put("protectObject", systemEntity.getProObject()); system.put("protectObject", systemEntity.getProObject());
system.put("systemDesc", systemEntity.getSystemDescribe()); system.put("systemDesc", systemEntity.getSystemDescribe());
system.put("sort", i);
List<Map<String, Object>> systemEquipmentList = new ArrayList<>(); List<Map<String, Object>> equipments = new ArrayList<>();
List<Map<String, Object>> securityMeasureList = new ArrayList<>();
for (SystemEquipmentRelationEntity relationEntity : relationEntities) { for (SystemEquipmentRelationEntity relationEntity : relationEntities) {
Long equipmentId = relationEntity.getEquipmentId(); Long equipmentId = relationEntity.getEquipmentId();
if (equipmentCountMap.containsKey(equipmentId)) { if (equipmentCountMap.containsKey(equipmentId)) {
if (Objects.equals(SystemGroupShowTypeEnum.SYSTEM_EQUIPMENT.getCode(), relationEntity.getType())) { Map<String, Object> equipmentMap = equipmentCountMap.get(equipmentId);
systemEquipmentList.add(equipmentCountMap.get(equipmentId)); Map<String, Object> equipment = new HashMap<>();
} equipment.put("id", equipmentMap.get("equipmentId"));
if (Objects.equals(SystemGroupShowTypeEnum.SECURITY_MEASURE.getCode(), relationEntity.getType())) { equipment.put("name", equipmentMap.get("equipmentName"));
securityMeasureList.add(equipmentCountMap.get(equipmentId)); equipment.put("num", Integer.valueOf(equipmentMap.getOrDefault("count", "0").toString()));
} equipment.put("unit", equipmentMap.get("unit"));
equipment.put("sort", relationEntity.getSort());
equipment.put("type", relationEntity.getType());
equipments.add(equipment);
} }
} }
system.put("systemEquipment", systemEquipmentList); system.put("equipments", equipments);
system.put("securityMeasure", securityMeasureList); systems.add(system);
group.add(system);
} }
groups.add(group); groups.add(group);
} }
return groups; return groups;
} }
/**
* 删除分组
*
* @param groupId
*/
@Override
@Transactional
public void deleteGroup(Long groupId) {
FireFightingSystemGroupEntity groupEntity = fireFightingSystemGroupMapper.selectById(groupId);
if (Objects.isNull(groupEntity)) {
throw new BadRequest("分组不存在");
}
String systemIds = groupEntity.getSystemIds();
List<Long> systemIdList = Arrays.stream(systemIds.split(",")).map(Long::parseLong).collect(Collectors.toList());
// 删除映射关系
systemEquipmentRelationService.remove(
Wrappers.<SystemEquipmentRelationEntity>lambdaQuery()
.in(!systemIdList.isEmpty(), SystemEquipmentRelationEntity::getSystemId, systemIdList)
);
// 删除分组
fireFightingSystemGroupMapper.deleteById(groupId);
}
} }
...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
...@@ -63,6 +64,7 @@ import java.net.NetworkInterface; ...@@ -63,6 +64,7 @@ import java.net.NetworkInterface;
import java.net.SocketException; import java.net.SocketException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
...@@ -94,6 +96,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -94,6 +96,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Autowired @Autowired
EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper; EquipmentSpecificAlarmMapper equipmentSpecificAlarmMapper;
@Autowired @Autowired
EquipmentSpecificAlarmLogMapper equipmentSpecificAlarmLogMapper;
@Autowired
private SourceSceneMapper sourceSceneMapper; private SourceSceneMapper sourceSceneMapper;
@Value("${equipment.fire.systemid}") @Value("${equipment.fire.systemid}")
private String fireSystemId; private String fireSystemId;
...@@ -182,6 +186,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -182,6 +186,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
} }
@Override @Override
public Page<EquipCountBySystemVO> getEquipCountPageBySystemId(Long systemId, Integer pageNumber, Integer pageSize) {
return this.baseMapper.getEquipCountPageBySystemId(new Page(pageNumber, pageSize), systemId);
}
@Override
public List<EquiplistSpecificBySystemVO> public List<EquiplistSpecificBySystemVO>
getEquiplistBySystemId(Long systemId) { getEquiplistBySystemId(Long systemId) {
return this.baseMapper.getEquiplistBySystemId(systemId); return this.baseMapper.getEquiplistBySystemId(systemId);
...@@ -1114,7 +1124,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1114,7 +1124,21 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public List<AlarmDataVO> getSystemById(Long id) { public List<AlarmDataVO> getSystemById(Long id) {
return this.baseMapper.getSystemById(id); List<AlarmDataVO> list = this.baseMapper.getSystemById(id);
// 部件总数
Integer equipmentCount = equipmentSpecificMapper.selectCount(
Wrappers.<EquipmentSpecific>lambdaQuery().eq(EquipmentSpecific::getSystemId, id)
);
// 今日报警次数
Integer alarmCount = equipmentSpecificAlarmLogMapper.selectCount(
Wrappers.<EquipmentSpecificAlarmLog>lambdaQuery()
.like(EquipmentSpecificAlarmLog::getSystemIds, id)
.eq(EquipmentSpecificAlarmLog::getStatus, "1")
.likeRight(EquipmentSpecificAlarmLog::getCreateDate, LocalDate.now().toString())
);
list.add(new AlarmDataVO("部件总数", equipmentCount + " 个", false));
list.add(new AlarmDataVO("今日报警次数", alarmCount + " 次", false));
return list;
} }
@Override @Override
......
...@@ -109,18 +109,21 @@ ...@@ -109,18 +109,21 @@
AND code like CONCAT('%',#{code},'%') AND code like CONCAT('%',#{code},'%')
</if> </if>
</select> </select>
<select id="getEquipmentSpecificCount" resultType="Map"> <select id="getEquipmentCount" resultType="Map">
SELECT SELECT
we.id as id, we.id AS equipmentId,
we.name as equipmentName, we.name AS equipmentName,
count(1) as count count(1) AS count,
u.name AS unit
FROM FROM
wl_equipment_specific wesp wl_equipment_specific wesp
LEFT JOIN wl_equipment_detail wsd ON wesp.equipment_detail_id = wsd.id LEFT JOIN wl_equipment_detail wsd ON wesp.equipment_detail_id = wsd.id
LEFT JOIN wl_equipment we ON wsd.equipment_id = we.id LEFT JOIN wl_equipment we ON wsd.equipment_id = we.id
LEFT JOIN wl_unit u on u.id = we.unit_id
<where> <where>
we.id IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''"> <if test="bizOrgCode != null and bizOrgCode != ''">
AND wesp.biz_org_code = concat(#{bizOrgCode},'%') AND wesp.biz_org_code like concat(#{bizOrgCode},'%')
</if> </if>
</where> </where>
GROUP BY GROUP BY
...@@ -2898,6 +2901,26 @@ ...@@ -2898,6 +2901,26 @@
</if> </if>
</select> </select>
<select id="selectEquipmentCountBySystemId" resultType="int">
SELECT
es.id,
es.name,
es.biz_org_name bizOrgName,
es.code,
es.position,
ed.standard,
DATEDIFF( DATE_ADD( DATE_FORMAT( ed.production_date, '%Y-%m-%d' ), INTERVAL e.expiry_date YEAR ), CURRENT_DATE ) AS dayNum
FROM
wl_equipment_specific es
LEFT JOIN wl_equipment_detail ed ON ed.id = es.equipment_detail_id
LEFT JOIN wl_equipment e ON ed.equipment_id = e.id
LEFT JOIN wl_stock_detail sd ON sd.equipment_detail_id = ed.id
WHERE
ed.production_date IS NOT NULL
AND e.expiry_date IS NOT NULL
<if test="bussIds != null and bussIds != ''">
And find_in_set(es.id, #{bussIds}) > 0
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<result property="equipmentName" column="equipment_name"></result> <result property="equipmentName" column="equipment_name"></result>
<result property="equipmentNum" column="num"></result> <result property="equipmentNum" column="num"></result>
<result property="unitName" column="unit_name"></result> <result property="unitName" column="unit_name"></result>
<result property="img" column="img"></result>
</resultMap> </resultMap>
<resultMap id="CategoryAmountList" type="com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO"> <resultMap id="CategoryAmountList" type="com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO">
<result column="id" property="id"></result> <result column="id" property="id"></result>
...@@ -98,6 +99,7 @@ ...@@ -98,6 +99,7 @@
det.NAME equipment_name, det.NAME equipment_name,
count(spe.id) num, count(spe.id) num,
unit.name unit_name, unit.name unit_name,
wle.img,
cate.NAME AS equipmentCateGoryName cate.NAME AS equipmentCateGoryName
FROM FROM
wl_equipment_specific AS spe wl_equipment_specific AS spe
...@@ -109,6 +111,24 @@ ...@@ -109,6 +111,24 @@
find_in_set(#{systemId},spe.system_id) and spe.single = true find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id group by wle.id
</select> </select>
<select id="getEquipCountPageBySystemId" resultMap="EquipCountBySystemId">
SELECT
wle.id equipment_id,
det.NAME equipment_name,
count(spe.id) num,
unit.name unit_name,
wle.img,
cate.NAME AS equipmentCateGoryName
FROM
wl_equipment_specific AS spe
LEFT JOIN wl_equipment_detail AS det ON spe.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN wl_equipment_category cate ON cate.id = wle.category_id
LEFT JOIN wl_unit as unit ON wle.unit_id = unit.id
where
find_in_set(#{systemId},spe.system_id) and spe.single = true
group by wle.id
</select>
<insert id="save"> <insert id="save">
INSERT INTO INSERT INTO
f_fire_fighting_system f_fire_fighting_system
...@@ -719,7 +739,17 @@ ...@@ -719,7 +739,17 @@
f_fire_fighting_system fffs f_fire_fighting_system fffs
LEFT JOIN wl_equipment_category wlec ON fffs.system_type = wlec.id LEFT JOIN wl_equipment_category wlec ON fffs.system_type = wlec.id
left join wl_manufacturer_info wlmi on wlmi.id=fffs.maintenance_unit left join wl_manufacturer_info wlmi on wlmi.id=fffs.maintenance_unit
left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit) a where a.id=#{id} order by sort left join wl_manufacturer_info wlmi1 on wlmi1.id=fffs.construction_unit
UNION ALL
SELECT
fffs.id,
'保护区域' AS `key`,
pro_object AS value,
false as isHref,
9 as sort
FROM
f_fire_fighting_system fffs
) a where a.id=#{id} order by sort
</select> </select>
<select id="getEquipmentAlarmBySystemIdOrSourceIdVO" <select id="getEquipmentAlarmBySystemIdOrSourceIdVO"
resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO"> resultType="com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment