代码提交
This commit is contained in:
parent
c1d1789057
commit
84d2cfae51
|
|
@ -0,0 +1,89 @@
|
|||
package com.bonus.waterdesign.controller.water;
|
||||
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
import com.bonus.waterdesign.service.DeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:29
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/device")
|
||||
public class DeviceController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DeviceService deviceService;
|
||||
@PreAuthorize("@ss.hasPermi('device:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceDto dto) {
|
||||
startPage();
|
||||
List<DeviceDto> list = deviceService.list(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@GetMapping("/getDeviceType")
|
||||
public AjaxResult getDeviceType() {
|
||||
List<SelectDto> list = deviceService.getDeviceType();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('device:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(@RequestBody DeviceDto dto) {
|
||||
return deviceService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:update')")
|
||||
@PostMapping("/update")
|
||||
public AjaxResult update(@RequestBody DeviceDto dto) {
|
||||
return deviceService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:del')")
|
||||
@PostMapping("/del")
|
||||
public AjaxResult del(@RequestBody DeviceDto dto) {
|
||||
return deviceService.delete(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:detail')")
|
||||
@GetMapping("/getById")
|
||||
public AjaxResult getById(String id) {
|
||||
return AjaxResult.success(deviceService.get(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 领用
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:use')")
|
||||
@PostMapping("/use")
|
||||
public AjaxResult use(@RequestBody DeviceRecord dto) {
|
||||
return deviceService.use(dto);
|
||||
}
|
||||
/**
|
||||
* 归还
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('device:return')")
|
||||
@PostMapping("/returnDevice")
|
||||
public AjaxResult returnDevice(@RequestBody DeviceRecord dto) {
|
||||
return deviceService.returnDevice(dto);
|
||||
}
|
||||
|
||||
// 领用状态下 查询最后一次领用人和领用日期
|
||||
@GetMapping("/getLastUse")
|
||||
public AjaxResult getLastUse() {
|
||||
return AjaxResult.success(deviceService.getLastUse());
|
||||
}
|
||||
|
||||
// 领用记录
|
||||
@GetMapping("/getRecordList")
|
||||
public AjaxResult getRecordList() {
|
||||
return AjaxResult.success(deviceService.getRecordList());
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.waterdesign.controller.water;
|
||||
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
import com.bonus.waterdesign.service.DeviceService;
|
||||
import com.bonus.waterdesign.service.DeviceTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:29
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/deviceType")
|
||||
public class DeviceTypeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DeviceTypeService deviceTypeService;
|
||||
@PreAuthorize("@ss.hasPermi('device:type:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(DeviceTypeDto dto) {
|
||||
startPage();
|
||||
List<DeviceTypeDto> list = deviceTypeService.getDeviceType(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(DeviceTypeDto dto) {
|
||||
return deviceTypeService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(DeviceTypeDto dto) {
|
||||
return deviceTypeService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('device:type:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(DeviceTypeDto dto) {
|
||||
return deviceTypeService.delete(dto);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
package com.bonus.waterdesign.controller.water;
|
||||
|
||||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.ProTypeDto;
|
||||
import com.bonus.waterdesign.service.DeviceTypeService;
|
||||
import com.bonus.waterdesign.service.ProTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/11 - 9:34
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/proType")
|
||||
public class ProTypeController extends BaseController {
|
||||
@Autowired
|
||||
private ProTypeService proTypeService;
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProTypeDto dto) {
|
||||
startPage();
|
||||
List<ProTypeDto> list = proTypeService.getDeviceType(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:add')")
|
||||
@PostMapping("/add")
|
||||
public AjaxResult add(ProTypeDto dto) {
|
||||
return proTypeService.add(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:update')")
|
||||
@GetMapping("/update")
|
||||
public AjaxResult update(ProTypeDto dto) {
|
||||
return proTypeService.update(dto);
|
||||
}
|
||||
@PreAuthorize("@ss.hasPermi('pro:type:del')")
|
||||
@GetMapping("/del")
|
||||
public AjaxResult del(ProTypeDto dto) {
|
||||
return proTypeService.delete(dto);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:30
|
||||
*/
|
||||
@Data
|
||||
public class DeviceDto {
|
||||
|
||||
private Integer id;
|
||||
// 设备名称
|
||||
private String deviceName;
|
||||
// 设备类型
|
||||
private String deviceType;
|
||||
// 设备编码
|
||||
private String deviceCode;
|
||||
// 设备管理人
|
||||
private Integer userId;
|
||||
//设备状态0:闲置,1:在用
|
||||
private String status;
|
||||
// 删除状态,0正常1删除
|
||||
private String delFlag;
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 13:21
|
||||
*/
|
||||
@Data
|
||||
public class DeviceRecord {
|
||||
private Integer id;
|
||||
private String deviceId;
|
||||
private String deviceType;
|
||||
private String deviceTypeName;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String status;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:30
|
||||
*/
|
||||
@Data
|
||||
public class DeviceTypeDto {
|
||||
|
||||
private Integer id;
|
||||
private String typeName;
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.waterdesign.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:30
|
||||
*/
|
||||
@Data
|
||||
public class ProTypeDto {
|
||||
|
||||
private Integer id;
|
||||
private String typeName;
|
||||
// 备注
|
||||
private String remark;
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
package com.bonus.waterdesign.mapper;
|
||||
|
||||
import com.bonus.waterdesign.domain.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceMapper {
|
||||
int add(DeviceDto model);
|
||||
int delete(@Param("id") Integer id);
|
||||
int update(DeviceDto model);
|
||||
DeviceDto get(@Param("id") String id);
|
||||
List<DeviceDto> list(DeviceDto model);
|
||||
|
||||
|
||||
List<SelectDto> getDeviceType();
|
||||
|
||||
Integer addUseRecord(DeviceRecord dto);
|
||||
|
||||
int updateStatus(DeviceRecord dto);
|
||||
|
||||
int updateReturnRecord(DeviceRecord dto);
|
||||
|
||||
DeviceRecord getLastUse();
|
||||
|
||||
List<DeviceRecord> getRecordList();
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.bonus.waterdesign.mapper;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceTypeMapper {
|
||||
List<DeviceTypeDto> getDeviceType(DeviceTypeDto model);
|
||||
AjaxResult add(DeviceTypeDto model);
|
||||
AjaxResult delete(DeviceTypeDto dto);
|
||||
AjaxResult update(DeviceTypeDto model);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.waterdesign.mapper;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.ProTypeDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProTypeMapper {
|
||||
List<ProTypeDto> getDeviceType(ProTypeDto model);
|
||||
AjaxResult add(ProTypeDto model);
|
||||
AjaxResult delete(ProTypeDto dto);
|
||||
AjaxResult update(ProTypeDto model);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.bonus.waterdesign.service;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:34
|
||||
*/
|
||||
public interface DeviceService {
|
||||
AjaxResult add(DeviceDto model);
|
||||
AjaxResult delete(DeviceDto dto);
|
||||
AjaxResult update(DeviceDto model);
|
||||
DeviceDto get(String id);
|
||||
List<DeviceDto> list(DeviceDto model);
|
||||
|
||||
List<SelectDto> getDeviceType();
|
||||
|
||||
AjaxResult use(DeviceRecord dto);
|
||||
|
||||
AjaxResult returnDevice(DeviceRecord dto);
|
||||
|
||||
DeviceRecord getLastUse();
|
||||
|
||||
List<DeviceRecord> getRecordList();
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.bonus.waterdesign.service;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:34
|
||||
*/
|
||||
public interface DeviceTypeService {
|
||||
List<DeviceTypeDto> getDeviceType(DeviceTypeDto model);
|
||||
AjaxResult add(DeviceTypeDto model);
|
||||
AjaxResult delete(DeviceTypeDto dto);
|
||||
AjaxResult update(DeviceTypeDto model);
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.bonus.waterdesign.service;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.ProTypeDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:34
|
||||
*/
|
||||
public interface ProTypeService {
|
||||
List<ProTypeDto> getDeviceType(ProTypeDto model);
|
||||
AjaxResult add(ProTypeDto model);
|
||||
AjaxResult delete(ProTypeDto dto);
|
||||
AjaxResult update(ProTypeDto model);
|
||||
}
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
package com.bonus.waterdesign.service.impl;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
import com.bonus.waterdesign.mapper.DeviceMapper;
|
||||
import com.bonus.waterdesign.service.DeviceService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:35
|
||||
*/
|
||||
@Service
|
||||
public class DeviceServiceImpl implements DeviceService {
|
||||
|
||||
@Resource
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
@Override
|
||||
public AjaxResult add(DeviceDto model) {
|
||||
int add = deviceMapper.add(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("新增成功");
|
||||
} else {
|
||||
return AjaxResult.error("新增失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(DeviceDto model) {
|
||||
int delete = deviceMapper.delete(model.getId());
|
||||
if (delete > 0) {
|
||||
return AjaxResult.success("删除成功");
|
||||
} else {
|
||||
return AjaxResult.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(DeviceDto model) {
|
||||
int add = deviceMapper.update(model);
|
||||
if (add > 0) {
|
||||
return AjaxResult.success("修改成功");
|
||||
} else {
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDto get(String id) {
|
||||
return deviceMapper.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceDto> list(DeviceDto model) {
|
||||
return deviceMapper.list(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SelectDto> getDeviceType() {
|
||||
return deviceMapper.getDeviceType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult use(DeviceRecord dto) {
|
||||
int update = deviceMapper.updateStatus(dto);
|
||||
if (update > 0) {
|
||||
deviceMapper.addUseRecord(dto);
|
||||
return AjaxResult.success("领用成功");
|
||||
}
|
||||
return AjaxResult.error("领用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult returnDevice(DeviceRecord dto) {
|
||||
int update = deviceMapper.updateStatus(dto);
|
||||
if (update > 0) {
|
||||
deviceMapper.updateReturnRecord(dto);
|
||||
return AjaxResult.success("归还成功");
|
||||
}
|
||||
return AjaxResult.error("领用失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceRecord getLastUse() {
|
||||
return deviceMapper.getLastUse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceRecord> getRecordList() {
|
||||
return deviceMapper.getRecordList();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.waterdesign.service.impl;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceDto;
|
||||
import com.bonus.waterdesign.domain.DeviceRecord;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.SelectDto;
|
||||
import com.bonus.waterdesign.mapper.DeviceMapper;
|
||||
import com.bonus.waterdesign.mapper.DeviceTypeMapper;
|
||||
import com.bonus.waterdesign.service.DeviceService;
|
||||
import com.bonus.waterdesign.service.DeviceTypeService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:35
|
||||
*/
|
||||
@Service
|
||||
public class DeviceTypeServiceImpl implements DeviceTypeService {
|
||||
|
||||
@Resource
|
||||
private DeviceTypeMapper deviceTypeMapper;
|
||||
|
||||
@Override
|
||||
public List<DeviceTypeDto> getDeviceType(DeviceTypeDto model) {
|
||||
return deviceTypeMapper.getDeviceType(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult add(DeviceTypeDto model) {
|
||||
return deviceTypeMapper.add( model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(DeviceTypeDto dto) {
|
||||
return deviceTypeMapper.delete(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(DeviceTypeDto model) {
|
||||
return deviceTypeMapper.update( model);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.waterdesign.service.impl;
|
||||
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.waterdesign.domain.DeviceTypeDto;
|
||||
import com.bonus.waterdesign.domain.ProTypeDto;
|
||||
import com.bonus.waterdesign.mapper.DeviceTypeMapper;
|
||||
import com.bonus.waterdesign.mapper.ProTypeMapper;
|
||||
import com.bonus.waterdesign.service.DeviceTypeService;
|
||||
import com.bonus.waterdesign.service.ProTypeService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/11/10 - 10:35
|
||||
*/
|
||||
@Service
|
||||
public class ProTypeServiceImpl implements ProTypeService {
|
||||
|
||||
@Resource
|
||||
private ProTypeMapper proTypeMapper;
|
||||
|
||||
@Override
|
||||
public List<ProTypeDto> getDeviceType(ProTypeDto model) {
|
||||
return proTypeMapper.getDeviceType(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult add(ProTypeDto model) {
|
||||
return proTypeMapper.add(model);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delete(ProTypeDto dto) {
|
||||
return proTypeMapper.delete(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult update(ProTypeDto model) {
|
||||
return proTypeMapper.update(model);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,110 @@
|
|||
<?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.bonus.waterdesign.mapper.DeviceMapper">
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_device(device_name,device_type,device_code,user_id,status,remark) values(#{deviceName},#{deviceType},#{deviceCode},#{userId},#{status},#{remark})
|
||||
</insert>
|
||||
<insert id="addUseRecord">
|
||||
insert into tb_device_record(device_id,user_id,start_time) values(#{deviceId},#{userId},#{startTime})
|
||||
</insert>
|
||||
|
||||
|
||||
<update id="update">
|
||||
UPDATE tb_device
|
||||
<set>
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">
|
||||
device_name = #{deviceName},
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
device_type = #{deviceType},
|
||||
</if>
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
device_code = #{deviceCode},
|
||||
</if>
|
||||
<if test="userId != null">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</trim>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
<update id="updateStatus">
|
||||
update tb_device set status = #{status} where id = #{deviceId}
|
||||
</update>
|
||||
<update id="updateReturnRecord">
|
||||
update tb_device_record set end_time = #{endTime} where device_id = #{deviceId} and end_time is null
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from tb_device where id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="get" resultType="com.bonus.waterdesign.domain.DeviceDto">
|
||||
select * from tb_device where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="list" resultType="com.bonus.waterdesign.domain.DeviceDto">
|
||||
select * from tb_device
|
||||
where del_flag = 0
|
||||
<if test="deviceCode != null and deviceCode != ''">
|
||||
and device_code like concat ('%',#{deviceCode},'%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and status = #{status}
|
||||
</if>
|
||||
<if test="deviceType != null and deviceType != ''">
|
||||
and device_type = #{deviceType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.SelectDto">
|
||||
select id,
|
||||
type_name as name
|
||||
from tb_device_type
|
||||
</select>
|
||||
<select id="getLastUse" resultType="com.bonus.waterdesign.domain.DeviceRecord">
|
||||
select tdr.user_id as userId,
|
||||
su.nick_name as userName,
|
||||
tdr.start_time as startTime
|
||||
from tb_device_record tdr
|
||||
left join sys_user su on tdr.user_id = su.user_id
|
||||
where tdr.device_id = #{deviceId} and start_time is not null
|
||||
order by id desc limit 1
|
||||
</select>
|
||||
<select id="getRecordList" resultType="com.bonus.waterdesign.domain.DeviceRecord">
|
||||
select tdr.device_id as deviceId,
|
||||
tdr.user_id as userId,
|
||||
su.nick_name as userName,
|
||||
tdr.start_time as startTime,
|
||||
tdr.end_time as endTime,
|
||||
tdr.status as status,
|
||||
td.device_type as deviceType,
|
||||
sd.dict_label as deviceTypeName
|
||||
|
||||
from tb_device_record tdr
|
||||
left join tb_device td on tdr.device_id = td.id
|
||||
left join sys_user su on tdr.user_id = su.user_id
|
||||
left join tb_device_type sd on td.device_type = sd.id
|
||||
where tdr.device_id = #{deviceId}
|
||||
<if test="userId != null and userId != ''">
|
||||
and tdr.user_id = #{userId}
|
||||
</if>
|
||||
<if test="startTime != null and startTime != ''">
|
||||
and tdr.start_time = #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null and endTime != ''">
|
||||
and tdr.end_time = #{endTime}
|
||||
</if>
|
||||
order by id desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?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.bonus.waterdesign.mapper.DeviceTypeMapper">
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_device_type(type_name,remark) values(#{typeName},#{remark})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update tb_device_type
|
||||
set type_name=#{typeName},
|
||||
remark=#{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from tb_device_type where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.DeviceTypeDto">
|
||||
select * from tb_device_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
<?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.bonus.waterdesign.mapper.ProTypeMapper">
|
||||
|
||||
<insert id="add">
|
||||
insert into tb_device_type(type_name,remark) values(#{typeName},#{remark})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
update tb_device_type
|
||||
set type_name=#{typeName},
|
||||
remark=#{remark}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from tb_device_type where id=#{id}
|
||||
</delete>
|
||||
|
||||
<select id="getDeviceType" resultType="com.bonus.waterdesign.domain.ProTypeDto">
|
||||
select * from tb_device_type
|
||||
<where>
|
||||
<if test="typeName != null and typeName != ''">
|
||||
and type_name like concat('%', #{typeName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -111,13 +111,10 @@
|
|||
</select>
|
||||
<select id="proTypeSelect" resultType="com.bonus.waterdesign.domain.SelectDto">
|
||||
SELECT
|
||||
tp.dict_label as name,
|
||||
tp.dict_value as id
|
||||
tp.type_name as name,
|
||||
tp.id
|
||||
FROM
|
||||
sys_dict_data tp
|
||||
WHERE
|
||||
tp.dict_type = 'pro_type'
|
||||
and status = '0'
|
||||
tb_pro_type tp
|
||||
</select>
|
||||
|
||||
<update id="updateProject" parameterType="Project">
|
||||
|
|
|
|||
Loading…
Reference in New Issue