#update
This commit is contained in:
@@ -122,9 +122,9 @@ public class DeviceController extends BaseController {
|
||||
return AjaxResult.success(deviceRunStatisticsMapper.selectList(queryWrapperX));
|
||||
}
|
||||
|
||||
@GetMapping("/getDeviceIntradayData")
|
||||
public AjaxResult getDeviceIntradayData(@RequestParam("deviceId") String deviceId) {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData();
|
||||
@GetMapping("/getDeviceTotalData")
|
||||
public AjaxResult getDeviceTotalData(@RequestParam("deviceId") String deviceId) {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData(false);
|
||||
DeviceRunStatistics statistics = null;
|
||||
if (!CollectionUtils.isEmpty(resultList)) {
|
||||
statistics = resultList.stream().filter(x -> deviceId.equals(x.getDeviceId())).findFirst().orElse(null);
|
||||
@@ -132,15 +132,31 @@ public class DeviceController extends BaseController {
|
||||
return AjaxResult.success(statistics);
|
||||
}
|
||||
|
||||
public List<DeviceRunStatistics> getIntradayData() {
|
||||
LambdaQueryWrapperX<DeviceRunStatistics> wrapper = new LambdaQueryWrapperX<>();
|
||||
LocalDateTime start = LocalDate.now().atStartOfDay(); // 今天 00:00:00
|
||||
LocalDateTime end = LocalDate.now().plusDays(1).atStartOfDay(); // 明天 00:00:00
|
||||
@GetMapping("/getDeviceIntradayData")
|
||||
public AjaxResult getDeviceIntradayData(@RequestParam("deviceId") String deviceId) {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData(true);
|
||||
DeviceRunStatistics statistics = null;
|
||||
if (!CollectionUtils.isEmpty(resultList)) {
|
||||
statistics = resultList.stream().filter(x -> deviceId.equals(x.getDeviceId())).findFirst().orElse(null);
|
||||
}
|
||||
return AjaxResult.success(statistics);
|
||||
}
|
||||
|
||||
wrapper.ge(DeviceRunStatistics::getStartTime, start)
|
||||
.lt(DeviceRunStatistics::getStartTime, end);
|
||||
public List<DeviceRunStatistics> getIntradayData(Boolean day) {
|
||||
|
||||
List<DeviceRunStatistics> list = deviceRunStatisticsMapper.selectList(wrapper);
|
||||
List<DeviceRunStatistics> list;
|
||||
if (day) {
|
||||
LambdaQueryWrapperX<DeviceRunStatistics> wrapper = new LambdaQueryWrapperX<>();
|
||||
LocalDateTime start = LocalDate.now().atStartOfDay(); // 今天 00:00:00
|
||||
LocalDateTime end = LocalDate.now().plusDays(1).atStartOfDay(); // 明天 00:00:00
|
||||
|
||||
wrapper.ge(DeviceRunStatistics::getStartTime, start)
|
||||
.lt(DeviceRunStatistics::getStartTime, end);
|
||||
|
||||
list = deviceRunStatisticsMapper.selectList(wrapper);
|
||||
} else {
|
||||
list = deviceRunStatisticsMapper.selectList();
|
||||
}
|
||||
List<DeviceRunStatistics> resultList = new ArrayList<>();
|
||||
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
@@ -184,7 +200,7 @@ public class DeviceController extends BaseController {
|
||||
|
||||
@GetMapping("/generateOperationReport")
|
||||
public void generateOperationReport(HttpServletResponse response) throws UnsupportedEncodingException {
|
||||
List<DeviceRunStatistics> resultList = getIntradayData();
|
||||
List<DeviceRunStatistics> resultList = getIntradayData(true);
|
||||
// ✅ 4. 响应头(下载)
|
||||
response.setContentType(
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.maibu.controller;
|
||||
|
||||
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
import com.maibu.core.domain.R;
|
||||
import com.maibu.service.impl.WorkRecordService;
|
||||
import com.maibu.utils.MinioUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/iot/workRecord")
|
||||
public class WorkRecordController {
|
||||
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Autowired
|
||||
private WorkRecordService workRecordService;
|
||||
|
||||
|
||||
@PostMapping("/add")
|
||||
public R addWorkRecord(
|
||||
@RequestPart("file") MultipartFile file, // 接收上传的图片
|
||||
@RequestPart("workRecord") WorkRecord workRecord // 接收表单里的 JSON 对象
|
||||
) {
|
||||
int i = -1;
|
||||
|
||||
WorkRecord workRecord1 = workRecordService.selectWorkRecordByWorkName(workRecord.getWorkName());
|
||||
if (workRecord1 != null) {
|
||||
return R.fail("该任务已存在");
|
||||
}
|
||||
|
||||
try (InputStream inputStream = file.getInputStream()) {
|
||||
|
||||
String fileName = "routePlanImage/rt" + workRecord.getWorkName() + System.currentTimeMillis() + ".png";
|
||||
|
||||
// 上传到 MinIO
|
||||
minioUtil.uploadFile(fileName, inputStream, "image/png");
|
||||
|
||||
// 获取访问 URL
|
||||
String url = minioUtil.getPublicUrl(fileName);
|
||||
System.out.println("✅ 图片上传成功,访问地址: " + url);
|
||||
|
||||
// 这里可以把 URL 存到 workRecord 里
|
||||
workRecord.setImgUrl(url);
|
||||
|
||||
i = workRecordService.addWorkRecord(workRecord);
|
||||
} catch (Exception e) {
|
||||
return R.fail("新增失败: " + e.getMessage());
|
||||
}
|
||||
|
||||
return i <= 0 ? R.fail("新增失败") : R.ok("新增成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectByUserId")
|
||||
public R selectWorkRecordByUserId(String userId) {
|
||||
List<WorkRecord> workRecords = workRecordService.selectWorkRecordByUserId(userId);
|
||||
return R.ok(workRecords);
|
||||
}
|
||||
|
||||
@GetMapping("/selectByWorkName")
|
||||
public R selectWorkRecordByWorkName(String workName) {
|
||||
WorkRecord workRecord = workRecordService.selectWorkRecordByWorkName(workName);
|
||||
return R.ok(workRecord);
|
||||
}
|
||||
|
||||
@GetMapping("/deleteByWorkName")
|
||||
public R deleteWorkRecordByWorkName(String workName) {
|
||||
int i = workRecordService.deleteWorkRecordByWorkName(workName);
|
||||
return i <= 0 ? R.fail("删除失败") : R.ok("删除成功");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public R updateWorkRecord(@RequestBody WorkRecord workRecord) {
|
||||
boolean b = workRecordService.updateWorkRecord(workRecord);
|
||||
return !b ? R.fail("更新失败") : R.ok("更新成功");
|
||||
}
|
||||
|
||||
@GetMapping("/selectBySiteId")
|
||||
public R selectBySiteId(@RequestParam Long siteId) {
|
||||
List<WorkRecord> workRecords = workRecordService.selectBySiteId(siteId);
|
||||
return R.ok(workRecords);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
import com.maibu.core.business.DevicePlan;
|
||||
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备历史状态
|
||||
*/
|
||||
@Repository
|
||||
public interface DevicePlanMapper extends BaseMapperX<DevicePlan> {
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
import com.maibu.core.business.DevicePlanTask;
|
||||
import com.maibu.mybatis.mapper.BaseMapperX;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* 设备历史状态
|
||||
*/
|
||||
@Repository
|
||||
public interface DevicePlanTaskMapper extends BaseMapperX<DevicePlanTask> {
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.maibu.mapper;
|
||||
|
||||
|
||||
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface WorkRecordMapper {
|
||||
public int insertWorkRecord(WorkRecord workRecord);
|
||||
|
||||
public WorkRecord selectWorkRecordByWorkName(String workName);
|
||||
|
||||
public WorkRecord selectWorkRecordById(Long id);
|
||||
|
||||
public List<WorkRecord> selectWorkRecordByUserId(String workName);
|
||||
|
||||
public int deleteWorkRecordByWorkName(String workName);
|
||||
|
||||
public int updateWorkRecord(WorkRecord workRecord);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.maibu.service;
|
||||
|
||||
|
||||
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IWorkRecordService {
|
||||
|
||||
public int addWorkRecord(WorkRecord workRecord) throws Exception;
|
||||
|
||||
public WorkRecord selectWorkRecordByWorkName(String workName);
|
||||
|
||||
public List<WorkRecord> selectWorkRecordByUserId(String workName);
|
||||
|
||||
public int deleteWorkRecordByWorkName(String workName);
|
||||
|
||||
public int updateWorkRecord(WorkRecord workRecord);
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.maibu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.maibu.core.business.Device;
|
||||
import com.maibu.core.business.DevicePlan;
|
||||
import com.maibu.core.business.DeviceRunningStatusHistory;
|
||||
import com.maibu.core.business.DeviceStatusRecordDTO;
|
||||
import com.maibu.core.business.*;
|
||||
import com.maibu.core.business.dto.DeviceBindDTO;
|
||||
import com.maibu.core.business.uav.IotUAVDevice;
|
||||
import com.maibu.core.domain.AjaxResult;
|
||||
import com.maibu.core.domain.entity.SysRole;
|
||||
import com.maibu.core.domain.entity.SysSite;
|
||||
import com.maibu.core.domain.model.LoginUser;
|
||||
import com.maibu.core.enums.DeviceTaskStaus;
|
||||
import com.maibu.core.redis.RedisCache;
|
||||
import com.maibu.mapper.DeviceMapper;
|
||||
import com.maibu.mapper.DevicePlanMapper;
|
||||
import com.maibu.mapper.DeviceStatusHistoryMapper;
|
||||
import com.maibu.mapper.SysSiteMapper;
|
||||
import com.maibu.memory.GlobalMemory;
|
||||
import com.maibu.memory.SiteMemory;
|
||||
import com.maibu.service.IDeviceService;
|
||||
import com.maibu.service.ISysRoleService;
|
||||
import com.maibu.utils.SecurityUtils;
|
||||
@@ -29,6 +29,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -55,7 +56,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private SysSiteMapper sysSiteMapper;
|
||||
|
||||
|
||||
/**
|
||||
@@ -227,17 +229,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean bind(DeviceBindDTO bindDTO,String username) {
|
||||
public boolean bind(DeviceBindDTO bindDTO, String username) {
|
||||
try {
|
||||
List<String> deviceIds = bindDTO.getDeviceIds();
|
||||
LambdaQueryWrapper<Device> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Device::getSerialNumber,deviceIds);
|
||||
List<Device> list =deviceMapper.selectList(queryWrapper);
|
||||
queryWrapper.in(Device::getSerialNumber, deviceIds);
|
||||
List<Device> list = deviceMapper.selectList(queryWrapper);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return false;
|
||||
} else {
|
||||
list.forEach(device -> {
|
||||
if(bindDTO.getUserId()!=null){
|
||||
if (bindDTO.getUserId() != null) {
|
||||
device.setTenantId(bindDTO.getUserId());
|
||||
}
|
||||
device.setOrgId(bindDTO.getOrgId());
|
||||
@@ -254,11 +256,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean unbind(DeviceBindDTO dto,String username) {
|
||||
public boolean unbind(DeviceBindDTO dto, String username) {
|
||||
List<String> deviceIds = dto.getDeviceIds();
|
||||
if (!CollectionUtils.isEmpty(deviceIds)) {
|
||||
LambdaQueryWrapper<Device> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Device::getSerialNumber,deviceIds);
|
||||
queryWrapper.in(Device::getSerialNumber, deviceIds);
|
||||
List<Device> list = deviceMapper.selectList(queryWrapper);
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
list.forEach(x -> {
|
||||
@@ -279,7 +281,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getSiteList(LoginUser loginUser,Device device) {
|
||||
public List<Device> getSiteList(LoginUser loginUser, Device device) {
|
||||
SysRole sysRole = roleService.selectRoleById(loginUser.getRoleId());
|
||||
List<Device> deviceList = new ArrayList<>();
|
||||
if (sysRole != null) {
|
||||
@@ -293,11 +295,66 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
deviceList = deviceMapper.selectDeviceList(device);
|
||||
}
|
||||
}
|
||||
Map<Integer, Integer> statusStatistics = new HashMap<>();
|
||||
if (device.getOrgId() == null) {
|
||||
SysSite site = sysSiteMapper.selectById(device.getSiteId());
|
||||
if (site != null) {
|
||||
device.setOrgId(site.getOrgId());
|
||||
}
|
||||
}
|
||||
SiteMemory siteMemory = GlobalMemory.getSiteMemory(device.getOrgId(), device.getSiteId());
|
||||
if (siteMemory != null) {
|
||||
Integer work = 0;
|
||||
Integer free = 0;
|
||||
if (!CollectionUtils.isEmpty(deviceList)) {
|
||||
List<String> ids = deviceList.stream().map(Device::getDeviceName).collect(Collectors.toList());
|
||||
List<DeviceRunningStatusHistory> allStatusList = deviceStatusHistoryMapper.selectLatestByDeviceIds(ids);
|
||||
for (Device x : deviceList) {
|
||||
if (siteMemory.hasTask(x.getSerialNumber())) {
|
||||
work += 1;
|
||||
x.setFeStatus(1);
|
||||
} else {
|
||||
free += 1;
|
||||
x.setFeStatus(2);
|
||||
}
|
||||
String key = "running_status:" + x.getDeviceName();
|
||||
DeviceStatusRecordDTO recordDTO = redisCache.getCacheObject(key);
|
||||
DeviceRunningStatusHistory lastRunningStatus = null;
|
||||
if (recordDTO != null && !CollectionUtils.isEmpty(recordDTO.getHistories())) {
|
||||
List<DeviceRunningStatusHistory> list = recordDTO.getHistories().stream().filter(y -> !"0".equals(y.getQual())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
lastRunningStatus = list.get(list.size() - 1);
|
||||
}
|
||||
}
|
||||
if (lastRunningStatus == null) {
|
||||
if (!CollectionUtils.isEmpty(allStatusList)) {
|
||||
Map<String, List<DeviceRunningStatusHistory>> statusMap =
|
||||
allStatusList.stream()
|
||||
.collect(Collectors.groupingBy(DeviceRunningStatusHistory::getDeviceId));
|
||||
List<DeviceRunningStatusHistory> list = statusMap.get(x.getDeviceName());
|
||||
if (!CollectionUtils.isEmpty(list)) {
|
||||
List<DeviceRunningStatusHistory> l = list.stream().filter(y -> !"0".equals(y.getQual())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(l)) {
|
||||
lastRunningStatus = l.get(l.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
x.setLastRunningStatus(lastRunningStatus);
|
||||
}
|
||||
statusStatistics.put(0, work);
|
||||
statusStatistics.put(1, free);
|
||||
deviceList.forEach(y -> {
|
||||
y.setStatusStatistics(statusStatistics);
|
||||
});
|
||||
}
|
||||
}
|
||||
deviceList.sort(Comparator.comparing(Device::getFeStatus));
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getDeviceList(LoginUser loginUser,Device device) {
|
||||
public List<Device> getDeviceList(LoginUser loginUser, Device device) {
|
||||
SysRole sysRole = roleService.selectRoleById(loginUser.getRoleId());
|
||||
List<Device> deviceList = new ArrayList<>();
|
||||
if (sysRole != null) {
|
||||
@@ -315,14 +372,11 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
// } else {
|
||||
// deviceList = deviceMapper.selectDeviceList(device);
|
||||
// }
|
||||
deviceList = deviceMapper.selectDeviceList(device);
|
||||
deviceList = deviceMapper.selectDeviceList(device);
|
||||
}
|
||||
}
|
||||
return deviceList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.maibu.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
import com.maibu.mapper.WorkRecordMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WorkRecordService {
|
||||
|
||||
@Autowired
|
||||
private WorkRecordMapper workRecordMapper;
|
||||
|
||||
|
||||
public int addWorkRecord(WorkRecord workRecord) throws Exception {
|
||||
int i = workRecordMapper.insert(workRecord);
|
||||
// int i = workRecordMapper.insertWorkRecord(workRecord);
|
||||
return i;
|
||||
}
|
||||
|
||||
public WorkRecord selectWorkRecordByWorkName(String workName) {
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WorkRecord::getWorkName, workName);
|
||||
return workRecordMapper.selectOne(queryWrapper);
|
||||
}
|
||||
|
||||
public List<WorkRecord> selectWorkRecordByUserId(String userId) {
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WorkRecord::getUserId, userId);
|
||||
return workRecordMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
public int deleteWorkRecordByWorkName(String workName) {
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WorkRecord::getWorkName, workName);
|
||||
return workRecordMapper.delete(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
public boolean updateWorkRecord(WorkRecord workRecord) {
|
||||
return workRecordMapper.saveOrUpdate(workRecord);
|
||||
}
|
||||
|
||||
|
||||
public List<WorkRecord> selectBySiteId(Long siteId) {
|
||||
LambdaQueryWrapper<WorkRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(WorkRecord::getSiteId, siteId);
|
||||
return workRecordMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.maibu.service.impl;
|
||||
|
||||
import com.maibu.core.business.WorkRecord;
|
||||
import com.maibu.mapper.WorkRecordMapper;
|
||||
import com.maibu.service.IWorkRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WorkRecordServiceImpl implements IWorkRecordService {
|
||||
|
||||
@Autowired
|
||||
private WorkRecordMapper workRecordMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public int addWorkRecord(WorkRecord workRecord) throws Exception {
|
||||
int i = workRecordMapper.insertWorkRecord(workRecord);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WorkRecord selectWorkRecordByWorkName(String workName) {
|
||||
WorkRecord workRecord = workRecordMapper.selectWorkRecordByWorkName(workName);
|
||||
return workRecord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WorkRecord> selectWorkRecordByUserId(String workName) {
|
||||
List<WorkRecord> workRecordList = workRecordMapper.selectWorkRecordByUserId(workName);
|
||||
return workRecordList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteWorkRecordByWorkName(String workName) {
|
||||
int i = workRecordMapper.deleteWorkRecordByWorkName(workName);
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateWorkRecord(WorkRecord workRecord) {
|
||||
int i = workRecordMapper.updateWorkRecord(workRecord);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.maibu.mapper.WorkRecordMapper">
|
||||
|
||||
<insert id="insertWorkRecord" parameterType="com.maibu.core.business.WorkRecord">
|
||||
insert into iot_work_record(work_name, user_id, json_data, img_url)
|
||||
values (#{workName}, #{userId}, #{jsonData}, #{imgUrl})
|
||||
</insert>
|
||||
|
||||
<select id="selectWorkRecordByWorkName" resultType="com.maibu.core.business.WorkRecord">
|
||||
select *
|
||||
from iot_work_record
|
||||
where work_name = #{workName}
|
||||
</select>
|
||||
|
||||
<select id="selectWorkRecordById" resultType="com.maibu.core.business.WorkRecord">
|
||||
select *
|
||||
from iot_work_record
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectWorkRecordByUserId" resultType="com.maibu.core.business.WorkRecord">
|
||||
select id, work_name, img_url
|
||||
from iot_work_record
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<delete id="deleteWorkRecordByWorkName">
|
||||
delete
|
||||
from iot_work_record
|
||||
where work_name = #{workName}
|
||||
</delete>
|
||||
|
||||
<update id="updateWorkRecord">
|
||||
update iot_work_record
|
||||
set work_name=#{workName},
|
||||
user_id= #{userId},
|
||||
json_data=#{jsonData},
|
||||
img_url= #{imgUrl}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user