add - 机台日志

master
wenjy 2 years ago
parent 7b8579282a
commit b58260bce5

@ -0,0 +1,127 @@
package com.ruoyi.traceability.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.traceability.domain.ProLogrecord;
import com.ruoyi.traceability.service.IProLogrecordService;
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 wenjy
* @date 2022-12-01
*/
@Controller
@RequestMapping("/traceability/logrecord")
public class ProLogrecordController extends BaseController
{
private String prefix = "traceability/logrecord";
@Autowired
private IProLogrecordService proLogrecordService;
@RequiresPermissions("traceability:logrecord:view")
@GetMapping()
public String logrecord()
{
return prefix + "/logrecord";
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ProLogrecord proLogrecord)
{
startPage();
List<ProLogrecord> list = proLogrecordService.selectProLogrecordList(proLogrecord);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:export")
@Log(title = "机台日志", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ProLogrecord proLogrecord)
{
List<ProLogrecord> list = proLogrecordService.selectProLogrecordList(proLogrecord);
ExcelUtil<ProLogrecord> util = new ExcelUtil<ProLogrecord>(ProLogrecord.class);
return util.exportExcel(list, "机台日志数据");
}
/**
*
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:add")
@Log(title = "机台日志", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ProLogrecord proLogrecord)
{
return toAjax(proLogrecordService.insertProLogrecord(proLogrecord));
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:edit")
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
ProLogrecord proLogrecord = proLogrecordService.selectProLogrecordById(id);
mmap.put("proLogrecord", proLogrecord);
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:edit")
@Log(title = "机台日志", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ProLogrecord proLogrecord)
{
return toAjax(proLogrecordService.updateProLogrecord(proLogrecord));
}
/**
*
*/
@RequiresPermissions("traceability:logrecord:remove")
@Log(title = "机台日志", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(proLogrecordService.deleteProLogrecordByIds(ids));
}
}

@ -0,0 +1,96 @@
package com.ruoyi.traceability.domain;
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;
/**
* pro_logrecord
*
* @author wenjy
* @date 2022-12-01
*/
public class ProLogrecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键标识 */
private Long id;
/** 资源号 */
@Excel(name = "资源号")
private String resource;
/** 位置编号 */
@Excel(name = "位置编号")
private Long positionId;
/** 日志内容 */
@Excel(name = "日志内容")
private String message;
/** 记录时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date recordTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setResource(String resource)
{
this.resource = resource;
}
public String getResource()
{
return resource;
}
public void setPositionId(Long positionId)
{
this.positionId = positionId;
}
public Long getPositionId()
{
return positionId;
}
public void setMessage(String message)
{
this.message = message;
}
public String getMessage()
{
return message;
}
public void setRecordTime(Date recordTime)
{
this.recordTime = recordTime;
}
public Date getRecordTime()
{
return recordTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("resource", getResource())
.append("positionId", getPositionId())
.append("message", getMessage())
.append("recordTime", getRecordTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.ruoyi.traceability.mapper;
import java.util.List;
import com.ruoyi.traceability.domain.ProLogrecord;
/**
* Mapper
*
* @author wenjy
* @date 2022-12-01
*/
public interface ProLogrecordMapper
{
/**
*
*
* @param id
* @return
*/
public ProLogrecord selectProLogrecordById(Long id);
/**
*
*
* @param proLogrecord
* @return
*/
public List<ProLogrecord> selectProLogrecordList(ProLogrecord proLogrecord);
/**
*
*
* @param proLogrecord
* @return
*/
public int insertProLogrecord(ProLogrecord proLogrecord);
/**
*
*
* @param proLogrecord
* @return
*/
public int updateProLogrecord(ProLogrecord proLogrecord);
/**
*
*
* @param id
* @return
*/
public int deleteProLogrecordById(Long id);
/**
*
*
* @param ids
* @return
*/
public int deleteProLogrecordByIds(String[] ids);
}

@ -0,0 +1,61 @@
package com.ruoyi.traceability.service;
import java.util.List;
import com.ruoyi.traceability.domain.ProLogrecord;
/**
* Service
*
* @author wenjy
* @date 2022-12-01
*/
public interface IProLogrecordService
{
/**
*
*
* @param id
* @return
*/
public ProLogrecord selectProLogrecordById(Long id);
/**
*
*
* @param proLogrecord
* @return
*/
public List<ProLogrecord> selectProLogrecordList(ProLogrecord proLogrecord);
/**
*
*
* @param proLogrecord
* @return
*/
public int insertProLogrecord(ProLogrecord proLogrecord);
/**
*
*
* @param proLogrecord
* @return
*/
public int updateProLogrecord(ProLogrecord proLogrecord);
/**
*
*
* @param ids
* @return
*/
public int deleteProLogrecordByIds(String ids);
/**
*
*
* @param id
* @return
*/
public int deleteProLogrecordById(Long id);
}

@ -0,0 +1,94 @@
package com.ruoyi.traceability.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.traceability.mapper.ProLogrecordMapper;
import com.ruoyi.traceability.domain.ProLogrecord;
import com.ruoyi.traceability.service.IProLogrecordService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author wenjy
* @date 2022-12-01
*/
@Service
public class ProLogrecordServiceImpl implements IProLogrecordService
{
@Autowired
private ProLogrecordMapper proLogrecordMapper;
/**
*
*
* @param id
* @return
*/
@Override
public ProLogrecord selectProLogrecordById(Long id)
{
return proLogrecordMapper.selectProLogrecordById(id);
}
/**
*
*
* @param proLogrecord
* @return
*/
@Override
public List<ProLogrecord> selectProLogrecordList(ProLogrecord proLogrecord)
{
return proLogrecordMapper.selectProLogrecordList(proLogrecord);
}
/**
*
*
* @param proLogrecord
* @return
*/
@Override
public int insertProLogrecord(ProLogrecord proLogrecord)
{
return proLogrecordMapper.insertProLogrecord(proLogrecord);
}
/**
*
*
* @param proLogrecord
* @return
*/
@Override
public int updateProLogrecord(ProLogrecord proLogrecord)
{
return proLogrecordMapper.updateProLogrecord(proLogrecord);
}
/**
*
*
* @param ids
* @return
*/
@Override
public int deleteProLogrecordByIds(String ids)
{
return proLogrecordMapper.deleteProLogrecordByIds(Convert.toStrArray(ids));
}
/**
*
*
* @param id
* @return
*/
@Override
public int deleteProLogrecordById(Long id)
{
return proLogrecordMapper.deleteProLogrecordById(id);
}
}

@ -0,0 +1,71 @@
<?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.traceability.mapper.ProLogrecordMapper">
<resultMap type="ProLogrecord" id="ProLogrecordResult">
<result property="id" column="id" />
<result property="resource" column="resource" />
<result property="positionId" column="position_id" />
<result property="message" column="message" />
<result property="recordTime" column="record_time" />
</resultMap>
<sql id="selectProLogrecordVo">
select id, resource, position_id, message, record_time from pro_logrecord
</sql>
<select id="selectProLogrecordList" parameterType="ProLogrecord" resultMap="ProLogrecordResult">
<include refid="selectProLogrecordVo"/>
<where>
<if test="resource != null and resource != ''"> and resource = #{resource}</if>
<if test="positionId != null "> and position_id = #{positionId}</if>
<if test="params.beginRecordTime != null and params.beginRecordTime != '' and params.endRecordTime != null and params.endRecordTime != ''"> and record_time between #{params.beginRecordTime} and #{params.endRecordTime}</if>
</where>
</select>
<select id="selectProLogrecordById" parameterType="Long" resultMap="ProLogrecordResult">
<include refid="selectProLogrecordVo"/>
where id = #{id}
</select>
<insert id="insertProLogrecord" parameterType="ProLogrecord" useGeneratedKeys="true" keyProperty="id">
insert into pro_logrecord
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="resource != null">resource,</if>
<if test="positionId != null">position_id,</if>
<if test="message != null">message,</if>
<if test="recordTime != null">record_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="resource != null">#{resource},</if>
<if test="positionId != null">#{positionId},</if>
<if test="message != null">#{message},</if>
<if test="recordTime != null">#{recordTime},</if>
</trim>
</insert>
<update id="updateProLogrecord" parameterType="ProLogrecord">
update pro_logrecord
<trim prefix="SET" suffixOverrides=",">
<if test="resource != null">resource = #{resource},</if>
<if test="positionId != null">position_id = #{positionId},</if>
<if test="message != null">message = #{message},</if>
<if test="recordTime != null">record_time = #{recordTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteProLogrecordById" parameterType="Long">
delete from pro_logrecord where id = #{id}
</delete>
<delete id="deleteProLogrecordByIds" parameterType="String">
delete from pro_logrecord where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

@ -0,0 +1,60 @@
<!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-logrecord-add">
<div class="form-group">
<label class="col-sm-3 control-label">资源号:</label>
<div class="col-sm-8">
<input name="resource" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">位置编号:</label>
<div class="col-sm-8">
<input name="positionId" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">日志内容:</label>
<div class="col-sm-8">
<textarea name="message" class="form-control"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">记录时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="recordTime" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</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 + "traceability/logrecord"
$("#form-logrecord-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-logrecord-add').serialize());
}
}
$("input[name='recordTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,61 @@
<!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-logrecord-edit" th:object="${proLogrecord}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">资源号:</label>
<div class="col-sm-8">
<input name="resource" th:field="*{resource}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">位置编号:</label>
<div class="col-sm-8">
<input name="positionId" th:field="*{positionId}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">日志内容:</label>
<div class="col-sm-8">
<textarea name="message" class="form-control">[[*{message}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">记录时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="recordTime" th:value="${#dates.format(proLogrecord.recordTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</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 + "traceability/logrecord";
$("#form-logrecord-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-logrecord-edit').serialize());
}
}
$("input[name='recordTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script>
</body>
</html>

@ -0,0 +1,108 @@
<!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="resource"/>
</li>
<li>
<label>位置编号:</label>
<input type="text" name="positionId"/>
</li>
<li class="select-time">
<label>记录时间:</label>
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginRecordTime]"/>
<span>-</span>
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endRecordTime]"/>
</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="traceability:logrecord:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="traceability:logrecord:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="traceability:logrecord:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="traceability:logrecord: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('traceability:logrecord:edit')}]];
var removeFlag = [[${@permission.hasPermi('traceability:logrecord:remove')}]];
var prefix = ctx + "traceability/logrecord";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "机台日志",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键标识',
visible: false
},
{
field: 'resource',
title: '资源号'
},
{
field: 'positionId',
title: '位置编号'
},
{
field: 'message',
title: '日志内容'
},
{
field: 'recordTime',
title: '记录时间'
},
{
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.id + '\')"><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.id + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>
Loading…
Cancel
Save