Commit 9dd08c7f authored by 王淑君's avatar 王淑君

Merge branch 'dev' into 'master'

Dev

See merge request !8
parents cb560164 fec74ef2
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.rcisoft</groupId> <groupId>org.rcisoft</groupId>
<artifactId>projectArtifact</artifactId> <artifactId>91isoft_spbt_project</artifactId>
<version>2.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<description> education 2.0</description> <description> 91isoft_spbt_project </description>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
<dependency> <dependency>
<groupId>org.91isoft</groupId> <groupId>org.91isoft</groupId>
<artifactId>91isoft_spbt</artifactId> <artifactId>91isoft_spbt</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0.1-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>projectArtifacture</finalName> <finalName>91isoft_spbt_project</finalName>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
......
...@@ -3,9 +3,12 @@ ...@@ -3,9 +3,12 @@
`ssh://git@103.249.252.28:10022/wangshujun/91isoft_spbt_project.git` `ssh://git@103.249.252.28:10022/wangshujun/91isoft_spbt_project.git`
## 配置 settings.xml ## 配置 settings.xml
清空`<mirrors></mirrors> `
~~~ ~~~
<profile> <mirrors>
</mirrors>
<profiles>
<profile>
<id>nexus</id> <id>nexus</id>
<repositories> <repositories>
<repository> <repository>
...@@ -110,7 +113,7 @@ ...@@ -110,7 +113,7 @@
<dependency> <dependency>
<groupId>org.91isoft</groupId> <groupId>org.91isoft</groupId>
<artifactId>91isoft_spbt</artifactId> <artifactId>91isoft_spbt</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0.1-SNAPSHOT</version>
</dependency> </dependency>
</dependencies> </dependencies>
~~~ ~~~
...@@ -158,9 +161,8 @@ server: ...@@ -158,9 +161,8 @@ server:
port: 8084 port: 8084
~~~~ ~~~~
http://localhost:8084 访问 代码生成器,可以选择数据库信息 自动生成代码 http://localhost:8084 访问 代码生成器,可以选择数据库信息 自动生成代码
图片地址:
http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/8CE2352AE4BE4D9CBB13E891ABE8A63B.png
![swagger](http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/8CE2352AE4BE4D9CBB13E891ABE8A63B.png "代码生成器")
点击生成 就会自动下载,解压后将 点击生成 就会自动下载,解压后将
` org/rcisoft/business/`下 `bexception/mapper` 文件夹放在 ` org/rcisoft/business/`下 `bexception/mapper` 文件夹放在
...@@ -172,5 +174,135 @@ http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/8CE2352AE ...@@ -172,5 +174,135 @@ http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/8CE2352AE
### swaggerUI ### swaggerUI
http://localhost:8084/swagger-ui.html#/ 访问swaggerUI http://localhost:8084/swagger-ui.html#/ 访问swaggerUI
可以看到当前项目所有的接口详情 并测试接口 可以看到当前项目所有的接口详情 并测试接口
图片地址:
http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/95089C91B7B742B5A589156C456AFDDB.png ![swagger](http://learning.91isoft.com:18080/resourceServer/family/upload/mdfiles/95089C91B7B742B5A589156C456AFDDB.png "swagger")
## 91isoft_spbt
| 版本 | 组件 | 描述 | 维护人 |
| ------------ | ------------ | ------------ |------------ |
| v1.0 | lombok | 简化冗余代码,连通编辑器和构建工具 | cy |
| v1.0 | ssm | springmvc+spring+mybatis+mybatis扩展 | cy |
| v1.0 | springboot | 简化spring配置 | cy |
| v1.0 | springfox-swagger2 | 在线api | cy |
| v1.0 | logback | 日志 | cy |
| v1.0 | jwt | json web token 身份验证 | cy |
| v1.0 | spring-security | 安全性框架 | cy |
### 编码规范
| 版本 | 维护人员 | 维护时间 | 主要内容 |
| ------------ | ------------ | ------------ | ------------ |
| v1.0 | 李丛阳 | 2018-12-14 | 基础结构搭建 |
### 数据库设计规范
| 编号 | 类型 | 标题 | 描述 |
| ------------ | ------------ | ------------ | ------------ |
| 1 | 表 | 表名 | 小写,单词之间使用下划线 |
| 2 | 表 | 表名 | 中间表使用r_间隔 eg: b_r_teacher_course |
| 3 | 表 | 表结构 | 主表必须要有6+字段(创建时间,修改时间等),中间表不需要 |
| 4 | 列 | 列名 | 小写,单词之间使用下划线 |
| 5 | 列 | 列名 | 每一列必须要有备注 |
| 6 | 列 | 状态列 | char(1) 或 varchar(1),备注要描述清楚状态 |
### 微服务编码规范
| 编号 | 类型 | 标题 | 描述 |
| ------------ | ------------ | ------------ | ------------ |
| 0 | 结构 | 目录规范 | 详见 91isoft_spbt_project|
| 1 | 接口 | 提供其它服务调用的接口要标明 | 模块要单独提出一个controller,requestMappeing使用/api/ 开头|
| 2 | 接口 | 返回值 | Result / GridModel|
| 3 | 接口 | 使用restful风格 | get post pust delete,/id/ |
| 4 | 接口 | requestMappeing命名规范 | queryUsers, queryUserByPagination, detail/businessId, delete/businessId, add, update/businessId |
| 5 | 接口 | swagger | controller api docs |
| 6 | 结构 | service dao | 注释,尽量复用 |
| 7 | 结构 | tcc | 分布式事务书写规范 |
| 8 | 结构 | entity | @Entity @Data @NoArgsConstructor @AllArgsConstructor @Table |
### sql规范
~~~~
#!bin/bash
${basedir}/sql
-- db_init.sql
-- db_data.sql
-- db_clear.sql
-- date
-- db.bak.sql
-- db.alter.sql
~~~~
## 91isoft_spbt_project
| 版本 | 模块 | 描述 | 缺省 | 能否改变状态
| ------------ | ------------ | ------------ |------------ |
| v1.0 | pageUtil | 分页组件 | 开启 | 否 |
| v1.0 | quartz | 定时任务 | 关闭 | 是 |
| v1.0 | redis | 缓存 | 关闭 | 是 |
| v1.0 | ssl | https | 关闭 | 是 |
| v1.0 | decryptParam | 报文加密 | 关闭 | 是 |
| v1.0 | entityParam | 参数格式验证 | 开启 | 是 |
| v1.0 | swagger2 | 文档 | 开启 | 是 |
| v1.0 | multipleDs | 多数据源 | 关闭 | 是 |
| v1.0 | dbLod | 数据库日志 | 关闭 | 是 |
### pageUtil
1. 默认开启,不能关闭
2. service 下impl中` serviceImpl` 中要分页的方法的方法名以` ByPagination` 结尾,方法返回值为 `CyGridModel `
3. 用法模板:` public CyGridModel querySpaceListsByPagination(BSpace spaceList){
bSpaceServiceImpl.querySpaceListsByPagination(getPaginationUtility(),spaceList);
CyGridModel CyGridModel = getGridModelResponse();
return CyGridModel;
}`
### quartz
1. 定时任务 默认关闭 可以在`application-dev.yml`中配置参数`cy.model.quartz` 为true设为开启
### redis
1. 缓存机制 默认关闭 可以在`application-dev.yml`中配置`cy.model.redis` 为true设为开启
2. `application-dev.yml`中配置`spring.redis` 配置相关信息
3. 用法参考`org\rcisoft\core\service\impl\CyRedisServiceImpl.java`
### ssl
1. https请求 默认关闭
2. 开启方法:用Java自生成`.p12` 文件 添加在resource中,并在`application-dev.yml`中添加`server.ssl` 相关配置
### decryptParam
1. 报文加密 默认关闭 可以在`application-dev.yml`中配置`cy.model.decryptParam` 为true设为开启
2. 开启之后 前端需将参数和`global.decryptKey `的key值一起经过md5加密,形成sign 传到后端,
### entityParam
1. 参数格式验证 默认关闭 可以在`application-dev.yml`中配置`cy.model.entityParam` 为true设为开启
### swagger2
1. 文档测试工具 默认开启 可以在`application-dev.yml`中配置`cy.model.entityParam` 为false即为关闭
2. 启动项目之后再浏览器访问`http://localhost:8084/swagger-ui.html#/ `
### multipleDs
1. 多数据源 默认关闭 可以在`application-dev.yml`中配置`cy.model.multipleDs` true即为开启
2.`application-dev.yml`中修改`druid.power`` druid.pmiss` 以配置数据库相关信息
### dbLod
1. 日志存数据库 默认关闭
2.`resources\logback-spring.xml` 修改`<appender name="DBLog"></appender>`中的配置为自己数据库的信息即可
## seurity(权限)
#### `application-dev.yml`中`cy.model.security` 下相关配置
1. 目前是登陆后才可访问其他接口
2. 开启所有接口的直接访问:`cy.model.security.permitUnStatic` 下加` - "*/**" `即可
\ No newline at end of file
This diff is collapsed.
...@@ -2,136 +2,80 @@ package org.rcisoft.business.bspace.controller; ...@@ -2,136 +2,80 @@ package org.rcisoft.business.bspace.controller;
/*固定导入*/ /*固定导入*/
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.business.bspace.service.BSpaceService;
import org.rcisoft.config.CySecurityConfig;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.rcisoft.core.result.CyResult;
import org.rcisoft.core.util.CyResultGenUtil;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.exception.CyServiceException;
import javax.validation.Valid; import javax.validation.Valid;
import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.business.bspace.service.BSpaceService;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-6-21 17:10:54. * Created by cy on 2018-12-17 13:50:52.
*/ */
@RestController @RestController
@RequestMapping("bspace") @RequestMapping("/bspace")
@Slf4j
public class BSpaceController extends CyPaginationController<BSpace> { public class BSpaceController extends CyPaginationController<BSpace> {
@Autowired @Autowired
private BSpaceService bSpaceServiceImpl; private BSpaceService bSpaceServiceImpl;
@Autowired
private SysUserService userServiceImpl;
@Autowired
private CySecurityConfig cySecurityConfig;
@GetMapping(value = "/num")
@ApiOperation(value = "查看 集合 不分页", notes = "查看 集合")
public CyResult lists(BSpace bSpace) {
// return CyResultGenUtil.builder(new CyPersistModel(1),
// CyMessCons.MESSAGE_ALERT_SUCCESS,
// CyMessCons.MESSAGE_ALERT_ERROR,cySecurityConfig.httpStr());
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,bSpaceServiceImpl.listAllSpaces(bSpace));
}
/**
* 查询空间 分页
*
* @param spaceList
* @return
*/
@ApiOperation(value="分页查询空间", notes="分页查询空间")
@GetMapping(value = "/querySpaceListsByPagination")
public CyGridModel querySpaceListsByPagination(BSpace spaceList){
bSpaceServiceImpl.querySpaceListsByPagination(getPaginationUtility(),spaceList);
CyGridModel CyGridModel = getGridModelResponse();
return CyGridModel;
}
/**
* 增加/修改空间
*
* @param spaceList
* @return
*/
@ApiOperation(value = "增加/修改空间", notes = "增加/修改空间")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "spaceName", value = "空间名称", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "spaceId", value = "空间编号", required = true, dataType = "varchar")})
@PostMapping(value = "/spaceAdd")
public CyResult spaceAdd(BSpace spaceList) {
int line = bSpaceServiceImpl.persistSpaceList(spaceList,getToken());
return CyResultGenUtil.builder(new CyPersistModel(line),
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
spaceList);
}
/** @ApiOperation(value="添加", notes="添加")
* 通过businessId查询 //@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
* @param businessId @PostMapping(value = "/add")
* @return public CyResult add(@Valid BSpace bSpace, BindingResult bindingResult) {
*/ CyPersistModel data = bSpaceServiceImpl.save(bSpace);
@ApiOperation(value="根据Id查询数据", notes="根据Id查询数据") return CyResultGenUtil.builder(data,
@ApiImplicitParam(name = "businessId", value = "空间的businessId", required = true, dataType = "varchar")
@GetMapping(value = "/querySpaceListByBusinessId")
public CyResult querySpaceListByBusinessId(String businessId){
return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
bSpaceServiceImpl.querySpaceListByBusinessId(businessId)); bSpace);
} }
@ApiOperation(value="查询空间数", notes="查询空间数") @ApiOperation(value="逻辑删除", notes="逻辑删除")
@GetMapping(value = "/querySpaceNum") @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
public CyResult querySpaceNum(BSpace spaceList){ @DeleteMapping("/deleteLogical/{businessId:\\w+}")
return CyResultGenUtil.builder(new CyPersistModel(1), public CyResult deleteLogical(@PathVariable String businessId,BSpace bSpace) {
bSpace.setBusinessId(businessId);
CyPersistModel data = bSpaceServiceImpl.removeLogical(bSpace);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
bSpaceServiceImpl.querySpaceNum(spaceList)); businessId);
} }
@ApiOperation(value="删除", notes="删除")
@ApiOperation(value = "逻辑删除", notes = "逻辑删除") @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")}) @DeleteMapping("/delete/{businessId:\\w+}")
@PostMapping("/LogicalDelete") public CyResult delete(@PathVariable String businessId,BSpace bSpace) {
public CyResult delete(String businessId) { bSpace.setBusinessId(businessId);
BSpace bspqce = new BSpace(); CyPersistModel data = bSpaceServiceImpl.remove(bSpace);
bspqce.setBusinessId(businessId);
bspqce.setToken(getToken());
CyPersistModel data = bSpaceServiceImpl.remove(bspqce);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
businessId); businessId);
} }
@ApiOperation(value = "修改", notes = "修改") @ApiOperation(value="修改", notes="修改")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = false, dataType = "varchar")})
@PutMapping("/update/{id:\\w+}") @PutMapping("/update/{businessId:\\w+}")
public CyResult update(@Valid BSpace bSpace, BindingResult bindingCyResult) { public CyResult update(@PathVariable String businessId, @Valid BSpace bSpace, BindingResult bindingResult) {
bSpace.setToken(getToken()); bSpace.setBusinessId(businessId);
CyPersistModel data = bSpaceServiceImpl.merge(bSpace); CyPersistModel data = bSpaceServiceImpl.merge(bSpace);
return CyResultGenUtil.builder(data, return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
...@@ -139,28 +83,29 @@ public class BSpaceController extends CyPaginationController<BSpace> { ...@@ -139,28 +83,29 @@ public class BSpaceController extends CyPaginationController<BSpace> {
bSpace); bSpace);
} }
@ApiOperation(value = "查看单 ", notes = "查看单 ") @ApiOperation(value="查询单一", notes="查询单一")
@GetMapping("/detail/{id:\\w+}") @ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
public CyResult detail(@PathVariable String id) { @GetMapping("/detail/{businessId:\\w+}")
public CyResult detail(@PathVariable String businessId) {
return CyResultGenUtil.builder(new CyPersistModel(1), return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR, CyMessCons.MESSAGE_ALERT_ERROR,
bSpaceServiceImpl.findById(id)); bSpaceServiceImpl.findById(businessId));
} }
/** @ApiOperation(value="查询集合", notes="查询集合")
* @param bSpace @GetMapping(value = "/queryBSpaces")
* @return org.rcisoft.common.model.CyGridModel public CyResult queryBSpaces(BSpace bSpace) {
* @author ningxy
* @description 不分页查询空间
* @date 2018/7/20 下午1:35
*/
@ApiOperation(value = "查看 集合 不分页", notes = "查看 集合")
@GetMapping(value = "/queryBSpace")
public CyResult listAllSpaces(BSpace bSpace) {
return CyResultGenUtil.builder(new CyPersistModel(1), return CyResultGenUtil.builder(new CyPersistModel(1),
CyMessCons.MESSAGE_ALERT_SUCCESS, CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,bSpaceServiceImpl.listAllSpaces(bSpace)); CyMessCons.MESSAGE_ALERT_ERROR,
bSpaceServiceImpl.findAll(bSpace));
} }
@ApiOperation(value="分页查询集合", notes="分页查询集合")
@GetMapping(value = "/queryBSpaceByPagination")
public CyGridModel listByPagination(BSpace bSpace) {
bSpaceServiceImpl.findAllByPagination(getPaginationUtility(), bSpace);
return getGridModelResponse();
}
} }
package org.rcisoft.business.bspace.dao; package org.rcisoft.business.bspace.dao;
import org.rcisoft.core.base.CyBaseMapper;
import org.rcisoft.business.bspace.entity.BSpace; import org.rcisoft.business.bspace.entity.BSpace;
import org.apache.ibatis.annotations.ResultMap; import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.rcisoft.core.base.CyBaseMapper;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created with on 2018-6-21 17:10:54. * Created with cy on 2018-12-17 13:50:52.
*/ */
@Repository @Repository
public interface BSpaceRepository extends CyBaseMapper<BSpace> { public interface BSpaceRepository extends CyBaseMapper<BSpace> {
...@@ -21,84 +20,10 @@ public interface BSpaceRepository extends CyBaseMapper<BSpace> { ...@@ -21,84 +20,10 @@ public interface BSpaceRepository extends CyBaseMapper<BSpace> {
* *
*/ */
@Select("<script>select * from b_space where 1=1 " @Select("<script>select * from b_space where 1=1 "
+ "and del_flag = 0 " + "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "and flag = 1 " + "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "<if test=\"businessId !=null and businessId != '' \">and business_id = #{businessId} </if> "
+ "</script>") + "</script>")
@ResultMap(value = "BaseResultMap" ) @ResultMap(value = "BaseResultMap" )
List<BSpace> queryBSpaces(BSpace bSpace); List<BSpace> queryBSpaces(BSpace bSpace);
/**
* @param businessId
* @return
*/
@Select("select count(*) from b_space where del_flag = 0 and flag = 1 and business_id = #{businessId}")
int existSpace(String businessId);
/**
* 分页查询
* 分页增加
*
* */
@Select("<script>select * from b_space where flag = '1' and del_flag = '0' "
+ "and business_id = #{businessId}"
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> querySpaceListsByName(BSpace spaceList);
/**
* 通过businessId查询
* @param spaceId
* @return
*/
@Select("select * from b_space b where b.flag = '1' and b.del_flag = '0' and b.business_id=#{spaceId}")
@ResultMap(value = "BaseResultMap" )
BSpace querySpaceListByBusinessId(String spaceId);
/**
* spaceAdd 新增
* @param spaceList
* @return
*/
@Select("<script>select * from b_space where flag = '1' and del_flag = '0' "
+ "and space_id = #{spaceId} "
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> querySpaceListsByCodeOrName(BSpace spaceList);
/**
* 分页查询 bSpaceCategory
*查询空间列表 不分页
*/
@Select("<script>select * from b_space where "
+ " del_flag = 0 and flag = 1 </script>")
@ResultMap(value = "BaseResultMap" )
List<BSpace> queryBSpaceCategorys(BSpace spaceList);
@Select("<script> SELECT " +
"bs.space_name as spaceName, bs.space_id as spaceId, " +
"DATE_FORMAT( bs.create_date, '%Y-%m-%d' ) AS date " +
"FROM " +
"b_space bs " +
"WHERE " +
"1 = 1 " +
"AND bs.create_date BETWEEN '2018-7-28' " +
"AND '2018-8-28' " +
"GROUP BY " +
"bs.business_id, " +
"date " +
"</script>")
List<Map<String, Object>> queryAllSpacesByTime(String beginTime, String endTime);
/**
* 查询空间数
* @param spaceList
* @return
*/
@Select("select count(*) as spaceNum from b_space bs where bs.del_flag = 0 and bs.flag = 1")
List<BSpace> querySpaceNum(BSpace spaceList);
} }
...@@ -2,36 +2,47 @@ package org.rcisoft.business.bspace.entity; ...@@ -2,36 +2,47 @@ package org.rcisoft.business.bspace.entity;
import lombok.*; import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.CyIdEntity; import org.rcisoft.core.entity.CyIdEntity;
import org.springframework.data.annotation.Transient;
import javax.persistence.*; import javax.persistence.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/** /**
* Created with on 2018-6-21 17:10:54. * Created with cy on 2018-12-17 13:50:51.
*/ */
@Entity
@Data @Data
@Table(name = "b_space")
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Table(name = "b_space")
public class BSpace extends CyIdEntity<BSpace> { public class BSpace extends CyIdEntity<BSpace> {
private static final long serialVersionUID = -2165299707591725301L;
@Length(min=1,max=64,message="长度最小为1,最大为50")
@NotBlank
private String spaceName;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50")
@NotBlank /**
* @desc 空间编号
* @column space_id
* @default
*/
private String spaceId; private String spaceId;
@Length(min = 1,max = 64,message = "长度最小为1,最大为50") /**
@NotBlank * @desc 空间名
* @column space_name
* @default
*/
private String spaceName;
/**
* @desc 域名
* @column realm_name
* @default
*/
private String realmName; private String realmName;
@Transient
private String spaceNum;
} }
package org.rcisoft.business.bspace.service; package org.rcisoft.business.bspace.service;
import org.rcisoft.business.bspace.entity.BSpace; import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.aop.CyPageUtil;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* Created by on 2018-6-21 17:10:54. * Created by cy on 2018-12-17 13:50:52.
*/ */
public interface BSpaceService { public interface BSpaceService {
/** /**
* 保存 * 保存
*
* @param bSpace * @param bSpace
* @return * @return
*/ */
CyPersistModel save(BSpace bSpace); CyPersistModel save(BSpace bSpace);
/** /**
* 逻辑删除 * 删除
*
* @param bSpace * @param bSpace
* @return * @return
*/ */
CyPersistModel remove(BSpace bSpace); CyPersistModel remove(BSpace bSpace);
/**
* 逻辑删除
* @param bSpace
* @return
*/
CyPersistModel removeLogical(BSpace bSpace);
/** /**
* 修改 * 修改
*
* @param bSpace * @param bSpace
* @return * @return
*/ */
...@@ -39,7 +41,6 @@ public interface BSpaceService { ...@@ -39,7 +41,6 @@ public interface BSpaceService {
/** /**
* 根据id查询 * 根据id查询
*
* @param id * @param id
* @return * @return
*/ */
...@@ -47,45 +48,18 @@ public interface BSpaceService { ...@@ -47,45 +48,18 @@ public interface BSpaceService {
/** /**
* 分页查询 * 分页查询
*
* @param bSpace * @param bSpace
* @return * @return
*/ */
List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility, BSpace bSpace); List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility,
/** BSpace bSpace);
* @param bSpace
* @return java.util.List<org.rcisoft.business.bspace.entity.BSpace>
* @author ningxy
* @description 不分页查询所有空间
* @date 2018/7/20 下午1:36
*/
List<BSpace> listAllSpaces(BSpace bSpace);
/**
* 增加/修改
* @param spaceList
* @param token
* @return
*/
int persistSpaceList(BSpace spaceList, String token);
/** /**
* 通过businessId查询 * 查询list
* @param businessId * @param bSpace
* @return * @return
*/ */
BSpace querySpaceListByBusinessId(String businessId); List<BSpace> findAll(BSpace bSpace);
/**
* 查询 分页
* 查询所有角色,不分页
*/
List<BSpace> querySpaceListsByPagination(CyPageUtil<BSpace> paginationUtility, BSpace spaceList);
/**
* 查询空间数
* @param spaceList
* @return
*/
List<BSpace> querySpaceNum(BSpace spaceList);
} }
package org.rcisoft.business.bspace.service.impl; package org.rcisoft.business.bspace.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.result.CyResultServiceExceptionEnums;
import org.rcisoft.core.util.CyUserUtil; import org.rcisoft.core.util.CyUserUtil;
import org.rcisoft.core.aop.CyPageUtil;
import org.rcisoft.core.model.CyPersistModel; import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.business.bspace.dao.BSpaceRepository; import org.rcisoft.business.bspace.dao.BSpaceRepository;
import org.rcisoft.business.bspace.entity.BSpace; import org.rcisoft.business.bspace.entity.BSpace;
import org.rcisoft.business.bspace.service.BSpaceService; import org.rcisoft.business.bspace.service.BSpaceService;
import org.rcisoft.core.service.CyBaseService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
/** /**
* Created by on 2018-6-21 17:10:54. * Created by cy on 2018-12-17 13:50:52.
*/ */
@Service @Service
@Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED) @Transactional(readOnly = true,propagation = Propagation.NOT_SUPPORTED)
@Slf4j @Slf4j
@ConfigurationProperties(prefix = "cy.model.security", ignoreUnknownFields = true,ignoreInvalidFields = true) public class BSpaceServiceImpl extends CyBaseService implements BSpaceService {
public class BSpaceServiceImpl implements BSpaceService {
private static final long serialVersionUID = -3485875433825192456L;
@Autowired @Autowired
private BSpaceRepository bSpaceRepository; private BSpaceRepository bSpaceRepository;
/** /**
* 保存 bSpace * 保存
* @param bSpace * @param bSpace
* @return * @return
*/ */
...@@ -45,29 +42,45 @@ public class BSpaceServiceImpl implements BSpaceService { ...@@ -45,29 +42,45 @@ public class BSpaceServiceImpl implements BSpaceService {
//增加操作 //增加操作
CyUserUtil.setCurrentPersistOperation(bSpace); CyUserUtil.setCurrentPersistOperation(bSpace);
int line = bSpaceRepository.insertSelective(bSpace); int line = bSpaceRepository.insertSelective(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"新增了ID为"+ this.dbInfo(CyUserUtil.getAuthenUsername() + "新增了ID为"+bSpace.getBusinessId()+"的信息","新增");
log.info(CyUserUtil.getAuthenUsername()+"新增了ID为"+
bSpace.getBusinessId()+"的信息"); bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 逻辑删除 * 删除
* @param bSpace * @param bSpace
* @return * @return
*/ */
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public CyPersistModel remove(BSpace bSpace){ public CyPersistModel remove(BSpace bSpace){
int line = bSpaceRepository.deleteByPrimaryKey(bSpace.getBusinessId());
this.dbInfo(CyUserUtil.getAuthenUsername()+"删除了ID为"+bSpace.getBusinessId()+"的信息","删除");
log.info(CyUserUtil.getAuthenUsername()+"删除了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line);
}
/**
* 逻辑删除
* @param bSpace
* @return
*/
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public CyPersistModel removeLogical(BSpace bSpace){
CyUserUtil.setCurrentMergeOperation(bSpace); CyUserUtil.setCurrentMergeOperation(bSpace);
bSpace.setDeleted(); bSpace.setDeleted();
int line = bSpaceRepository.logicalDelete(bSpace); int line = bSpaceRepository.logicalDelete(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"逻辑删除了ID为"+ this.dbInfo(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+bSpace.getBusinessId()+"的信息","逻辑删除");
bSpace.getBusinessId()+"的信息"); log.info(CyUserUtil.getAuthenUsername()+"逻辑删除了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 修改 bSpace * 修改
* @param bSpace * @param bSpace
* @return * @return
*/ */
...@@ -76,13 +89,13 @@ public class BSpaceServiceImpl implements BSpaceService { ...@@ -76,13 +89,13 @@ public class BSpaceServiceImpl implements BSpaceService {
public CyPersistModel merge(BSpace bSpace){ public CyPersistModel merge(BSpace bSpace){
CyUserUtil.setCurrentMergeOperation(bSpace); CyUserUtil.setCurrentMergeOperation(bSpace);
int line = bSpaceRepository.updateByPrimaryKeySelective(bSpace); int line = bSpaceRepository.updateByPrimaryKeySelective(bSpace);
log.info(CyUserUtil.getUserInfoProp(bSpace.getToken(),CyUserUtil.USER_USERNAME)+"修改了ID为"+ this.dbInfo(CyUserUtil.getAuthenUsername()+"修改了ID为"+bSpace.getBusinessId()+"的信息","修改");
bSpace.getBusinessId()+"的信息"); log.info(CyUserUtil.getAuthenUsername()+"修改了ID为"+bSpace.getBusinessId()+"的信息");
return new CyPersistModel(line); return new CyPersistModel(line);
} }
/** /**
* 根据id查询 bSpace * 根据id查询
* @param id * @param id
* @return * @return
*/ */
...@@ -92,101 +105,25 @@ public class BSpaceServiceImpl implements BSpaceService { ...@@ -92,101 +105,25 @@ public class BSpaceServiceImpl implements BSpaceService {
} }
/** /**
* 分页查询 bSpace * 分页查询
* @param bSpace * @param bSpace
* @return * @return
*/ */
@Override @Override
public List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility, public List<BSpace> findAllByPagination(CyPageUtil<BSpace> paginationUtility,
BSpace bSpace){ BSpace bSpace){
bSpace.setStart(); bSpace.setNormal();
bSpace.setNotDeleted();
return bSpaceRepository.queryBSpaces(bSpace); return bSpaceRepository.queryBSpaces(bSpace);
} }
/** /**
* 查询list
* @param bSpace * @param bSpace
* @return java.util.List<org.rcisoft.business.bspace.entity.BSpace>
* @author ningxy
* @description 不分页查询所有空间
* @date 2018/7/20 下午1:36
*/
@Override
public List<BSpace> listAllSpaces(BSpace bSpace) {
return bSpaceRepository.queryBSpaces(bSpace);
}
/**
* 增加
*
* */
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public int persistSpaceList(BSpace spaceList, String token ) {
int line;
int line2=0;
int result = 0;
if(StringUtils.isNotBlank(spaceList.getBusinessId())){//修改
List<BSpace> spaceLists = bSpaceRepository.querySpaceListsByName(spaceList);
if(spaceLists.size() == 0){
throw new CyServiceException(CyResultServiceExceptionEnums.USER_EXISTS);
}
// Example example = new Example(BCategory.class);
// example.createCriteria().andEqualTo("spaceId",spaceList.getBusinessId());
// BCategory bcategory = new BCategory();
CyUserUtil.setCurrentMergeOperation(spaceList);
// bcategory.setCategoryName(spaceList.getSpaceName());
// bcategory.setSpaceId(spaceList.getBusinessId());
line = bSpaceRepository.updateByPrimaryKeySelective(spaceList);
// line2 = bCategoryRepository.updateByExampleSelective(bcategory,example);
}else{//增加
List<BSpace> spaceLists = bSpaceRepository.querySpaceListsByCodeOrName(spaceList);
if(spaceLists.size()>0){
throw new CyServiceException(CyResultServiceExceptionEnums.USER_EXISTS);
}
// BCategory bcategory = new BCategory();
// CyUserUtil.setCurrentPersistOperation(spaceList);
// CyUserUtil.setCurrentPersistOperation(bcategory);
// bcategory.setSpaceId(spaceList.getBusinessId());
// bcategory.setCategoryName(spaceList.getSpaceName());
// bcategory.setPid(0);
line = bSpaceRepository.insertSelective(spaceList);
// line2 = bCategoryRepository.insertSelective(bcategory);
}
// if(line == line2){
// result = line;
// }
return line;
}
/**
* 通过businessId查询
* @param businessId
* @return
*/
@Override
public BSpace querySpaceListByBusinessId(String businessId) {
return bSpaceRepository.querySpaceListByBusinessId(businessId);
}
@Override
public List<BSpace> querySpaceListsByPagination(CyPageUtil<BSpace> paginationUtility, BSpace spaceList) {
return bSpaceRepository.queryBSpaceCategorys(spaceList);
}
/**
* 查询空间数
* @param spaceList
* @return * @return
*/ */
@Override @Override
public List<BSpace> querySpaceNum(BSpace spaceList) { public List<BSpace> findAll(BSpace bSpace){
return bSpaceRepository.querySpaceNum(spaceList); bSpace.setNormal();
return bSpaceRepository.queryBSpaces(bSpace);
} }
} }
...@@ -16,7 +16,7 @@ server: ...@@ -16,7 +16,7 @@ server:
# org.springframework.web: DEBUG # org.springframework.web: DEBUG
druid: druid:
url: jdbc:mysql://127.0.0.1:3306/mall2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true url: jdbc:mysql://127.0.0.1:3306/mall4?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username: root username: root
password: 123456 password: 123456
initial-size: 1 initial-size: 1
...@@ -24,24 +24,24 @@ druid: ...@@ -24,24 +24,24 @@ druid:
max-active: 20 max-active: 20
test-on-borrow: true test-on-borrow: true
power: # power:
url: jdbc:mysql://127.0.0.1:3306/power?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true # url: jdbc:mysql://127.0.0.1:3306/power?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username: root # username: root
password: 123456 # password: 123456
initial-size: 1 # initial-size: 1
min-idle: 1 # min-idle: 1
max-active: 20 # max-active: 20
test-on-borrow: true # test-on-borrow: true
driverClass: com.mysql.jdbc.Driver # driverClass: com.mysql.jdbc.Driver
pmiss: # pmiss:
url: jdbc:mysql://127.0.0.1:3306/mall2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true # url: jdbc:mysql://127.0.0.1:3306/mall2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
username: root # username: root
password: 123456 # password: 123456
initial-size: 1 # initial-size: 1
min-idle: 1 # min-idle: 1
max-active: 20 # max-active: 20
test-on-borrow: true # test-on-borrow: true
driverClass: com.mysql.jdbc.Driver # driverClass: com.mysql.jdbc.Driver
mybatis: mybatis:
...@@ -80,17 +80,17 @@ spring: ...@@ -80,17 +80,17 @@ spring:
charset: UTF-8 charset: UTF-8
suffix: .ftl suffix: .ftl
template-loader-path: classpath:/templates/ template-loader-path: classpath:/templates/
redis: # redis:
host: 127.0.0.1 # host: 127.0.0.1
port: 6379 # port: 6379
pool: # pool:
max-idle: 50 # max-idle: 50
max-active: 1000 # max-active: 1000
min-idle: 5 # min-idle: 5
max-wait: -1 # max-wait: -1
database: 0 # database: 0
password: 123456 # password: 123456
timeout: 3600 # timeout: 3600
springfox: springfox:
documentation: documentation:
swagger: swagger:
...@@ -116,7 +116,7 @@ cy: ...@@ -116,7 +116,7 @@ cy:
multipleDs: false multipleDs: false
quartz: false quartz: false
redis: false redis: false
entityParam: false entityParam: true
decryptParam: false decryptParam: false
swagger2Config: true swagger2Config: true
security: security:
...@@ -131,7 +131,7 @@ cy: ...@@ -131,7 +131,7 @@ cy:
- "/code/**/**" - "/code/**/**"
- "/excelUtil/**" - "/excelUtil/**"
- "/cros/**" - "/cros/**"
- "/bspace/*" # - "*/**"
permitStatic: ["/", "/*.html", "/favicon.ico", "/**/*.html", "/**/*.js", "/**/*.css"] permitStatic: ["/", "/*.html", "/favicon.ico", "/**/*.html", "/**/*.js", "/**/*.css"]
logoutSuccessUrl: "/login" logoutSuccessUrl: "/login"
loginPage: "/login" loginPage: "/login"
......
...@@ -54,9 +54,9 @@ ...@@ -54,9 +54,9 @@
<connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource"> <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource">
<dataSource class="org.apache.tomcat.jdbc.pool.DataSource"> <dataSource class="org.apache.tomcat.jdbc.pool.DataSource">
<driverClassName class="com.mysql.jdbc.Driver" /> <driverClassName class="com.mysql.jdbc.Driver" />
<url>jdbc:mysql://127.0.0.1:3306/family?characterEncoding=UTF-8</url> <url>jdbc:mysql://127.0.0.1:3306/mall3?characterEncoding=UTF-8</url>
<username>root</username> <username>root</username>
<password>cy</password> <password>123456</password>
</dataSource> </dataSource>
</connectionSource> </connectionSource>
...@@ -81,13 +81,11 @@ ...@@ -81,13 +81,11 @@
</appender> </appender>
<!-- 用户操作日志logger --> <!-- 用户操作日志logger -->
<logger name="DBLog" level="INFO" > <!--<logger name="DBLog" level="INFO" >-->
<appender-ref ref="DBLog"/> <!--<appender-ref ref="DBLog"/>-->
</logger> <!--</logger>-->
<!-- <!--指定对应包名 -->
指定对应包名
-->
<logger name="com.minlia" level="DEBUG"/> <logger name="com.minlia" level="DEBUG"/>
<logger name="org.springframework.data.mybatis" level="DEBUG"/> <logger name="org.springframework.data.mybatis" level="DEBUG"/>
<logger name="org.springframework.aop.aspectj" level="ERROR"/> <logger name="org.springframework.aop.aspectj" level="ERROR"/>
......
<?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.rcisoft.business.bspace.dao.BSpaceRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bspace.entity.BSpace">
<id column="business_id" jdbcType="VARCHAR" property="businessId" />
<result column="space_name" jdbcType="VARCHAR" property="spaceName" />
<result column="space_id" jdbcType="VARCHAR" property="spaceId" />
<result column="CREATE_BY" property="createBy" jdbcType="VARCHAR" />
<result column="FLAG" property="flag" jdbcType="VARCHAR" />
<result column="REMARKS" property="remarks" jdbcType="VARCHAR" />
<result column="UPDATE_BY" property="updateBy" jdbcType="VARCHAR" />
<result column="DEL_FLAG" property="delFlag" jdbcType="VARCHAR" />
<result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="realm_name" property="realmName" jdbcType="VARCHAR" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.rcisoft.business.bspace.dao.BSpaceRepository">
<resultMap id="BaseResultMap" type="org.rcisoft.business.bspace.entity.BSpace">
<id column="business_id" jdbcType="VARCHAR" property="businessId"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_date" jdbcType="TIMESTAMP" property="createDate"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_date" jdbcType="TIMESTAMP" property="updateDate"/>
<result column="del_flag" jdbcType="VARCHAR" property="delFlag"/>
<result column="flag" jdbcType="VARCHAR" property="flag"/>
<result column="remarks" jdbcType="VARCHAR" property="remarks"/>
<result column="space_id" jdbcType="VARCHAR" property="spaceId"/>
<result column="space_name" jdbcType="VARCHAR" property="spaceName"/>
<result column="realm_name" jdbcType="VARCHAR" property="realmName"/>
</resultMap>
<!--<cache type="${corePackag!}.util.RedisCache"/>-->
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment