Commit 0d7b2ce3 by 14796

设备信息代码

parent c0bb5aa8
package share.system.service.impl;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import share.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import share.common.utils.SecurityUtils;
import share.system.mapper.DeviceMapper;
import share.system.domain.Device;
import share.system.service.DeviceService;
......@@ -16,8 +18,7 @@ import share.system.service.DeviceService;
* @date 2023-11-04
*/
@Service
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService
{
public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> implements DeviceService {
@Autowired
private DeviceMapper deviceMapper;
......@@ -28,8 +29,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 设备信息
*/
@Override
public Device selectDeviceById(Long id)
{
public Device selectDeviceById(Long id) {
return deviceMapper.selectDeviceById(id);
}
......@@ -40,8 +40,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 设备信息
*/
@Override
public List<Device> selectDeviceList(Device device)
{
public List<Device> selectDeviceList(Device device) {
return deviceMapper.selectDeviceList(device);
}
......@@ -52,9 +51,9 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 结果
*/
@Override
public int insertDevice(Device device)
{
public int insertDevice(Device device) {
device.setCreateTime(DateUtils.getNowDate());
device.setCreateBy(SecurityUtils.getUsername());
return deviceMapper.insertDevice(device);
}
......@@ -65,8 +64,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 结果
*/
@Override
public int updateDevice(Device device)
{
public int updateDevice(Device device) {
device.setUpdateTime(DateUtils.getNowDate());
return deviceMapper.updateDevice(device);
}
......@@ -78,8 +76,7 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 结果
*/
@Override
public int deleteDeviceByIds(Long[] ids)
{
public int deleteDeviceByIds(Long[] ids) {
return deviceMapper.deleteDeviceByIds(ids);
}
......@@ -90,20 +87,19 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
* @return 结果
*/
@Override
public int deleteDeviceById(Long id)
{
public int deleteDeviceById(Long id) {
return deviceMapper.deleteDeviceById(id);
}
/**
* 修改设备信息
* 根据devid
*
* @param device 设备信息
* @return 结果
*/
@Override
public int updateDeviceByDevId(Device device)
{
public int updateDeviceByDevId(Device device) {
device.setUpdateTime(DateUtils.getNowDate());
return deviceMapper.updateDeviceByDevId(device);
}
......
......@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeviceGatewayVo">
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, group, status, mqtt_iP, mqtt_port, mqtt_user, mqtt_paswd, create_by, create_time, update_by, update_time, remark, dev_position from s_device_gateway
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, `group`, status, mqtt_iP, mqtt_port, mqtt_user, mqtt_paswd, create_by, create_time, update_by, update_time, remark, dev_position from s_device_gateway
</sql>
<select id="selectDeviceGatewayList" parameterType="DeviceGateway" resultMap="DeviceGatewayResult">
......
......@@ -28,7 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeviceVo">
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, projt_id, projt_psw, group, status, create_by, create_time, update_by, update_time, remark, dev_position, gateway_id, voltage, signal_value from s_device
select id, dev_name, dev_mac, dev_id, dev_psw, dev_ver, dev_type, projt_id, projt_psw, `group`, status, create_by, create_time, update_by, update_time, remark, dev_position, gateway_id, voltage, signal_value from s_device
</sql>
<select id="selectDeviceList" parameterType="Device" resultMap="DeviceResult">
......@@ -143,7 +143,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="devType != null">dev_type = #{devType},</if>
<if test="projtId != null">projt_id = #{projtId},</if>
<if test="projtPsw != null">projt_psw = #{projtPsw},</if>
<if test="group != null">group = #{group},</if>
<if test="group != null"> group = #{group},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
......
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