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

master
wenjy 2 years ago
parent d87fcfb69f
commit 7b8579282a

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

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

@ -43,6 +43,16 @@
</div> </div>
</div> </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> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />

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

@ -44,6 +44,15 @@
</div> </div>
</div> </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> </form>
</div> </div>
<th:block th:include="include :: footer" /> <th:block th:include="include :: footer" />

Loading…
Cancel
Save