change - 设备信息添加物料品种

master
wenjy 2 years ago
parent d87fcfb69f
commit 7b8579282a

@ -7,92 +7,111 @@ import com.ruoyi.common.core.domain.TreeEntity;
/**
* base_deviceinfo
*
*
* @author wenjy
* @date 2022-11-23
*/
public class BaseDeviceInfo extends TreeEntity
{
public class BaseDeviceInfo extends TreeEntity {
private static final long serialVersionUID = 1L;
/** 设备id */
/**
* id
*/
private Long deviceId;
/** 设备名称 */
/**
*
*/
@Excel(name = "设备名称")
private String deviceName;
/** 资源编号 */
/**
*
*/
@Excel(name = "资源编号")
private String resource;
/** 设备状态0正常 1停用 */
/**
* 0 1
*/
@Excel(name = "设备状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标志0代表存在 2代表删除 */
/**
* 0 2
*/
private String delFlag;
public void setDeviceId(Long deviceId)
{
/**
*
*/
@Excel(name = "品种")
private Integer materialType;
public void setDeviceId(Long deviceId) {
this.deviceId = deviceId;
}
public Long getDeviceId()
{
public Long getDeviceId() {
return deviceId;
}
public void setDeviceName(String deviceName)
{
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceName()
{
public String getDeviceName() {
return deviceName;
}
public void setResource(String resource)
{
public void setResource(String resource) {
this.resource = resource;
}
public String getResource()
{
public String getResource() {
return resource;
}
public void setStatus(String status)
{
public void setStatus(String status) {
this.status = status;
}
public String getStatus()
{
public String getStatus() {
return status;
}
public void setDelFlag(String delFlag)
{
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getDelFlag()
{
public String getDelFlag() {
return delFlag;
}
public void setMaterialType(Integer materialType) {
this.materialType = materialType;
}
public Integer getMaterialType() {
return materialType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("parentId", getParentId())
.append("deviceName", getDeviceName())
.append("orderNum", getOrderNum())
.append("resource", getResource())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("deviceId", getDeviceId())
.append("parentId", getParentId())
.append("deviceName", getDeviceName())
.append("orderNum", getOrderNum())
.append("resource", getResource())
.append("status", getStatus())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("materialType", getMaterialType())
.toString();
}
}

@ -1,9 +1,9 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.traceability.mapper.BaseDeviceInfoMapper">
<resultMap type="BaseDeviceInfo" id="BaseDeviceInfoResult">
<result property="deviceId" column="device_id" />
<result property="parentId" column="parent_id" />
@ -16,32 +16,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="materialType" column="material_type" />
<result property="parentName" column="parent_name" />
</resultMap>
<sql id="selectBaseDeviceInfoVo">
select device_id, parent_id, device_name, order_num, resource, status, del_flag, create_by, create_time, update_by, update_time from base_deviceinfo
select device_id, parent_id, device_name, order_num, resource, status, del_flag, create_by, create_time, update_by, update_time, material_type from base_deviceinfo
</sql>
<select id="selectBaseDeviceInfoList" parameterType="BaseDeviceInfo" resultMap="BaseDeviceInfoResult">
<include refid="selectBaseDeviceInfoVo"/>
<where>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
<if test="orderNum != null "> and order_num = #{orderNum}</if>
<if test="resource != null and resource != ''"> and resource = #{resource}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="materialType != null "> and material_type = #{materialType}</if>
</where>
order by parent_id
</select>
<select id="selectBaseDeviceInfoByDeviceId" parameterType="Long" resultMap="BaseDeviceInfoResult">
select t.device_id, t.parent_id, t.device_name, t.order_num, t.resource, t.status, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time, p.device_name as parent_name
select t.device_id, t.parent_id, t.device_name, t.order_num, t.resource, t.status, t.del_flag, t.create_by, t.create_time, t.update_by, t.update_time, t.material_type, p.device_name as parent_name
from base_deviceinfo t
left join base_deviceinfo p on p.device_id = t.parent_id
left join base_deviceinfo p on p.device_id = t.parent_id
where t.device_id = #{deviceId}
</select>
<insert id="insertBaseDeviceInfo" parameterType="BaseDeviceInfo" useGeneratedKeys="true" keyProperty="deviceId">
insert into base_deviceinfo
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -55,7 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<if test="materialType != null">material_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="parentId != null">#{parentId},</if>
<if test="deviceName != null">#{deviceName},</if>
@ -67,7 +70,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
<if test="materialType != null">#{materialType},</if>
</trim>
</insert>
<update id="updateBaseDeviceInfo" parameterType="BaseDeviceInfo">
@ -83,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="materialType != null">material_type = #{materialType},</if>
</trim>
where device_id = #{deviceId}
</update>
@ -92,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteBaseDeviceInfoByDeviceIds" parameterType="String">
delete from base_deviceinfo where device_id in
delete from base_deviceinfo where device_id in
<foreach item="deviceId" collection="array" open="(" separator="," close=")">
#{deviceId}
</foreach>

@ -43,6 +43,16 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品种:</label>
<div class="col-sm-8">
<select name="materialType" class="form-control m-b" th:with="type=${@dict.getType('material_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />

@ -1,91 +1,98 @@
<!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('设备信息列表')" />
<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>父级id</label>
<input type="text" name="parentId"/>
</li>
<li>
<label>设备名称:</label>
<input type="text" name="deviceName"/>
</li>
<li>
<label>显示顺序:</label>
<input type="text" name="orderNum"/>
</li>
<li>
<label>资源编号:</label>
<input type="text" name="resource"/>
</li>
<li>
<label>设备状态:</label>
<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.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="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>
<input type="text" name="resource"/>
</li>
<li>
<label>物料品种:</label>
<select name="materialType" th:with="type=${@dict.getType('material_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>设备状态:</label>
<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.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:deviceinfo:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="traceability:deviceinfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-info" id="expandAllBtn">
<i class="fa fa-exchange"></i> 展开/折叠
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-tree-table"></table>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="traceability:deviceinfo:add">
<i class="fa fa-plus"></i> 新增
</a>
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="traceability:deviceinfo:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-info" id="expandAllBtn">
<i class="fa fa-exchange"></i> 展开/折叠
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-tree-table"></table>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('traceability:deviceinfo:add')}]];
var editFlag = [[${@permission.hasPermi('traceability:deviceinfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('traceability:deviceinfo:remove')}]];
var statusDatas = [[${@dict.getType('sys_normal_disable')}]];
var delFlagDatas = [[${@dict.getType('sys_yes_no')}]];
var prefix = ctx + "traceability/deviceinfo";
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
var addFlag = [[${@permission.hasPermi('traceability:deviceinfo:add')}]];
var editFlag = [[${@permission.hasPermi('traceability:deviceinfo:edit')}]];
var removeFlag = [[${@permission.hasPermi('traceability:deviceinfo:remove')}]];
var statusDatas = [[${@dict.getType('sys_normal_disable')}]];
var delFlagDatas = [[${@dict.getType('sys_yes_no')}]];
var materialTypeDatas = [[${@dict.getType('material_type')}]];
var prefix = ctx + "traceability/deviceinfo";
$(function() {
var options = {
code: "deviceId",
parentCode: "parentId",
expandColumn: "2",
uniqueId: "deviceId",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}",
modalName: "设备信息",
columns: [{
field: 'selectItem',
radio: true
},
$(function () {
var options = {
code: "deviceId",
parentCode: "parentId",
expandColumn: "2",
uniqueId: "deviceId",
url: prefix + "/list",
createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}",
modalName: "设备信息",
expandAll: false,
expandFirst: true,
columns: [{
field: 'selectItem',
radio: true
},
{
field: 'parentId',
title: '父级id',
align: 'left'
align: 'left',
visible: false
},
{
field: 'deviceName',
@ -95,18 +102,27 @@
{
field: 'orderNum',
title: '显示顺序',
align: 'left'
align: 'left',
visible: false
},
{
field: 'resource',
title: '资源编号',
align: 'left'
},
{
field: 'materialType',
title: '物料品种',
align: 'left',
formatter: function (value, row, index) {
return $.table.selectDictLabel(materialTypeDatas, value);
}
},
{
field: 'status',
title: '设备状态',
align: 'left',
formatter: function(value, row, index) {
formatter: function (value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
},
@ -114,7 +130,7 @@
title: '操作',
align: 'center',
align: 'left',
formatter: function(value, row, index) {
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.deviceId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.deviceId + '\')"><i class="fa fa-plus"></i>新增</a> ');
@ -122,9 +138,9 @@
return actions.join('');
}
}]
};
$.treeTable.init(options);
});
</script>
};
$.treeTable.init(options);
});
</script>
</body>
</html>

@ -44,6 +44,15 @@
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品种:</label>
<div class="col-sm-8">
<select name="materialType" class="form-control m-b" th:with="type=${@dict.getType('material_type')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{materialType}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />

Loading…
Cancel
Save