灌溉记录的逻辑实现
This commit is contained in:
@ -0,0 +1,132 @@
|
||||
package com.fastbee.data.controller.userRecharge;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.enums.BusinessType;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.service.IUserIrrigationRecordService;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 灌溉记录Controller
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/rechargecard/record")
|
||||
@Api(tags = "灌溉记录")
|
||||
public class UserIrrigationRecordController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUserIrrigationRecordService userIrrigationRecordService;
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:list')")
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("查询灌溉记录列表")
|
||||
public TableDataInfo list(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
startPage();
|
||||
List<UserIrrigationRecord> list = userIrrigationRecordService.selectUserIrrigationRecordList(userIrrigationRecord);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录详细信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:query')")
|
||||
@GetMapping(value = "/list/{cardNumber}")
|
||||
@ApiOperation("获取灌溉记录详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("cardNumber") String cardNumber)
|
||||
{
|
||||
return success(userIrrigationRecordService.selectUserIrrigationRecordListBycardNumber(cardNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录展示详细信息列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:query')")
|
||||
@GetMapping(value = "/list/show/{cardNumber}")
|
||||
@ApiOperation("获取灌溉记录详细信息")
|
||||
public AjaxResult getShowInfo(@PathVariable("cardNumber") String cardNumber)
|
||||
{
|
||||
return success(userIrrigationRecordService.selectUserIrrigationRecordListShowBycardNumber(cardNumber));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出灌溉记录列表
|
||||
*/
|
||||
@ApiOperation("导出灌溉记录列表")
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:export')")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
List<UserIrrigationRecord> list = userIrrigationRecordService.selectUserIrrigationRecordList(userIrrigationRecord);
|
||||
ExcelUtil<UserIrrigationRecord> util = new ExcelUtil<UserIrrigationRecord>(UserIrrigationRecord.class);
|
||||
util.exportExcel(response, list, "灌溉记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取灌溉记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiOperation("获取灌溉记录详细信息")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(userIrrigationRecordService.selectUserIrrigationRecordById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:add')")
|
||||
@PostMapping
|
||||
@ApiOperation("新增灌溉记录")
|
||||
public AjaxResult add(@RequestBody UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
return toAjax(userIrrigationRecordService.insertUserIrrigationRecord(userIrrigationRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:edit')")
|
||||
@PutMapping
|
||||
@ApiOperation("修改灌溉记录")
|
||||
public AjaxResult edit(@RequestBody UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
return toAjax(userIrrigationRecordService.updateUserIrrigationRecord(userIrrigationRecord));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除灌溉记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('rechargecard:record:remove')")
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除灌溉记录")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(userIrrigationRecordService.deleteUserIrrigationRecordByIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.fastbee.rechargecard.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 灌溉记录对象 user_irrigation_record
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@ApiModel(value = "UserIrrigationRecord",description = "灌溉记录 user_irrigation_record")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserIrrigationRecord extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 序号 */
|
||||
private Long id;
|
||||
|
||||
/** 用户id,关联用户 */
|
||||
@Excel(name = "用户id,关联用户")
|
||||
@ApiModelProperty("用户id,关联用户")
|
||||
private Long userId;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
@ApiModelProperty("设备编码")
|
||||
private String deviceNumber;
|
||||
|
||||
/** 所属项目id */
|
||||
@Excel(name = "所属项目id")
|
||||
@ApiModelProperty("所属项目id")
|
||||
private Long projectId;
|
||||
|
||||
/** 所属机构 */
|
||||
@Excel(name = "所属机构")
|
||||
@ApiModelProperty("所属机构")
|
||||
private Long deptId;
|
||||
|
||||
/** 购水卡号 */
|
||||
@Excel(name = "购水卡号")
|
||||
@ApiModelProperty("购水卡号")
|
||||
private String cardNumber;
|
||||
|
||||
/** 区域号 */
|
||||
@Excel(name = "区域号")
|
||||
@ApiModelProperty("区域号")
|
||||
private String areaCode;
|
||||
|
||||
/** 本次用水量,以立方米为单位 */
|
||||
@Excel(name = "本次用水量,以立方米为单位")
|
||||
@ApiModelProperty("本次用水量,以立方米为单位")
|
||||
private BigDecimal curFlow;
|
||||
|
||||
/** 本次用电量 */
|
||||
@Excel(name = "本次用电量")
|
||||
@ApiModelProperty("本次用电量")
|
||||
private BigDecimal curEle;
|
||||
|
||||
/** 卡内余额 */
|
||||
@Excel(name = "卡内余额")
|
||||
@ApiModelProperty("卡内余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
/** 开泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("开泵时间")
|
||||
private Date startTime;
|
||||
|
||||
/** 关泵时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "关泵时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("关泵时间")
|
||||
private Date endTime;
|
||||
|
||||
/** 灌溉持续时间 */
|
||||
@Excel(name = "灌溉持续时间")
|
||||
@ApiModelProperty("灌溉持续时间")
|
||||
private BigDecimal duration;
|
||||
|
||||
/** 灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年 */
|
||||
@Excel(name = "灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年")
|
||||
@ApiModelProperty("灌溉时间单位,0=小时、1=天、2=周、3=月、4=季度、5=年")
|
||||
private Integer unit;
|
||||
|
||||
/** 灌溉上报时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "灌溉上报时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty("灌溉上报时间")
|
||||
private Date lastTime;
|
||||
|
||||
/** 灌溉状态,1=开始灌溉,2=结束灌溉 */
|
||||
@Excel(name = "灌溉状态,1=开始灌溉,2=结束灌溉")
|
||||
@ApiModelProperty("灌溉状态,1=开始灌溉,2=结束灌溉")
|
||||
private Integer status;
|
||||
|
||||
/** 关于灌溉记录的额外信息或备注 */
|
||||
@Excel(name = "关于灌溉记录的额外信息或备注")
|
||||
@ApiModelProperty("关于灌溉记录的额外信息或备注")
|
||||
private String remarks;
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.fastbee.rechargecard.domain.dto;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
public class UserIrrigationRecordDto
|
||||
{
|
||||
public String userName;
|
||||
public String deviceName;
|
||||
public String cardNumber;
|
||||
public BigDecimal flow;
|
||||
public Date startTime;
|
||||
public Date endTime;
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.fastbee.rechargecard.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 灌溉记录Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserIrrigationRecordMapper
|
||||
{
|
||||
/**
|
||||
* 查询用户灌溉记录列表
|
||||
*
|
||||
* @param cardNumber
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 删除灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.fastbee.rechargecard.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
|
||||
/**
|
||||
* 灌溉记录Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
public interface IUserIrrigationRecordService
|
||||
{
|
||||
/**
|
||||
* 查询用户灌溉展示记录列表
|
||||
*
|
||||
* @param cardNumber 卡号
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordListShowBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询用户灌溉记录列表
|
||||
*
|
||||
* @param cardNumber 卡号
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录集合
|
||||
*/
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord);
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的灌溉记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除灌溉记录信息
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUserIrrigationRecordById(Long id);
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package com.fastbee.rechargecard.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.iot.mapper.DeviceMapper;
|
||||
import com.fastbee.rechargecard.domain.dto.UserIrrigationRecordDto;
|
||||
import com.fastbee.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.rechargecard.mapper.UserIrrigationRecordMapper;
|
||||
import com.fastbee.rechargecard.domain.UserIrrigationRecord;
|
||||
import com.fastbee.rechargecard.service.IUserIrrigationRecordService;
|
||||
|
||||
/**
|
||||
* 灌溉记录Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-12-18
|
||||
*/
|
||||
@Service
|
||||
public class UserIrrigationRecordServiceImpl implements IUserIrrigationRecordService
|
||||
{
|
||||
@Autowired
|
||||
private UserIrrigationRecordMapper userIrrigationRecordMapper;
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录列表
|
||||
* @param cardNumber 卡号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordListBycardNumber(String cardNumber)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordListBycardNumber(cardNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户灌溉记录展示数据列表
|
||||
* @param cardNumber 卡号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecordDto> selectUserIrrigationRecordListShowBycardNumber(String cardNumber)
|
||||
{
|
||||
List<UserIrrigationRecordDto> result=new ArrayList<>();
|
||||
List<UserIrrigationRecord> list=userIrrigationRecordMapper.selectUserIrrigationRecordListBycardNumber(cardNumber);
|
||||
for(int i=0;i<list.size();i++)
|
||||
{
|
||||
UserIrrigationRecordDto temp=new UserIrrigationRecordDto();
|
||||
temp.userName= sysUserMapper.selectUserById(list.get(i).getUserId()).getUserName();
|
||||
temp.deviceName=deviceMapper.selectDeviceBySerialNumber(list.get(i).getDeviceNumber()).getDeviceName();
|
||||
temp.cardNumber=list.get(i).getCardNumber();
|
||||
temp.flow=list.get(i).getCurFlow();
|
||||
temp.startTime=list.get(i).getStartTime();
|
||||
temp.endTime=list.get(i).getEndTime();
|
||||
result.add(temp);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询灌溉记录
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
@Override
|
||||
public UserIrrigationRecord selectUserIrrigationRecordById(Long id)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询灌溉记录列表
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 灌溉记录
|
||||
*/
|
||||
@Override
|
||||
public List<UserIrrigationRecord> selectUserIrrigationRecordList(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
return userIrrigationRecordMapper.selectUserIrrigationRecordList(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
userIrrigationRecord.setCreateTime(DateUtils.getNowDate());
|
||||
return userIrrigationRecordMapper.insertUserIrrigationRecord(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改灌溉记录
|
||||
*
|
||||
* @param userIrrigationRecord 灌溉记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUserIrrigationRecord(UserIrrigationRecord userIrrigationRecord)
|
||||
{
|
||||
userIrrigationRecord.setUpdateTime(DateUtils.getNowDate());
|
||||
return userIrrigationRecordMapper.updateUserIrrigationRecord(userIrrigationRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除灌溉记录
|
||||
*
|
||||
* @param ids 需要删除的灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserIrrigationRecordByIds(Long[] ids)
|
||||
{
|
||||
return userIrrigationRecordMapper.deleteUserIrrigationRecordByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除灌溉记录信息
|
||||
*
|
||||
* @param id 灌溉记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUserIrrigationRecordById(Long id)
|
||||
{
|
||||
return userIrrigationRecordMapper.deleteUserIrrigationRecordById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
<?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.fastbee.rechargecard.mapper.UserIrrigationRecordMapper">
|
||||
|
||||
<resultMap type="UserIrrigationRecord" id="UserIrrigationRecordResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="deviceNumber" column="device_number" />
|
||||
<result property="projectId" column="project_id" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="cardNumber" column="card_number" />
|
||||
<result property="areaCode" column="area_code" />
|
||||
<result property="curFlow" column="cur_flow" />
|
||||
<result property="curEle" column="cur_ele" />
|
||||
<result property="balance" column="balance" />
|
||||
<result property="startTime" column="start_time" />
|
||||
<result property="endTime" column="end_time" />
|
||||
<result property="duration" column="duration" />
|
||||
<result property="unit" column="unit" />
|
||||
<result property="lastTime" column="last_time" />
|
||||
<result property="status" column="status" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserIrrigationRecordVo">
|
||||
select id, user_id, device_number, project_id, dept_id, card_number, area_code, cur_flow, cur_ele, balance, start_time, end_time, duration, unit, last_time, status, remarks, create_time, update_time, create_by, update_by from user_irrigation_record
|
||||
</sql>
|
||||
|
||||
<select id="selectUserIrrigationRecordList" parameterType="UserIrrigationRecord" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
<where>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
<if test="deviceNumber != null and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
|
||||
<if test="projectId != null "> and project_id = #{projectId}</if>
|
||||
<if test="deptId != null "> and dept_id = #{deptId}</if>
|
||||
<if test="cardNumber != null and cardNumber != ''"> and card_number = #{cardNumber}</if>
|
||||
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
||||
<if test="curFlow != null "> and cur_flow = #{curFlow}</if>
|
||||
<if test="curEle != null "> and cur_ele = #{curEle}</if>
|
||||
<if test="balance != null "> and balance = #{balance}</if>
|
||||
<if test="startTime != null "> and start_time = #{startTime}</if>
|
||||
<if test="endTime != null "> and end_time = #{endTime}</if>
|
||||
<if test="duration != null "> and duration = #{duration}</if>
|
||||
<if test="unit != null "> and unit = #{unit}</if>
|
||||
<if test="lastTime != null "> and last_time = #{lastTime}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserIrrigationRecordListBycardNumber" parameterType="String" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
<where>
|
||||
card_number=#{cardNumber}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectUserIrrigationRecordById" parameterType="Long" resultMap="UserIrrigationRecordResult">
|
||||
<include refid="selectUserIrrigationRecordVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertUserIrrigationRecord" parameterType="UserIrrigationRecord" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_irrigation_record
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="deviceNumber != null">device_number,</if>
|
||||
<if test="projectId != null">project_id,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="cardNumber != null">card_number,</if>
|
||||
<if test="areaCode != null">area_code,</if>
|
||||
<if test="curFlow != null">cur_flow,</if>
|
||||
<if test="curEle != null">cur_ele,</if>
|
||||
<if test="balance != null">balance,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="duration != null">duration,</if>
|
||||
<if test="unit != null">unit,</if>
|
||||
<if test="lastTime != null">last_time,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="remarks != null">remarks,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deviceNumber != null">#{deviceNumber},</if>
|
||||
<if test="projectId != null">#{projectId},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="cardNumber != null">#{cardNumber},</if>
|
||||
<if test="areaCode != null">#{areaCode},</if>
|
||||
<if test="curFlow != null">#{curFlow},</if>
|
||||
<if test="curEle != null">#{curEle},</if>
|
||||
<if test="balance != null">#{balance},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="duration != null">#{duration},</if>
|
||||
<if test="unit != null">#{unit},</if>
|
||||
<if test="lastTime != null">#{lastTime},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="remarks != null">#{remarks},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateUserIrrigationRecord" parameterType="UserIrrigationRecord">
|
||||
update user_irrigation_record
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="deviceNumber != null">device_number = #{deviceNumber},</if>
|
||||
<if test="projectId != null">project_id = #{projectId},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="cardNumber != null">card_number = #{cardNumber},</if>
|
||||
<if test="areaCode != null">area_code = #{areaCode},</if>
|
||||
<if test="curFlow != null">cur_flow = #{curFlow},</if>
|
||||
<if test="curEle != null">cur_ele = #{curEle},</if>
|
||||
<if test="balance != null">balance = #{balance},</if>
|
||||
<if test="startTime != null">start_time = #{startTime},</if>
|
||||
<if test="endTime != null">end_time = #{endTime},</if>
|
||||
<if test="duration != null">duration = #{duration},</if>
|
||||
<if test="unit != null">unit = #{unit},</if>
|
||||
<if test="lastTime != null">last_time = #{lastTime},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="remarks != null">remarks = #{remarks},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteUserIrrigationRecordById" parameterType="Long">
|
||||
delete from user_irrigation_record where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteUserIrrigationRecordByIds" parameterType="String">
|
||||
delete from user_irrigation_record where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Reference in New Issue
Block a user