Merge branch 'main' of https://git.jsspisoft.com/ry-das
This commit is contained in:
commit
2362e23863
@ -244,7 +244,12 @@ public class SysIotModelController {
|
||||
return R.success();
|
||||
}
|
||||
|
||||
/** 根据设备类型查询物模型 */
|
||||
@PostMapping("/getSysIotModelByType")
|
||||
public R<List<SysIotModelVo>> getSysIotModelByType(@RequestBody SysIotModelDto sysIotModelDto) {
|
||||
|
||||
return R.success(sysIotModelService.getSysIotModelByType(sysIotModelDto.getObjectType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,5 +24,7 @@ public interface SysEquipmentMapper extends BaseMapper<SysEquipment> {
|
||||
|
||||
List<SysEquipmentExcel> queryInfoById (@Param("info") SysEquipmentDto sysEquipmentDto);
|
||||
|
||||
Long queryParentEquipmentIdByName(@Param("name")String name);
|
||||
Long queryChildEquipmentCount(@Param("id")Long id);
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,4 +14,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface SysIotModelFieldMapper extends BaseMapperPlus<SysIotModelField, SysIotModelField> {
|
||||
|
||||
IPage<SysIotModelFieldVo> querySysIotModelFieldList(IPage<SysIotModelFieldVo> page, @Param("info") SysIotModelFieldDto sysIotModelFieldDto);
|
||||
|
||||
Long querySysIotModelFieldByModelId(Long id);
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ package com.das.modules.equipment.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.das.modules.equipment.domain.excel.SysIotModelFieldExcel;
|
||||
import com.das.modules.equipment.domain.excel.SysIotModelServiceExcel;
|
||||
import com.das.modules.equipment.domain.vo.SysIotModelFieldVo;
|
||||
import com.das.modules.equipment.domain.vo.SysIotModelServiceVo;
|
||||
import com.das.modules.equipment.domain.vo.SysIotModelVo;
|
||||
import com.das.modules.equipment.entity.SysIotModel;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -20,4 +19,6 @@ public interface SysIotModelMapper extends BaseMapper<SysIotModel> {
|
||||
|
||||
Long queryIotModelIdByName(String name);
|
||||
|
||||
List<SysIotModelVo> getSysIotModelByType(Integer objectType);
|
||||
|
||||
}
|
||||
|
@ -14,4 +14,7 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface SysIotModelServiceMapper extends BaseMapperPlus<SysIotModelServices, SysIotModelServices> {
|
||||
|
||||
IPage<SysIotModelServiceVo> querySysIotModelServiceList(IPage<SysIotModelServiceVo> page, @Param("info") SysIotModelServiceDto sysIotModelServiceDto);
|
||||
|
||||
Long querySysIotModelServiceByModelId (Long id);
|
||||
|
||||
}
|
||||
|
@ -43,4 +43,6 @@ public interface SysIotModelService {
|
||||
|
||||
void importSysIotModel(String iotModelId, MultipartFile file) throws IOException;
|
||||
|
||||
List<SysIotModelVo> getSysIotModelByType(Integer objectType);
|
||||
|
||||
}
|
||||
|
@ -81,6 +81,10 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
|
||||
@Override
|
||||
public void deleteSysEquipment(SysEquipmentDto sysEquipmentDto) {
|
||||
// 设备下面有子设备则不能删除
|
||||
if (sysEquipmentMapper.queryChildEquipmentCount(sysEquipmentDto.getId()) > 0) {
|
||||
throw new RuntimeException("该设备下有子设备,不能删除");
|
||||
}
|
||||
sysEquipmentMapper.deleteById(sysEquipmentDto.getId());
|
||||
}
|
||||
|
||||
|
@ -94,21 +94,25 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
|
||||
@Override
|
||||
public void deleteSysIotModel(SysIotModelDto sysIotModelDto) {
|
||||
// 物模型下面有类型或者动作则不能删除
|
||||
if ((sysIotModelServiceMapper.querySysIotModelServiceByModelId(sysIotModelDto.getId()) > 0) || (sysIotModelFieldMapper.querySysIotModelFieldByModelId(sysIotModelDto.getId()) > 0)){
|
||||
throw new RuntimeException("该物模型下面有类型,不能删除");
|
||||
}
|
||||
sysIotModelMapper.deleteById(sysIotModelDto.getId());
|
||||
// 删除绑定的物模型属性和动作
|
||||
// sysIotModelFieldMapper.delete(new QueryWrapper<SysIotModelField>().eq("iot_model_id",sysIotModelDto.getId()));
|
||||
// sysIotModelServiceMapper.delete(new QueryWrapper<SysIotModelServices>().eq("iot_model_id",sysIotModelDto.getId()));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysIotModelVo> querySysIotModel(SysIotModelDto sysIotModelDto) {
|
||||
List<SysIotModelVo> sysIotModelVoList = new ArrayList<>();
|
||||
List<SysIotModel> sysIotModels;
|
||||
QueryWrapper<SysIotModel> sysIotModelQueryWrapper = new QueryWrapper<>();
|
||||
if (sysIotModelDto.getIotModelCode() == null && sysIotModelDto.getIotModelName() == null){
|
||||
sysIotModels = sysIotModelMapper.selectList(null);
|
||||
sysIotModelQueryWrapper.orderByAsc("object_type");
|
||||
sysIotModels = sysIotModelMapper.selectList(sysIotModelQueryWrapper);
|
||||
} else {
|
||||
QueryWrapper<SysIotModel> sysIotModelQueryWrapper = new QueryWrapper<>();
|
||||
sysIotModelQueryWrapper.like("iot_model_code",sysIotModelDto.getIotModelCode()).or().like("iot_model_name",sysIotModelDto.getIotModelName());
|
||||
sysIotModelQueryWrapper.orderByAsc("object_type");
|
||||
sysIotModels = sysIotModelMapper.selectList(sysIotModelQueryWrapper);
|
||||
}
|
||||
for (SysIotModel item : sysIotModels){
|
||||
@ -304,4 +308,10 @@ public class SysIotModelServiceImpl implements SysIotModelService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysIotModelVo> getSysIotModelByType(Integer objectType) {
|
||||
List<SysIotModelVo> list = sysIotModelMapper.getSysIotModelByType(objectType);
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,4 +13,6 @@ import org.apache.ibatis.annotations.Param;
|
||||
public interface SysCommunicationLinkMapper extends BaseMapper<SysCommunicationLink> {
|
||||
IPage<SysCommunicationLinkVo> querySysCommunicationLinkList(IPage<SysCommunicationLinkVo> page, @Param("info") SysCommunicationLinkDto sysCommunicationLinkDto);
|
||||
|
||||
Long querySysCommunicationLinkCount(@Param("nodeId") Long nodeId);
|
||||
|
||||
}
|
||||
|
@ -89,6 +89,9 @@ public class SysNodeServiceImpl implements SysNodeService {
|
||||
@Override
|
||||
public void deleteSysNode(Long id) {
|
||||
// 判断节点下是否有链路,有就不能删除
|
||||
if (sysCommunicationLinkMapper.querySysCommunicationLinkCount(id) > 0) {
|
||||
throw new RuntimeException("该节点下有链路,不能删除");
|
||||
}
|
||||
sysNodeMapper.deleteById(id);
|
||||
}
|
||||
|
||||
|
@ -24,5 +24,10 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="querySysCommunicationLinkCount" resultType="java.lang.Long">
|
||||
select count(1) from sys_communicationlink sc where sc.node_id = #{nodeId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -103,8 +103,8 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="queryParentEquipmentIdByName" resultType="java.lang.Long">
|
||||
select id from sys_equipment where name = #{name}
|
||||
<select id="queryChildEquipmentCount" resultType="java.lang.Long">
|
||||
select count(1) from sys_equipment where parent_equipment_id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -27,4 +27,9 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="querySysIotModelFieldByModelId" resultType="java.lang.Long">
|
||||
select count(1) from sys_iot_model_field where iot_model_id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -19,6 +19,13 @@
|
||||
<result property="porder" column="porder" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.das.modules.equipment.domain.vo.SysIotModelVo" id="SysIotModelMap">
|
||||
<result property="iotModelName" column="iot_model_name" jdbcType="VARCHAR"/>
|
||||
<result property="id" column="id" jdbcType="BIGINT"/>
|
||||
<result property="objectType" column="object_type" jdbcType="INTEGER"/>
|
||||
<result property="iotModelCode" column="iot_model_code" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="queryFieldByModelId" resultMap="SysIotModelFieldMap">
|
||||
select simf.*,sim.iot_model_name as iotModelName from sys_iot_model_field simf left join sys_iot_model sim on simf.iot_model_id = sim.id
|
||||
where simf.iot_model_id = #{id}
|
||||
@ -32,4 +39,9 @@
|
||||
<select id="queryIotModelIdByName" resultType="java.lang.Long">
|
||||
select id from sys_iot_model where name = #{name}
|
||||
</select>
|
||||
|
||||
<select id="getSysIotModelByType" resultMap="SysIotModelMap">
|
||||
select * from sys_iot_model where object_type = #{objectType}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -27,4 +27,7 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="querySysIotModelServiceByModelId" resultType="java.lang.Long">
|
||||
select count(1) from sys_iot_model_service where iot_model_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user