提交 56ea1934 编写于 作者: shuzheng5201314's avatar shuzheng5201314

新增角色字段

上级 7d61249e
......@@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="com.zheng.upms.dao.model.UpmsRole">
<id column="role_id" jdbcType="INTEGER" property="roleId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="ctime" jdbcType="BIGINT" property="ctime" />
<result column="orders" jdbcType="BIGINT" property="orders" />
......@@ -67,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
role_id, name, description, ctime, orders
role_id, name, title, description, ctime, orders
</sql>
<select id="selectByExample" parameterType="com.zheng.upms.dao.model.UpmsRoleExample" resultMap="BaseResultMap">
select
......@@ -108,10 +109,12 @@
</if>
</delete>
<insert id="insert" parameterType="com.zheng.upms.dao.model.UpmsRole">
insert into upms_role (role_id, name, description,
ctime, orders)
values (#{roleId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{ctime,jdbcType=BIGINT}, #{orders,jdbcType=BIGINT})
insert into upms_role (role_id, name, title,
description, ctime, orders
)
values (#{roleId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{ctime,jdbcType=BIGINT}, #{orders,jdbcType=BIGINT}
)
</insert>
<insert id="insertSelective" parameterType="com.zheng.upms.dao.model.UpmsRole">
insert into upms_role
......@@ -122,6 +125,9 @@
<if test="name != null">
name,
</if>
<if test="title != null">
title,
</if>
<if test="description != null">
description,
</if>
......@@ -139,6 +145,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
......@@ -165,6 +174,9 @@
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.description != null">
description = #{record.description,jdbcType=VARCHAR},
</if>
......@@ -183,6 +195,7 @@
update upms_role
set role_id = #{record.roleId,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
title = #{record.title,jdbcType=VARCHAR},
description = #{record.description,jdbcType=VARCHAR},
ctime = #{record.ctime,jdbcType=BIGINT},
orders = #{record.orders,jdbcType=BIGINT}
......@@ -196,6 +209,9 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
......@@ -211,6 +227,7 @@
<update id="updateByPrimaryKey" parameterType="com.zheng.upms.dao.model.UpmsRole">
update upms_role
set name = #{name,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
ctime = #{ctime,jdbcType=BIGINT},
orders = #{orders,jdbcType=BIGINT}
......
......@@ -17,6 +17,13 @@ public class UpmsRole implements Serializable {
*/
private String name;
/**
* 角色标题
*
* @mbg.generated
*/
private String title;
/**
* 角色描述
*
......@@ -56,6 +63,14 @@ public class UpmsRole implements Serializable {
this.name = name;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
......@@ -88,6 +103,7 @@ public class UpmsRole implements Serializable {
sb.append("Hash = ").append(hashCode());
sb.append(", roleId=").append(roleId);
sb.append(", name=").append(name);
sb.append(", title=").append(title);
sb.append(", description=").append(description);
sb.append(", ctime=").append(ctime);
sb.append(", orders=").append(orders);
......@@ -109,6 +125,7 @@ public class UpmsRole implements Serializable {
UpmsRole other = (UpmsRole) that;
return (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
&& (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
&& (this.getDescription() == null ? other.getDescription() == null : this.getDescription().equals(other.getDescription()))
&& (this.getCtime() == null ? other.getCtime() == null : this.getCtime().equals(other.getCtime()))
&& (this.getOrders() == null ? other.getOrders() == null : this.getOrders().equals(other.getOrders()));
......@@ -120,6 +137,7 @@ public class UpmsRole implements Serializable {
int result = 1;
result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
result = prime * result + ((getDescription() == null) ? 0 : getDescription().hashCode());
result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode());
result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode());
......
......@@ -257,6 +257,76 @@ public class UpmsRoleExample implements Serializable {
return (Criteria) this;
}
public Criteria andTitleIsNull() {
addCriterion("title is null");
return (Criteria) this;
}
public Criteria andTitleIsNotNull() {
addCriterion("title is not null");
return (Criteria) this;
}
public Criteria andTitleEqualTo(String value) {
addCriterion("title =", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotEqualTo(String value) {
addCriterion("title <>", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThan(String value) {
addCriterion("title >", value, "title");
return (Criteria) this;
}
public Criteria andTitleGreaterThanOrEqualTo(String value) {
addCriterion("title >=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThan(String value) {
addCriterion("title <", value, "title");
return (Criteria) this;
}
public Criteria andTitleLessThanOrEqualTo(String value) {
addCriterion("title <=", value, "title");
return (Criteria) this;
}
public Criteria andTitleLike(String value) {
addCriterion("title like", value, "title");
return (Criteria) this;
}
public Criteria andTitleNotLike(String value) {
addCriterion("title not like", value, "title");
return (Criteria) this;
}
public Criteria andTitleIn(List<String> values) {
addCriterion("title in", values, "title");
return (Criteria) this;
}
public Criteria andTitleNotIn(List<String> values) {
addCriterion("title not in", values, "title");
return (Criteria) this;
}
public Criteria andTitleBetween(String value1, String value2) {
addCriterion("title between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andTitleNotBetween(String value1, String value2) {
addCriterion("title not between", value1, value2, "title");
return (Criteria) this;
}
public Criteria andDescriptionIsNull() {
addCriterion("description is null");
return (Criteria) this;
......
......@@ -21,6 +21,7 @@
<resultMap id="UpmsRoleResultMap" type="com.zheng.upms.dao.model.UpmsRole">
<id column="role_id" jdbcType="INTEGER" property="roleId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="description" jdbcType="VARCHAR" property="description" />
<result column="ctime" jdbcType="BIGINT" property="ctime" />
<result column="orders" jdbcType="BIGINT" property="orders" />
......@@ -33,7 +34,7 @@
<!-- 角色字段 -->
<sql id="UpmsRole_Column_List">
role_id, name, description, ctime, orders
role_id, name, title, description, ctime, orders
</sql>
<!-- 根据用户获取所拥有的权限 -->
......
......@@ -42,12 +42,6 @@
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- zheng-upms-client -->
<dependency>
<groupId>com.zheng</groupId>
<artifactId>zheng-upms-client</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
<profiles>
......
......@@ -83,6 +83,7 @@ public class UpmsRoleController extends BaseController {
public Object create(UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
......@@ -120,6 +121,7 @@ public class UpmsRoleController extends BaseController {
public Object update(@PathVariable("id") int id, UpmsRole upmsRole) {
ComplexResult result = FluentValidator.checkAll()
.on(upmsRole.getName(), new LengthValidator(1, 20, "名称"))
.on(upmsRole.getTitle(), new LengthValidator(1, 20, "标题"))
.doValidate()
.result(ResultCollectors.toComplex());
if (!result.isSuccess()) {
......
......@@ -12,6 +12,10 @@
<label for="name">名称</label>
<input id="name" type="text" class="form-control" name="name" maxlength="20">
</div>
<div class="form-group">
<label for="title">标题</label>
<input id="title" type="text" class="form-control" name="title" maxlength="20">
</div>
<div class="form-group">
<label for="description">描述</label>
<input id="description" type="text" class="form-control" name="description" maxlength="300">
......@@ -33,6 +37,10 @@ function createSubmit() {
$('#name').focus();
return false;
}
if ($('#title').val() == '') {
$('#title').focus();
return false;
}
},
success: function(result) {
if (result.code != 1) {
......
......@@ -72,6 +72,7 @@ $(function() {
{field: 'ck', checkbox: true},
{field: 'roleId', title: '编号', sortable: true, align: 'center'},
{field: 'name', title: '角色名称'},
{field: 'title', title: '角色标题'},
{field: 'description', title: '角色描述'},
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
]
......
......@@ -12,6 +12,10 @@
<label for="name">名称</label>
<input id="name" type="text" class="form-control" name="name" maxlength="20" value="${role.name}">
</div>
<div class="form-group">
<label for="title">标题</label>
<input id="title" type="text" class="form-control" name="title" maxlength="20" value="${role.title}">
</div>
<div class="form-group">
<label for="description">描述</label>
<input id="description" type="text" class="form-control" name="description" maxlength="300" value="${role.description}">
......@@ -29,10 +33,14 @@ function createSubmit() {
url: '${basePath}/manage/role/update/${role.roleId}',
data: $('#updateForm').serialize(),
beforeSend: function() {
if ($('#name').val() == '') {
$('#name').focus();
return false;
}
if ($('#name').val() == '') {
$('#name').focus();
return false;
}
if ($('#title').val() == '') {
$('#title').focus();
return false;
}
},
success: function(result) {
if (result.code != 1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册