升级注意!角色编码和岗位编码增加viewCode,在开启租户模式的时候roleCode格式为corpCode_viewCode,可能会影响到直接使用roleCode判断权限的业务代码。treeData接口返回viewCode数据
This commit is contained in:
@@ -98,7 +98,7 @@ public class Office extends TreeEntity<Office> {
|
||||
}
|
||||
|
||||
@NotBlank(message="机构代码不能为空")
|
||||
@Pattern(regexp="[a-zA-Z0-9_]{0,30}", message="编码长度不能大于 30 个字符,并且只能包含字母、数字、下划线")
|
||||
@Pattern(regexp="[a-zA-Z0-9_]{0,30}", message="代码长度不能大于 30 个字符,并且只能包含字母、数字、下划线")
|
||||
public String getViewCode() {
|
||||
return viewCode;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.jeesite.modules.sys.entity;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
import com.jeesite.common.entity.BaseEntity;
|
||||
import com.jeesite.common.entity.DataEntity;
|
||||
@@ -16,6 +17,7 @@ import com.jeesite.common.mybatis.mapper.query.QueryType;
|
||||
@Column(includeEntity=BaseEntity.class),
|
||||
@Column(includeEntity=DataEntity.class),
|
||||
@Column(name="post_code", attrName="postCode", label="岗位编码", isPK=true),
|
||||
@Column(name="view_code", attrName="viewCode", label="岗位代码"),
|
||||
@Column(name="post_name", attrName="postName", label="岗位名称"),
|
||||
@Column(name="post_type", attrName="postType", label="岗位分类", comment="岗位分类(高管、中层、基层)"),
|
||||
@Column(name="post_sort", attrName="postSort", label="岗位排序", comment="岗位排序(升序)"),
|
||||
@@ -25,6 +27,7 @@ public class Post extends DataEntity<Post> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String postCode; // 岗位编码
|
||||
private String viewCode; // 岗位代码(作为显示用,多租户内唯一)
|
||||
private String postName; // 岗位名称
|
||||
private String postType; // 岗位分类(高管、中层、基层)
|
||||
private Integer postSort; // 岗位排序(升序)
|
||||
@@ -47,6 +50,16 @@ public class Post extends DataEntity<Post> {
|
||||
this.postCode = postCode;
|
||||
}
|
||||
|
||||
@NotBlank(message="岗位代码不能为空")
|
||||
@Pattern(regexp="[a-zA-Z0-9_]{0,30}", message="代码长度不能大于 30 个字符,并且只能包含字母、数字、下划线")
|
||||
public String getViewCode() {
|
||||
return viewCode;
|
||||
}
|
||||
|
||||
public void setViewCode(String viewCode) {
|
||||
this.viewCode = viewCode;
|
||||
}
|
||||
|
||||
@NotBlank(message="岗位名称不能为空")
|
||||
@Size(min=0, max=100, message="岗位名称长度不能超过 100 个字符")
|
||||
public String getPostName() {
|
||||
|
||||
@@ -51,6 +51,10 @@ public class PostServiceSupport extends CrudService<PostDao, Post>
|
||||
@Override
|
||||
@Transactional(readOnly=false)
|
||||
public void save(Post post) {
|
||||
if (post.getIsNewRecord()){
|
||||
// 生成主键,并验证改主键是否存在,如存在则抛出验证信息
|
||||
genIdAndValid(post, post.getViewCode());
|
||||
}
|
||||
super.save(post);
|
||||
}
|
||||
|
||||
|
||||
@@ -248,6 +248,7 @@ public class CompanyController extends BaseController {
|
||||
if ("true".equals(isShowFullName) || "1".equals(isShowFullName)){
|
||||
name = e.getFullName();
|
||||
}
|
||||
map.put("code", e.getViewCode());
|
||||
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getViewCode(), name));
|
||||
map.put("title", e.getFullName());
|
||||
mapList.add(map);
|
||||
|
||||
@@ -322,6 +322,7 @@ public class OfficeController extends BaseController {
|
||||
if ("true".equals(isShowFullName) || "1".equals(isShowFullName)){
|
||||
name = e.getFullName();
|
||||
}
|
||||
map.put("code", e.getViewCode());
|
||||
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getViewCode(), name));
|
||||
map.put("title", e.getFullName());
|
||||
// 如果需要加载用户,则处理用户数据
|
||||
|
||||
@@ -147,7 +147,8 @@ public class PostController extends BaseController {
|
||||
Map<String, Object> map = MapUtils.newHashMap();
|
||||
map.put("id", e.getId());
|
||||
map.put("pId", "0");
|
||||
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getPostCode(), e.getPostName()));
|
||||
map.put("code", e.getViewCode());
|
||||
map.put("name", StringUtils.getTreeNodeName(isShowCode, e.getViewCode(), e.getPostName()));
|
||||
mapList.add(map);
|
||||
});
|
||||
return mapList;
|
||||
|
||||
@@ -28,10 +28,11 @@
|
||||
<div class="col-xs-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-4" title="">
|
||||
<span class="required ">*</span> ${text('岗位编码')}:<i class="fa icon-question hide"></i></label>
|
||||
<span class="required ">*</span> ${text('岗位代码')}:<i class="fa icon-question hide"></i></label>
|
||||
<div class="col-sm-8">
|
||||
<#form:hidden path="isNewRecord"/>
|
||||
<#form:input path="postCode" maxlength="64" readonly="${!post.isNewRecord}" class="form-control required abc"/>
|
||||
<#form:hidden path="postCode"/>
|
||||
<#form:input path="viewCode" maxlength="64" readonly="${!post.isNewRecord}" class="form-control required abc"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user