添加 使用记录

master
wanghao 1 month ago
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,172 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增使用记录')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-record_use-add">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备ID</label>
<div class="col-sm-8">
<input name="deviceId" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备编码:</label>
<div class="col-sm-8">
<input name="deviceCode" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备名称:</label>
<div class="col-sm-8">
<input name="deviceName" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备类型:</label>
<div class="col-sm-8">
<select name="deviceType" class="form-control" th:with="type=${@baseTypeService.selectBaseTypeList(null)}">
<option th:each="dict : ${type}" th:text="${dict.deviceTypeName}" th:value="${dict.deviceTypeName}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">开锁时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="openTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">关锁时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="closeTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">使用时间(小时)</label>
<div class="col-sm-8">
<input name="useTime" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">默认使用时间:</label>
<div class="col-sm-8">
<input name="defaultTime" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">计费价格:</label>
<div class="col-sm-8">
<input name="chargePrice" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">超时状态:</label>
<div class="col-sm-8">
<select name="overtimeState" class="form-control" th:with="type=${@dict.getType('overtime_state')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">使用状态:</label>
<div class="col-sm-8">
<select name="useState" class="form-control" th:with="type=${@dict.getType('record_use_state')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">借用人:</label>
<div class="col-sm-8">
<input name="useUser" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">借用单位:</label>
<div class="col-sm-8">
<input name="useUnit" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">统计年份:</label>
<div class="col-sm-8">
<input name="queryYear" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">统计月份:</label>
<div class="col-sm-8">
<input name="queryMonth" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "device/record_use"
$("#form-record_use-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-record_use-add').serialize());
}
}
$("input[name='openTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='closeTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,174 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改使用记录')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-record_use-edit" th:object="${recordUse}">
<input name="objId" th:field="*{objId}" type="hidden">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备ID</label>
<div class="col-sm-8">
<input name="deviceId" th:field="*{deviceId}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备编码:</label>
<div class="col-sm-8">
<input name="deviceCode" th:field="*{deviceCode}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备名称:</label>
<div class="col-sm-8">
<input name="deviceName" th:field="*{deviceName}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">设备类型:</label>
<div class="col-sm-8">
<select name="deviceType" class="form-control" th:with="type=${@baseTypeService.selectBaseTypeList(null)}">
<option th:each="dict : ${type}" th:text="${dict.deviceTypeName}" th:value="${dict.deviceTypeName}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">开锁时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="openTime" th:value="${#dates.format(recordUse.openTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">关锁时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="closeTime" th:value="${#dates.format(recordUse.closeTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">使用时间(小时)</label>
<div class="col-sm-8">
<input name="useTime" th:field="*{useTime}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">默认使用时间:</label>
<div class="col-sm-8">
<input name="defaultTime" th:field="*{defaultTime}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">计费价格:</label>
<div class="col-sm-8">
<input name="chargePrice" th:field="*{chargePrice}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">超时状态:</label>
<div class="col-sm-8">
<select name="overtimeState" class="form-control" th:field="*{overtimeState}" th:with="type=${@dict.getType('overtime_state')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">使用状态:</label>
<div class="col-sm-8">
<select name="useState" class="form-control" th:field="*{useState}" th:with="type=${@dict.getType('record_use_state')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">借用人:</label>
<div class="col-sm-8">
<input name="useUser" th:field="*{useUser}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">借用单位:</label>
<div class="col-sm-8">
<input name="useUnit" th:field="*{useUnit}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">统计年份:</label>
<div class="col-sm-8">
<input name="queryYear" th:field="*{queryYear}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">统计月份:</label>
<div class="col-sm-8">
<input name="queryMonth" th:field="*{queryMonth}" class="form-control" type="text">
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "device/record_use";
$("#form-record_use-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-record_use-edit').serialize());
}
}
$("input[name='openTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='closeTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -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>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</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…
Cancel
Save