Commit 49879854 authored by zhangyanduan's avatar zhangyanduan

fix: 修改设备表新增编辑接口

parent f6b4ca97
......@@ -421,12 +421,14 @@ public class JieLinkServiceImpl implements IJieLinkService {
public static List<Map<String,String>> deviceGuidInArray = new ArrayList<>();
static{
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","1");}});
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","2");}});
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","3");}});
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","4");}});
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","5");}});
deviceGuidInArray.add(new HashMap(){{ put("deviceApGuid","1");}});
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","59c50c9c-3d75-420f-be9b-ad2db1aee432");}});//右出口
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","64467dcf-9e59-495e-b9e4-f65a98732a99");}});//右入口
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","6e2bfaad-feb3-4171-9b85-86f00589bcce");}});//左入口
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","e90c55ec-bc68-498d-966c-66091ee85c27");}});//左出口
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","754fdf10-be59-4004-b869-969dbc61987d");}});//大门出口
deviceGuidAllArray.add(new HashMap(){{ put("deviceApGuid","a3dc7973-a64c-4359-bdc9-a19fe32a9f9d");}});//大门入口
//门口访客机器
deviceGuidInArray.add(new HashMap(){{ put("deviceApGuid","");}});
}
......
......@@ -18,6 +18,10 @@ import java.util.List;
public interface DevicesRepository extends CyBaseMapper<Devices> {
int saveDeviceInfo(@Param("entity") Devices devices);
void updateDeviceInfo(@Param("entity") Devices devices);
List<Devices> queryDevicess(@Param("entity") Devices devices);
/**
......@@ -31,7 +35,7 @@ public interface DevicesRepository extends CyBaseMapper<Devices> {
* @param deviceGuid
* @return
*/
Devices getDeviceInfoByDeviceGuid(@Param("deviceGuid")String deviceGuid);
Devices getDeviceInfoByGuid(@Param("deviceGuid")String deviceGuid);
}
......
......@@ -42,9 +42,9 @@ public class DevicesServiceImpl extends ServiceImpl<DevicesRepository,Devices>
@Override
public CyPersistModel persist(Devices devices){
//增加操作
int line = baseMapper.insert(devices);
int line = baseMapper.saveDeviceInfo(devices);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
devices.getBusinessId()+"的通行设备信息表信息");
devices.getDeviceGuid()+"的通行设备信息表信息");
return new CyPersistModel(line);
}
......@@ -69,9 +69,9 @@ public class DevicesServiceImpl extends ServiceImpl<DevicesRepository,Devices>
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel merge(Devices devices){
int line = baseMapper.updateById(devices);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ devices.getBusinessId()+"的通行设备信息表信息");
return new CyPersistModel(line);
baseMapper.updateDeviceInfo(devices);
log.debug(CyUserUtil.getAuthenUsername()+"修改了ID为"+ devices.getDeviceGuid()+"的通行设备信息表信息");
return new CyPersistModel(1);
}
/**
......@@ -118,7 +118,7 @@ public class DevicesServiceImpl extends ServiceImpl<DevicesRepository,Devices>
@Override
public Devices getDeviceInfoByDeviceGuid(String deviceGuid) {
return baseMapper.getDeviceInfoByDeviceGuid(deviceGuid);
return baseMapper.getDeviceInfoByGuid(deviceGuid);
}
......
......@@ -3,7 +3,6 @@
<mapper namespace="org.rcisoft.sys.devices.dao.DevicesRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.sys.devices.entity.Devices">
<id column="device_guid" jdbcType="VARCHAR" property="deviceGuid"/>
<result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
<result column="device_name" jdbcType="VARCHAR" property="deviceName"/>
<result column="device_ip" jdbcType="VARCHAR" property="deviceIp"/>
......@@ -15,6 +14,50 @@
<result column="parent_id" jdbcType="VARCHAR" property="parentId"/>
</resultMap>
<insert id="saveDeviceInfo" parameterType="org.rcisoft.sys.devices.entity.Devices" useGeneratedKeys="false" >
insert into devices
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="entity.deviceGuid != null">device_guid ,</if>
<if test="entity.deviceId != null">device_id ,</if>
<if test="entity.deviceName != null">device_name ,</if>
<if test="entity.deviceIp != null">device_ip ,</if>
<if test="entity.deviceGateway != null">device_gateway ,</if>
<if test="entity.deviceNetmask != null">device_netmask ,</if>
<if test="entity.deviceType != null">device_type ,</if>
<if test="entity.deviceioType != null">deviceIo_type ,</if>
<if test="entity.remark != null">remark ,</if>
<if test="entity.parentId != null">parent_id ,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="entity.deviceGuid != null">#{entity.deviceGuid},</if>
<if test="entity.deviceId != null">#{entity.deviceId},</if>
<if test="entity.deviceName != null">#{entity.deviceName},</if>
<if test="entity.deviceIp != null">#{entity.deviceIp},</if>
<if test="entity.deviceGateway != null">#{entity.deviceGateway},</if>
<if test="entity.deviceNetmask != null">#{entity.deviceNetmask},</if>
<if test="entity.deviceType != null">#{entity.deviceType},</if>
<if test="entity.deviceioType != null">#{entity.deviceioType},</if>
<if test="entity.remark != null">#{entity.remark},</if>
<if test="entity.parentId != null">#{entity.parentId},</if>
</trim>
</insert>
<update id="updateDeviceInfo" parameterType="org.rcisoft.sys.devices.entity.Devices">
update devices
<trim prefix="SET" suffixOverrides=",">
<if test="entity.deviceId != null">device_id = #{entity.deviceId},</if>
<if test="entity.deviceName != null">device_name = #{entity.deviceName},</if>
<if test="entity.deviceIp != null">device_ip = #{entity.deviceIp},</if>
<if test="entity.deviceGateway != null">device_gateway = #{entity.deviceGateway},</if>
<if test="entity.deviceNetmask != null">device_netmask = #{entity.deviceNetmask},</if>
<if test="entity.deviceType != null">device_type = #{entity.deviceType},</if>
<if test="entity.deviceioType != null">deviceIo_type = #{entity.deviceioType},</if>
<if test="entity.remark != null">remark = #{entity.remark},</if>
<if test="entity.parentId != null">parent_id = #{entity.parentId},</if>
</trim>
where device_guid = #{entity.deviceGuid}
</update>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
<select id="queryDevicess" resultMap="BaseResultMap">
select * from devices
......
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