Browse Source

基础框架发布: 8.2.40

1. 修复数据导出的bug
  2. 角色实体增加排序字段, SYS_ROLE 表增加 ORDER_ 字段

前端核心发布: 8.2.133
  1. 修改客户端请求超时时间为 5 分钟
  2. 增加统一的错误处理,如果服务端返回的错误没找到国际化消息,则显示 java.lang.Exception 对应的国际化消息
  3. 用户选入角色对话框采用百分比宽度,每页100条
  4. 角色管理增加排序号,且默认按排序号排序
main
wangshaoping 1 month ago
parent
commit
2aaddd51d5
  1. 1
      io.sc.platform.security/src/main/resources/liquibase/io.sc.platform.security_8.0.0_20220606__Security_Database_Schema_DDL.xml
  2. 10
      io.sc.platform.system.api/src/main/java/io/sc/platform/system/api/role/RoleVo.java
  3. 5
      io.sc.platform.system.frontend/src/views/role/Role.vue
  4. 17
      io.sc.platform.system.frontend/src/views/shared/SelectRoleDialog.vue
  5. 23
      io.sc.platform.system/src/main/java/io/sc/platform/system/role/jpa/entity/RoleEntity.java
  6. 4
      io.sc.platform.system/src/main/java/io/sc/platform/system/role/jpa/repository/RoleRepository.java
  7. 17
      io.sc.platform.system/src/main/java/io/sc/platform/system/role/service/impl/RoleServiceImpl.java
  8. BIN
      io.sc.platform.system/src/main/resources/io/sc/platform/system/role/jpa/entity/RoleEntity.xlsx

1
io.sc.platform.security/src/main/resources/liquibase/io.sc.platform.security_8.0.0_20220606__Security_Database_Schema_DDL.xml

@ -109,6 +109,7 @@
<column name="CODE_" type="NVARCHAR(255)" remarks="角色代码"/>
<column name="NAME_" type="NVARCHAR(255)" remarks="角色名"></column>
<column name="ENABLE_" type="SMALLINT" remarks="是否可用"></column>
<column name="ORDER_" type="INTEGER" remarks="顺序"></column>
<column name="DESCRIPTION_" type="NVARCHAR(255)" remarks="描述"></column>
<column name="INDEX_PAGE_URL_" type="NVARCHAR(2000)" remarks="首页面URL"></column>
<column name="JPA_VERSION_" type="INTEGER" remarks="JPA乐观锁版本"/>

10
io.sc.platform.system.api/src/main/java/io/sc/platform/system/api/role/RoleVo.java

@ -13,6 +13,8 @@ public class RoleVo extends CorporationAuditorVo {
private String description;
//是否可用
private Boolean enable;
//排序号
private Integer order;
//默认首页面模版路径
private String indexPageUrl;
@ -56,6 +58,14 @@ public class RoleVo extends CorporationAuditorVo {
this.enable = enable;
}
public Integer getOrder() {
return order;
}
public void setOrder(Integer order) {
this.order = order;
}
public String getIndexPageUrl() {
return indexPageUrl;
}

5
io.sc.platform.system.frontend/src/views/role/Role.vue

@ -6,11 +6,12 @@
ref="roleGridRef"
:title="$t('system.role.grid.title')"
:config-button="true"
dnd-mode="server"
selection="multiple"
db-click-operation="edit"
:checkbox-selection="true"
:data-url="Environment.apiContextPath('/api/system/role')"
:sort-by="['name']"
:sort-by="['order']"
:query-form-cols-num="3"
:query-form-fields="[
{ name: 'code', label: $t('code'), type: 'w-text' },
@ -20,6 +21,7 @@
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="['query', 'refresh', 'separator', 'add', 'clone', 'edit', 'remove', 'separator', 'view', 'separator', 'export']"
:columns="[
{ width: 60, name: 'order', label: $t('order') },
{ width: 200, name: 'code', label: $t('code') },
{ width: '100%', name: 'name', label: $t('name') },
{ width: 70, name: 'enable', label: $t('status'), align: 'center', format: Formater.enableTag() },
@ -52,6 +54,7 @@
return SessionManager.isPrimaryCorporation();
},
},
{ name: 'order', label: $t('order'), type: 'w-integer' },
{ name: 'enable', label: $t('enable'), type: 'w-checkbox', defaultValue: true },
],
},

17
io.sc.platform.system.frontend/src/views/shared/SelectRoleDialog.vue

@ -2,8 +2,8 @@
<w-dialog
ref="dialogRef"
:title="$t('system.shared.selectRole.dialog.title')"
width="800px"
height="500px"
width="70%"
height="600px"
:can-maximize="false"
:buttons="[
{
@ -23,6 +23,7 @@
:full-screen-button="false"
:toolbar-configure="{ noIcon: false }"
:toolbar-actions="['query', 'refresh']"
:query-form-cols-num="4"
:query-form-fields="[
{ name: 'code', label: $t('code'), type: 'w-text' },
{ name: 'name', label: $t('name'), type: 'w-text' },
@ -43,16 +44,20 @@
]"
:auto-fetch-data="false"
:fetch-data-url="fetchDataUrl + '?' + foreignKey + '=' + foreignValue"
:sort-by="['order']"
:pagination="{ reqPageStart: 0, rowsPerPage: 100 }"
:columns="[
{ name: 'code', label: $t('code') },
{ name: 'name', label: $t('name') },
{ width: 60, name: 'order', label: $t('order') },
{ width: 200, name: 'code', label: $t('code') },
{ width: '100%', name: 'name', label: $t('name') },
{
width: 60,
name: 'status',
label: t('status'),
format: Formater.enableTag(),
},
{ name: 'lastModifier', label: t('lastModifier') },
{ name: 'lastModifyDate', label: t('lastModifyDate') },
{ width: 100, name: 'lastModifier', label: t('lastModifier') },
{ width: 150, name: 'lastModifyDate', label: t('lastModifyDate') },
]"
></w-grid>
</div>

23
io.sc.platform.system/src/main/java/io/sc/platform/system/role/jpa/entity/RoleEntity.java

@ -51,6 +51,10 @@ public class RoleEntity extends CorporationAuditorEntity<RoleVo> {
@Column(name="ENABLE_")
@Convert(converter=NumericBooleanConverter.class)
private Boolean enable;
//排序
@Column(name="ORDER_",nullable=false)
private Integer order;
//默认首页面模版路径
@Column(name="INDEX_PAGE_URL_", length=255)
@ -95,6 +99,7 @@ public class RoleEntity extends CorporationAuditorEntity<RoleVo> {
vo.setName(this.getName());
vo.setDescription(this.getDescription());
vo.setEnable(this.getEnable());
vo.setOrder(this.getOrder());
vo.setIndexPageUrl(this.getIndexPageUrl());
return vo;
}
@ -178,7 +183,23 @@ public class RoleEntity extends CorporationAuditorEntity<RoleVo> {
public void setEnable(Boolean enable) {
this.enable = enable;
}
/**
* 获取排序号
* @return 排序号
*/
public Integer getOrder() {
return order;
}
/**
* 设置排序号
* @param order 排序号
*/
public void setOrder(Integer order) {
this.order = order;
}
/**
* 获取首页面URL
* @return 首页面URL

4
io.sc.platform.system/src/main/java/io/sc/platform/system/role/jpa/repository/RoleRepository.java

@ -3,6 +3,7 @@ package io.sc.platform.system.role.jpa.repository;
import io.sc.platform.orm.repository.DaoRepository;
import io.sc.platform.system.role.jpa.entity.RoleEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@ -14,4 +15,7 @@ public interface RoleRepository extends DaoRepository<RoleEntity,String> {
public RoleEntity findByCode(String code);
public List<RoleEntity> findByCodeIn(List<String> codes);
public List<RoleEntity> findAllByOrderByName();
@Query("select max(e.order)+1 from io.sc.platform.system.role.jpa.entity.RoleEntity e")
public Integer getNextOrder();
}

17
io.sc.platform.system/src/main/java/io/sc/platform/system/role/service/impl/RoleServiceImpl.java

@ -4,11 +4,13 @@ import io.sc.platform.jdbc.util.SqlBatcher;
import io.sc.platform.orm.service.impl.DaoServiceImpl;
import io.sc.platform.orm.service.support.QueryParameter;
import io.sc.platform.orm.service.support.QueryResult;
import io.sc.platform.security.util.SecurityUtil;
import io.sc.platform.system.desensitizer.jpa.entity.DesensitizeFieldEntity;
import io.sc.platform.system.menu.jpa.entity.MenuEntity;
import io.sc.platform.system.role.jpa.entity.RoleEntity;
import io.sc.platform.system.role.jpa.repository.RoleRepository;
import io.sc.platform.system.role.service.RoleService;
import io.sc.platform.system.shortcutmenu.jpa.entity.ShortcutMenuEntity;
import io.sc.platform.system.user.jpa.entity.UserEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -38,6 +40,21 @@ public class RoleServiceImpl extends DaoServiceImpl<RoleEntity, String, RoleRepo
return repository.findAdminRole();
}
@Override
public RoleEntity add(RoleEntity entity) throws Exception {
if(entity==null){
return null;
}
if(entity.getOrder()==null) {
Integer nextOrder = repository.getNextOrder();
entity.setOrder(nextOrder == null ? 1 : nextOrder);
}
RoleEntity result =super.add(entity);
return result;
}
@Override
public Page<RoleEntity> queryRolesByCodeOrName(String filter, QueryParameter queryParameter) throws Exception {
if(StringUtils.hasText(filter)) {

BIN
io.sc.platform.system/src/main/resources/io/sc/platform/system/role/jpa/entity/RoleEntity.xlsx

Binary file not shown.
Loading…
Cancel
Save