添加 使用记录
parent
c4523aa95a
commit
d4c71d06f2
@ -0,0 +1,128 @@
|
||||
package com.ruoyi.device.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.device.domain.RecordUse;
|
||||
import com.ruoyi.device.service.IRecordUseService;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 使用记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-19
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/device/record_use")
|
||||
public class RecordUseController extends BaseController
|
||||
{
|
||||
private String prefix = "device/record_use";
|
||||
|
||||
@Autowired
|
||||
private IRecordUseService recordUseService;
|
||||
|
||||
@RequiresPermissions("device:record_use:view")
|
||||
@GetMapping()
|
||||
public String record_use()
|
||||
{
|
||||
return prefix + "/record_use";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询使用记录列表
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(RecordUse recordUse)
|
||||
{
|
||||
startPage();
|
||||
List<RecordUse> list = recordUseService.selectRecordUseList(recordUse);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出使用记录列表
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:export")
|
||||
@Log(title = "使用记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(RecordUse recordUse)
|
||||
{
|
||||
List<RecordUse> list = recordUseService.selectRecordUseList(recordUse);
|
||||
ExcelUtil<RecordUse> util = new ExcelUtil<RecordUse>(RecordUse.class);
|
||||
return util.exportExcel(list, "使用记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增使用记录
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:add")
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存使用记录
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:add")
|
||||
@Log(title = "使用记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(RecordUse recordUse)
|
||||
{
|
||||
return toAjax(recordUseService.insertRecordUse(recordUse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改使用记录
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:edit")
|
||||
@GetMapping("/edit/{objId}")
|
||||
public String edit(@PathVariable("objId") Long objId, ModelMap mmap)
|
||||
{
|
||||
RecordUse recordUse = recordUseService.selectRecordUseByObjId(objId);
|
||||
mmap.put("recordUse", recordUse);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存使用记录
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:edit")
|
||||
@Log(title = "使用记录", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(RecordUse recordUse)
|
||||
{
|
||||
return toAjax(recordUseService.updateRecordUse(recordUse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除使用记录
|
||||
*/
|
||||
@RequiresPermissions("device:record_use:remove")
|
||||
@Log(title = "使用记录", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(recordUseService.deleteRecordUseByObjIds(ids));
|
||||
}
|
||||
}
|
@ -0,0 +1,295 @@
|
||||
package com.ruoyi.device.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 使用记录对象 device_record_use
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-19
|
||||
*/
|
||||
public class RecordUse extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long objId;
|
||||
|
||||
/** 设备ID */
|
||||
@Excel(name = "设备ID")
|
||||
private String deviceId;
|
||||
|
||||
/** 设备编码 */
|
||||
@Excel(name = "设备编码")
|
||||
private String deviceCode;
|
||||
|
||||
/** 设备名称 */
|
||||
@Excel(name = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/** 设备类型 */
|
||||
@Excel(name = "设备类型")
|
||||
private String deviceType;
|
||||
|
||||
/** 开锁时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Excel(name = "开锁时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date openTime;
|
||||
|
||||
/** 关锁时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
@Excel(name = "关锁时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date closeTime;
|
||||
|
||||
/** 使用时间(小时) */
|
||||
@Excel(name = "使用时间(小时)")
|
||||
private double useTime;
|
||||
|
||||
/** 默认使用时间 */
|
||||
@Excel(name = "默认使用时间")
|
||||
private double defaultTime;
|
||||
|
||||
/** 计费价格 */
|
||||
@Excel(name = "计费价格")
|
||||
private double chargePrice;
|
||||
|
||||
/** 超时状态 */
|
||||
@Excel(name = "超时状态")
|
||||
private String overtimeState;
|
||||
|
||||
/** 使用状态 */
|
||||
@Excel(name = "使用状态")
|
||||
private String useState;
|
||||
|
||||
/** 借用人 */
|
||||
@Excel(name = "借用人")
|
||||
private String useUser;
|
||||
|
||||
/** 借用单位 */
|
||||
@Excel(name = "借用单位")
|
||||
private String useUnit;
|
||||
|
||||
/** 统计年份 */
|
||||
private String queryYear;
|
||||
|
||||
/** 统计月份 */
|
||||
private String queryMonth;
|
||||
|
||||
/** 数据权限1 */
|
||||
private String deptId;
|
||||
|
||||
/** 数据权限2 */
|
||||
private String userId;
|
||||
|
||||
public void setObjId(Long objId)
|
||||
{
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public Long getObjId()
|
||||
{
|
||||
return objId;
|
||||
}
|
||||
|
||||
public void setDeviceId(String deviceId)
|
||||
{
|
||||
this.deviceId = deviceId;
|
||||
}
|
||||
|
||||
public String getDeviceId()
|
||||
{
|
||||
return deviceId;
|
||||
}
|
||||
|
||||
public void setDeviceCode(String deviceCode)
|
||||
{
|
||||
this.deviceCode = deviceCode;
|
||||
}
|
||||
|
||||
public String getDeviceCode()
|
||||
{
|
||||
return deviceCode;
|
||||
}
|
||||
|
||||
public void setDeviceName(String deviceName)
|
||||
{
|
||||
this.deviceName = deviceName;
|
||||
}
|
||||
|
||||
public String getDeviceName()
|
||||
{
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
public void setDeviceType(String deviceType)
|
||||
{
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public String getDeviceType()
|
||||
{
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setOpenTime(Date openTime)
|
||||
{
|
||||
this.openTime = openTime;
|
||||
}
|
||||
|
||||
public Date getOpenTime()
|
||||
{
|
||||
return openTime;
|
||||
}
|
||||
|
||||
public void setCloseTime(Date closeTime)
|
||||
{
|
||||
this.closeTime = closeTime;
|
||||
}
|
||||
|
||||
public Date getCloseTime()
|
||||
{
|
||||
return closeTime;
|
||||
}
|
||||
|
||||
public void setUseTime(double useTime)
|
||||
{
|
||||
this.useTime = useTime;
|
||||
}
|
||||
|
||||
public double getUseTime()
|
||||
{
|
||||
return useTime;
|
||||
}
|
||||
|
||||
public void setDefaultTime(double defaultTime)
|
||||
{
|
||||
this.defaultTime = defaultTime;
|
||||
}
|
||||
|
||||
public double getDefaultTime()
|
||||
{
|
||||
return defaultTime;
|
||||
}
|
||||
|
||||
public void setChargePrice(double chargePrice)
|
||||
{
|
||||
this.chargePrice = chargePrice;
|
||||
}
|
||||
|
||||
public double getChargePrice()
|
||||
{
|
||||
return chargePrice;
|
||||
}
|
||||
|
||||
public void setOvertimeState(String overtimeState)
|
||||
{
|
||||
this.overtimeState = overtimeState;
|
||||
}
|
||||
|
||||
public String getOvertimeState()
|
||||
{
|
||||
return overtimeState;
|
||||
}
|
||||
|
||||
public void setUseState(String useState)
|
||||
{
|
||||
this.useState = useState;
|
||||
}
|
||||
|
||||
public String getUseState()
|
||||
{
|
||||
return useState;
|
||||
}
|
||||
|
||||
public void setUseUser(String useUser)
|
||||
{
|
||||
this.useUser = useUser;
|
||||
}
|
||||
|
||||
public String getUseUser()
|
||||
{
|
||||
return useUser;
|
||||
}
|
||||
|
||||
public void setUseUnit(String useUnit)
|
||||
{
|
||||
this.useUnit = useUnit;
|
||||
}
|
||||
|
||||
public String getUseUnit()
|
||||
{
|
||||
return useUnit;
|
||||
}
|
||||
|
||||
public void setQueryYear(String queryYear)
|
||||
{
|
||||
this.queryYear = queryYear;
|
||||
}
|
||||
|
||||
public String getQueryYear()
|
||||
{
|
||||
return queryYear;
|
||||
}
|
||||
|
||||
public void setQueryMonth(String queryMonth)
|
||||
{
|
||||
this.queryMonth = queryMonth;
|
||||
}
|
||||
|
||||
public String getQueryMonth()
|
||||
{
|
||||
return queryMonth;
|
||||
}
|
||||
|
||||
public void setDeptId(String deptId)
|
||||
{
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("objId", getObjId())
|
||||
.append("deviceId", getDeviceId())
|
||||
.append("deviceCode", getDeviceCode())
|
||||
.append("deviceName", getDeviceName())
|
||||
.append("deviceType", getDeviceType())
|
||||
.append("openTime", getOpenTime())
|
||||
.append("closeTime", getCloseTime())
|
||||
.append("useTime", getUseTime())
|
||||
.append("defaultTime", getDefaultTime())
|
||||
.append("chargePrice", getChargePrice())
|
||||
.append("overtimeState", getOvertimeState())
|
||||
.append("useState", getUseState())
|
||||
.append("useUser", getUseUser())
|
||||
.append("useUnit", getUseUnit())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("queryYear", getQueryYear())
|
||||
.append("queryMonth", getQueryMonth())
|
||||
.append("deptId", getDeptId())
|
||||
.append("userId", getUserId())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ruoyi.device.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import com.ruoyi.device.domain.RecordUse;
|
||||
|
||||
/**
|
||||
* 使用记录Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-19
|
||||
*/
|
||||
@Repository
|
||||
public interface RecordUseMapper
|
||||
{
|
||||
/**
|
||||
* 查询使用记录
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 使用记录
|
||||
*/
|
||||
public RecordUse selectRecordUseByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询使用记录列表
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 使用记录集合
|
||||
*/
|
||||
public List<RecordUse> selectRecordUseList(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 新增使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordUse(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 修改使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordUse(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 删除使用记录
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordUseByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除使用记录
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordUseByObjIds(String[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.ruoyi.device.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.device.domain.RecordUse;
|
||||
|
||||
/**
|
||||
* 使用记录Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-19
|
||||
*/
|
||||
public interface IRecordUseService
|
||||
{
|
||||
/**
|
||||
* 查询使用记录
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 使用记录
|
||||
*/
|
||||
public RecordUse selectRecordUseByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询使用记录列表
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 使用记录集合
|
||||
*/
|
||||
public List<RecordUse> selectRecordUseList(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 新增使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertRecordUse(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 修改使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateRecordUse(RecordUse recordUse);
|
||||
|
||||
/**
|
||||
* 批量删除使用记录
|
||||
*
|
||||
* @param objIds 需要删除的使用记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordUseByObjIds(String objIds);
|
||||
|
||||
/**
|
||||
* 删除使用记录信息
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteRecordUseByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.ruoyi.device.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.device.mapper.RecordUseMapper;
|
||||
import com.ruoyi.device.domain.RecordUse;
|
||||
import com.ruoyi.device.service.IRecordUseService;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
|
||||
/**
|
||||
* 使用记录Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-05-19
|
||||
*/
|
||||
@Service
|
||||
public class RecordUseServiceImpl implements IRecordUseService
|
||||
{
|
||||
@Autowired
|
||||
private RecordUseMapper recordUseMapper;
|
||||
|
||||
/**
|
||||
* 查询使用记录
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 使用记录
|
||||
*/
|
||||
@Override
|
||||
public RecordUse selectRecordUseByObjId(Long objId)
|
||||
{
|
||||
return recordUseMapper.selectRecordUseByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询使用记录列表
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 使用记录
|
||||
*/
|
||||
@Override
|
||||
public List<RecordUse> selectRecordUseList(RecordUse recordUse)
|
||||
{
|
||||
return recordUseMapper.selectRecordUseList(recordUse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRecordUse(RecordUse recordUse)
|
||||
{
|
||||
recordUse.setCreateTime(DateUtils.getNowDate());
|
||||
recordUse.setCreateBy(ShiroUtils.getLoginName());
|
||||
return recordUseMapper.insertRecordUse(recordUse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改使用记录
|
||||
*
|
||||
* @param recordUse 使用记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRecordUse(RecordUse recordUse)
|
||||
{
|
||||
return recordUseMapper.updateRecordUse(recordUse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除使用记录
|
||||
*
|
||||
* @param objIds 需要删除的使用记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordUseByObjIds(String objIds)
|
||||
{
|
||||
return recordUseMapper.deleteRecordUseByObjIds(Convert.toStrArray(objIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除使用记录信息
|
||||
*
|
||||
* @param objId 使用记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRecordUseByObjId(Long objId)
|
||||
{
|
||||
return recordUseMapper.deleteRecordUseByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
<?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.ruoyi.device.mapper.RecordUseMapper">
|
||||
|
||||
<resultMap type="RecordUse" id="RecordUseResult">
|
||||
<result property="objId" column="obj_id" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="deviceCode" column="device_code" />
|
||||
<result property="deviceName" column="device_name" />
|
||||
<result property="deviceType" column="device_type" />
|
||||
<result property="openTime" column="open_time" />
|
||||
<result property="closeTime" column="close_time" />
|
||||
<result property="useTime" column="use_time" />
|
||||
<result property="defaultTime" column="default_time" />
|
||||
<result property="chargePrice" column="charge_price" />
|
||||
<result property="overtimeState" column="overtime_state" />
|
||||
<result property="useState" column="use_state" />
|
||||
<result property="useUser" column="use_user" />
|
||||
<result property="useUnit" column="use_unit" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="queryYear" column="query_year" />
|
||||
<result property="queryMonth" column="query_month" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="userId" column="user_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRecordUseVo">
|
||||
select obj_id, device_id, device_code, device_name, device_type, open_time, close_time, use_time, default_time, charge_price, overtime_state, use_state, use_user, use_unit, create_by, create_time, query_year, query_month, dept_id, user_id from device_record_use
|
||||
</sql>
|
||||
|
||||
<select id="selectRecordUseList" parameterType="RecordUse" resultMap="RecordUseResult">
|
||||
<include refid="selectRecordUseVo"/>
|
||||
<where>
|
||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
||||
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
||||
<if test="params.beginOpenTime != null and params.beginOpenTime != '' and params.endOpenTime != null and params.endOpenTime != ''"> and open_time between #{params.beginOpenTime} and #{params.endOpenTime}</if>
|
||||
<if test="overtimeState != null and overtimeState != ''"> and overtime_state = #{overtimeState}</if>
|
||||
<if test="useState != null and useState != ''"> and use_state = #{useState}</if>
|
||||
<if test="useUnit != null and useUnit != ''"> and use_unit = #{useUnit}</if>
|
||||
<if test="queryYear != null and queryYear != ''"> and query_year = #{queryYear}</if>
|
||||
<if test="queryMonth != null and queryMonth != ''"> and query_month = #{queryMonth}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRecordUseByObjId" parameterType="Long" resultMap="RecordUseResult">
|
||||
<include refid="selectRecordUseVo"/>
|
||||
where obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertRecordUse" parameterType="RecordUse" useGeneratedKeys="true" keyProperty="objId">
|
||||
insert into device_record_use
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="deviceCode != null">device_code,</if>
|
||||
<if test="deviceName != null">device_name,</if>
|
||||
<if test="deviceType != null">device_type,</if>
|
||||
<if test="openTime != null">open_time,</if>
|
||||
<if test="closeTime != null">close_time,</if>
|
||||
<if test="useTime != null">use_time,</if>
|
||||
<if test="defaultTime != null">default_time,</if>
|
||||
<if test="chargePrice != null">charge_price,</if>
|
||||
<if test="overtimeState != null">overtime_state,</if>
|
||||
<if test="useState != null">use_state,</if>
|
||||
<if test="useUser != null">use_user,</if>
|
||||
<if test="useUnit != null">use_unit,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="queryYear != null">query_year,</if>
|
||||
<if test="queryMonth != null">query_month,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="deviceCode != null">#{deviceCode},</if>
|
||||
<if test="deviceName != null">#{deviceName},</if>
|
||||
<if test="deviceType != null">#{deviceType},</if>
|
||||
<if test="openTime != null">#{openTime},</if>
|
||||
<if test="closeTime != null">#{closeTime},</if>
|
||||
<if test="useTime != null">#{useTime},</if>
|
||||
<if test="defaultTime != null">#{defaultTime},</if>
|
||||
<if test="chargePrice != null">#{chargePrice},</if>
|
||||
<if test="overtimeState != null">#{overtimeState},</if>
|
||||
<if test="useState != null">#{useState},</if>
|
||||
<if test="useUser != null">#{useUser},</if>
|
||||
<if test="useUnit != null">#{useUnit},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="queryYear != null">#{queryYear},</if>
|
||||
<if test="queryMonth != null">#{queryMonth},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRecordUse" parameterType="RecordUse">
|
||||
update device_record_use
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="deviceCode != null">device_code = #{deviceCode},</if>
|
||||
<if test="deviceName != null">device_name = #{deviceName},</if>
|
||||
<if test="deviceType != null">device_type = #{deviceType},</if>
|
||||
<if test="openTime != null">open_time = #{openTime},</if>
|
||||
<if test="closeTime != null">close_time = #{closeTime},</if>
|
||||
<if test="useTime != null">use_time = #{useTime},</if>
|
||||
<if test="defaultTime != null">default_time = #{defaultTime},</if>
|
||||
<if test="chargePrice != null">charge_price = #{chargePrice},</if>
|
||||
<if test="overtimeState != null">overtime_state = #{overtimeState},</if>
|
||||
<if test="useState != null">use_state = #{useState},</if>
|
||||
<if test="useUser != null">use_user = #{useUser},</if>
|
||||
<if test="useUnit != null">use_unit = #{useUnit},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="queryYear != null">query_year = #{queryYear},</if>
|
||||
<if test="queryMonth != null">query_month = #{queryMonth},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRecordUseByObjId" parameterType="Long">
|
||||
delete from device_record_use where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRecordUseByObjIds" parameterType="String">
|
||||
delete from device_record_use where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('使用记录列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>设备名称:</label>
|
||||
<input type="text" name="deviceName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>设备类型:</label>
|
||||
<select name="deviceType" th:with="type=${@baseTypeService.selectBaseTypeList(null)}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.deviceTypeName}" th:value="${dict.deviceTypeName}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>开锁时间:</label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginOpenTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endOpenTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>超时状态:</label>
|
||||
<select name="overtimeState" th:with="type=${@dict.getType('overtime_state')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<label>使用状态:</label>
|
||||
<select name="useState" th:with="type=${@dict.getType('record_use_state')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<label>借用单位:</label>
|
||||
<input type="text" name="useUnit"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>统计年份:</label>
|
||||
<input type="text" name="queryYear"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>统计月份:</label>
|
||||
<input type="text" name="queryMonth"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="device:record_use:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="device:record_use:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="device:record_use:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="device:record_use:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('device:record_use:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('device:record_use:remove')}]];
|
||||
var deviceTypeDatas = [[${@dict.getType('device_state')}]];
|
||||
var overtimeStateDatas = [[${@dict.getType('overtime_state')}]];
|
||||
var useStateDatas = [[${@dict.getType('record_use_state')}]];
|
||||
var useUnitDatas = [[${@dict.getType('overtime_state')}]];
|
||||
var prefix = ctx + "device/record_use";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "使用记录",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'objId',
|
||||
title: '主键',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'deviceId',
|
||||
title: '设备ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'deviceCode',
|
||||
title: '设备编码'
|
||||
},
|
||||
{
|
||||
field: 'deviceName',
|
||||
title: '设备名称'
|
||||
},
|
||||
{
|
||||
field: 'deviceType',
|
||||
title: '设备类型'
|
||||
},
|
||||
{
|
||||
field: 'openTime',
|
||||
title: '开锁时间'
|
||||
},
|
||||
{
|
||||
field: 'closeTime',
|
||||
title: '关锁时间'
|
||||
},
|
||||
{
|
||||
field: 'useTime',
|
||||
title: '使用时间(小时)'
|
||||
},
|
||||
{
|
||||
field: 'defaultTime',
|
||||
title: '默认使用时间'
|
||||
},
|
||||
{
|
||||
field: 'chargePrice',
|
||||
title: '计费价格'
|
||||
},
|
||||
{
|
||||
field: 'overtimeState',
|
||||
title: '超时状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(overtimeStateDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'useState',
|
||||
title: '使用状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(useStateDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'useUser',
|
||||
title: '借用人'
|
||||
},
|
||||
{
|
||||
field: 'useUnit',
|
||||
title: '借用单位',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(useUnitDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.objId + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,22 @@
|
||||
-- 菜单 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录', '2001', '1', '/device/record_use', 'C', '0', 'device:record_use:view', '#', 'admin', sysdate(), '', null, '使用记录菜单');
|
||||
|
||||
-- 按钮父菜单ID
|
||||
SELECT @parentId := LAST_INSERT_ID();
|
||||
|
||||
-- 按钮 SQL
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录查询', @parentId, '1', '#', 'F', '0', 'device:record_use:list', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录新增', @parentId, '2', '#', 'F', '0', 'device:record_use:add', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录修改', @parentId, '3', '#', 'F', '0', 'device:record_use:edit', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录删除', @parentId, '4', '#', 'F', '0', 'device:record_use:remove', '#', 'admin', sysdate(), '', null, '');
|
||||
|
||||
insert into sys_menu (menu_name, parent_id, order_num, url, menu_type, visible, perms, icon, create_by, create_time, update_by, update_time, remark)
|
||||
values('使用记录导出', @parentId, '5', '#', 'F', '0', 'device:record_use:export', '#', 'admin', sysdate(), '', null, '');
|
Loading…
Reference in New Issue