增加序列号

This commit is contained in:
jinqiming 2020-11-27 18:06:49 +08:00
parent fc9ea59be4
commit 76113333fa
3 changed files with 27 additions and 3 deletions

View File

@ -50,10 +50,14 @@
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:role:export">
<i class="fa fa-download"></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-table"></table>
<table id="bootstrap-tree-table"></table>
</div>
</div>
</div>
@ -66,6 +70,9 @@
$(function() {
var options = {
code: "roleId",
parentCode: "parentId",
uniqueId: "roleId",
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
@ -123,7 +130,7 @@
}
}]
};
$.table.init(options);
$.treeTable.init(options);
});
/* 角色管理-分配数据权限 */

View File

@ -19,6 +19,8 @@ public class SysRole extends BaseEntity
/** 角色ID */
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
private Long roleId;
@Excel(name = "父角色", cellType = ColumnType.NUMERIC)
private Long parentId;
/** 角色名称 */
@Excel(name = "角色名称")
@ -177,6 +179,14 @@ public class SysRole extends BaseEntity
this.deptIds = deptIds;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -17,11 +17,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="parentId" column="parent_id" />
</resultMap>
<sql id="selectRoleContactVo">
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope,
r.status, r.del_flag, r.create_time, r.remark
r.status, r.del_flag, r.create_time, r.remark,r.parent_id
from sys_role r
left join sys_user_role ur on ur.role_id = r.role_id
left join sys_user u on u.user_id = ur.user_id
@ -29,7 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</sql>
<sql id="selectRoleVo">
select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, r.del_flag, r.create_time, r.remark
select r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status, r.del_flag, r.create_time, r.remark,r.parent_id
from sys_role r
</sql>
@ -42,6 +43,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">
AND r.status = #{status}
</if>
<if test="parentId != null and parentId != 0">
AND r.parent_id = #{parentId}
</if>
<if test="roleKey != null and roleKey != ''">
AND r.role_key like concat('%', #{roleKey}, '%')
</if>
@ -99,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="parentId != null and parentId != 0">parent_id = #{parentId},</if>
update_time = sysdate()
</set>
where role_id = #{roleId}
@ -107,6 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertRole" parameterType="SysRole" useGeneratedKeys="true" keyProperty="roleId">
insert into sys_role(
<if test="roleId != null and roleId != 0">role_id,</if>
<if test="parentId != null and parentId != 0">parent_id,</if>
<if test="roleName != null and roleName != ''">role_name,</if>
<if test="roleKey != null and roleKey != ''">role_key,</if>
<if test="roleSort != null and roleSort != ''">role_sort,</if>
@ -117,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
create_time
)values(
<if test="roleId != null and roleId != 0">#{roleId},</if>
<if test="parentId != null and parentId != 0">#{parentId},</if>
<if test="roleName != null and roleName != ''">#{roleName},</if>
<if test="roleKey != null and roleKey != ''">#{roleKey},</if>
<if test="roleSort != null and roleSort != ''">#{roleSort},</if>