🎉 2.0.0-RC1.

This commit is contained in:
smallchill 2019-01-02 00:54:50 +08:00
parent 25c5e34053
commit 452db24b15
34 changed files with 176 additions and 151 deletions

View File

@ -13,7 +13,7 @@ SpringBlade 2.0 是一个基于 Spring Boot 2 & Spring Cloud Finchley & Mybatis
## 工程结构 ## 工程结构
``` ```
bladex SpringBlade
├── blade-auth -- 授权服务提供 ├── blade-auth -- 授权服务提供
├── blade-common -- 常用工具封装包 ├── blade-common -- 常用工具封装包
├── blade-gateway -- Spring Cloud 网关 ├── blade-gateway -- Spring Cloud 网关

View File

@ -27,11 +27,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration @Configuration
public class RegistryConfiguration implements WebMvcConfigurer { public class RegistryConfiguration implements WebMvcConfigurer {
@Bean @Bean
public SecureRegistry secureRegistry() { public SecureRegistry secureRegistry() {
SecureRegistry secureRegistry = new SecureRegistry(); SecureRegistry secureRegistry = new SecureRegistry();
secureRegistry.excludePathPatterns("/token/**"); secureRegistry.excludePathPatterns("/token/**");
return secureRegistry; return secureRegistry;
} }
} }

View File

@ -20,13 +20,17 @@ import org.springblade.core.launch.constant.AppConstant;
import org.springblade.core.launch.BladeApplication; import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* admin启动器
*
* @author Chill
*/
@EnableAdminServer @EnableAdminServer
@SpringBootApplication @SpringBootApplication
public class BladeAdminApplication { public class BladeAdminApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_ADMIN_NAME, BladeAdminApplication.class, args); BladeApplication.run(AppConstant.APPLICATION_ADMIN_NAME, BladeAdminApplication.class, args);
} }
} }

View File

@ -20,6 +20,8 @@ import org.springblade.support.BladeGenerator;
/** /**
* 代码生成器 * 代码生成器
*
* @author Chill
*/ */
public class CodeGenerator { public class CodeGenerator {

View File

@ -20,13 +20,17 @@ import org.springblade.core.launch.BladeApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.config.server.EnableConfigServer; import org.springframework.cloud.config.server.EnableConfigServer;
/**
* 服务中心启动器
*
* @author Chill
*/
@EnableConfigServer @EnableConfigServer
@SpringBootApplication @SpringBootApplication
public class BladeConfigApplication { public class BladeConfigApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_CONFIG_NAME, BladeConfigApplication.class, args); BladeApplication.run(AppConstant.APPLICATION_CONFIG_NAME, BladeConfigApplication.class, args);
} }
} }

View File

@ -25,21 +25,24 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
/** /**
* Feign接口类 * Notice Feign接口类
*
* @author Chill
*/ */
@FeignClient( @FeignClient(
value = AppConstant.APPLICATION_DESK_NAME value = AppConstant.APPLICATION_DESK_NAME
) )
public interface INoticeClient { public interface INoticeClient {
String API_PREFIX = "/dashboard"; String API_PREFIX = "/dashboard";
/** /**
* 获取notice列表 * 获取notice列表
* @param number *
* @return * @param number
*/ * @return
*/
@GetMapping(API_PREFIX + "/top") @GetMapping(API_PREFIX + "/top")
R<List<Notice>> top(@RequestParam("number") Integer number); R<List<Notice>> top(@RequestParam("number") Integer number);
} }

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.Dict;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class DictDTO extends Dict { public class DictDTO extends Dict {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -26,31 +26,32 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
/** /**
* Feign接口类 * Feign接口类
*/ */
@FeignClient( @FeignClient(
value = AppConstant.APPLICATION_SYSTEM_NAME, value = AppConstant.APPLICATION_SYSTEM_NAME,
fallback = IDictClientFallback.class fallback = IDictClientFallback.class
) )
public interface IDictClient { public interface IDictClient {
String API_PREFIX = "/dict"; String API_PREFIX = "/dict";
/** /**
* 获取字典表对应值 * 获取字典表对应值
* *
* @param code 字典编号 * @param code 字典编号
* @param dictKey 字典序号 * @param dictKey 字典序号
* @return * @return
*/ */
@GetMapping(API_PREFIX + "/getValue") @GetMapping(API_PREFIX + "/getValue")
R<String> getValue(@RequestParam("code") String code, @RequestParam("dictKey") Integer dictKey); R<String> getValue(@RequestParam("code") String code, @RequestParam("dictKey") Integer dictKey);
/** /**
* 获取字典表 * 获取字典表
* @param code 字典编号 *
* @return * @param code 字典编号
*/ * @return
*/
@GetMapping(API_PREFIX + "/getList") @GetMapping(API_PREFIX + "/getList")
R<List<Dict>> getList(@RequestParam("code") String code); R<List<Dict>> getList(@RequestParam("code") String code);

View File

@ -20,6 +20,11 @@ import org.springblade.system.entity.Dict;
import java.util.List; import java.util.List;
/**
* Feign失败配置
*
* @author Chill
*/
public class IDictClientFallback implements IDictClient { public class IDictClientFallback implements IDictClient {
@Override @Override
public R<String> getValue(String code, Integer dictKey) { public R<String> getValue(String code, Integer dictKey) {

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.Code;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class CodeDTO extends Code { public class CodeDTO extends Code {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.Dept;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class DeptDTO extends Dept { public class DeptDTO extends Dept {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.Menu;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class MenuDTO extends Menu { public class MenuDTO extends Menu {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.Role;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class RoleDTO extends Role { public class RoleDTO extends Role {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -28,6 +28,6 @@ import org.springblade.system.entity.RoleMenu;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class RoleMenuDTO extends RoleMenu { public class RoleMenuDTO extends RoleMenu {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -30,6 +30,6 @@ import org.springblade.system.entity.Code;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "CodeVO对象", description = "CodeVO对象") @ApiModel(value = "CodeVO对象", description = "CodeVO对象")
public class CodeVO extends Code { public class CodeVO extends Code {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -30,6 +30,6 @@ import org.springblade.system.entity.RoleMenu;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "RoleMenuVO对象", description = "RoleMenuVO对象") @ApiModel(value = "RoleMenuVO对象", description = "RoleMenuVO对象")
public class RoleMenuVO extends RoleMenu { public class RoleMenuVO extends RoleMenu {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -23,7 +23,7 @@ import org.springblade.core.mp.base.BaseEntity;
import java.time.LocalDateTime; import java.time.LocalDateTime;
/** /**
* 实体类 * 实体类
* *
* @author Chill * @author Chill
*/ */
@ -32,48 +32,48 @@ import java.time.LocalDateTime;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class User extends BaseEntity { public class User extends BaseEntity {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 账号 * 账号
*/ */
private String account; private String account;
/** /**
* 密码 * 密码
*/ */
private String password; private String password;
/** /**
* 昵称 * 昵称
*/ */
private String name; private String name;
/** /**
* 真名 * 真名
*/ */
private String realName; private String realName;
/** /**
* 邮箱 * 邮箱
*/ */
private String email; private String email;
/** /**
* 手机 * 手机
*/ */
private String phone; private String phone;
/** /**
* 生日 * 生日
*/ */
private LocalDateTime birthday; private LocalDateTime birthday;
/** /**
* 性别 * 性别
*/ */
private Integer sex; private Integer sex;
/** /**
* 角色id * 角色id
*/ */
private String roleId; private String roleId;
/** /**
* 部门id * 部门id
*/ */
private String deptId; private String deptId;
} }

View File

@ -22,29 +22,33 @@ import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
/**
* 用户信息
*
* @author Chill
*/
@Data @Data
@ApiModel(description = "用户信息") @ApiModel(description = "用户信息")
public class UserInfo implements Serializable { public class UserInfo implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 用户基础信息 * 用户基础信息
*/ */
@ApiModelProperty(value = "用户") @ApiModelProperty(value = "用户")
private User user; private User user;
/** /**
* 权限标识集合 * 权限标识集合
*/ */
@ApiModelProperty(value = "权限集合") @ApiModelProperty(value = "权限集合")
private List<String> permissions; private List<String> permissions;
/** /**
* 角色集合 * 角色集合
*/ */
@ApiModelProperty(value = "角色集合") @ApiModelProperty(value = "角色集合")
private List<String> roles; private List<String> roles;
} }

View File

@ -24,21 +24,23 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
* Feign接口类 * User Feign接口类
* @author Chill
*/ */
@FeignClient( @FeignClient(
value = AppConstant.APPLICATION_USER_NAME value = AppConstant.APPLICATION_USER_NAME
) )
public interface IUserClient { public interface IUserClient {
String API_PREFIX = "/user"; String API_PREFIX = "/user";
/** /**
* 获取用户信息 * 获取用户信息
* @param account 账号 *
* @param password 密码 * @param account 账号
* @return * @param password 密码
*/ * @return
*/
@GetMapping(API_PREFIX + "/userInfo") @GetMapping(API_PREFIX + "/userInfo")
R<UserInfo> userInfo(@RequestParam("account") String account, @RequestParam("password") String password); R<UserInfo> userInfo(@RequestParam("account") String account, @RequestParam("password") String password);

View File

@ -21,15 +21,17 @@ import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
/** /**
* 首页 * Desk启动器
*
* @author Chill
*/ */
@SpringCloudApplication @SpringCloudApplication
@EnableFeignClients(AppConstant.BASE_PACKAGES) @EnableFeignClients(AppConstant.BASE_PACKAGES)
public class DeskApplication { public class DeskApplication {
public static void main(String[] args) { public static void main(String[] args) {
BladeApplication.run(AppConstant.APPLICATION_DESK_NAME, DeskApplication.class, args); BladeApplication.run(AppConstant.APPLICATION_DESK_NAME, DeskApplication.class, args);
} }
} }

View File

@ -25,17 +25,22 @@ import springfox.documentation.annotations.ApiIgnore;
import java.util.List; import java.util.List;
/**
* Notice Feign
*
* @author Chill
*/
@ApiIgnore() @ApiIgnore()
@RestController @RestController
@AllArgsConstructor @AllArgsConstructor
public class NoticeClient implements INoticeClient { public class NoticeClient implements INoticeClient {
NoticeMapper mapper; NoticeMapper mapper;
@Override @Override
@GetMapping(API_PREFIX + "/top") @GetMapping(API_PREFIX + "/top")
public R<List<Notice>> top(Integer number) { public R<List<Notice>> top(Integer number) {
return R.data(mapper.topList(number)); return R.data(mapper.topList(number));
} }
} }

View File

@ -22,15 +22,15 @@ import org.springblade.desk.entity.Notice;
import java.util.List; import java.util.List;
/** /**
* Mapper 接口 * Mapper 接口
* *
* @author Chill * @author Chill
* @since 2018-09-29 * @since 2018-09-29
*/ */
public interface NoticeMapper extends BaseMapper<Notice> { public interface NoticeMapper extends BaseMapper<Notice> {
List<Notice> topList(Integer number); List<Notice> topList(Integer number);
List<Notice> selectNoticePage(IPage page, Notice notice); List<Notice> selectNoticePage(IPage page, Notice notice);
} }

View File

@ -20,7 +20,7 @@ import org.springblade.core.mp.base.BaseService;
import org.springblade.desk.entity.Notice; import org.springblade.desk.entity.Notice;
/** /**
* 服务类 * 服务类
* *
* @author Chill * @author Chill
* @since 2018-09-29 * @since 2018-09-29

View File

@ -23,7 +23,7 @@ import org.springblade.desk.service.INoticeService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* 服务实现类 * 服务实现类
* *
* @author Chill * @author Chill
* @since 2018-09-29 * @since 2018-09-29
@ -31,9 +31,9 @@ import org.springframework.stereotype.Service;
@Service @Service
public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, Notice> implements INoticeService { public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, Notice> implements INoticeService {
@Override @Override
public IPage<Notice> selectNoticePage(IPage<Notice> page, Notice notice) { public IPage<Notice> selectNoticePage(IPage<Notice> page, Notice notice) {
return page.setRecords(baseMapper.selectNoticePage(page, notice)); return page.setRecords(baseMapper.selectNoticePage(page, notice));
} }
} }

View File

@ -19,7 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.log.model.LogApi; import org.springblade.core.log.model.LogApi;
/** /**
* 服务类 * 服务类
* *
* @author Chill * @author Chill
* @since 2018-09-26 * @since 2018-09-26

View File

@ -19,7 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.log.model.LogError; import org.springblade.core.log.model.LogError;
/** /**
* 服务类 * 服务类
* *
* @author Chill * @author Chill
* @since 2018-09-26 * @since 2018-09-26

View File

@ -19,7 +19,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.core.log.model.LogUsual; import org.springblade.core.log.model.LogUsual;
/** /**
* 服务类 * 服务类
* *
* @author Chill * @author Chill
* @since 2018-10-12 * @since 2018-10-12

View File

@ -22,7 +22,7 @@ import org.springblade.core.log.service.ILogApiService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* 服务实现类 * 服务实现类
* *
* @author Chill * @author Chill
*/ */

View File

@ -22,7 +22,7 @@ import org.springblade.core.log.service.ILogErrorService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* 服务实现类 * 服务实现类
* *
* @author Chill * @author Chill
* @since 2018-09-26 * @since 2018-09-26

View File

@ -22,7 +22,7 @@ import org.springblade.core.log.service.ILogUsualService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
* 服务实现类 * 服务实现类
* *
* @author Chill * @author Chill
* @since 2018-10-12 * @since 2018-10-12

View File

@ -66,9 +66,9 @@ public class CodeController extends BladeController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="codeName", value = "模块名", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "codeName", value = "模块名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name="tableName", value = "表名", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "tableName", value = "表名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name="modelName", value = "实体名", paramType = "query", dataType = "string") @ApiImplicitParam(name = "modelName", value = "实体名", paramType = "query", dataType = "string")
}) })
@ApiOperation(value = "分页", notes = "传入code", position = 2) @ApiOperation(value = "分页", notes = "传入code", position = 2)
public R<IPage<CodeVO>> list(@ApiIgnore @RequestParam Map<String, Object> code, Query query) { public R<IPage<CodeVO>> list(@ApiIgnore @RequestParam Map<String, Object> code, Query query) {

View File

@ -63,8 +63,8 @@ public class DictController extends BladeController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="code", value = "字典编号", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
@ApiImplicitParam(name="dictValue", value = "字典名称", paramType = "query", dataType = "string") @ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
}) })
@ApiOperation(value = "列表", notes = "传入dict", position = 2) @ApiOperation(value = "列表", notes = "传入dict", position = 2)
public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dict) { public R<List<INode>> list(@ApiIgnore @RequestParam Map<String, Object> dict) {

View File

@ -66,9 +66,9 @@ public class ParamController extends BladeController {
*/ */
@GetMapping("/list") @GetMapping("/list")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name="paramName", value = "参数名称", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "paramName", value = "参数名称", paramType = "query", dataType = "string"),
@ApiImplicitParam(name="paramKey", value = "参数键名", paramType = "query", dataType = "string"), @ApiImplicitParam(name = "paramKey", value = "参数键名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name="paramValue", value = "参数键值", paramType = "query", dataType = "string") @ApiImplicitParam(name = "paramValue", value = "参数键值", paramType = "query", dataType = "string")
}) })
@ApiOperation(value = "分页", notes = "传入param", position = 2) @ApiOperation(value = "分页", notes = "传入param", position = 2)
public R<IPage<ParamVO>> list(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<ParamVO>> list(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {

View File

@ -29,20 +29,13 @@ import org.springblade.system.vo.ParamVO;
* @since 2018-12-28 * @since 2018-12-28
*/ */
@AllArgsConstructor @AllArgsConstructor
public class ParamWrapper extends BaseEntityWrapper<Param, ParamVO> { public class ParamWrapper extends BaseEntityWrapper<Param, ParamVO> {
private IDictClient dictClient; private IDictClient dictClient;
@Override @Override
public ParamVO entityVO(Param param) { public ParamVO entityVO(Param param) {
ParamVO paramVO = BeanUtil.copy(param, ParamVO.class); ParamVO paramVO = BeanUtil.copy(param, ParamVO.class);
/*R<String> dict = dictClient.getValue("param" , paramVO.getCategory());
if (dict.isSuccess()) {
String categoryName = dict.getData();
paramVO.setCategoryName(categoryName);
}*/
return paramVO; return paramVO;
} }