🎉 2.1.0.RELEASE
This commit is contained in:
parent
3e914ccc47
commit
8bee39c924
|
|
@ -8,7 +8,7 @@
|
|||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>blade-auth</artifactId>
|
||||
|
|
|
|||
|
|
@ -49,20 +49,21 @@ public class AuthController {
|
|||
|
||||
@ApiLog("登录用户验证")
|
||||
@PostMapping("token")
|
||||
@ApiOperation(value = "获取认证token", notes = "传入账号:account,密码:password")
|
||||
public R<AuthInfo> token(@ApiParam(value = "账号", required = true) @RequestParam String account,
|
||||
@ApiOperation(value = "获取认证token", notes = "传入租户编号:tenantCode,账号:account,密码:password")
|
||||
public R<AuthInfo> token(@ApiParam(value = "租户编号", required = true) @RequestParam String tenantCode,
|
||||
@ApiParam(value = "账号", required = true) @RequestParam String account,
|
||||
@ApiParam(value = "密码", required = true) @RequestParam String password) {
|
||||
|
||||
if (Func.hasEmpty(account, password)) {
|
||||
return R.fail("接口调用不合法");
|
||||
}
|
||||
|
||||
R<UserInfo> res = client.userInfo(account, DigestUtil.encrypt(password));
|
||||
R<UserInfo> res = client.userInfo(tenantCode, account, DigestUtil.encrypt(password));
|
||||
|
||||
User user = res.getData().getUser();
|
||||
|
||||
//验证用户
|
||||
if (user == null || Func.isEmpty(user.getId())) {
|
||||
if (Func.isEmpty(user.getId())) {
|
||||
return R.fail("用户名或密码不正确");
|
||||
}
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ public class AuthController {
|
|||
Map<String, String> param = new HashMap<>(16);
|
||||
param.put(SecureUtil.USER_ID, Func.toStr(user.getId()));
|
||||
param.put(SecureUtil.ROLE_ID, user.getRoleId());
|
||||
param.put(SecureUtil.TENANT_CODE, user.getTenantCode());
|
||||
param.put(SecureUtil.ACCOUNT, user.getAccount());
|
||||
param.put(SecureUtil.USER_NAME, user.getRealName());
|
||||
param.put(SecureUtil.ROLE_NAME, Func.join(res.getData().getRoles()));
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-ops</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.springblade.core.tool.api.R;
|
|||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.develop.entity.Code;
|
||||
import org.springblade.develop.service.ICodeService;
|
||||
import org.springblade.develop.support.BladeGenerator;
|
||||
import org.springblade.develop.support.BladeCodeGenerator;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
|
|
@ -37,7 +37,6 @@ import java.util.Map;
|
|||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -99,9 +98,10 @@ public class CodeController extends BladeController {
|
|||
public R genCode(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam(defaultValue = "sword") String system) {
|
||||
Collection<Code> codes = codeService.listByIds(Func.toIntList(ids));
|
||||
codes.forEach(code -> {
|
||||
BladeGenerator generator = new BladeGenerator();
|
||||
BladeCodeGenerator generator = new BladeCodeGenerator();
|
||||
generator.setSystemName(system);
|
||||
generator.setServiceName(code.getServiceName());
|
||||
generator.setCodeName(code.getCodeName());
|
||||
generator.setPackageName(code.getPackageName());
|
||||
generator.setPackageDir(code.getApiPath());
|
||||
generator.setPackageWebDir(code.getWebPath());
|
||||
|
|
|
|||
|
|
@ -45,11 +45,15 @@ import java.util.*;
|
|||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
public class BladeGenerator {
|
||||
public class BladeCodeGenerator {
|
||||
/**
|
||||
* 代码所在系统
|
||||
*/
|
||||
private String systemName = CommonConstant.SWORD_NAME;
|
||||
/**
|
||||
* 代码模块名称
|
||||
*/
|
||||
private String codeName;
|
||||
/**
|
||||
* 代码所在服务名
|
||||
*/
|
||||
|
|
@ -86,6 +90,10 @@ public class BladeGenerator {
|
|||
* 基础业务字段
|
||||
*/
|
||||
private String[] superEntityColumns = {"id", "create_time", "create_user", "update_time", "update_user", "status", "is_deleted"};
|
||||
/**
|
||||
* 租户字段
|
||||
*/
|
||||
private String tenantColumn = "tenant_code";
|
||||
/**
|
||||
* 是否启用swagger
|
||||
*/
|
||||
|
|
@ -174,16 +182,24 @@ public class BladeGenerator {
|
|||
InjectionConfig cfg = new InjectionConfig() {
|
||||
@Override
|
||||
public void initMap() {
|
||||
map.put("codeName", codeName);
|
||||
map.put("serviceName", serviceName);
|
||||
map.put("servicePackage", servicePackage);
|
||||
map.put("tenantColumn", tenantColumn);
|
||||
this.setMap(map);
|
||||
}
|
||||
};
|
||||
List<FileOutConfig> focList = new ArrayList<>();
|
||||
focList.add(new FileOutConfig("/templates/sql/menu.sql.vm") {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
map.put("entityKey", (tableInfo.getEntityName().toLowerCase()));
|
||||
return getOutputDir() + "/" + "/sql/menu.mysql";
|
||||
}
|
||||
});
|
||||
focList.add(new FileOutConfig("/templates/entityVO.java.vm") {
|
||||
@Override
|
||||
public String outputFile(TableInfo tableInfo) {
|
||||
map.put("entityKey", StringUtil.humpToLine(tableInfo.getEntityName()));
|
||||
return getOutputDir() + "/" + packageName.replace(".", "/") + "/" + "vo" + "/" + tableInfo.getEntityName() + "VO" + StringPool.DOT_JAVA;
|
||||
}
|
||||
});
|
||||
|
|
@ -285,7 +301,7 @@ public class BladeGenerator {
|
|||
* @return outputDir
|
||||
*/
|
||||
public String getOutputDir() {
|
||||
return (Func.isBlank(packageDir) ? System.getProperty("user.dir") : packageDir) + "/src/main/java";
|
||||
return (Func.isBlank(packageDir) ? System.getProperty("user.dir") + "/blade-ops/blade-develop" : packageDir) + "/src/main/java";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,6 +58,7 @@ public class $!{entity} implements Serializable {
|
|||
|
||||
## ---------- BEGIN 字段循环遍历 ----------
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
#if($!{field.keyFlag})
|
||||
#set($keyPropertyName=$!{field.propertyName})
|
||||
#end
|
||||
|
|
@ -98,7 +99,7 @@ public class $!{entity} implements Serializable {
|
|||
@TableLogic
|
||||
#end
|
||||
private $!{field.propertyType} $!{field.propertyName};
|
||||
|
||||
#end
|
||||
#end
|
||||
## ---------- END 字段循环遍历 ----------
|
||||
|
||||
|
|
|
|||
|
|
@ -19,26 +19,16 @@
|
|||
<result column="$!{field.name}" property="$!{field.propertyName}"/>
|
||||
#end
|
||||
#foreach($field in $!{table.fields})
|
||||
#if(!$!{field.keyFlag})##生成普通字段
|
||||
#if(!$!{field.keyFlag} && $!{field.name} != $!{cfg.tenantColumn})##生成普通字段
|
||||
<result column="$!{field.name}" property="$!{field.propertyName}"/>
|
||||
#end
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
#end
|
||||
#if($!{baseColumnList})
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="baseColumnList">
|
||||
select
|
||||
#foreach($field in $!{table.commonFields})
|
||||
#if($!{field.name} == $!{field.propertyName})$!{field.name}#else$!{field.name} AS $!{field.propertyName}#end,
|
||||
#end
|
||||
$!{table.fieldNames}
|
||||
</sql>
|
||||
|
||||
<select id="select$!{entity}Page" resultMap="$!{table.entityPath}ResultMap">
|
||||
select * from $!{table.name} where is_deleted = 0
|
||||
</select>
|
||||
|
||||
#end
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
author=BladeX
|
||||
author=Blade
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
selection: true,
|
||||
column: [
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
{
|
||||
label: "$!{field.comment}",
|
||||
prop: "$!{field.propertyName}",
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
#end
|
||||
#end
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
set @parentid = (SELECT LAST_INSERT_ID());
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
||||
|
|
@ -52,6 +52,7 @@ class $!{entity}Add extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
{getFieldDecorator('$!{field.propertyName}', {
|
||||
rules: [
|
||||
|
|
@ -62,6 +63,7 @@ class $!{entity}Add extends PureComponent {
|
|||
],
|
||||
})(<Input placeholder="请输入$!{field.comment}" />)}
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const FormItem = Form.Item;
|
|||
|
||||
@connect(({ $!{table.entityPath}, loading }) => ({
|
||||
$!{table.entityPath},
|
||||
submitting: loading.effects['code/submit'],
|
||||
submitting: loading.effects['$!{table.entityPath}/submit'],
|
||||
}))
|
||||
@Form.create()
|
||||
class $!{entity}Edit extends PureComponent {
|
||||
|
|
@ -75,6 +75,7 @@ class $!{entity}Edit extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
{getFieldDecorator('$!{field.propertyName}', {
|
||||
rules: [
|
||||
|
|
@ -86,6 +87,7 @@ class $!{entity}Edit extends PureComponent {
|
|||
initialValue: detail.$!{field.propertyName},
|
||||
})(<Input placeholder="请输入$!{field.comment}" />)}
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -57,10 +57,12 @@ class $!{entity} extends PureComponent {
|
|||
|
||||
const columns = [
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
{
|
||||
title: '$!{field.comment}',
|
||||
dataIndex: '$!{field.propertyName}',
|
||||
},
|
||||
#end
|
||||
#end
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -61,9 +61,11 @@ class $!{entity}View extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
<span>{detail.$!{field.propertyName}}</span>
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
package org.springblade.test;
|
||||
|
||||
|
||||
import org.springblade.develop.support.BladeGenerator;
|
||||
import org.springblade.develop.support.BladeCodeGenerator;
|
||||
|
||||
/**
|
||||
* 代码生成器
|
||||
|
|
@ -25,18 +25,26 @@ import org.springblade.develop.support.BladeGenerator;
|
|||
*/
|
||||
public class CodeGenerator {
|
||||
|
||||
/**
|
||||
* 代码生成的模块名
|
||||
*/
|
||||
public static String CODE_NAME = "租户管理";
|
||||
/**
|
||||
* 代码所在服务名
|
||||
*/
|
||||
public static String SERVICE_NAME = "blade-system";
|
||||
/**
|
||||
* 代码生成的包名
|
||||
*/
|
||||
public static String PACKAGE_NAME = "org.springblade.demo";
|
||||
public static String PACKAGE_NAME = "org.springblade.system";
|
||||
/**
|
||||
* 前端代码生成所属系统
|
||||
*/
|
||||
public static String SYSTEM_NAME = "saber";
|
||||
public static String SYSTEM_NAME = "sword";
|
||||
/**
|
||||
* 前端代码生成地址
|
||||
*/
|
||||
public static String PACKAGE_WEB_DIR = "/Users/chill/Workspaces/dev/Saber";
|
||||
public static String PACKAGE_WEB_DIR = "/Users/chill/Workspaces/product/Sword";
|
||||
/**
|
||||
* 需要去掉的表前缀
|
||||
*/
|
||||
|
|
@ -44,7 +52,7 @@ public class CodeGenerator {
|
|||
/**
|
||||
* 需要生成的表名(两者只能取其一)
|
||||
*/
|
||||
public static String[] INCLUDE_TABLES = {"blade_notice"};
|
||||
public static String[] INCLUDE_TABLES = {"blade_tenant"};
|
||||
/**
|
||||
* 需要排除的表名(两者只能取其一)
|
||||
*/
|
||||
|
|
@ -52,18 +60,20 @@ public class CodeGenerator {
|
|||
/**
|
||||
* 是否包含基础业务字段
|
||||
*/
|
||||
public static Boolean HAS_SUPER_ENTITY = Boolean.FALSE;
|
||||
public static Boolean HAS_SUPER_ENTITY = Boolean.TRUE;
|
||||
/**
|
||||
* 基础业务字段
|
||||
*/
|
||||
public static String[] SUPER_ENTITY_COLUNMS = {"id", "create_time", "create_user", "update_time", "update_user", "status", "is_deleted"};
|
||||
public static String[] SUPER_ENTITY_COLUMNS = {"id", "create_time", "create_user", "update_time", "update_user", "status", "is_deleted"};
|
||||
|
||||
|
||||
/**
|
||||
* RUN THIS
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
BladeGenerator generator = new BladeGenerator();
|
||||
BladeCodeGenerator generator = new BladeCodeGenerator();
|
||||
generator.setCodeName(CODE_NAME);
|
||||
generator.setServiceName(SERVICE_NAME);
|
||||
generator.setSystemName(SYSTEM_NAME);
|
||||
generator.setPackageName(PACKAGE_NAME);
|
||||
generator.setPackageWebDir(PACKAGE_WEB_DIR);
|
||||
|
|
@ -71,7 +81,7 @@ public class CodeGenerator {
|
|||
generator.setIncludeTables(INCLUDE_TABLES);
|
||||
generator.setExcludeTables(EXCLUDE_TABLES);
|
||||
generator.setHasSuperEntity(HAS_SUPER_ENTITY);
|
||||
generator.setSuperEntityColumns(SUPER_ENTITY_COLUNMS);
|
||||
generator.setSuperEntityColumns(SUPER_ENTITY_COLUMNS);
|
||||
generator.run();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public class $!{entity} implements Serializable {
|
|||
|
||||
## ---------- BEGIN 字段循环遍历 ----------
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
#if($!{field.keyFlag})
|
||||
#set($keyPropertyName=$!{field.propertyName})
|
||||
#end
|
||||
|
|
@ -98,7 +99,7 @@ public class $!{entity} implements Serializable {
|
|||
@TableLogic
|
||||
#end
|
||||
private $!{field.propertyType} $!{field.propertyName};
|
||||
|
||||
#end
|
||||
#end
|
||||
## ---------- END 字段循环遍历 ----------
|
||||
|
||||
|
|
|
|||
|
|
@ -19,26 +19,16 @@
|
|||
<result column="$!{field.name}" property="$!{field.propertyName}"/>
|
||||
#end
|
||||
#foreach($field in $!{table.fields})
|
||||
#if(!$!{field.keyFlag})##生成普通字段
|
||||
#if(!$!{field.keyFlag} && $!{field.name} != $!{cfg.tenantColumn})##生成普通字段
|
||||
<result column="$!{field.name}" property="$!{field.propertyName}"/>
|
||||
#end
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
#end
|
||||
#if($!{baseColumnList})
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="baseColumnList">
|
||||
select
|
||||
#foreach($field in $!{table.commonFields})
|
||||
#if($!{field.name} == $!{field.propertyName})$!{field.name}#else$!{field.name} AS $!{field.propertyName}#end,
|
||||
#end
|
||||
$!{table.fieldNames}
|
||||
</sql>
|
||||
|
||||
<select id="select$!{entity}Page" resultMap="$!{table.entityPath}ResultMap">
|
||||
select * from $!{table.name} where is_deleted = 0
|
||||
</select>
|
||||
|
||||
#end
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/bladex?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/blade?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&serverTimezone=GMT%2B8
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=root
|
||||
author=BladeX
|
||||
author=Blade
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@
|
|||
selection: true,
|
||||
column: [
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
{
|
||||
label: "$!{field.comment}",
|
||||
prop: "$!{field.propertyName}",
|
||||
|
|
@ -57,6 +58,7 @@
|
|||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
#end
|
||||
#end
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', 0, '$!{cfg.entityKey}', '$!{cfg.codeName}', 'menu', '/$!{cfg.servicePackage}/$!{cfg.entityKey}', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
set @parentid = (SELECT LAST_INSERT_ID());
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_add', '新增', 'add', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_edit', '修改', 'edit', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/edit', 'form', 2, 2, 1, 2, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_delete', '删除', 'delete', '/api/$!{cfg.serviceName}/$!{cfg.entityKey}/remove', 'delete', 3, 2, 1, 3, NULL, 0);
|
||||
INSERT INTO `blade_menu`(`tenant_code`, `parent_id`, `code`, `name`, `alias`, `path`, `source`, `sort`, `category`, `action`, `is_open`, `remark`, `is_deleted`)
|
||||
VALUES ('000000', @parentid, '$!{cfg.entityKey}_view', '查看', 'view', '/$!{cfg.servicePackage}/$!{cfg.entityKey}/view', 'file-text', 4, 2, 1, 2, NULL, 0);
|
||||
|
|
@ -52,6 +52,7 @@ class $!{entity}Add extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
{getFieldDecorator('$!{field.propertyName}', {
|
||||
rules: [
|
||||
|
|
@ -62,6 +63,7 @@ class $!{entity}Add extends PureComponent {
|
|||
],
|
||||
})(<Input placeholder="请输入$!{field.comment}" />)}
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const FormItem = Form.Item;
|
|||
|
||||
@connect(({ $!{table.entityPath}, loading }) => ({
|
||||
$!{table.entityPath},
|
||||
submitting: loading.effects['code/submit'],
|
||||
submitting: loading.effects['$!{table.entityPath}/submit'],
|
||||
}))
|
||||
@Form.create()
|
||||
class $!{entity}Edit extends PureComponent {
|
||||
|
|
@ -75,6 +75,7 @@ class $!{entity}Edit extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
{getFieldDecorator('$!{field.propertyName}', {
|
||||
rules: [
|
||||
|
|
@ -86,6 +87,7 @@ class $!{entity}Edit extends PureComponent {
|
|||
initialValue: detail.$!{field.propertyName},
|
||||
})(<Input placeholder="请输入$!{field.comment}" />)}
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -57,10 +57,12 @@ class $!{entity} extends PureComponent {
|
|||
|
||||
const columns = [
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
{
|
||||
title: '$!{field.comment}',
|
||||
dataIndex: '$!{field.propertyName}',
|
||||
},
|
||||
#end
|
||||
#end
|
||||
];
|
||||
|
||||
|
|
|
|||
|
|
@ -61,9 +61,11 @@ class $!{entity}View extends PureComponent {
|
|||
<Form hideRequiredMark style={{ marginTop: 8 }}>
|
||||
<Card className={styles.card} bordered={false}>
|
||||
#foreach($field in $!{table.fields})
|
||||
#if($!{field.name}!=$!{cfg.tenantColumn})
|
||||
<FormItem {...formItemLayout} label="$!{field.comment}">
|
||||
<span>{detail.$!{field.propertyName}}</span>
|
||||
</FormItem>
|
||||
#end
|
||||
#end
|
||||
</Card>
|
||||
</Form>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.springblade.system.entity.Dept;
|
|||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import java.io.Serializable;
|
|||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
public class MenuDTO implements Serializable {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.springblade.system.entity.Param;
|
|||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.springblade.system.entity.Role;
|
|||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@ import org.springblade.system.entity.RoleMenu;
|
|||
* 数据传输对象实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.io.Serializable;
|
|||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_dept")
|
||||
|
|
@ -45,6 +44,12 @@ public class Dept implements Serializable {
|
|||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@ApiModelProperty(value = "租户编号")
|
||||
private String tenantCode;
|
||||
|
||||
/**
|
||||
* 父主键
|
||||
*/
|
||||
|
|
@ -58,9 +63,9 @@ public class Dept implements Serializable {
|
|||
private String deptName;
|
||||
|
||||
/**
|
||||
* 部门全程
|
||||
* 部门全称
|
||||
*/
|
||||
@ApiModelProperty(value = "部门全程")
|
||||
@ApiModelProperty(value = "部门全称")
|
||||
private String fullName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import java.io.Serializable;
|
|||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_menu")
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.springblade.core.mp.base.BaseEntity;
|
|||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_param")
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.io.Serializable;
|
|||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_role")
|
||||
|
|
@ -45,6 +44,12 @@ public class Role implements Serializable {
|
|||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@ApiModelProperty(value = "租户编号")
|
||||
private String tenantCode;
|
||||
|
||||
/**
|
||||
* 父主键
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import java.io.Serializable;
|
|||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_role_menu")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_tenant")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "Tenant对象", description = "Tenant对象")
|
||||
public class Tenant extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 租户编号
|
||||
*/
|
||||
@ApiModelProperty(value = "租户编号")
|
||||
private String tenantCode;
|
||||
/**
|
||||
* 租户名称
|
||||
*/
|
||||
@ApiModelProperty(value = "租户名称")
|
||||
private String tenantName;
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
@ApiModelProperty(value = "联系人")
|
||||
private String linkman;
|
||||
/**
|
||||
* 联系电话
|
||||
*/
|
||||
@ApiModelProperty(value = "联系电话")
|
||||
private String contactNumber;
|
||||
/**
|
||||
* 联系地址
|
||||
*/
|
||||
@ApiModelProperty(value = "联系地址")
|
||||
private String address;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.feign;
|
||||
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.system.entity.Dept;
|
||||
import org.springblade.system.entity.Role;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* Feign接口类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@FeignClient(
|
||||
value = AppConstant.APPLICATION_SYSTEM_NAME,
|
||||
fallback = ISysClientFallback.class
|
||||
)
|
||||
public interface ISysClient {
|
||||
|
||||
String API_PREFIX = "/sys";
|
||||
|
||||
/**
|
||||
* 获取部门名
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 部门名
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/getDeptName")
|
||||
String getDeptName(@RequestParam("id") Integer id);
|
||||
|
||||
/**
|
||||
* 获取部门
|
||||
*
|
||||
* @param id 主键
|
||||
* @return Dept
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/getDept")
|
||||
Dept getDept(@RequestParam("id") Integer id);
|
||||
|
||||
/**
|
||||
* 获取角色名
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 角色名
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/getRoleName")
|
||||
String getRoleName(@RequestParam("id") Integer id);
|
||||
|
||||
/**
|
||||
* 获取角色别名
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 角色别名
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/getRoleAlias")
|
||||
String getRoleAlias(@RequestParam("id") Integer id);
|
||||
|
||||
/**
|
||||
* 获取角色
|
||||
*
|
||||
* @param id 主键
|
||||
* @return Role
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/getRole")
|
||||
Role getRole(@RequestParam("id") Integer id);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.feign;
|
||||
|
||||
import org.springblade.system.entity.Dept;
|
||||
import org.springblade.system.entity.Role;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Feign失败配置
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Component
|
||||
public class ISysClientFallback implements ISysClient {
|
||||
@Override
|
||||
public String getDeptName(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dept getDept(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoleName(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRoleAlias(Integer id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Role getRole(Integer id) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.springblade.system.entity.Param;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.springblade.system.entity.RoleMenu;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ import java.util.List;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.springblade.system.user.entity;
|
|||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ import java.time.LocalDateTime;
|
|||
@Data
|
||||
@TableName("blade_user")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class User extends BaseEntity {
|
||||
public class User extends TenantEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||
|
||||
/**
|
||||
* User Feign接口类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@FeignClient(
|
||||
|
|
@ -37,11 +38,12 @@ public interface IUserClient {
|
|||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param tenantCode 租户编号
|
||||
* @param account 账号
|
||||
* @param password 密码
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(API_PREFIX + "/userInfo")
|
||||
R<UserInfo> userInfo(@RequestParam("account") String account, @RequestParam("password") String password);
|
||||
@GetMapping(API_PREFIX + "/user-info")
|
||||
R<UserInfo> userInfo(@RequestParam("tenantCode") String tenantCode, @RequestParam("account") String account, @RequestParam("password") String password);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.springblade.system.user.entity.User;
|
|||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
<parent>
|
||||
<artifactId>SpringBlade</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>blade-service-api</artifactId>
|
||||
<name>${project.artifactId}</name>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>SpringBlade 微服务API集合</description>
|
||||
|
||||
|
|
@ -28,6 +28,11 @@
|
|||
<artifactId>blade-core-mybatis</artifactId>
|
||||
<version>${blade.tool.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-core-tenant</artifactId>
|
||||
<version>${blade.tool.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<parent>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
|
|
|||
|
|
@ -15,11 +15,14 @@
|
|||
*/
|
||||
package org.springblade.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.node.INode;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.entity.Dept;
|
||||
|
|
@ -37,7 +40,6 @@ import java.util.Map;
|
|||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -67,8 +69,9 @@ public class DeptController extends BladeController {
|
|||
@ApiImplicitParam(name = "fullName", value = "部门全称", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "列表", notes = "传入dept", position = 2)
|
||||
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dept) {
|
||||
List<Dept> list = deptService.list(Condition.getQueryWrapper(dept, Dept.class));
|
||||
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dept, BladeUser bladeUser) {
|
||||
QueryWrapper<Dept> queryWrapper = Condition.getQueryWrapper(dept, Dept.class);
|
||||
List<Dept> list = deptService.list((!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Dept::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
||||
DeptWrapper deptWrapper = new DeptWrapper();
|
||||
return R.data(deptWrapper.listNodeVO(list));
|
||||
}
|
||||
|
|
@ -80,8 +83,8 @@ public class DeptController extends BladeController {
|
|||
*/
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation(value = "树形结构", notes = "树形结构", position = 3)
|
||||
public R<List<DeptVO>> tree() {
|
||||
List<DeptVO> tree = deptService.tree();
|
||||
public R<List<DeptVO>> tree(String tenantCode, BladeUser bladeUser) {
|
||||
List<DeptVO> tree = deptService.tree(Func.toStr(tenantCode, bladeUser.getTenantCode()));
|
||||
return R.data(tree);
|
||||
}
|
||||
|
||||
|
|
@ -90,11 +93,13 @@ public class DeptController extends BladeController {
|
|||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperation(value = "新增或修改", notes = "传入dept", position = 6)
|
||||
public R submit(@Valid @RequestBody Dept dept) {
|
||||
public R submit(@Valid @RequestBody Dept dept, BladeUser user) {
|
||||
if (Func.isEmpty(dept.getId())) {
|
||||
dept.setTenantCode(user.getTenantCode());
|
||||
}
|
||||
return R.status(deptService.saveOrUpdate(dept));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ package org.springblade.system.controller;
|
|||
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.common.cache.CacheNames;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.tool.api.R;
|
||||
|
|
@ -35,11 +34,13 @@ import javax.validation.Valid;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springblade.common.cache.CacheNames.DICT_LIST;
|
||||
import static org.springblade.common.cache.CacheNames.DICT_VALUE;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -102,7 +103,7 @@ public class DictController extends BladeController {
|
|||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@CacheEvict(cacheNames = {CacheNames.DICT_LIST, CacheNames.DICT_VALUE})
|
||||
@CacheEvict(cacheNames = {DICT_LIST, DICT_VALUE})
|
||||
@ApiOperation(value = "删除", notes = "传入ids", position = 7)
|
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(dictService.removeByIds(Func.toIntList(ids)));
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ import java.util.Map;
|
|||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -113,8 +112,8 @@ public class MenuController extends BladeController {
|
|||
*/
|
||||
@GetMapping("/grant-tree")
|
||||
@ApiOperation(value = "权限分配树形结构", notes = "权限分配树形结构", position = 6)
|
||||
public R<List<MenuVO>> grantTree() {
|
||||
return R.data(menuService.grantTree());
|
||||
public R<List<MenuVO>> grantTree(BladeUser user) {
|
||||
return R.data(menuService.grantTree(user));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -147,7 +146,6 @@ public class MenuController extends BladeController {
|
|||
|
||||
/**
|
||||
* 获取配置的角色权限
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("auth-routes")
|
||||
@ApiOperation(value = "菜单的角色权限", position = 8)
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import java.util.Map;
|
|||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
|
|||
|
|
@ -15,13 +15,15 @@
|
|||
*/
|
||||
package org.springblade.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.node.INode;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.entity.Role;
|
||||
import org.springblade.system.service.IRoleService;
|
||||
|
|
@ -38,7 +40,6 @@ import java.util.Map;
|
|||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
|
|
@ -68,8 +69,9 @@ public class RoleController extends BladeController {
|
|||
@ApiImplicitParam(name = "roleAlias", value = "角色别名", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "列表", notes = "传入role", position = 2)
|
||||
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> role) {
|
||||
List<Role> list = roleService.list(Condition.getQueryWrapper(role, Role.class));
|
||||
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> role, BladeUser bladeUser) {
|
||||
QueryWrapper<Role> queryWrapper = Condition.getQueryWrapper(role, Role.class);
|
||||
List<Role> list = roleService.list((!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Role::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
||||
RoleWrapper roleWrapper = new RoleWrapper(roleService);
|
||||
return R.data(roleWrapper.listNodeVO(list));
|
||||
}
|
||||
|
|
@ -79,8 +81,8 @@ public class RoleController extends BladeController {
|
|||
*/
|
||||
@GetMapping("/tree")
|
||||
@ApiOperation(value = "树形结构", notes = "树形结构", position = 3)
|
||||
public R<List<RoleVO>> tree() {
|
||||
List<RoleVO> tree = roleService.tree();
|
||||
public R<List<RoleVO>> tree(String tenantCode, BladeUser bladeUser) {
|
||||
List<RoleVO> tree = roleService.tree(Func.toStr(tenantCode, bladeUser.getTenantCode()));
|
||||
return R.data(tree);
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +91,10 @@ public class RoleController extends BladeController {
|
|||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperation(value = "新增或修改", notes = "传入role", position = 6)
|
||||
public R submit(@Valid @RequestBody Role role) {
|
||||
public R submit(@Valid @RequestBody Role role, BladeUser user) {
|
||||
if (Func.isEmpty(role.getId())) {
|
||||
role.setTenantCode(user.getTenantCode());
|
||||
}
|
||||
return R.status(roleService.saveOrUpdate(role));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.entity.Tenant;
|
||||
import org.springblade.system.service.ITenantService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/tenant")
|
||||
@ApiIgnore
|
||||
@Api(value = "租户管理", tags = "接口")
|
||||
public class TenantController extends BladeController {
|
||||
|
||||
private ITenantService tenantService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value = "详情", notes = "传入tenant", position = 1)
|
||||
public R<Tenant> detail(Tenant tenant) {
|
||||
Tenant detail = tenantService.getOne(Condition.getQueryWrapper(tenant));
|
||||
return R.data(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "tenantCode", value = "参数名称", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "tenantName", value = "角色别名", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "contactNumber", value = "联系电话", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "分页", notes = "传入tenant", position = 2)
|
||||
public R<IPage<Tenant>> list(@ApiIgnore @RequestParam Map<String, Object> tenant, Query query, BladeUser bladeUser) {
|
||||
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant, Tenant.class);
|
||||
IPage<Tenant> pages = tenantService.page(Condition.getPage(query), (!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Tenant::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下拉数据源
|
||||
*/
|
||||
@GetMapping("/select")
|
||||
@ApiOperation(value = "下拉数据源", notes = "传入tenant", position = 3)
|
||||
public R<List<Tenant>> select(Tenant tenant, BladeUser bladeUser) {
|
||||
QueryWrapper<Tenant> queryWrapper = Condition.getQueryWrapper(tenant);
|
||||
List<Tenant> list = tenantService.list((!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(Tenant::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
||||
return R.data(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "分页", notes = "传入tenant", position = 4)
|
||||
public R<IPage<Tenant>> page(Tenant tenant, Query query) {
|
||||
IPage<Tenant> pages = tenantService.selectTenantPage(Condition.getPage(query), tenant);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperation(value = "新增或修改", notes = "传入tenant", position = 7)
|
||||
public R submit(@Valid @RequestBody Tenant tenant) {
|
||||
return R.status(tenantService.saveTenant(tenant));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperation(value = "逻辑删除", notes = "传入ids", position = 8)
|
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||
return R.status(tenantService.deleteLogic(Func.toIntList(ids)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,3 +1,18 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.feign;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.feign;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.system.entity.Dept;
|
||||
import org.springblade.system.entity.Role;
|
||||
import org.springblade.system.service.IDeptService;
|
||||
import org.springblade.system.service.IRoleService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
/**
|
||||
* 系统服务Feign实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@ApiIgnore
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class SysClient implements ISysClient {
|
||||
|
||||
IDeptService deptService;
|
||||
|
||||
IRoleService roleService;
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/getDeptName")
|
||||
public String getDeptName(Integer id) {
|
||||
return deptService.getById(id).getDeptName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/getDept")
|
||||
public Dept getDept(Integer id) {
|
||||
return deptService.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/getRoleName")
|
||||
public String getRoleName(Integer id) {
|
||||
return roleService.getById(id).getRoleName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/getRoleAlias")
|
||||
public String getRoleAlias(Integer id) {
|
||||
return roleService.getById(id).getRoleAlias();
|
||||
}
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/getRole")
|
||||
public Role getRole(Integer id) {
|
||||
return roleService.getById(id);
|
||||
}
|
||||
}
|
||||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface DeptMapper extends BaseMapper<Dept> {
|
||||
|
||||
|
|
@ -42,8 +41,9 @@ public interface DeptMapper extends BaseMapper<Dept> {
|
|||
/**
|
||||
* 获取树形节点
|
||||
*
|
||||
* @param tenantCode
|
||||
* @return
|
||||
*/
|
||||
List<DeptVO> tree();
|
||||
List<DeptVO> tree(String tenantCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@
|
|||
</select>
|
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, dept_name as title, id as `value`, id as `key` from blade_dept where is_deleted = 0
|
||||
select id, parent_id, dept_name as title, id as 'value', id as 'key' from blade_dept where is_deleted = 0
|
||||
<if test="_parameter!=null">
|
||||
and tenant_code = #{_parameter}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface DictMapper extends BaseMapper<Dict> {
|
||||
|
||||
|
|
|
|||
|
|
@ -38,12 +38,19 @@
|
|||
from blade_dict where code = #{param1} and dict_key = #{param2} limit 1
|
||||
</select>
|
||||
|
||||
<!-- oracle 版本 -->
|
||||
<!--<select id="getValue" resultType="java.lang.String">
|
||||
select
|
||||
dict_value
|
||||
from blade_dict where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} rownum 1
|
||||
</select>-->
|
||||
|
||||
<select id="getList" resultMap="dictResultMap">
|
||||
select code, dict_key, dict_value, sort, remark from blade_dict where code = #{param1}
|
||||
</select>
|
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, dict_value as title, id as `value`, id as `key` from blade_dict where is_deleted = 0
|
||||
select id, parent_id, dict_value as title, id as 'value', id as 'key' from blade_dict where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface MenuMapper extends BaseMapper<Menu> {
|
||||
|
||||
|
|
@ -54,6 +53,13 @@ public interface MenuMapper extends BaseMapper<Menu> {
|
|||
*/
|
||||
List<MenuVO> grantTree();
|
||||
|
||||
/**
|
||||
* 授权树形结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<MenuVO> grantTreeByRole(List<Integer> roleId);
|
||||
|
||||
/**
|
||||
* 所有菜单
|
||||
*
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
</select>
|
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, name as title, id as `value`, id as `key` from blade_menu where is_deleted = 0 and category = 1
|
||||
select id, parent_id, name as title, id as 'value', id as 'key' from blade_menu where is_deleted = 0 and category = 1
|
||||
</select>
|
||||
|
||||
<select id="allMenu" resultMap="menuResultMap">
|
||||
|
|
@ -109,7 +109,22 @@
|
|||
</select>
|
||||
|
||||
<select id="grantTree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, name as title, id as `value`, id as `key` from blade_menu where is_deleted = 0
|
||||
select id, parent_id, name as title, id as 'value', id as 'key' from blade_menu where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="grantTreeByRole" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, name as title, id as 'value', id as 'key' from blade_menu where is_deleted = 0
|
||||
and id in ( select menu_id from blade_role_menu where role_id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach> )
|
||||
or id in (
|
||||
select parent_id from blade_menu where is_deleted = 0
|
||||
and id in ( select menu_id from blade_role_menu where role_id in
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach> )
|
||||
)
|
||||
</select>
|
||||
|
||||
<select id="authRoutes" resultType="org.springblade.system.dto.MenuDTO">
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
public interface ParamMapper extends BaseMapper<Param> {
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface RoleMapper extends BaseMapper<Role> {
|
||||
|
||||
|
|
@ -42,8 +41,9 @@ public interface RoleMapper extends BaseMapper<Role> {
|
|||
/**
|
||||
* 获取树形节点
|
||||
*
|
||||
* @param tenantCode
|
||||
* @return
|
||||
*/
|
||||
List<RoleVO> tree();
|
||||
List<RoleVO> tree(String tenantCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,10 @@
|
|||
</select>
|
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, role_name as title, id as `value`, id as `key` from blade_role where is_deleted = 0
|
||||
select id, parent_id, role_name as title, id as 'value', id as 'key' from blade_role where is_deleted = 0
|
||||
<if test="_parameter!=null">
|
||||
and tenant_code = #{_parameter}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface RoleMenuMapper extends BaseMapper<RoleMenu> {
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.system.entity.Tenant;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface TenantMapper extends BaseMapper<Tenant> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tenant
|
||||
* @return
|
||||
*/
|
||||
List<Tenant> selectTenantPage(IPage page, Tenant tenant);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.system.mapper.TenantMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="tenantResultMap" type="org.springblade.system.entity.Tenant">
|
||||
<result column="id" property="id"/>
|
||||
<result column="create_user" property="createUser"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="update_user" property="updateUser"/>
|
||||
<result column="update_time" property="updateTime"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
<result column="tenant_name" property="tenantName"/>
|
||||
<result column="linkman" property="linkman"/>
|
||||
<result column="contact_number" property="contactNumber"/>
|
||||
<result column="address" property="address"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectTenantPage" resultMap="tenantResultMap">
|
||||
select * from blade_tenant where is_deleted = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface IDeptService extends IService<Dept> {
|
||||
|
||||
|
|
@ -42,8 +41,9 @@ public interface IDeptService extends IService<Dept> {
|
|||
/**
|
||||
* 树形结构
|
||||
*
|
||||
* @param tenantCode
|
||||
* @return
|
||||
*/
|
||||
List<DeptVO> tree();
|
||||
List<DeptVO> tree(String tenantCode);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import java.util.List;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface IDictService extends IService<Dict> {
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import java.util.List;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface IMenuService extends IService<Menu> {
|
||||
|
||||
|
|
@ -67,9 +66,10 @@ public interface IMenuService extends IService<Menu> {
|
|||
/**
|
||||
* 授权树形结构
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
List<MenuVO> grantTree();
|
||||
List<MenuVO> grantTree(BladeUser user);
|
||||
|
||||
/**
|
||||
* 默认选中节点
|
||||
|
|
@ -81,6 +81,7 @@ public interface IMenuService extends IService<Menu> {
|
|||
|
||||
/**
|
||||
* 获取配置的角色权限
|
||||
*
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ import org.springblade.system.vo.ParamVO;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
public interface IParamService extends BaseService<Param> {
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import org.springblade.system.entity.RoleMenu;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface IRoleMenuService extends IService<RoleMenu> {
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import java.util.List;
|
|||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
public interface IRoleService extends IService<Role> {
|
||||
|
||||
|
|
@ -43,9 +42,10 @@ public interface IRoleService extends IService<Role> {
|
|||
/**
|
||||
* 树形结构
|
||||
*
|
||||
* @param tenantCode
|
||||
* @return
|
||||
*/
|
||||
List<RoleVO> tree();
|
||||
List<RoleVO> tree(String tenantCode);
|
||||
|
||||
/**
|
||||
* 权限配置
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import org.springblade.system.entity.Tenant;
|
||||
|
||||
/**
|
||||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface ITenantService extends BaseService<Tenant> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page
|
||||
* @param tenant
|
||||
* @return
|
||||
*/
|
||||
IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant);
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param tenant
|
||||
* @return
|
||||
*/
|
||||
boolean saveTenant(Tenant tenant);
|
||||
|
||||
}
|
||||
|
|
@ -30,7 +30,6 @@ import java.util.List;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements IDeptService {
|
||||
|
|
@ -41,8 +40,8 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<DeptVO> tree() {
|
||||
return ForestNodeMerger.merge(baseMapper.tree());
|
||||
public List<DeptVO> tree(String tenantCode) {
|
||||
return ForestNodeMerger.merge(baseMapper.tree(tenantCode));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ import static org.springblade.common.cache.CacheNames.DICT_VALUE;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements IDictService {
|
||||
|
|
@ -77,5 +76,4 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, Dict> implements ID
|
|||
}
|
||||
return saveOrUpdate(dict);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.node.ForestNodeMerger;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
|
|
@ -40,7 +41,6 @@ import java.util.stream.Collectors;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
|
|
@ -86,8 +86,8 @@ public class MenuServiceImpl extends ServiceImpl<MenuMapper, Menu> implements IM
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<MenuVO> grantTree() {
|
||||
return ForestNodeMerger.merge(baseMapper.grantTree());
|
||||
public List<MenuVO> grantTree(BladeUser user) {
|
||||
return ForestNodeMerger.merge(user.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE) ? baseMapper.grantTree() : baseMapper.grantTreeByRole(Func.toIntList(user.getRoleId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import org.springframework.stereotype.Service;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@Service
|
||||
public class ParamServiceImpl extends BaseServiceImpl<ParamMapper, Param> implements IParamService {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import org.springframework.stereotype.Service;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ import java.util.List;
|
|||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
|
|
@ -52,8 +51,8 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements IR
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<RoleVO> tree() {
|
||||
return ForestNodeMerger.merge(baseMapper.tree());
|
||||
public List<RoleVO> tree(String tenantCode) {
|
||||
return ForestNodeMerger.merge(baseMapper.tree(tenantCode));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
/**
|
||||
* Copyright (c) 2018-2028, Chill Zhuang 庄骞 (smallchill@163.com).
|
||||
* <p>
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* <p>
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* <p>
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springblade.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.tenant.TenantId;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.entity.Dept;
|
||||
import org.springblade.system.entity.Role;
|
||||
import org.springblade.system.entity.Tenant;
|
||||
import org.springblade.system.mapper.DeptMapper;
|
||||
import org.springblade.system.mapper.RoleMapper;
|
||||
import org.springblade.system.mapper.TenantMapper;
|
||||
import org.springblade.system.service.ITenantService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class TenantServiceImpl extends BaseServiceImpl<TenantMapper, Tenant> implements ITenantService {
|
||||
|
||||
private final TenantId tenantId;
|
||||
private final RoleMapper roleMapper;
|
||||
private final DeptMapper deptMapper;
|
||||
|
||||
@Override
|
||||
public IPage<Tenant> selectTenantPage(IPage<Tenant> page, Tenant tenant) {
|
||||
return page.setRecords(baseMapper.selectTenantPage(page, tenant));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveTenant(Tenant tenant) {
|
||||
if (Func.isEmpty(tenant.getId())) {
|
||||
List<Tenant> tenants = baseMapper.selectList(Wrappers.<Tenant>query().lambda().eq(Tenant::getIsDeleted, BladeConstant.DB_NOT_DELETED));
|
||||
List<String> codes = tenants.stream().map(Tenant::getTenantCode).collect(Collectors.toList());
|
||||
String tenantCode = getTenantCode(codes);
|
||||
tenant.setTenantCode(tenantCode);
|
||||
// 新建租户对应的默认角色
|
||||
Role role = new Role();
|
||||
role.setTenantCode(tenantCode);
|
||||
role.setParentId(0);
|
||||
role.setRoleName("管理员");
|
||||
role.setRoleAlias("admin");
|
||||
role.setSort(2);
|
||||
role.setIsDeleted(0);
|
||||
roleMapper.insert(role);
|
||||
// 新建租户对应的默认部门
|
||||
Dept dept = new Dept();
|
||||
dept.setTenantCode(tenantCode);
|
||||
dept.setParentId(0);
|
||||
dept.setDeptName(tenant.getTenantName());
|
||||
dept.setFullName(tenant.getTenantName());
|
||||
dept.setSort(2);
|
||||
dept.setIsDeleted(0);
|
||||
deptMapper.insert(dept);
|
||||
}
|
||||
return super.saveOrUpdate(tenant);
|
||||
}
|
||||
|
||||
private String getTenantCode(List<String> codes) {
|
||||
String code = tenantId.generate();
|
||||
if (codes.contains(code)) {
|
||||
return getTenantCode(codes);
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -33,7 +33,6 @@ import java.util.stream.Collectors;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class DeptWrapper extends BaseEntityWrapper<Dept, DeptVO> {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import java.util.stream.Collectors;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class DictWrapper extends BaseEntityWrapper<Dict, DictVO> {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import java.util.stream.Collectors;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class MenuWrapper extends BaseEntityWrapper<Menu, MenuVO> {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.springblade.system.vo.ParamVO;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-28
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class ParamWrapper extends BaseEntityWrapper<Param, ParamVO> {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.springblade.system.vo.RoleMenuVO;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class RoleMenuWrapper extends BaseEntityWrapper<RoleMenu, RoleMenuVO> {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ import java.util.stream.Collectors;
|
|||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
* @since 2018-12-24
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
public class RoleWrapper extends BaseEntityWrapper<Role, RoleVO> {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<parent>
|
||||
<artifactId>blade-service</artifactId>
|
||||
<groupId>org.springblade</groupId>
|
||||
<version>2.0.2</version>
|
||||
<version>2.1.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
package org.springblade.system.user.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -24,7 +25,9 @@ import io.swagger.annotations.ApiParam;
|
|||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.BladeUser;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.utils.DigestUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.system.feign.IDictClient;
|
||||
|
|
@ -72,8 +75,9 @@ public class UserController {
|
|||
@ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperation(value = "列表", notes = "传入account和realName", position = 2)
|
||||
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query) {
|
||||
IPage<User> pages = userService.page(Condition.getPage(query), Condition.getQueryWrapper(user, User.class));
|
||||
public R<IPage<UserVO>> list(@ApiIgnore @RequestParam Map<String, Object> user, Query query, BladeUser bladeUser) {
|
||||
QueryWrapper<User> queryWrapper = Condition.getQueryWrapper(user, User.class);
|
||||
IPage<User> pages = userService.page(Condition.getPage(query), (!bladeUser.getTenantCode().equals(BladeConstant.ADMIN_TENANT_CODE)) ? queryWrapper.lambda().eq(User::getTenantCode, bladeUser.getTenantCode()) : queryWrapper);
|
||||
UserWrapper userWrapper = new UserWrapper(userService, dictClient);
|
||||
return R.data(userWrapper.pageVO(pages));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ public class UserClient implements IUserClient {
|
|||
IUserService service;
|
||||
|
||||
@Override
|
||||
@GetMapping(API_PREFIX + "/userInfo")
|
||||
public R<UserInfo> userInfo(String account, String password) {
|
||||
return R.data(service.userInfo(account, password));
|
||||
@GetMapping(API_PREFIX + "/user-info")
|
||||
public R<UserInfo> userInfo(String tenantCode, String account, String password) {
|
||||
return R.data(service.userInfo(tenantCode, account, password));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user