Commit e42c7cd1 authored by wuqinghua's avatar wuqinghua

2022/2/12 吴卿华

parent 37139dcb
......@@ -78,15 +78,6 @@ public class TDeviceInfoController extends BaseController
{
//添加设备信息表数据 并且返回新增id
tDeviceInfoService.insertTDeviceInfo(listaw.gettDeviceInfo());
Long deviceId = listaw.gettDeviceInfo().getDeviceId();
if (listaw.gettDeviceInfoS().size()!=0){
//添加 关联设备表 设备id添加
for (int i=0;i<listaw.gettDeviceInfoS().size();i++){
listaw.gettDeviceInfoS().get(i).setRelationDeviceId(Math.toIntExact(deviceId));
}
//添加关联设备信息表数据
tDeviceInfoService.insertDeviceDetailInfo(listaw.gettDeviceInfoS());
}
// TDeviceInfo tDeviceInfo = new TDeviceInfo();
// //根据企业id查询企业名称
// String EnterpriseName = tEmployedPeopleInfoService.selectEnterpriseName(tDeviceInfo.getBeyondEnterpriseId());
......@@ -123,12 +114,46 @@ public class TDeviceInfoController extends BaseController
* 获取设备详细信息列表
*/
@PreAuthorize("@ss.hasPermi('device:device:deviceDetailInfo')")
@GetMapping(value = "/{getdeviceDetailInfo}")
public AjaxResult getdeviceDetailInfo(@PathVariable("deviceId") Long deviceId)
{
@GetMapping("/getdeviceDetailInfo")
public AjaxResult getdeviceDetailInfo(Long deviceId) {
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoService.getdeviceDetailInfo(deviceId);
System.out.println("111111111");
System.out.println(tDeviceInfoS+"111111111");
return AjaxResult.success(tDeviceInfoS);
}
/**
* 查询无绑定的 关联设备信息
* @return
*/
@RequestMapping("/selectDetailInfo")
public TableDataInfo selectDetailInfo(@RequestBody TDeviceInfoS tDeviceInfos){
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoService.selectDetailInfo(tDeviceInfos);
return getDataTable(tDeviceInfoS);
}
/**
* 添加关联设备数据接口
*/
@RequestMapping("/insertDetailInfo")
public void insertDetailInfo(@RequestBody TDeviceInfoS tDeviceInfoS){
//添加关联设备信息表数据
tDeviceInfoService.insertDeviceDetailInfo(tDeviceInfoS);
}
/**
* 关联设备批量数据删除接口
*/
@RequestMapping("/deleteDetailInfo")
public void deleteDetailInfo(@RequestBody int deviceId){
tDeviceInfoService.deleteDetailinfOS(deviceId);
}
/**
* 关联设备批量数据删除接口
* @param deviceId
*/
@RequestMapping("/deleteeListDetailInfo")
public void deleteeListDetailInfo(@RequestBody Long[] deviceId){
tDeviceInfoService.deleteDetailInfo(deviceId);
}
}
......@@ -6,8 +6,6 @@ import com.zehong.common.core.domain.BaseEntity;
*/
public class TDeviceInfoS extends BaseEntity {
/**
* 关联设备详情ID
*/
......@@ -31,7 +29,7 @@ public class TDeviceInfoS extends BaseEntity {
/**
* 设备类型:1.压力表 2.流量计
*/
private Integer deviceType;
private String deviceType;
/**
* 物联网编号
......@@ -76,11 +74,11 @@ public class TDeviceInfoS extends BaseEntity {
this.deviceModel = deviceModel;
}
public Integer getDeviceType() {
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(Integer deviceType) {
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
......
......@@ -64,7 +64,7 @@ public interface TDeviceInfoMapper
* 添加关联设备信息表数据
* @param gettDeviceInfoS
*/
void insertDeviceDetailInfo(List<TDeviceInfoS> gettDeviceInfoS);
void insertDeviceDetailInfo(TDeviceInfoS gettDeviceInfoS);
/**
* 获取设备详细信息列表
......@@ -72,4 +72,22 @@ public interface TDeviceInfoMapper
* @return
*/
List<TDeviceInfoS> getdeviceDetailInfo(Long deviceId);
/**
* 查询无绑定的 关联设备信息
* @return
*/
List<TDeviceInfoS> selectDetailInfo(TDeviceInfoS tDeviceInfos);
/**
* 关联设备数据删除接口
* @param deviceIds
*/
void deleteDetailInfo(Long[] deviceIds);
/**
* 关联设备数据删除接口 单条删除
* @param deviceId
*/
void deleteDetailinfOS(int deviceId);
}
......@@ -64,7 +64,7 @@ public interface ITDeviceInfoService
* 添加关联设备信息表数据
* @param gettDeviceInfoS
*/
void insertDeviceDetailInfo(List<TDeviceInfoS> gettDeviceInfoS);
void insertDeviceDetailInfo(TDeviceInfoS gettDeviceInfoS);
/**
* 获取设备详细信息列表
......@@ -72,4 +72,22 @@ public interface ITDeviceInfoService
* @return
*/
List<TDeviceInfoS> getdeviceDetailInfo(Long deviceId);
/**
* 查询无绑定的 关联设备信息
* @return
*/
List<TDeviceInfoS> selectDetailInfo(TDeviceInfoS tDeviceInfos);
/**
* 关联设备数据删除接口
* @param deviceIds
*/
void deleteDetailInfo(Long[] deviceIds);
/**
* 关联设备数据删除接口 单条删除
* @param deviceId
*/
void deleteDetailinfOS(int deviceId);
}
......@@ -100,7 +100,7 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
* @param gettDeviceInfoS
*/
@Override
public void insertDeviceDetailInfo(List<TDeviceInfoS> gettDeviceInfoS) {
public void insertDeviceDetailInfo(TDeviceInfoS gettDeviceInfoS) {
tDeviceInfoMapper.insertDeviceDetailInfo(gettDeviceInfoS);
}
......@@ -114,4 +114,32 @@ public class TDeviceInfoServiceImpl implements ITDeviceInfoService
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoMapper.getdeviceDetailInfo(deviceId);
return tDeviceInfoS;
}
/**
* 查询无绑定的 关联设备信息
* @return
*/
@Override
public List<TDeviceInfoS> selectDetailInfo(TDeviceInfoS tDeviceInfos) {
List<TDeviceInfoS> tDeviceInfoS = tDeviceInfoMapper.selectDetailInfo(tDeviceInfos);
return tDeviceInfoS;
}
/**
* 关联设备数据删除接口
* @param deviceIds
*/
@Override
public void deleteDetailInfo(Long[] deviceIds) {
tDeviceInfoMapper.deleteDetailInfo(deviceIds);
}
/**
* 关联设备数据删除接口 单条删除
* @param deviceId
*/
@Override
public void deleteDetailinfOS(int deviceId) {
tDeviceInfoMapper.deleteDetailinfOS(deviceId);
}
}
......@@ -150,12 +150,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<!--添加关联设备信息表数据-->
<insert id="insertDeviceDetailInfo" parameterType="java.util.List">
INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no)
<!-- <insert id="insertDeviceDetailInfo" parameterType="java.util.List">-->
<!-- INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no)-->
<!-- VALUES-->
<!-- <foreach collection="list" item="item" index="key" separator=",">-->
<!-- (#{item.relationDeviceId},#{item.deviceName},#{item.deviceModel},#{item.deviceType},#{item.iotNo})-->
<!-- </foreach>-->
<!-- </insert>-->
<insert id="insertDeviceDetailInfo">
INSERT INTO t_relation_device_detail_info (relation_device_id,device_name,device_model,device_type,iot_no,remarks)
VALUES
<foreach collection="list" item="item" index="key" separator=",">
(#{item.relationDeviceId},#{item.deviceName},#{item.deviceModel},#{item.deviceType},#{item.iotNo})
</foreach>
(#{relationDeviceId},#{deviceName},#{deviceModel},#{deviceType},#{iotNo},#{remarksn})
</insert>
<!--获取设备详细信息列表-->
......@@ -164,4 +170,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from t_relation_device_detail_info where relation_device_id =#{deviceId}
</select>
<!--查询无绑定的 关联设备信息-->
<select id="selectDetailInfo" resultMap="TDeviceInfoResultS">
select relation_device_detail_id,relation_device_id,device_name,device_model,iot_no,remarks, (CASE device_type WHEN '1' THEN '压力表' WHEN '2' THEN '流量计' end) as device_type
from t_relation_device_detail_info where is_del='0' and relation_device_id is null
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="deviceModel != null and deviceModel != ''"> and device_model like concat('%', #{deviceModel}, '%')</if>
<if test="iotNo != null and iotNo != ''"> and iot_no like concat('%', #{iotNo}, '%')</if>
group by relation_device_detail_id desc
</select>
<!--关联设备数据删除接口-->
<update id="deleteDetailInfo">
update t_relation_device_detail_info set is_del='1' where relation_device_detail_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>
</update>
<!--关联设备数据删除接口 单条删除-->
<update id="deleteDetailinfOS">
update t_relation_device_detail_info set is_del='1' where relation_device_detail_id = #{deviceId}
</update>
</mapper>
......@@ -61,9 +61,39 @@ export function selectTEnterprise() {
}
// 关联设备详情信息
export function getDdeviceDetailInfo(deviceId) {
export function getDdeviceDetailInfo(data) {
return request({
url: '/device/device/getdeviceDetailInfo' + deviceId,
method: 'get'
url: '/device/device/selectDetailInfo',
method: 'post',
data:data
})
}
// 新增关联设备信息
export function addDetailInfos(data) {
return request({
url: '/device/device/insertDetailInfo',
method: 'post',
data: data
})
}
// 删除关联设备信息
export function deleteDetailInfo(deviceId) {
return request({
url: '/device/device/deleteDetailInfo',
method: 'delete',
data:deviceId
})
}
// 删除关联设备信息
export function deleteeListDetailInfo(deviceId) {
return request({
url: '/device/device/deleteeListDetailInfo',
method: 'delete',
data: deviceId
})
}
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