前后端分目录

This commit is contained in:
andywang
2022-07-14 12:55:31 +08:00
parent cd72c43d62
commit bb8cf90f53
1155 changed files with 47237 additions and 14446 deletions

14
ddp/.gitignore vendored Normal file
View File

@@ -0,0 +1,14 @@
.DS_Store
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.idea
.Archive/
.vscode/
dist
*.log
target/
*.iml
apidoc/
logs/

0
ddp/README.md Normal file
View File

21
ddp/ddp-analysis/pom.xml Normal file
View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ddp</artifactId>
<groupId>com.fibo.ddp</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ddp-analysis</artifactId>
<dependencies>
<dependency>
<groupId>com.fibo.ddp</groupId>
<artifactId>ddp-common-service</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,64 @@
package com.fibo.ddp.analysis.controller;
import com.fibo.ddp.common.model.analyse.vo.AnalyseData;
import com.fibo.ddp.common.model.analyse.vo.AnalyseEngineSummaryVo;
import com.fibo.ddp.common.model.analyse.vo.AnalyseRequestParam;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.service.analyse.AnalyseEngineSummaryService;
import com.fibo.ddp.common.service.analyse.AnalyseService;
import com.fibo.ddp.common.service.analyse.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
@RestController
@RequestMapping("v3/analyse")
public class AnalyseController {
@Autowired
private AnalyseService analyseService;
@Resource
@Qualifier("analyseChartStatisticServiceImpl")
private StatisticsService statisticsService;
@Autowired
private AnalyseEngineSummaryService analyseEngineSummaryService;
/**
* 分析中心-下方图表数据
* @param param
* @return
*/
@PostMapping("/getData")
public ResponseEntityDto getAnalyseData(@RequestBody AnalyseRequestParam param){
AnalyseData analyseData = analyseService.getAnalyseData(param);
return ResponseEntityBuilder.buildNormalResponse(analyseData);
}
/**
* 分析中心-引擎概况数据
* @param param
* @return
*/
@PostMapping("/getEngineSummary")
public ResponseEntityDto getEngineSummary(@RequestBody AnalyseRequestParam param){
Map<String, AnalyseEngineSummaryVo> analyseData = analyseEngineSummaryService.getAnalyseData(param);
return ResponseEntityBuilder.buildNormalResponse(analyseData);
}
/**
* 分析中心- 监控数据统计分析后入库
* @return
*/
@PostMapping("/decision")
public ResponseEntityDto decision(){
statisticsService.statisticData();
return ResponseEntityBuilder.buildNormalResponse();
}
}

22
ddp/ddp-authx/pom.xml Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ddp</artifactId>
<groupId>com.fibo.ddp</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ddp-authx</artifactId>
<dependencies>
<dependency>
<groupId>com.fibo.ddp</groupId>
<artifactId>ddp-common-service</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,71 @@
package com.fibo.ddp.authx.dictionary.controller;
import com.fibo.ddp.common.model.authx.dictionary.Dictionary;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.model.common.requestParam.QueryListParam;
import com.fibo.ddp.common.service.authx.dictionary.DictionaryService;
import com.fibo.ddp.common.utils.exception.ApiException;
import com.github.pagehelper.PageInfo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* (Dictionary)表控制层
*
* @author jgp
* @since 2021-12-15 15:08:06
*/
@RestController
@RequestMapping("/dictionary")
public class DictionaryController {
/**
* 服务对象
*/
@Resource
private DictionaryService dictionaryService;
@PostMapping("/getByKey")
public ResponseEntityDto<Dictionary> getByKey (@RequestBody Dictionary param){
Dictionary dictionary = dictionaryService.queryByKey(param.getDictKey());
return ResponseEntityBuilder.buildNormalResponse(dictionary);
}
@PostMapping("/getList")
public ResponseEntityDto<PageInfo> getList (@RequestBody QueryListParam<Dictionary> param){
PageInfo pageInfo = dictionaryService.queryList(param);
return ResponseEntityBuilder.buildNormalResponse(pageInfo);
}
@PostMapping("/addBatch")
public ResponseEntityDto addBatch (@RequestBody Collection<Dictionary> param){
boolean result = dictionaryService.saveBatchDictionary(param);
return ResponseEntityBuilder.buildNormalResponse(result);
}
@PostMapping("/updateById")
public ResponseEntityDto updateById (Dictionary param){
boolean result = dictionaryService.update(param);
return ResponseEntityBuilder.buildNormalResponse(result);
}
@PostMapping("/deleteByIds")
public ResponseEntityDto deleteByIds (@RequestBody List<Long> ids){
if (CollectionUtils.isEmpty(ids)){
throw new ApiException(ErrorCodeEnum.PARAMS_EXCEPTION.getCode(),"删除字典表id不能为空");
}
boolean result = dictionaryService.deleteByIds(ids);
return ResponseEntityBuilder.buildNormalResponse(result);
}
@PostMapping("/refreshCache")
public ResponseEntityDto refreshCache (){
Map<String, Dictionary> result = dictionaryService.refreshCache();
return ResponseEntityBuilder.buildNormalResponse(result);
}
}

View File

@@ -0,0 +1,5 @@
package com.fibo.ddp.authx.system.business;
public class LoginBusiness {
}

View File

@@ -0,0 +1,101 @@
package com.fibo.ddp.authx.system.controller;
import com.alibaba.fastjson.JSONObject;
import com.fibo.ddp.common.model.authx.system.SysUser;
import com.fibo.ddp.common.model.authx.system.request.LoginInfoParam;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.service.authx.system.SysUserService;
import com.fibo.ddp.common.service.common.AccountSessionWrap;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.monitor.logger.ArchivesLog;
import com.fibo.ddp.common.service.redis.RedisManager;
import com.fibo.ddp.common.utils.common.MD5;
import com.fibo.ddp.common.utils.constant.Constants;
import com.fibo.ddp.common.utils.constant.OpTypeConst;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* @apiDefine account 1. 账户
*/
@Controller("loginControllerV2")
@RequestMapping("/v2/login/*")
public class LoginController {
@Autowired
private RedisManager redisManager;
@Autowired
private SysUserService sysUserService;
/**
* @api {POST} /v2/login/login 1.01. 用户登录
* @apiGroup account
* @apiVersion 1.0.1
* @apiParam {String} account 账号
* @apiParam {String} password 密码
* @apiSuccess {String} token 会话token
* @apiParamExample {json} Request:
* {"account":"admin","password":"123456"}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"token":"21fd6379df134ea590a462e4de1f6b33"}}
*/
@ResponseBody
@RequestMapping(value = "/login")
@ArchivesLog(operationType = OpTypeConst.LOGIN)
public ResponseEntityDto<Object> login(@RequestBody LoginInfoParam param) {
Map<String, Object> map = new HashMap<>();
String account = param.getAccount();
String password = param.getPassword();
if(!("".equals(account)) && !("".equals(password))){
SysUser user = sysUserService.login(account.trim(), MD5.GetMD5Code(password));
if(null != user && user.getStatus()==1){
String token = UUID.randomUUID().toString().replaceAll("-", "");
redisManager.set(token, JSONObject.toJSONString(user), Constants.LOGIN_TOKEN_TIME.intValue());
map.put("token", token);
com.fibo.ddp.common.service.common.AccountSessionWrap acsw = new AccountSessionWrap(null, null);
acsw.setSysUser(user);
SessionManager.setSession(acsw);
}else{
return ResponseEntityBuilder.buildErrorResponse(ErrorCodeEnum.LOGIN_ERROR);
}
}
return ResponseEntityBuilder.buildNormalResponse(map);
}
/**
* @api {POST} /v2/login/logout 1.02. 用户登出
* @apiGroup account
* @apiVersion 1.0.1
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} Request:
* {}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":null}
*/
@ResponseBody
@RequestMapping(value = "logout", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.LOGOUT)
public ResponseEntityDto<Object> logout(HttpServletRequest request) {
String token = request.getHeader(Constants.SYSTEM_KEY_TOKEN);
if(StringUtils.isNotBlank(token)){
redisManager.del(token);
}
return ResponseEntityBuilder.buildNormalResponse();
}
}

View File

@@ -0,0 +1,386 @@
package com.fibo.ddp.authx.system.controller;
import com.fibo.ddp.common.model.authx.system.SysMenu;
import com.fibo.ddp.common.model.authx.system.SysUser;
import com.fibo.ddp.common.model.authx.system.request.MenuParam;
import com.fibo.ddp.common.model.authx.system.response.SysMenuVo;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.service.authx.system.SysMenuService;
import com.fibo.ddp.common.service.authx.system.SysUserService;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.monitor.logger.ArchivesLog;
import com.fibo.ddp.common.utils.constant.OpTypeConst;
import com.fibo.ddp.common.utils.exception.ApiException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Controller("sysMenuControllerV2")
@RequestMapping("v2/sysMenu")
@ResponseBody
public class SysMenuController {
@Autowired
private SysMenuService sysMenuService;
@Autowired
private SysUserService sysUserService;
/**
* @api {POST} /v2/sysMenu/getMenuList 6.31. 获取资源列表
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} pageNo 页数
* @apiParam {Integer} pageSize 每页的条数
* @apiSuccess {JSON} pager 分页信息
* @apiSuccess {JSONArray} listMenu 资源列表
* @apiSuccess (listMenu) {Long} userId 资源编号
* @apiSuccess (listMenu) {Long} userId 分配者
* @apiSuccess (listMenu) {String} name 资源名称
* @apiSuccess (listMenu) {String} versionCode 资源代号
* @apiSuccess (listMenu) {String} url 资源路径
* @apiSuccess (listMenu) {Long} parentId 父节点
* @apiSuccess (listMenu) {String} des 资源描述
* @apiSuccess (listMenu) {Long} birth 创建时间
* @apiSuccess (listMenu) {String} icon 图标
* @apiSuccess (listMenu) {Integer} sort 顺序(值越小优先级越高)
* @apiSuccess (listMenu) {Integer} status 状态0停用1启用, -1删除
* @apiParamExample {json} 请求示例:
* {"pageNo":1,"pageSize":2}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":17,"pages":9,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6,7,8],"navigateFirstPage":1,"navigateLastPage":8,"lastPage":8,"firstPage":1},"listMenu":[{"userId":1,"userId":0,"name":"引擎管理","versionCode":"0001","url":"sysMenu/getChildMenu","parentId":0,"des":"引擎管理","birth":1498721562000,"icon":null,"sort":0,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false},{"userId":2,"userId":0,"name":"规则管理","versionCode":"0002","url":"sysMenu/getChildMenu","parentId":0,"des":"规则管理","birth":1498807962000,"icon":"bb","sort":5,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false}]}}
*/
@RequestMapping(value = "getMenuList", method = RequestMethod.POST)
public ResponseEntityDto getMenuList(@RequestBody MenuParam menuParam) {
PageHelper.startPage(menuParam.getPageNo(),menuParam.getPageSize());
// 获取所有菜单
List<SysMenu> listMenu = sysMenuService.getAllSysMenu(menuParam.getEntity());
PageInfo<SysMenu> pageInfo = new PageInfo<SysMenu>(listMenu);
pageInfo.setList(null);
HashMap<String, Object> modelMap = new HashMap<>();
modelMap.put("listMenu", listMenu);
modelMap.put("pager", pageInfo);
return ResponseEntityBuilder.buildNormalResponse(modelMap);
}
/**
* @api {POST} /v2/sysMenu/save 6.32. 创建资源
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {String} name 资源名称
* @apiParam {String} versionCode 资源代号
* @apiParam {String} url 资源路径
* @apiParam {Long} parentId 父节点
* @apiParam {String} des 资源描述
* @apiParam {String} icon 图标
* @apiParam {Integer} sort 顺序(值越小优先级越高)
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"name":"测试资源","versionCode":"0066","url":"testMenu","parentId":0,"des":"测试资源描述","icon":"el-icon-eleme","sort":2}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.SAVE_SYS_MENU)
public ResponseEntityDto save(@RequestBody SysMenu sysMenu) {
List<SysMenu> list = sysMenuService.validateMenuOnly(sysMenu);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getMessage());
}
int num = sysMenuService.createSysMenu(sysMenu);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysMenu/getMenuInfo/{userId} 6.33. 获取资源详情
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 资源编号url参数
* @apiSuccess {Long} userId 资源编号
* @apiSuccess {Long} userId 分配者
* @apiSuccess {String} name 资源名称
* @apiSuccess {String} versionCode 资源代号
* @apiSuccess {String} url 资源路径
* @apiSuccess {Long} parentId 父节点
* @apiSuccess {String} des 资源描述
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {String} icon 图标
* @apiSuccess {Integer} sort 顺序(值越小优先级越高)
* @apiSuccess {Integer} status 状态0停用1启用, -1删除
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"userId":32,"userId":135,"name":"测试资源","versionCode":"0066","url":"testMenu","parentId":0,"des":"测试资源描述","birth":1616760174000,"icon":"el-icon-eleme","sort":2,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"hidden":false}}
*/
@RequestMapping(value = "/getMenuInfo/{id}", method = RequestMethod.POST)
public ResponseEntityDto getMenuInfo(@PathVariable long id) {
SysMenu sysMenu = sysMenuService.findById(id);
return ResponseEntityBuilder.buildNormalResponse(sysMenu);
}
/**
* @api {POST} /v2/sysMenu/update 6.34. 修改资源
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 资源编号
* @apiParam {String} name 资源名称
* @apiParam {String} versionCode 资源代号
* @apiParam {String} url 资源路径
* @apiParam {Long} parentId 父节点
* @apiParam {String} des 资源描述
* @apiParam {String} icon 图标
* @apiParam {Integer} sort 顺序(值越小优先级越高)
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"userId":32,"name":"测试资源1","versionCode":"0067","url":"testMenu","parentId":0,"des":"测试资源描述","icon":"el-icon-eleme","sort":5}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_MENU)
public ResponseEntityDto update(@RequestBody SysMenu sysMenu) {
List<SysMenu> list = sysMenuService.validateMenuOnly(sysMenu);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_MENU_NAME_REPEAT.getMessage());
}
int num = sysMenuService.updateSysMenu(sysMenu);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysMenu/updateStatus 6.35. 资源删除
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} status 状态:-1删除
* @apiParam {String} ids 资源编号,逗号分隔
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"status":-1,"ids":"26"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "updateStatus", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_MENU_STATUS)
public ResponseEntityDto updateStatus(@RequestBody Map<String, Object> param) {
int status = (Integer) param.get("status");
String ids = (String)param.get("ids");
int num = 0;
List<Integer> list = new ArrayList<Integer>();
if (ids != "") {
String[] strs = ids.split(",");
for (int i = 0; i < strs.length; i++) {
list.add(Integer.parseInt(strs[i]));
}
}
if (list != null && list.size() > 0) {
num = sysMenuService.updateStatus(status, list);
}
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysMenu/getTreeMenu 6.36. 新增/修改资源获取父节点树
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} parentId 父节点Id
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"parentId":0}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":[{"userId":22,"userId":0,"name":"模型管理","versionCode":"0007","url":"sysMenu/getChildMenu","parentId":0,"des":"模型管理","birth":1498980762000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":23,"userId":0,"name":"数据源管理","versionCode":"0008","url":"sysMenu/getChildMenu","parentId":0,"des":"数据源管理","birth":1498984362000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":24,"userId":0,"name":"黑白名单库管理","versionCode":"0009","url":"sysMenu/getChildMenu","parentId":0,"des":"黑白名单库管理","birth":1498987962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":25,"userId":0,"name":"评分卡管理","versionCode":"0010","url":"sysMenu/getChildMenu","parentId":0,"des":"评分卡管理","birth":1498897962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false}]}
*/
@RequestMapping(value = "getTreeMenu", method = RequestMethod.POST)
public ResponseEntityDto getTreeMenu(@RequestBody MenuParam menuParam){
long parentId = menuParam.getParentId();
List<SysMenu> listMenu = sysMenuService.getAllValidMenu(menuParam.getEntity());
if(listMenu!=null&&listMenu.size()>0){
for(int i=0;i<listMenu.size();i++){
if(listMenu.get(i).getResourceId()==parentId){
listMenu.get(i).setChecked(true);
}
}
}
return ResponseEntityBuilder.buildNormalResponse(listMenu);
}
/**
* @api {POST} /v2/sysMenu/findTreeList 6.37.1. 权限分配,获取资源树
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} roleId 角色编号
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"roleId":76}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":[{"userId":22,"userId":0,"name":"模型管理","versionCode":"0007","url":"sysMenu/getChildMenu","parentId":0,"des":"模型管理","birth":1498980762000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":23,"userId":0,"name":"数据源管理","versionCode":"0008","url":"sysMenu/getChildMenu","parentId":0,"des":"数据源管理","birth":1498984362000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":24,"userId":0,"name":"黑白名单库管理","versionCode":"0009","url":"sysMenu/getChildMenu","parentId":0,"des":"黑白名单库管理","birth":1498987962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false},{"userId":25,"userId":0,"name":"评分卡管理","versionCode":"0010","url":"sysMenu/getChildMenu","parentId":0,"des":"评分卡管理","birth":1498897962000,"icon":null,"status":1,"roleId":0,"checked":false,"chkDisabled":false,"isHidden":false}]}
*/
@RequestMapping(value = "findTreeList", method = RequestMethod.POST)
public ResponseEntityDto findTreeList(@RequestBody MenuParam menuParam){
Long roleId = menuParam.getRoleId();
Long organRoleId = 0L;
List<SysMenu> listAll = new ArrayList<SysMenu>();
//获取登录用户id
SysUser user = SessionManager.getLoginAccount();
long userId = user.getUserId();
long orgId = user.getOrganId();
//获取登录人角色id
SysUser sysUser = sysUserService.findRoleByUserId(userId);
if(sysUser!=null){
organRoleId = sysUser.getSysRole().getRoleId();
}
//角色资源
menuParam.getEntity().setRoleId(roleId);
List<SysMenu> listRoleMenu = sysMenuService.findTreeList(menuParam.getEntity());
if(orgId==1){
//全部启用资源
listAll = sysMenuService.getAllValidMenu(menuParam.getEntity());
if(listAll!=null&&listAll.size()>0){
for(int i=0;i<listAll.size();i++){
//初始化禁用节点
if(listAll.get(i).getResourceId()==14 || listAll.get(i).getResourceId()==13){
listAll.get(i).setChkDisabled(true);
listAll.get(i).setHidden(true);
}
//判断默认选中
long id_i = listAll.get(i).getResourceId();
if (listRoleMenu != null && listRoleMenu.size() > 0) {
for (int j = 0; j < listRoleMenu.size(); j++) {
long id_j = listRoleMenu.get(j).getResourceId();
if (id_j == id_i) {
listAll.get(i).setChecked(true);
}
}
}
}
}
}else{
//公司资源
menuParam.getEntity().setRoleId(organRoleId);
listAll = sysMenuService.findTreeList(menuParam.getEntity());
if(listAll!=null&&listAll.size()>0){
for(int i=0;i<listAll.size();i++){
//初始化禁用节点
if(listAll.get(i).getResourceId()==4){
listAll.get(i).setChkDisabled(true);
listAll.get(i).setHidden(true);
}
//判断默认选中
long id_i = listAll.get(i).getResourceId();
if (listRoleMenu != null && listRoleMenu.size() > 0) {
for (int j = 0; j < listRoleMenu.size(); j++) {
long id_j = listRoleMenu.get(j).getResourceId();
if (id_j == id_i) {
listAll.get(i).setChecked(true);
}
}
}
}
}
}
return ResponseEntityBuilder.buildNormalResponse(listAll);
}
/**
* @api {POST} /v2/sysMenu/insertRoleMenu 6.38.1. 权限分配保存
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} roleId 角色编号
* @apiParam {String} ids 资源编号,逗号分隔
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"roleId":76,"ids":"1,18,2,15,3,16,17,4,11,12,19"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":11}
*/
@RequestMapping(value = "insertRoleMenu", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.SAVE_OR_UPDATE_MENU_ROLE)
public ResponseEntityDto insertRoleMenu(@RequestBody Map<String, Object> param) {
long roleId = Long.valueOf(param.get("roleId").toString());
String ids = (String)param.get("ids");
int num = 0;
List<Integer> list = new ArrayList<Integer>();
if (ids != "") {
String[] strs = ids.split(",");
for (int i = 0; i < strs.length; i++) {
list.add(Integer.parseInt(strs[i]));
}
if (list != null && list.size() > 0) {
num = sysMenuService.insertRoleMenu(roleId, list);
}
}else{
num = sysMenuService.deleteRoleMenu(roleId);
}
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysMenu/getMenus 6.39. 获取菜单信息
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":[{"title":"系统首页","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"引擎列表","index":"sysMenu/getChildMenu","icon":"xx","subs":[]},{"title":"引擎管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"指标管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"规则管理","index":"sysMenu/getChildMenu","icon":"bb","subs":[]},{"title":"评分卡管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"模型管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"数据源管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"黑白名单库管理","index":"sysMenu/getChildMenu","icon":null,"subs":[]},{"title":"系统管理","index":"sysMenu/getChildMenu","icon":null,"subs":[{"title":"用户管理","index":"sysUser/view","icon":null,"subs":[]},{"title":"角色管理","index":"sysRole/view","icon":"aa","subs":[]},{"title":"日志管理","index":"log/index","icon":null,"subs":[]}]}]}
*/
@RequestMapping(value = "getMenus", method = RequestMethod.POST)
public ResponseEntityDto getMenus(@RequestBody MenuParam menuParam){
List<SysMenu> menuList = new ArrayList<>();
SysUser user = SessionManager.getLoginAccount();
long orgId = user.getOrganId();
long userId = user.getUserId();
if(orgId==1){
menuList = sysMenuService.getAllValidMenu(menuParam.getEntity());
}else{
long roleId = 0;
SysUser sysUser = sysUserService.findRoleByUserId(userId);
if(sysUser!=null){
roleId = sysUser.getSysRole().getRoleId();
}
menuParam.getEntity().setRoleId(roleId);
menuList = sysMenuService.findTreeList(menuParam.getEntity());
}
long parentId = 0;
List<SysMenuVo> result = recursionMenu(menuList, parentId);
return ResponseEntityBuilder.buildNormalResponse(result);
}
/**
* 递归获取子菜单
* @param menuList
* @param parentId
* @return
*/
private List<SysMenuVo> recursionMenu(List<SysMenu> menuList, long parentId){
List<SysMenuVo> sysMenuVoList = new ArrayList<>();
for(SysMenu sysMenu : menuList) {
if(sysMenu.getParentId() == parentId){
SysMenuVo sysMenuVo = new SysMenuVo();
sysMenuVo.setTitle(sysMenu.getName());
sysMenuVo.setIndex(StringUtils.isBlank(sysMenu.getUrl()) ? UUID.randomUUID().toString() : sysMenu.getUrl());
sysMenuVo.setIcon(sysMenu.getIcon());
List<SysMenuVo> sysMenuVos = recursionMenu(menuList, sysMenu.getResourceId());
if(!sysMenuVos.isEmpty()){
sysMenuVo.setSubs(sysMenuVos);
}
sysMenuVoList.add(sysMenuVo);
}
}
return sysMenuVoList;
}
}

View File

@@ -0,0 +1,198 @@
package com.fibo.ddp.authx.system.controller;
import com.fibo.ddp.common.model.authx.system.SysOrganization;
import com.fibo.ddp.common.model.authx.system.SysUser;
import com.fibo.ddp.common.model.common.BaseParam;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.service.authx.system.SysOrganizationService;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.monitor.logger.ArchivesLog;
import com.fibo.ddp.common.utils.constant.OpTypeConst;
import com.fibo.ddp.common.utils.exception.ApiException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller("sysOrganizationControllerV2")
@RequestMapping("v2/sysOrganization")
@ResponseBody
public class SysOrganizationController {
@Autowired
private SysOrganizationService sysOrganizationService;
/**
* @api {POST} /v2/sysOrganization/getOrganList 6.41. 获取组织列表
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} pageNo 页数
* @apiParam {Integer} pageSize 每页的条数
* @apiSuccess {JSON} pager 分页信息
* @apiSuccess {JSONArray} listOrgan 组织列表
* @apiSuccess (listOrgan) {Long} userId 组织编号
* @apiSuccess (listOrgan) {String} name 组织名称
* @apiSuccess (listOrgan) {String} versionCode 组织代号
* @apiSuccess (listOrgan) {Integer} status 状态0禁用1启用
* @apiSuccess (listOrgan) {String} author 创建者
* @apiSuccess (listOrgan) {Long} birth 创建时间
* @apiSuccess (listOrgan) {String} token 唯一标识
* @apiParamExample {json} 请求示例:
* {"pageNo":1,"pageSize":2}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"listOrgan":[{"userId":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"}],"pager":{"pageNum":1,"pageSize":2,"size":1,"startRow":1,"endRow":1,"total":1,"pages":1,"list":null,"prePage":0,"nextPage":0,"isFirstPage":true,"isLastPage":true,"hasPreviousPage":false,"hasNextPage":false,"navigatePages":8,"navigatepageNums":[1],"navigateFirstPage":1,"navigateLastPage":1,"lastPage":1,"firstPage":1}}}
*/
@RequestMapping(value = "getOrganList", method = RequestMethod.POST)
public ResponseEntityDto getOrganList(@RequestBody BaseParam baseParam){
PageHelper.startPage(baseParam.getPageNo(), baseParam.getPageSize());
List<SysOrganization> listOrgan = sysOrganizationService.getAllSysOrganization();
PageInfo<SysOrganization> pageInfo = new PageInfo<SysOrganization>(listOrgan);
pageInfo.setList(null);
HashMap<String, Object> modelMap = new HashMap<>();
modelMap.put("listOrgan", listOrgan);
modelMap.put("pager", pageInfo);
return ResponseEntityBuilder.buildNormalResponse(modelMap);
}
/**
* @api {POST} /v2/sysOrganization/getAllValidOrgan 6.42. 获取所有已启用组织
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiSuccess {Long} userId 组织编号
* @apiSuccess {String} name 组织名称
* @apiSuccess {String} versionCode 组织代号
* @apiSuccess {Integer} status 状态0禁用1启用
* @apiSuccess {String} author 创建者
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {String} token 唯一标识
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":[{"userId":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"},{"userId":1,"name":"rik","versionCode":"0001","email":"123.com ","telephone":"1234567489","status":1,"author":"超级管理员","birth":1498721562000,"token":"6a6ea35e-aabe-4e64-bd98-dae304b10a21"}]}
*/
@RequestMapping(value = "getAllValidOrgan", method = RequestMethod.POST)
public ResponseEntityDto getAllValidOrgan(){
List<SysOrganization> list = new ArrayList<>();
SysUser sysUser = SessionManager.getLoginAccount();
Long organId = sysUser.getOrganId();
if(organId.longValue() == 1){
list = sysOrganizationService.getAllValidOrgan();
} else {
SysOrganization sysOrganization = sysOrganizationService.findById(organId);
list.add(sysOrganization);
}
return ResponseEntityBuilder.buildNormalResponse(list);
}
/**
* @api {POST} /v2/sysOrganization/save 6.43. 创建组织
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {String} name 组织名称
* @apiParam {String} versionCode 组织代号
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"name":"测试公司","versionCode":"666"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.SAVE_ORGAN)
public ResponseEntityDto save(@RequestBody SysOrganization sysOrganization) {
//验证唯一性
List<SysOrganization> list = sysOrganizationService.validateOrganOnly(sysOrganization);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getMessage());
}
int num = sysOrganizationService.createSysOrganization(sysOrganization);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysOrganization/getOrganInfo/{userId} 6.44. 获取组织详情
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 组织编号url参数
* @apiSuccess {Long} userId 组织编号
* @apiSuccess {String} name 组织名称
* @apiSuccess {String} versionCode 组织代号
* @apiSuccess {Integer} status 状态0禁用1启用
* @apiSuccess {String} author 创建者
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {String} token 唯一标识
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":{"userId":46,"name":"管理员","versionCode":"007","email":null,"telephone":null,"status":1,"author":"超级管理员","birth":1498722046000,"token":"4f15125c-93c0-43fb-9ed2-e0b92763fa3d"}}
*/
@RequestMapping(value = "/getOrganInfo/{id}", method = RequestMethod.POST)
public ResponseEntityDto getOrganInfo(@PathVariable long id){
SysOrganization sysOrganization = sysOrganizationService.findById(id);
return ResponseEntityBuilder.buildNormalResponse(sysOrganization);
}
/**
* @api {POST} /v2/sysOrganization/update 6.45. 修改组织
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 组织编号
* @apiParam {String} name 组织名称
* @apiParam {String} versionCode 组织代号
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"userId":47,"name":"测试公司2","versionCode":"666"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_ORGAN)
public ResponseEntityDto update(@RequestBody SysOrganization sysOrganization) {
//验证唯一性
List<SysOrganization> list = sysOrganizationService.validateOrganOnly(sysOrganization);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ORGAN_NAME_REPEAT.getMessage());
}
int num = sysOrganizationService.updateSysOrganization(sysOrganization);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysOrganization/updateStatus 6.46. 组织停用、启用、删除
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} status 状态0停用1启用, -1删除
* @apiParam {String} ids 用户Id逗号分隔
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"status":0,"ids":"46"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "updateStatus", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_ORGAN_STATUS)
public ResponseEntityDto updateStates(@RequestBody Map<String, Object> param){
int status = (Integer) param.get("status");
String ids = (String)param.get("ids");
int num = 0;
List<Integer> list = new ArrayList<Integer>();
if(ids!=""){
String[] strs = ids.split(",");
for(int i=0;i<strs.length;i++){
list.add(Integer.parseInt(strs[i]));
}
}
if(list!=null && list.size()>0){
num = sysOrganizationService.updateStatus(status,list);
}
return ResponseEntityBuilder.buildNormalResponse(num);
}
}

View File

@@ -0,0 +1,228 @@
package com.fibo.ddp.authx.system.controller;
import com.fibo.ddp.common.model.authx.system.SysRole;
import com.fibo.ddp.common.model.authx.system.SysUser;
import com.fibo.ddp.common.model.common.BaseParam;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.service.authx.system.SysRoleService;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.monitor.logger.ArchivesLog;
import com.fibo.ddp.common.utils.constant.OpTypeConst;
import com.fibo.ddp.common.utils.exception.ApiException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller("sysRoleControllerV2")
@RequestMapping("v2/sysRole")
@ResponseBody
public class SysRoleController {
@Autowired
private SysRoleService sysRoleService;
/**
* @api {POST} /v2/sysRole/getRoleList 6.21. 获取角色列表
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} pageNo 页数
* @apiParam {Integer} pageSize 每页的条数
* @apiSuccess {JSON} pager 分页信息
* @apiSuccess {JSONArray} listRole 角色列表
* @apiSuccess (listRole) {Integer} userId 角色编号
* @apiSuccess (listRole) {Integer} organId 组织编号
* @apiSuccess (listRole) {String} roleName 角色名称
* @apiSuccess (listRole) {String} author 创建者
* @apiSuccess (listRole) {Long} birth 创建时间
* @apiSuccess (listRole) {Integer} status 状态0禁用1启用
* @apiParamExample {json} 请求示例:
* {"pageNo":1,"pageSize":2}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"listRole":[{"userId":72,"organId":46,"roleName":"业务管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725111000,"status":1},{"userId":71,"organId":46,"roleName":"引擎管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725103000,"status":1}],"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":3,"pages":2,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2],"navigateFirstPage":1,"navigateLastPage":2,"firstPage":1,"lastPage":2}}}
*/
@RequestMapping(value = "/getRoleList", method = RequestMethod.POST)
public ResponseEntityDto getRoleList(@RequestBody BaseParam baseParam){
List<SysRole> listRole = null;
//获取公司管理员所在公司
SysUser sysUser = SessionManager.getLoginAccount();
long organId = sysUser.getOrganId();
PageHelper.startPage(baseParam.getPageNo(),baseParam.getPageSize());
if(organId==1){
//获取所有未删除角色
listRole = sysRoleService.getAllRoles();
}else{
//获取本公司未删除角色
listRole = sysRoleService.getAllSysRole(organId);
}
PageInfo<SysRole> pageInfo = new PageInfo<SysRole>(listRole);
pageInfo.setList(null);
HashMap<String, Object> modelMap = new HashMap<>();
modelMap.put("listRole", listRole);
modelMap.put("pager", pageInfo);
return ResponseEntityBuilder.buildNormalResponse(modelMap);
}
/**
* @api {POST} /v2/sysRole/getAllValidRole 6.22. 根据公司获取所有启用角色
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} organId 组织编号
* @apiSuccess {Integer} userId 角色编号
* @apiSuccess {Integer} organId 组织编号
* @apiSuccess {String} roleName 角色名称
* @apiSuccess {String} author 创建者
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {Integer} status 状态0禁用1启用
* @apiParamExample {json} 请求示例:
* {"organId":46}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":[{"userId":70,"organId":46,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498724751000,"status":1},{"userId":71,"organId":46,"roleName":"引擎管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725103000,"status":1},{"userId":72,"organId":46,"roleName":"业务管理员","roleCode":null,"roleDesc":null,"author":"超级管理员","birth":1498725111000,"status":1}]}
*/
@RequestMapping(value = "getAllValidRole", method = RequestMethod.POST)
public ResponseEntityDto getAllValidRole(@RequestBody Map<String, Object> param){
String author = "";
SysUser sysUser = SessionManager.getLoginAccount();
Long orgId = sysUser.getOrganId();
if(orgId==1){
author = "超级管理员";
}
long organId = orgId;
if(param.get("organId") != null){
organId = Long.valueOf(param.get("organId").toString());
}
List<SysRole> list = sysRoleService.getAllValidRole(organId,author);
return ResponseEntityBuilder.buildNormalResponse(list);
}
/**
* @api {POST} /v2/sysRole/save 6.23. 创建角色
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} organId 组织编号
* @apiParam {String} roleName 角色名称
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"organId":1,"roleName":"浏览者"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.SAVE_SYS_ROLE)
public ResponseEntityDto save(@RequestBody SysRole sysRole) {
//确保每个公司只能创建一个公司管理员
SysUser sysUser = SessionManager.getLoginAccount();
Long or_id = sysUser.getOrganId();
if(or_id==1){
sysRole.setAuthor(sysUser.getNickName());
//查询公司管理员是否存在
List<SysRole> list_role = sysRoleService.getOrganRoleByAuthor(sysRole);
if(list_role!=null&&list_role.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_ROLE_ADMIN_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_ADMIN_REPEAT.getMessage());
}
}else{
sysRole.setAuthor(sysUser.getNickName());
}
//验证名称唯一性
List<SysRole> list = sysRoleService.validateRoleOnly(sysRole);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getMessage());
}
int num = sysRoleService.createSysRole(sysRole);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysRole/getRoleInfo/{userId} 6.24. 获取角色详情
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 角色编号url参数
* @apiSuccess {Integer} userId 角色编号
* @apiSuccess {Integer} organId 组织编号
* @apiSuccess {String} roleName 角色名称
* @apiSuccess {String} author 创建者
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {Integer} status 状态0禁用1启用
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":{"userId":76,"organId":46,"roleName":"浏览者","roleCode":null,"roleDesc":null,"author":"管理员","birth":1563634443000,"status":1}}
*/
@RequestMapping(value = "/getRoleInfo/{id}", method = RequestMethod.POST)
public ResponseEntityDto getRoleInfo(@PathVariable long id){
SysRole sysrole = null;
//获取管理员所在公司
SysUser sysUser = SessionManager.getLoginAccount();
long organId = sysUser.getOrganId();
if(organId==1){
sysrole = sysRoleService.findByAId(id);
}else{
sysrole = sysRoleService.findById(id,organId);
}
return ResponseEntityBuilder.buildNormalResponse(sysrole);
}
/**
* @api {POST} /v2/sysRole/update 6.25. 修改角色
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} userId 角色编号
* @apiParam {Integer} organId 组织编号
* @apiParam {String} roleName 角色名称
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"userId":77,"organId":1,"roleName":"浏览者2"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_ROLE)
public ResponseEntityDto update(@RequestBody SysRole sysRole) {
List<SysRole> list = sysRoleService.validateRoleOnly(sysRole);
if(list!=null&&list.size()>0){
throw new ApiException(ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_ROLE_NAME_REPEAT.getMessage());
}
int num = sysRoleService.updateSysRole(sysRole);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysRole/updateStatus 6.26. 角色停用、启用、删除
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} status 状态0停用1启用, -1删除
* @apiParam {String} ids 用户Id逗号分隔
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"status":0,"ids":"77"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "updateStatus", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_ROLE_STATUS)
public ResponseEntityDto updateStates(@RequestBody Map<String, Object> param){
int status = (Integer) param.get("status");
String ids = (String)param.get("ids");
int num = 0;
List<Integer> list = new ArrayList<Integer>();
if(ids!=""){
String[] strs = ids.split(",");
for(int i=0;i<strs.length;i++){
list.add(Integer.parseInt(strs[i]));
}
}
if(list!=null && list.size()>0){
num = sysRoleService.updateStatus(status,list);
}
return ResponseEntityBuilder.buildNormalResponse(num);
}
}

View File

@@ -0,0 +1,238 @@
package com.fibo.ddp.authx.system.controller;
import com.fibo.ddp.common.model.authx.system.SysUser;
import com.fibo.ddp.common.model.common.BaseParam;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.enums.ErrorCodeEnum;
import com.fibo.ddp.common.service.authx.system.SysUserService;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.monitor.logger.ArchivesLog;
import com.fibo.ddp.common.utils.constant.OpTypeConst;
import com.fibo.ddp.common.utils.exception.ApiException;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @apiDefine sysManager 6.系统管理
*/
@Controller("sysUserControllerV2")
@RequestMapping("v2/sysUser")
@ResponseBody
public class SysUserController {
@Autowired
private SysUserService sysUserService;
/**
* @api {POST} /v2/sysUser/getUserList 6.11. 获取用户列表
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} pageNo 页数
* @apiParam {Integer} pageSize 每页的条数
* @apiSuccess {JSON} pager 分页信息
* @apiSuccess {JSONArray} listUser 用户列表
* @apiSuccess (listUser) {Long} userId 用户Id
* @apiSuccess (listUser) {Long} organId 组织编号
* @apiSuccess (listUser) {String} employeeId 员工编号
* @apiSuccess (listUser) {String} account 账号
* @apiSuccess (listUser) {String} nickName 姓名
* @apiSuccess (listUser) {String} cellphone 手机号
* @apiSuccess (listUser) {String} email 邮箱
* @apiSuccess (listUser) {Integer} status 状态0停用1启用, -1删除
* @apiSuccess (listUser) {String} author 创建人
* @apiSuccess (listUser) {Long} birth 创建时间
* @apiSuccess (listUser) {JSON} sysRole 角色信息
* @apiSuccess (sysRole) {Long} userId 角色编号
* @apiSuccess (sysRole) {String} roleName 角色名称
* @apiSuccess (listUser) {JSON} sysOrgan 公司信息
* @apiSuccess (sysOrgan) {Long} userId 组织编号
* @apiSuccess (sysOrgan) {String} name 组织名称
* @apiParamExample {json} 请求示例:
* {"pageNo":1,"pageSize":2}
* @apiSuccessExample {json} Success-Response:
* {"status":"1","error":"00000000","msg":null,"data":{"pager":{"pageNum":1,"pageSize":2,"size":2,"startRow":1,"endRow":2,"total":12,"pages":6,"list":null,"prePage":0,"nextPage":2,"isFirstPage":true,"isLastPage":false,"hasPreviousPage":false,"hasNextPage":true,"navigatePages":8,"navigatepageNums":[1,2,3,4,5,6],"navigateFirstPage":1,"navigateLastPage":6,"lastPage":6,"firstPage":1},"listUser":[{"userId":149,"organId":46,"employeeId":"011","account":"rong360","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"rong","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613801940000,"author":"超级管理员","sysRole":{"userId":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"userId":46,"name":"管理员","versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}},{"userId":148,"organId":46,"employeeId":"010","account":"yljr","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"yljr","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613720093000,"author":"超级管理员","sysRole":{"userId":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"userId":46,"name":"管理员","versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}}]}}
*/
@RequestMapping(value = "getUserList", method = RequestMethod.POST)
public ResponseEntityDto<Object> getUserList(@RequestBody BaseParam baseParam) {
SysUser sysUser = new SysUser();
//获取登录人所在公司
SysUser user = SessionManager.getLoginAccount();
long organId = user.getOrganId();
sysUser.setOrganId(organId);
PageHelper.startPage(baseParam.getPageNo(), baseParam.getPageSize());
List<SysUser> listUser = sysUserService.getAllUsers(sysUser);
PageInfo<SysUser> pageInfo = new PageInfo<SysUser>(listUser);
pageInfo.setList(null);
HashMap<String, Object> modelMap = new HashMap<>();
modelMap.put("listUser", listUser);
modelMap.put("pager", pageInfo);
return ResponseEntityBuilder.buildNormalResponse(modelMap);
}
/**
* @api {POST} /v2/sysUser/save 6.12. 创建用户
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} organId 组织编号
* @apiParam {String} employeeId 员工编号
* @apiParam {String} account 账号
* @apiParam {String} nickName 姓名
* @apiParam {String} cellphone 手机号
* @apiParam {String} email 邮箱
* @apiParam {JSON} sysRole 角色信息
* @apiParam (sysRole) {Long} userId 角色编号
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"organId":46,"employeeId":"012","account":"testuser","nickName":"张三","email":"11@qq.com","cellphone":"15222222222","sysRole":{"userId":71}}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "save", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.SAVE_SYS_USER)
public ResponseEntityDto<Object> save(@RequestBody SysUser sysUser) {
String nickName = sysUser.getNickName();
if (nickName.equals("超级管理员")) {
throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_ERROR.getCode(), ErrorCodeEnum.CREATE_USER_NAME_ERROR.getMessage());
}
String account = sysUser.getAccount();
sysUser.setAccount(account);
//验证唯一性
List<SysUser> list = sysUserService.validateUserOnly(sysUser);
if (list != null && list.size() > 0) {
throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getMessage());
}
long num = sysUserService.createSysUser(sysUser);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysUser/getUserInfo/{userId} 6.13. 获取用户详情
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 用户Idurl参数
* @apiSuccess {Long} userId 用户Id
* @apiSuccess {Long} organId 组织编号
* @apiSuccess {String} employeeId 员工编号
* @apiSuccess {String} account 账号
* @apiSuccess {String} nickName 姓名
* @apiSuccess {String} cellphone 手机号
* @apiSuccess {String} email 邮箱
* @apiSuccess {Integer} status 状态0停用1启用, -1删除
* @apiSuccess {String} author 创建人
* @apiSuccess {Long} birth 创建时间
* @apiSuccess {JSON} sysRole 角色信息
* @apiSuccess (sysRole) {Long} userId 角色编号
* @apiSuccess (sysRole) {String} roleName 角色名称
* @apiSuccess {JSON} sysOrgan 公司信息
* @apiSuccess (sysOrgan) {Long} userId 组织编号
* @apiSuccess (sysOrgan) {String} name 组织名称
* @apiParamExample {json} 请求示例:
* {}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":{"userId":149,"organId":46,"employeeId":"011","account":"rong360","password":"4m774i0~4m2&5n1c4i55296#2@1j010i","nickName":"rong","email":"11@qq.com","cellphone":"15222222222","qq":null,"latestTime":null,"latestIp":null,"status":1,"birth":1613801940000,"author":"超级管理员","sysRole":{"userId":70,"organId":0,"roleName":"管理员","roleCode":null,"roleDesc":null,"author":null,"birth":null,"status":0},"sysOrgan":{"userId":46,"name":null,"versionCode":null,"email":null,"telephone":null,"status":0,"author":null,"birth":null,"token":null}}}
*/
@RequestMapping(value = "/getUserInfo/{id}", method = RequestMethod.POST)
public ResponseEntityDto<Object> getUserInfo(@PathVariable long id) {
SysUser sysUser = new SysUser();
sysUser.setUserId(id);
//获取用户所在公司
SysUser user = SessionManager.getLoginAccount();
long organId = user.getOrganId();
sysUser.setOrganId(organId);
SysUser result = sysUserService.findById(sysUser);
return ResponseEntityBuilder.buildNormalResponse(result);
}
/**
* @api {POST} /v2/sysUser/update 6.14. 修改用户
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 用户Id
* @apiParam {Long} organId 组织编号
* @apiParam {String} employeeId 员工编号
* @apiParam {String} account 账号
* @apiParam {String} nickName 姓名
* @apiParam {String} cellphone 手机号
* @apiParam {String} email 邮箱
* @apiParam {JSON} sysRole 角色信息
* @apiParam (sysRole) {Long} userId 角色编号
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"userId":150,"organId":46,"employeeId":"012","account":"testuser2","nickName":"张三","email":"11@qq.com","cellphone":"15222222222","sysRole":{"userId":72}}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "update", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_USER)
public ResponseEntityDto<Object> update(@RequestBody SysUser sysUser) {
String account = sysUser.getAccount();
sysUser.setAccount(account);
List<SysUser> list = sysUserService.validateUserOnly(sysUser);
if (list != null && list.size() > 0) {
throw new ApiException(ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getCode(), ErrorCodeEnum.CREATE_USER_NAME_REPEAT.getMessage());
}
int num = sysUserService.updateSysUser(sysUser);
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysUser/updateStatus 6.15. 用户停用、启用、删除
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Integer} status 状态0停用1启用, -1删除
* @apiParam {String} ids 用户Id逗号分隔
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"status":0,"ids":"150,151"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":2}
*/
@RequestMapping(value = "updateStatus", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDATE_SYS_USER_STATUS)
public ResponseEntityDto<Object> updateStatus(@RequestBody Map<String, Object> param) {
int status = (Integer) param.get("status");
String ids = (String) param.get("ids");
int num = 0;
List<Integer> list = new ArrayList<Integer>();
if (ids != "") {
String[] strs = ids.split(",");
for (int i = 0; i < strs.length; i++) {
list.add(Integer.parseInt(strs[i]));
}
}
if (list != null && list.size() > 0) {
num = sysUserService.updateStates(status, list);
}
return ResponseEntityBuilder.buildNormalResponse(num);
}
/**
* @api {POST} /v2/sysUser/updatePassword 6.16. 修改密码
* @apiGroup sysManager
* @apiVersion 2.0.0
* @apiParam {Long} userId 用户Id
* @apiParam {String} password 新密码
* @apiSuccess {String} status 状态: 1成功, 0失败
* @apiParamExample {json} 请求示例:
* {"userId":136,"password":"654321"}
* @apiSuccessExample {json} 成功返回数据示例:
* {"status":"1","error":"00000000","msg":null,"data":1}
*/
@RequestMapping(value = "updatePassword", method = RequestMethod.POST)
@ArchivesLog(operationType = OpTypeConst.UPDTE_PASSWORD)
public ResponseEntityDto updatePassword(@RequestBody SysUser sysUser) {
int num = sysUserService.updatePassword(sysUser);
return ResponseEntityBuilder.buildNormalResponse(num);
}
}

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ddp-common</artifactId>
<groupId>com.fibo.ddp</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ddp-common-dao</artifactId>
<dependencies>
<dependency>
<groupId>com.fibo.ddp</groupId>
<artifactId>ddp-common-model</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<!-- 此配置不可缺否则mybatis的Mapper.xml将会丢失 -->
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<!--指定资源的位置-->
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>

View File

@@ -0,0 +1,8 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseDecisionResult;
public interface AnalyseDecisionResultMapper extends BaseMapper<AnalyseDecisionResult> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseDecisionTables;
/**
* (AnalyseDecisionTables)表数据库访问层
*/
public interface AnalyseDecisionTablesMapper extends BaseMapper<AnalyseDecisionTables> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseEngineCall;
/**
* (AnalyseEngineCall)表数据库访问层
*/
public interface AnalyseEngineCallMapper extends BaseMapper<AnalyseEngineCall> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseEngineNode;
/**
* (AnalyseEngineNode)表数据库访问层
*/
public interface AnalyseEngineNodeMapper extends BaseMapper<AnalyseEngineNode> {
}

View File

@@ -0,0 +1,8 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseEngineSummary;
public interface AnalyseEngineSummaryMapper extends BaseMapper<AnalyseEngineSummary> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseRule;
/**
* (AnalyseRule)表数据库访问层
*/
public interface AnalyseRuleMapper extends BaseMapper<AnalyseRule> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.analyse;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.analyse.AnalyseScorecard;
/**
* (AnalyseScorecard)表数据库访问层
*/
public interface AnalyseScorecardMapper extends BaseMapper<AnalyseScorecard> {
}

View File

@@ -0,0 +1,18 @@
package com.fibo.ddp.common.dao.approval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.approval.ApprovalConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (ApprovalConfig)表数据库访问层
*/
@Mapper
public interface ApprovalConfigMapper extends BaseMapper<ApprovalConfig> {
int insertOrUpdate(ApprovalConfig entity);
int insertOrUpdateBatch(@Param("entities") List<ApprovalConfig> entities);
}

View File

@@ -0,0 +1,45 @@
<?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="com.fibo.ddp.common.dao.approval.ApprovalConfigMapper">
<resultMap type="com.fibo.ddp.common.model.approval.ApprovalConfig" id="ApprovalConfigMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="approvalType" column="approval_type" jdbcType="VARCHAR"/>
<result property="approvalName" column="approval_name" jdbcType="VARCHAR"/>
<result property="approvalDesc" column="approval_desc" jdbcType="VARCHAR"/>
<result property="approvalStatus" column="approval_status" jdbcType="INTEGER"/>
<result property="organId" column="organ_id" jdbcType="INTEGER"/>
<result property="createUserId" column="create_user_id" jdbcType="INTEGER"/>
<result property="updateUserId" column="update_user_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--新增所有列-->
<insert id="insertOrUpdate" keyProperty="id" useGeneratedKeys="true">
insert into riskmanage.t_approval_config(approval_type, approval_name, approval_desc, approval_status, organ_id, create_user_id, update_user_id, create_time, update_time)
values (#{approvalType}, #{approvalName}, #{approvalDesc}, #{approvalStatus}, #{organId}, #{createUserId}, #{updateUserId}, #{createTime}, #{updateTime})
on duplicate key update
approval_type = values(approval_type) , approval_name = values(approval_name) , approval_desc =
values(approval_desc) , approval_status = values(approval_status) , organ_id = values(organ_id) , create_user_id
= values(create_user_id) , update_user_id = values(update_user_id) , create_time = values(create_time) ,
update_time = values(update_time)
</insert>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into riskmanage.t_approval_config(approval_type, approval_name, approval_desc, approval_status, organ_id,
create_user_id, update_user_id )
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.approvalType}, #{entity.approvalName}, #{entity.approvalDesc}, #{entity.approvalStatus},
#{entity.organId}, #{entity.createUserId}, #{entity.updateUserId})
</foreach>
on duplicate key update
approval_type = values(approval_type) , approval_name = values(approval_name) , approval_desc =
values(approval_desc) , approval_status = values(approval_status) , organ_id = values(organ_id) ,
create_user_id = values(create_user_id) , update_user_id = values(update_user_id)
</insert>
</mapper>

View File

@@ -0,0 +1,12 @@
package com.fibo.ddp.common.dao.approval;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.approval.Approval;
/**
* (Approval)表数据库访问层
*/
public interface ApprovalMapper extends BaseMapper<Approval> {
}

View File

@@ -0,0 +1,73 @@
<?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="com.fibo.ddp.common.dao.approval.ApprovalMapper">
<resultMap type="com.fibo.ddp.common.model.approval.Approval" id="ApprovalMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="applyType" column="apply_type" jdbcType="VARCHAR"/>
<result property="createUserId" column="create_user_id" jdbcType="INTEGER"/>
<result property="createUserName" column="create_user_name" jdbcType="VARCHAR"/>
<result property="updateUserId" column="update_user_id" jdbcType="INTEGER"/>
<result property="updateUserName" column="update_user_name" jdbcType="VARCHAR"/>
<result property="organId" column="organ_id" jdbcType="INTEGER"/>
<result property="applyStatus" column="apply_status" jdbcType="INTEGER"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="approvalTime" column="approval_time" jdbcType="TIMESTAMP"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="applyDetail" column="apply_detail" jdbcType="VARCHAR"/>
<result property="applyDesc" column="apply_desc" jdbcType="VARCHAR"/>
</resultMap>
<sql id="BaseField">
id, apply_type, create_user_id, create_user_name, update_user_id, update_user_name, organ_id, apply_status, status, approval_time, create_time, update_time, apply_detail, apply_desc
</sql>
<sql id="condition">
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="applyType != null and applyType != ''">
and apply_type = #{applyType}
</if>
<if test="createUserId != null">
and create_user_id = #{createUserId}
</if>
<if test="createUserName != null and createUserName != ''">
and create_user_name = #{createUserName}
</if>
<if test="updateUserId != null">
and update_user_id = #{updateUserId}
</if>
<if test="updateUserName != null and updateUserName != ''">
and update_user_name = #{updateUserName}
</if>
<if test="organId != null">
and organ_id = #{organId}
</if>
<if test="applyStatus != null">
and apply_status = #{applyStatus}
</if>
<if test="status != null">
and status = #{status}
</if>
<if test="approvalTime != null">
and approval_time = #{approvalTime}
</if>
<if test="createTime != null">
and create_time = #{createTime}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
</if>
<if test="applyDetail != null and applyDetail != ''">
and apply_detail = #{applyDetail}
</if>
<if test="applyDesc != null and applyDesc != ''">
and apply_desc = #{applyDesc}
</if>
</where>
</sql>
</mapper>

View File

@@ -0,0 +1,20 @@
package com.fibo.ddp.common.dao.authx.dictionary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.authx.dictionary.Dictionary;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
/**
* (Dictionary)表数据库访问层
*
* @author jgp
* @since 2021-12-15 15:08:04
*/
public interface DictionaryMapper extends BaseMapper<Dictionary> {
int insertOrUpdateBatch(@Param("entities") Collection<Dictionary> entities);
}

View File

@@ -0,0 +1,28 @@
<?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="com.fibo.ddp.common.dao.authx.dictionary.DictionaryMapper">
<resultMap type="com.fibo.ddp.common.model.authx.dictionary.Dictionary" id="DictionaryMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="dictKey" column="dict_key" jdbcType="VARCHAR"/>
<result property="dictValue" column="dict_value" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into t_dictionary(dict_key, dict_value)
values
<foreach collection="entities" item="entity" separator=",">
( #{entity.dictKey}, #{entity.dictValue})
</foreach>
on duplicate key update
dict_key = values(dict_key) , dict_value = values(dict_value)
</insert>
</mapper>

View File

@@ -0,0 +1,82 @@
package com.fibo.ddp.common.dao.authx.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.authx.system.SysMenu;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysMenuMapper extends BaseMapper<SysMenu> {
/**
* 查询所有资源
*
* @return
*/
public List<SysMenu> getAllSysMenu(SysMenu entity);
/**
* 查询单条资源
*
* @param id
* @return
*/
public SysMenu findById(long id);
/**
* 新增资源
*
* @param sysMenu
* @return
*/
public int createSysMenu(SysMenu sysMenu);
/**
* 修改资源
*
* @param sysMenu
* @return
*/
public int updateSysMenu(SysMenu sysMenu);
/**
* 修改资源状态
*
* @param id
* @param idList
* @return
*/
public int updateStatus(@Param("status") int status, @Param("list") List<Integer> list);
/**
* 保存角色菜单关系
*/
public int insertRoleMenu(@Param("roleId") long roleId, @Param("list") List<Integer> list);
/**
* 删除角色菜单关系(实现修改)
*/
public int deleteRoleMenu(long roleId);
/**
* 分配资源树
*
* @param roleId
* @return
*/
public List<SysMenu> findTreeList(SysMenu entity);
/**
* 获取所有启用资源
*
* @return
*/
public List<SysMenu> getAllValidMenu(SysMenu entity);
/**
* 验证唯一性
*/
public List<SysMenu> validateMenuOnly(SysMenu sysMenu);
}

View File

@@ -0,0 +1,132 @@
<?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="com.fibo.ddp.common.dao.authx.system.SysMenuMapper">
<resultMap type='SysMenu' id='menuMap'>
<id property='resourceId' column='resource_id' />
<result property='userId' column='user_id' />
<result property='name' column='name' />
<result property='code' column='code' />
<result property='url' column='url' />
<result property='parentId' column='parent_id' />
<result property='resourceSystem' column='resource_system' />
<result property='des' column='des' />
<result property='birth' column='birth' />
<result property='icon' column='icon' />
<result property='sort' column='sort' />
<result property='status' column='status' />
</resultMap>
<sql id="Base_Column_List" >
resource_id, user_id, name, code, url, parent_id, des,resource_system, birth, icon, sort, status
</sql>
<select id='getAllSysMenu' resultMap='menuMap' parameterType="SysMenu">
select
<include refid="Base_Column_List" />
from t_resource where status != -1
<if test="resourceSystem != null and resourceSystem !=''">
and resource_system = #{resourceSystem}
</if>
order by resource_id
</select>
<select id='findById' resultMap='menuMap'>
select
<include refid="Base_Column_List" />
from t_resource
where resource_id = #{resourceId} and status !=-1
</select>
<!-- 分配资源树 -->
<select id='findTreeList' resultMap='menuMap' parameterType="SysMenu">
select
re.resource_id, re.user_id, re.name, re.code, re.url, re.parent_id, re.des,re.resource_system, re.birth, re.icon, re.status
from t_role ro, t_role_resource_rel rr, t_resource re
where ro.role_id = rr.role_id AND rr.resource_id = re.resource_id
<if test="resourceSystem != null and resourceSystem !=''">
and resource_system = #{resourceSystem}
</if>
and rr.role_id = #{roleId} and re.status = 1 order by re.sort asc
</select>
<!-- 查询所有可用资源 -->
<select id="getAllValidMenu" resultMap="menuMap">
select
<include refid="Base_Column_List" />
from t_resource
where status = 1
<if test="resourceSystem != null and resourceSystem !=''">
and resource_system = #{resourceSystem}
</if>
order by sort asc
</select>
<!-- 验证唯一性 -->
<select id='validateMenuOnly' resultMap='menuMap' parameterType="SysMenu">
select
<include refid="Base_Column_List" />
from t_resource
where (name = #{name} or code = #{code})
and status != -1
<if test="resourceId != null and resourceId !='' and resourceId !=0">
and resource_id != #{resourceId}
</if>
<if test="resourceSystem != null and resourceSystem !=''">
and resource_system = #{resourceSystem}
</if>
</select>
<insert id="createSysMenu" parameterType="SysMenu">
insert into t_resource (user_id, name, code, url, parent_id, des,resource_system, birth, icon, sort)
values (#{userId}, #{name}, #{code}, #{url}, #{parentId}, #{des},#{resourceSystem}, now(), #{icon}, #{sort})
</insert>
<!--保存菜单角色关系 -->
<insert id="insertRoleMenu">
insert into t_role_resource_rel (role_id, resource_id)
values
<foreach collection="list" item="ids" index="index" separator="," >
(#{roleId}, #{ids})
</foreach>
</insert>
<update id="updateSysMenu" parameterType="SysMenu" >
update t_resource set name=#{name},
url=#{url},
<if test="des != null and des !=''">
des=#{des},
</if>
<if test="resourceSystem != null and resourceSystem !=''">
resource_system = #{resourceSystem},
</if>
<if test="icon != null and icon !=''">
icon=#{icon},
</if>
<if test="userId != null and userId !=''">
user_id=#{userId},
</if>
<if test="parentId != null">
parent_id=#{parentId},
</if>
<if test="sort != null">
sort=#{sort},
</if>
code=#{code}
where resource_id = #{resourceId}
</update>
<!-- 删除菜单角色关系 -->
<delete id="deleteRoleMenu">
delete from t_role_resource_rel where role_id = #{roleId}
</delete>
<update id="updateStatus">
update t_resource set status=#{status}
<where>
<if test="list!=null and list.size()>0">
resource_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
</mapper>

View File

@@ -0,0 +1,61 @@
package com.fibo.ddp.common.dao.authx.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.authx.system.SysOrganization;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysOrganizationMapper extends BaseMapper<SysOrganization> {
/**
* 查询所有公司
*
* @return
*/
public List<SysOrganization> getAllSysOrganization();
/**
* 获取所有启用公司
*
* @return
*/
public List<SysOrganization> getAllValidOrgan();
/**
* 查询单个公司
*
* @param id
* @return
*/
public SysOrganization findById(long id);
/**
* 创建公司
*
* @param SysOrganization
* @return
*/
public int createSysOrganization(SysOrganization SysOrganization);
/**
* 修改组织
*
* @param SysOrganization
* @return
*/
public int updateSysOrganization(SysOrganization SysOrganization);
/**
* 修改公司状态(停用/启用、删除)
*
* @param states
* @return
*/
public int updateStatus(@Param("status") int status, @Param("list") List<Integer> list);
/**
* 验证唯一性
*/
public List<SysOrganization> validateOrganOnly(SysOrganization SysOrganization);
}

View File

@@ -0,0 +1,88 @@
<?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="com.fibo.ddp.common.dao.authx.system.SysOrganizationMapper">
<resultMap type='com.fibo.ddp.common.model.authx.system.SysOrganization' id='organizationMap'>
<id property='organId' column='organ_id'/>
<result property='name' column='name'/>
<result property='code' column='code'/>
<result property='email' column='email'/>
<result property='telephone' column='telephone'/>
<result property='status' column='status'/>
<result property='author' column='author'/>
<result property='birth' column='birth'/>
<result property='token' column='token'/>
</resultMap>
<sql id="Base_Column_List">
organ_id, name, code, email, telephone, status, birth, author,token
</sql>
<select id='getAllSysOrganization' resultMap='organizationMap'>
select
<include refid="Base_Column_List"/>
from t_organization where status != -1 and organ_id != 1
order by organ_id desc
</select>
<select id='getAllValidOrgan' resultMap='organizationMap'>
select
<include refid="Base_Column_List"/>
from t_organization where status = 1
order by organ_id desc
</select>
<select id='findById' resultMap='organizationMap'>
select
<include refid="Base_Column_List"/>
from t_organization
where organ_id = #{organId} and status != -1
</select>
<!-- 验证公司唯一性 -->
<select id='validateOrganOnly' resultMap='organizationMap' parameterType="SysOrganization">
select
<include refid="Base_Column_List"/>
from t_organization
where (name = #{name} or code = #{code})
and status != -1
<if test="organId != null and organId !='' and organId !=0">
and organ_id != #{organId}
</if>
</select>
<insert id="createSysOrganization" parameterType="SysOrganization" useGeneratedKeys="true" >
insert into t_organization (name, code, email, telephone, status, author, birth, token)
values (#{name}, #{code}, #{email}, #{telephone}, 1, #{author}, now(), #{token})
</insert>
<update id="updateSysOrganization" parameterType="SysOrganization">
update t_organization set name=#{name},
<if test="email != null and email != ''">
email=#{email},
</if>
<if test="telephone != null and telephone!=''">
telephone=#{telephone},
</if>
<if test="author != null and author !=''">
author=#{author},
</if>
code=#{code}
where organ_id=#{id}
</update>
<update id="updateStatus">
update t_organization set status=#{status}
<where>
<if test="list!=null and list.size()>0">
organ_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
</mapper>

View File

@@ -0,0 +1,93 @@
package com.fibo.ddp.common.dao.authx.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.authx.system.SysRole;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface SysRoleMapper extends BaseMapper<SysRole> {
/**
* 获取本组织所有角色
*
* @return
*/
public List<SysRole> getAllSysRole(long organId);
/**
* 获取所有角色
*/
public List<SysRole> getAllRoles();
/**
* 获取本组织启用的角色
*
* @param organId
* @return
*/
public List<SysRole> getAllValidRole(@Param("organId") long organId, @Param("author") String author);
/**
* 查询本组织的单个角色
*
* @param id
* @return
*/
public SysRole findById(@Param("userId") long id, @Param("organId") long organId);
/**
* 查询单个角色
*
* @param id
* @return
*/
public SysRole findByAId(long id);
/**
* 创建本组织角色
*
* @param sysRole
* @return
*/
public int createSysRole(SysRole sysRole);
/**
* 修改本公司角色
*
* @param sysRole
* @return
*/
public int updateSysRole(SysRole sysRole);
/**
* 修改角色状态(停用、启用、删除)
*
* @param id
* @param idList
* @return
*/
public int updateStatus(@Param("status") int status, @Param("list") List<Integer> list);
/**
* 根据角色查询角色所在公司
*/
public long getOrganByRoleId(long roleId);
/**
* 验证角色唯一性
*/
public List<SysRole> validateRoleOnly(SysRole sysRole);
/**
* 查询公司管理员角色id
*/
public List<SysRole> getOrganRoleByAuthor(SysRole sysRole);
/**
* 删除多个公司的所有角色
*/
public int deleteRolesByOrgans(@Param("status") Integer status, @Param("list") List<Integer> list);
}

View File

@@ -0,0 +1,127 @@
<?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="com.fibo.ddp.common.dao.authx.system.SysRoleMapper">
<resultMap type='com.fibo.ddp.common.model.authx.system.SysRole' id='roleMap'>
<id property='roleId' column='role_id'/>
<result property='organId' column='organ_id'/>
<result property='roleName' column='role_name'/>
<result property='roleCode' column='role_code'/>
<result property='roleDesc' column='role_desc'/>
<result property='author' column='author'/>
<result property='birth' column='birth'/>
<result property='status' column='status'/>
</resultMap>
<sql id="Base_Column_List">
role_id, organ_id, role_name, role_code, role_desc, author, birth, status
</sql>
<select id='getAllSysRole' resultMap='roleMap'>
select
<include refid="Base_Column_List"/>
from t_role where organ_id = #{organId} and status != -1 and author != "超级管理员"
order by role_id desc
</select>
<select id='getAllRoles' resultMap='roleMap'>
select
<include refid="Base_Column_List"/>
from t_role where status != -1 and author='超级管理员' order by role_id desc
</select>
<select id='findById' resultMap='roleMap'>
select
<include refid="Base_Column_List"/>
from t_role where role_id=#{id} and organ_id = #{organId} and status != -1
</select>
<select id='findByAId' resultMap='roleMap'>
select
<include refid="Base_Column_List"/>
from t_role where role_id=#{id} and status != -1
</select>
<select id="getAllValidRole" resultMap='roleMap'>
select
<include refid="Base_Column_List"/>
from t_role where organ_id = #{organId} and status = 1
<if test="author =='超级管理员'">
and author = #{author}
</if>
<if test="author != '超级管理员'">
and author != "超级管理员"
</if>
order by role_id
</select>
<select id="getOrganByRoleId" resultType='java.lang.Long'>
select
organ_id
from t_role where role_id = #{roleId}
</select>
<!-- 验证角色唯一性 -->
<select id="validateRoleOnly" resultMap="roleMap">
select
<include refid="Base_Column_List"/>
from t_role where organ_id = #{organId} and status !=-1
and role_name = #{roleName}
<if test="roleId!=null and roleId!='' and roleId!=0">
and role_id != #{roleId}
</if>
</select>
<!-- 查询公司管理员角色id -->
<select id="getOrganRoleByAuthor" resultMap="roleMap">
select
<include refid="Base_Column_List"/>
from t_role where organ_id = #{organId} and author = #{author} and status != -1
</select>
<insert id="createSysRole" parameterType="SysRole">
insert into t_role (role_id, organ_id, role_name, role_code, role_desc, author, birth, status)
values (#{roleId}, #{organId}, #{roleName}, #{roleCode}, #{roleDesc}, #{author}, now(), 1)
</insert>
<update id="updateSysRole" parameterType="SysRole">
update t_role set
<if test="organId != null and organId != ''">
organ_id=#{organId},
</if>
<if test="roleDesc != null and roleDesc != ''">
role_desc=#{roleDesc},
</if>
<if test="roleCode != null and roleCode != ''">
role_code=#{roleCode},
</if>
role_name=#{roleName}
where role_id = #{roleId}
</update>
<update id="updateStatus">
update t_role set status=#{status}
<where>
<if test="list!=null and list.size()>0">
role_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
<update id="deleteRolesByOrgans">
update t_role set status = #{status}
<where>
<if test="list!=null and list.size()>0">
organ_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
</mapper>

View File

@@ -0,0 +1,112 @@
package com.fibo.ddp.common.dao.authx.system;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.authx.system.SysUser;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
/**
* 查询搜索用户
*/
public List<SysUser> getAllUsers(SysUser sysUser);
/**
* 查询本组织单个用户
*
* @param id
* @return
*/
public SysUser findById(SysUser sysUser);
/**
* 创建本公司用户
*
* @param sysUser
* @return
*/
public long createSysUser(SysUser sysUser);
/**
* 添加用户角色关系
*
* @param userId
* @param roleId
* @return
*/
public int insertUserRole(@Param("userId") long userId,
@Param("roleId") long roleId,
@Param("organId") long organId);
/**
* 修改本公司用户
*
* @param sysUser
* @return
*/
public int updateSysUser(SysUser sysUser);
/**
* 修改用户角色关系
*
* @param sysUser
* @return
*/
public int updateUserRole(SysUser sysUser);
/**
* 修改用户状态(停用/启用/删除)
*
* @param states
* @return
*/
public int updateStates(@Param("status") int status, @Param("list") List<Integer> list);
/**
* 通过用户id查询角色
*
* @param userId
* @return
*/
public SysUser findRoleByUserId(long userId);
/**
* 修改密码
*/
public int updatePassword(SysUser sysUser);
/**
* 本公司账号员工编号唯一性
*/
public List<SysUser> validateUserOnly(SysUser sysUser);
/**
* 删除多个公司的用户角色关系
*/
public int deleteUserRoleByOrgan(@Param("status") Integer status, @Param("list") List<Integer> list);
/**
* 删除角色关联的所有账号
*/
public int deleteUsersByIds(@Param("status") Integer status, @Param("list") List<Long> list);
/**
* 批量删除角色账号关系
*/
public int deleteBatchUserRole(@Param("status") Integer status, @Param("list") List<Integer> list);
/**
* 批量查询角色关联的账号
*/
public List<Long> getBatchUserIdsByRoleId(List<Integer> list);
String findNickNameById(Long userId);
SysUser findUserById(Long userId);
void deleteUsersByOrgans(@Param("status")Integer status, @Param("list") List<Integer> list);
}

View File

@@ -0,0 +1,252 @@
<?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="com.fibo.ddp.common.dao.authx.system.SysUserMapper">
<resultMap type='com.fibo.ddp.common.model.authx.system.SysUser' id='userMap'>
<id property='userId' column='user_id'/>
<result property='organId' column='organ_id'/>
<result property='employeeId' column='employee_id'/>
<result property='account' column='account'/>
<result property='password' column='password'/>
<result property='nickName' column='nick_name'/>
<result property='email' column='email'/>
<result property='cellphone' column='cellphone'/>
<result property='qq' column='qq'/>
<result property='latestTime' column='latest_time'/>
<result property='latestIp' column='latest_ip'/>
<result property='remark' column='remark'/>
<result property='status' column='status'/>
<result property='birth' column='birth'/>
<result property='author' column='author'/>
<association property="sysRole" javaType="com.fibo.ddp.common.model.authx.system.SysRole">
<id property='roleId' column='role_id'/>
<result property='roleName' column='role_name'/>
<result property='roleCode' column='role_code'/>
</association>
<association property="sysOrgan" javaType="com.fibo.ddp.common.model.authx.system.SysOrganization">
<id property='organId' column='organ_id'/>
<result property='name' column='name'/>
</association>
</resultMap>
<sql id="Base_Column_List">
user_id, organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, status, birth, author
</sql>
<!-- 查询搜索用户 -->
<select id='getAllUsers' resultMap='userMap'>
select
u.user_id, u.organ_id, u.employee_id, u.account, u.password, u.nick_name, u.email, u.cellphone,
u.qq,u.latest_time,u.latest_ip,u.remark,u.status,u.birth,u.author,
r.role_id, r.role_name, r.role_code,
g.organ_id, g.name
from
t_user u, t_user_role_rel urr, t_role r, t_organization g
where
u.user_id = urr.user_id and r.role_id = urr.role_id
and g.organ_id = u.organ_id
<if test="account != null and account != ''">
and (u.account = #{account} or u.employee_id = #{account})
</if>
<if test="organId != null and organId !='' and organId != 1">
and u.organ_id = #{organId} and u.author != '超级管理员'
</if>
<if test="organId != null and organId !='' and organId == 1">
and u.author = '超级管理员'
</if>
and u.status != -1
order by user_id desc
</select>
<!-- 查询本组织单条用户 -->
<select id='findById' resultMap='userMap'>
select u.user_id, u.organ_id, u.employee_id,u.account, u.password, u.nick_name, u.email, u.cellphone,
u.qq,u.latest_time,u.latest_ip,u.remark,u.status,u.birth,u.author,
r.role_id, r.role_name, r.role_code
from t_user u, t_user_role_rel urr, t_role r
where u.user_id = urr.user_id and r.role_id = urr.role_id and u.user_id = #{userId}
<if test="organId !=null and organId!='' and organId !=1">
and u.organ_id = #{organId}
</if>
and u.status != -1
</select>
<!-- 通过用户id查询角色 -->
<select id="findRoleByUserId" resultMap='userMap'>
select r.role_id, r.role_name from t_user u, t_user_role_rel ur, t_role r
where u.user_id = ur.user_id and r.role_id = ur.role_id and u.user_id = #{userId} and r.status=1
</select>
<!-- 本公司账号员工编号唯一性 -->
<select id="validateUserOnly" resultMap='userMap'>
select account,employee_id
from t_user where (account = #{account} or employee_id = #{employeeId})
and organ_id = #{organId} and STATUS != -1
<if test="userId!=null and userId!='' and userId!=0">
and user_id != #{userId}
</if>
</select>
<!-- 批量查询角色关联的账号 -->
<select id="getBatchUserIdsByRoleId" resultType='java.lang.Long'>
select user_id from t_user_role_rel
<where>
<if test="list!=null and list.size()>0">
role_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</select>
<select id="findNickNameById" resultType="java.lang.String">
SELECT
nick_name
FROM
t_user
where
user_id = #{userId}
</select>
<select id="findUserById" resultType="com.fibo.ddp.common.model.authx.system.SysUser">
select
`user_id`, `organ_id`, `employee_id`, `account`, `password`, `nick_name`, `email`, `cellphone`, `qq`, `latest_time`, `latest_ip`, `status`, `birth`, `author`
from t_user
where user_id = #{userId,jdbcType=INTEGER}
</select>
<!-- 保存用户 -->
<insert id="createSysUser" useGeneratedKeys="true" parameterType="SysUser">
insert into t_user (organ_id, employee_id, account, password, nick_name, email, cellphone, qq, latest_time, latest_ip, remark,status, birth, author)
values (#{organId}, #{employeeId}, #{account}, #{password}, #{nickName}, #{email}, #{cellphone}, #{qq}, #{latestTime}, #{latestIp}, #{remark},1, now(), #{author})
</insert>
<!-- 保存用户角色关系 -->
<insert id="insertUserRole" parameterType="SysUser">
insert into t_user_role_rel (user_id, role_id,organ_id)
values (#{userId}, #{roleId},#{organId})
</insert>
<!-- 修改用户 -->
<update id="updateSysUser" parameterType="SysUser">
update t_user set account=#{account},
<if test="organId != null and organId != ''">
organ_id=#{organId},
</if>
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="employeeId != null and employeeId != ''">
employee_id=#{employeeId},
</if>
<if test="email != null ">
email=#{email},
</if>
<if test="cellphone != null ">
cellphone=#{cellphone},
</if>
<if test="qq != null and qq != ''">
qq=#{qq},
</if>
<if test="latestTime != null and latestTime !=''">
latest_time=#{latestTime},
</if>
<if test="latestIp != null and latestIp !=''">
latest_ip=#{latestIp},
</if>
<if test="remark!=null ">
remark = #{remark},
</if>
<if test="birth != null and birth !=''">
birth=#{birth},
</if>
<if test="author != null and author != ''">
author=#{author},
</if>
nick_name=#{nickName}
where user_id=#{userId}
</update>
<!-- 修改用户角色关系 -->
<update id="updateUserRole" parameterType="SysUser">
update t_user_role_rel set
<if test="organId != null and organId != ''">
organ_id=#{organId},
</if>
user_id=#{userId}, role_id=#{sysRole.roleId}
where user_id=#{userId}
</update>
<!-- 批量删除、修改用户状态 -->
<update id="updateStates">
update t_user set status=#{status}
<where>
<if test="list!=null and list.size()>0">
user_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
<!-- 修改密码 -->
<update id="updatePassword" parameterType="SysUser">
update t_user set password = #{password} where user_id=#{userId}
</update>
<update id="deleteUsersByOrgans">
update t_user set status = #{status}
<where>
<if test="list!=null and list.size()>0">
organ_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
<update id="deleteUserRoleByOrgan">
update t_user_role_rel set status = #{status}
<where>
<if test="list!=null and list.size()>0">
organ_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
<!-- 删除角色下的所有用户 -->
<update id="deleteUsersByIds">
update t_user set status = #{status}
<where>
<!--<if test="list!=null and list.size()>0">-->
user_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
<!--</if>-->
</where>
</update>
<!-- 批量删除角色账号关系 -->
<update id="deleteBatchUserRole">
update t_user_role_rel set status = #{status}
<where>
<if test="list!=null and list.size()>0">
role_id in
<foreach collection="list" item="ids" index="index"
open="(" separator="," close=")">#{ids}
</foreach>
</if>
</where>
</update>
</mapper>

View File

@@ -0,0 +1,126 @@
package com.fibo.ddp.common.dao.canal;
/**
* 缓存数据同步表
*/
public enum TableEnum {
/**
* 引擎
*/
T_ENGINE("t_engine", "id", ""),
T_ENGINE_VERSION("t_engine_version", "version_id", "engine_id"),
T_ENGINE_NODE("t_engine_node", "node_id", "version_id"),
/**
* 指标
*/
T_FIELD("t_field", "id", ""),
T_FIELD_INTERFACE("t_field_interface", "id", ""),
T_FIELD_DATA_SOURCE("t_field_data_source", "id", ""),
/**
* 规则
*/
T_RULE("t_rule", "id", ""),
T_RULE_VERSION("t_rule_version", "id", "rule_id"),
T_RULE_CONDITION("t_rule_condition", "id", "version_id"),
T_RULE_LOOP_GROUP_ACTION("t_rule_loop_group_action", "id", "condition_for_id"),
/**
* 评分卡
*/
T_SCORECARD("t_scorecard", "id", ""),
T_SCORECARD_VERSION("t_scorecard_version", "id", "scorecard_id"),
T_SCORECARD_DIMENSION("t_scorecard_dimension", "id", "version_id"),
T_SCORECARD_DETAIL("t_scorecard_detail", "id", "dimension_id"),
T_SCORECARD_DETAIL_CONDITION("t_scorecard_detail_condition", "id", "detail_id"),
/**
* 决策表
*/
T_DECISION_TABLES("t_decision_tables", "id", ""),
T_DECISION_TABLES_VERSION("t_decision_tables_version", "id", "decision_tables_id"),
T_DECISION_TABLES_DETAIL("t_decision_tables_detail", "id", "version_id"),
T_DECISION_TABLES_DETAIL_CONDITION("t_decision_tables_detail_condition", "id", "detail_id"),
T_DECISION_TABLES_RESULT("t_decision_tables_result", "id", "version_id"),
/**
* 决策树
*/
T_DECISION_TREE("t_decision_tree", "id", ""),
T_DECISION_TREE_VERSION("t_decision_tree_version", "id", "decision_tree_id"),
T_DECISION_TREE_DETAIL("t_decision_tree_detail", "id", "decision_tree_version_id"),
T_DECISION_TREE_DETAIL_CONDITION("t_decision_tree_detail_condition", "id", "detail_id"),
/**
* 模型
*/
T_MACHINE_LEARNING_MODELS("t_machine_learning_models", "id", ""),
/**
* 策略输出
*/
T_STRATEGY_OUTPUT("t_strategy_output", "id", "strategy_id"),
/**
* 集合规则
*/
T_LIST_OPERATION("t_list_operation","id",""),
T_LIST_OPERATION_VERSION("t_list_operation_version","id","list_op_id"),
T_LIST_OPERATION_BLOCK("t_list_operation_block","id","list_op_version_id"),
T_LIST_OPERATION_CONDITION("t_list_operation_condition","id","list_op_version_id"),
T_LIST_OPERATION_FILTER_CONDITION("t_list_operation_filter_condition","id","list_op_version_id"),
T_LIST_OPERATION_OUTPUT("t_list_operation_output","id","list_op_version_id"),
/**
* 数据清洗
*/
T_DATA_CLEAN("t_data_clean","id",""),
T_DATA_CLEAN_VERSION("t_data_clean_version","id","data_clean_id"),
T_DATA_CLEAN_ORIGINAL_DATA_OP("t_data_clean_original_data_op","id","data_clean_version_id"),
T_DATA_CLEAN_BLOCK("t_data_clean_block","id","data_clean_version_id"),
T_DATA_CLEAN_CONDITION("t_data_clean_condition","id","data_clean_version_id"),
T_DATA_CLEAN_FILTER_CONDITION("t_data_clean_filter_condition","id","data_clean_version_id"),
T_DATA_CLEAN_OUTPUT("t_data_clean_output","id","data_clean_version_id");
private String tableName;
private String primaryId;
private String foreignId;
TableEnum(String tableName, String primaryId, String foreignId) {
this.tableName = tableName;
this.primaryId = primaryId;
this.foreignId = foreignId;
}
public static TableEnum getByTableName(String tableName) {
for (TableEnum tableEnum : TableEnum.values()) {
if (tableName.equals(tableEnum.getTableName())) {
return tableEnum;
}
}
return null;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getPrimaryId() {
return primaryId;
}
public void setPrimaryId(String primaryId) {
this.primaryId = primaryId;
}
public String getForeignId() {
return foreignId;
}
public void setForeignId(String foreignId) {
this.foreignId = foreignId;
}
}

View File

@@ -0,0 +1,18 @@
package com.fibo.ddp.common.dao.cignacmb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.cignacmb.BusinessEventLog;
import com.fibo.ddp.common.model.cignacmb.request.EventLogParam;
import com.fibo.ddp.common.model.cignacmb.response.EventLogResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface BusinessEventLogMapper extends BaseMapper<BusinessEventLog> {
/**
* 查询指定行数据
*/
List<EventLogResponse> queryAllByLimit(EventLogParam param);
}

View File

@@ -0,0 +1,76 @@
<?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="com.fibo.ddp.common.dao.cignacmb.BusinessEventLogMapper">
<resultMap type="com.fibo.ddp.common.model.cignacmb.BusinessEventLog" id="TBusinessEventLogMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="batchNo" column="batch_no" jdbcType="VARCHAR"/>
<result property="eventRequestId" column="event_request_id" jdbcType="VARCHAR"/>
<result property="eventId" column="event_id" jdbcType="VARCHAR"/>
<result property="eventName" column="event_name" jdbcType="VARCHAR"/>
<result property="businessName" column="business_name" jdbcType="VARCHAR"/>
<result property="businessCode" column="business_code" jdbcType="VARCHAR"/>
<result property="businessChildName" column="business_child_name" jdbcType="VARCHAR"/>
<result property="businessChildCode" column="business_child_code" jdbcType="VARCHAR"/>
<result property="templateId" column="template_id" jdbcType="VARCHAR"/>
<result property="templateName" column="template_name" jdbcType="VARCHAR"/>
<result property="customerName" column="customer_name" jdbcType="VARCHAR"/>
<result property="customerMobile" column="customer_mobile" jdbcType="VARCHAR"/>
<result property="policyNo" column="policy_no" jdbcType="VARCHAR"/>
<result property="sendPlatform" column="send_platform" jdbcType="VARCHAR"/>
<result property="callStartTime" column="call_start_time" jdbcType="TIMESTAMP"/>
<result property="callEndTime" column="call_end_time" jdbcType="TIMESTAMP"/>
<result property="callTime" column="call_time" jdbcType="INTEGER"/>
<result property="callStatus" column="call_status" jdbcType="INTEGER"/>
<result property="ruleLogIds" column="rule_log_ids" jdbcType="VARCHAR"/>
<result property="organId" column="organ_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultType="com.fibo.ddp.common.model.cignacmb.response.EventLogResponse">
select
id,
batch_no,
event_request_id,
event_id,
event_name,
business_name,
business_child_name,
template_id,
template_name,
customer_name,
customer_mobile,
policy_no,
send_platform,
call_start_time,
call_time,
call_status,
rule_log_ids,
organ_id
from t_business_event_log
<where>
<if test="eventRequestId != null and eventRequestId != ''">
and event_request_id like CONCAT('%',#{eventRequestId},'%')
</if>
<if test="businessName != null and businessName != ''">
and business_name like CONCAT('%',#{businessName},'%')
</if>
<if test="businessChildName != null and businessChildName != ''">
and business_child_name like CONCAT('%',#{businessChildName},'%')
</if>
<if test="templateId != null and templateId != ''">
and template_id like CONCAT('%',#{templateId},'%')
</if>
<if test="startTime != null and endTime != null">
and create_time between #{startTime} and #{endTime}
</if>
<if test="organId != null">
and organ_id = #{organId}
</if>
</where>
order by id desc
</select>
</mapper>

View File

@@ -0,0 +1,27 @@
package com.fibo.ddp.common.dao.cignacmb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.cignacmb.BusinessRuleLog;
import com.fibo.ddp.common.model.cignacmb.request.RuleLogParam;
import com.fibo.ddp.common.model.cignacmb.response.EventLogDetailResponse;
import com.fibo.ddp.common.model.cignacmb.response.RuleLogResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface BusinessRuleLogMapper extends BaseMapper<BusinessRuleLog> {
/**
* 查询指定行数据
*/
List<RuleLogResponse> queryAllByLimit(RuleLogParam param);
/**
* 根据ids查询规则事件规则输出详情
* @param ruleLogIds
* @return
*/
List<EventLogDetailResponse> queryByIds(@Param("ids") List<String> ids);
}

View File

@@ -0,0 +1,85 @@
<?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="com.fibo.ddp.common.dao.cignacmb.BusinessRuleLogMapper">
<resultMap type="com.fibo.ddp.common.model.cignacmb.BusinessRuleLog" id="BusinessRuleLogMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="batchNo" column="batch_no" jdbcType="VARCHAR"/>
<result property="ruleName" column="rule_name" jdbcType="VARCHAR"/>
<result property="ruleCode" column="rule_code" jdbcType="VARCHAR"/>
<result property="ruleType" column="rule_type" jdbcType="VARCHAR"/>
<result property="businessName" column="business_name" jdbcType="VARCHAR"/>
<result property="businessCode" column="business_code" jdbcType="VARCHAR"/>
<result property="businessChildName" column="business_child_name" jdbcType="VARCHAR"/>
<result property="businessChildCode" column="business_child_code" jdbcType="VARCHAR"/>
<result property="ruleDescription" column="rule_description" jdbcType="VARCHAR"/>
<result property="executeSwitch" column="execute_switch" jdbcType="INTEGER"/>
<result property="organId" column="organ_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="ruleResult" column="rule_result" jdbcType="VARCHAR"/>
<result property="validStartTime" column="valid_start_time" jdbcType="TIMESTAMP"/>
<result property="validEndTime" column="valid_end_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultType="com.fibo.ddp.common.model.cignacmb.response.RuleLogResponse">
select
count(rule_code) executeNum,
rule_code,
rule_name,
rule_type,
business_name,
business_code,
business_child_name,
business_child_code,
rule_description,
execute_switch,
valid_start_time,
valid_end_time,
organ_id
from t_business_rule_log
<where>
<if test="ruleCode != null and ruleCode != ''">
and rule_code like CONCAT('%',#{ruleCode},'%')
</if>
<if test="ruleName != null and ruleName != ''">
and rule_name like CONCAT('%',#{ruleName},'%')
</if>
<if test="ruleType != null and ruleType != ''">
and rule_type like CONCAT('%',#{ruleType},'%')
</if>
<if test="businessName != null and businessName != ''">
and business_name like CONCAT('%',#{businessName},'%')
</if>
<if test="businessChildName != null and businessChildName != ''">
and business_child_name like CONCAT('%',#{businessChildName},'%')
</if>
<if test="startTime != null and endTime != null">
and create_time between #{startTime} and #{endTime}
</if>
<if test="organId != null">
and organ_id = #{organId}
</if>
</where>
group by rule_code
</select>
<select id="queryByIds" resultType="com.fibo.ddp.common.model.cignacmb.response.EventLogDetailResponse">
select
rule_code,
rule_name,
rule_type,
rule_description,
execute_switch,
valid_start_time,
valid_end_time,
rule_result
from t_business_rule_log
where id in
<foreach collection="ids" item="id" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.cignacmb;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.cignacmb.TBusinessRuleRel;
/**
* <p>
* 业务类型与规则关联表 Mapper 接口
* </p>
*
* @author oldRose
* @since 2021-11-10
*/
public interface TBusinessRuleRelMapper extends BaseMapper<TBusinessRuleRel> {
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.cignacmb.TBusinessRuleRelMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.common.message.template;
import com.fibo.ddp.common.model.common.message.template.entity.AppTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* APP推送模板表(AppTemplate)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:11:16
*/
@Mapper
public interface AppTemplateMapper extends BaseMapper<AppTemplate>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.common.message.template.AppTemplateMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.common.message.template;
import com.fibo.ddp.common.model.common.message.template.entity.MessageSendRecord;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 消息发送记录表(MessageSendRecord)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:13:24
*/
@Mapper
public interface MessageSendRecordMapper extends BaseMapper<MessageSendRecord>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.common.message.template.MessageSendRecordMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.common.message.template;
import com.fibo.ddp.common.model.common.message.template.entity.SmsTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 短信模板表(SmsTemplate)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:11:16
*/
@Mapper
public interface SmsTemplateMapper extends BaseMapper<SmsTemplate>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.common.message.template.SmsTemplateMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.common.message.template;
import com.fibo.ddp.common.model.common.message.template.entity.WebhookTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* webhook模板表(WebhookTemplate)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:12:03
*/
@Mapper
public interface WebhookTemplateMapper extends BaseMapper<WebhookTemplate>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.common.message.template.WebhookTemplateMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.common.message.template;
import com.fibo.ddp.common.model.common.message.template.entity.WechatTemplate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 微信服务号模板表(WechatTemplate)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:11:16
*/
@Mapper
public interface WechatTemplateMapper extends BaseMapper<WechatTemplate>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.common.message.template.WechatTemplateMapper">
</mapper>

View File

@@ -0,0 +1,18 @@
package com.fibo.ddp.common.dao.datax.datainterface;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datainterface.InterfaceInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface InterfaceMapper extends BaseMapper<InterfaceInfo> {
int updateStatus(@Param(value = "ids") Long[] ids, @Param(value = "status") Integer status);
List<InterfaceInfo> queryInterfaceList(InterfaceInfo interfaceInfo);
List<InterfaceInfo> queryLimit(@Param(value = "start") int start, @Param(value = "size") int size);
}

View File

@@ -0,0 +1,75 @@
<?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="com.fibo.ddp.common.dao.datax.datainterface.InterfaceMapper">
<resultMap type="com.fibo.ddp.common.model.datax.datainterface.InterfaceInfo" id="InterfaceMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="url" column="url" jdbcType="VARCHAR"/>
<result property="method" column="method" jdbcType="VARCHAR"/>
<result property="requestHeaders" column="request_headers" jdbcType="VARCHAR"/>
<result property="requestBody" column="request_body" jdbcType="VARCHAR"/>
<result property="responseBody" column="response_body" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="creator" column="creator" jdbcType="INTEGER"/>
<result property="modifier" column="modifier" jdbcType="INTEGER"/>
<result property="organId" column="organ_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="requestType" column="request_type" jdbcType="VARCHAR"/>
</resultMap>
<update id="updateStatus">
update riskmanage.t_field_interface set status = #{status}
where id in
<foreach collection="ids" item="interfaceId" open="(" separator="," close=")">
#{interfaceId}
</foreach>
</update>
<!--查询单个-->
<select id="queryLimit" resultMap="InterfaceMap">
select *
from riskmanage.t_field_interface
limit #{start},#{size}
</select>
<select id="queryInterfaceList" parameterType="com.fibo.ddp.common.model.datax.datainterface.InterfaceInfo" resultMap="InterfaceMap">
select *
from riskmanage.t_field_interface
<where>
<if test="id != null">
and id = #{id}
</if>
<if test="name != null and name != ''">
and name = #{name}
</if>
<if test="url != null and url != ''">
and url = #{url}
</if>
<if test="method != null and method != ''">
and method = #{method}
</if>
<if test="request_headers != null">
and request_headers = #{request_headers}
</if>
<if test="request_body != null">
and request_body = #{request_body}
</if>
<if test="response_body != null">
and response_body = #{response_body}
</if>
<if test="creator != null">
and creator = #{creator}
</if>
<if test="modifier != null">
and modifier = #{modifier}
</if>
<if test="organ_id != null">
and organ_id = #{organ_id}
</if>
</where>
</select>
</mapper>

View File

@@ -0,0 +1,89 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.CustList;
import java.util.List;
import java.util.Map;
public interface CustListMapper extends BaseMapper<CustList> {
/**
* findCustList:(查找黑/白名单库的客户名单列表). <br/>
* @param paramMap 参数集合
* @return
* */
public List<CustList> findCustList(Map<String, Object> paramMap);
/**
* checkDupCustList:(根据输入的客户信息参数在黑(白)名单库里查找是否存在). <br/>
* @param paramMap 参数集合
* @return 存在的结果
* */
public int checkDupCustList(Map<String, Object> paramMap);
/**
* importOneCustList:(导入一条黑(白)名单客户信息数据). <br/>
* @param paramMap 参数集合
* @return 存在的结果
* */
public int importOneCustList(CustList custList);
/**
* findValidColumnData:(导出黑/白名单库的客户名单列表). <br/>
* @param paramMap 参数集合
* @return
* */
public List<CustList> findValidColumnData(Map<String, Object> paramMap);
/**
* searchTop4Column:(查找黑/白名单库的客户名单前4列数据列表). <br/>
* @param paramMap 参数集合
* @return
* */
public List<CustList> searchTop4Column(Map<String, Object> paramMap);
/**
* findById:(根据黑/白名单库的客户id查找客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public CustList findById(Map<String, Object> paramMap);
/**
* createCustList:(新增黑/白名单的客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public boolean createCustList(Map<String, Object> paramMap);
/**
* updateCustList:(修改黑/白名单的客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public boolean updateCustList(Map<String, Object> paramMap);
/**
* deleteCustList:(删除黑/白名单的客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public boolean deleteCustList(Map<String, Object> paramMap);
/**
* findByQueryKey:(按照黑/白名单的查询key检索命中的客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public Integer findByQueryKey(Map<String, Object> paramMap);
/**
* revFindByQueryKey:(黑/白名单模糊搜索时补充按照查询key反向检索命中的客户信息). <br/>
* @param paramMap 参数集合
* @return
* */
public Integer revFindByQueryKey(Map<String, Object> paramMap);
}

View File

@@ -0,0 +1,121 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.CustListMapper">
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.CustList" id="custListMap">
<id column="id" property="id"/>
<result column="t0" property="t0"/>
<result column="t1" property="t1"/>
<result column="t2" property="t2"/>
<result column="t3" property="t3"/>
<result column="t4" property="t4"/>
<result column="t5" property="t5"/>
<result column="t6" property="t6"/>
<result column="t7" property="t7"/>
<result column="t8" property="t8"/>
<result column="t9" property="t9"/>
<result column="t10" property="t10"/>
<result column="t11" property="t11"/>
<result column="t12" property="t12"/>
<result column="t13" property="t13"/>
<result column="t14" property="t14"/>
<result column="t15" property="t15"/>
<result column="t16" property="t16"/>
<result column="t17" property="t17"/>
<result column="t18" property="t18"/>
<result column="t19" property="t19"/>
<result column="userId" property="userId"/>
<result column="created" property="created"/>
<result column="nick_name" property="nickName"/>
<result column="tableName" property="tableName"/>
</resultMap>
<select id="findCustList" parameterType="map" resultMap="custListMap">
select id,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,user_id as userId,created
from ${tableName}
</select>
<select id="searchTop4Column" parameterType="map" resultMap="custListMap">
select ${colTop4Array}
from ${tableName}
where t0 like '%${searchKey}%'
or t1 like '%${searchKey}%'
or t2 like '%${searchKey}%'
or t3 like '%${searchKey}%'
order by created desc
</select>
<select id="findValidColumnData" parameterType="map" resultMap="custListMap">
select ${validColArray}
from ${tableName}
</select>
<select id="findById" parameterType="map" resultMap="custListMap">
select ${fieldName}
from ${tableName}
where id = #{id}
</select>
<select id="findByQueryKey" parameterType="map" resultType="java.lang.Integer">
select count(1)
from ${tableName}
where ${queryKey}
</select>
<select id="revFindByQueryKey" parameterType="map" resultType="java.lang.Integer">
select ${revQueryKey}
from ${tableName}
</select>
<insert id="createCustList" useGeneratedKeys="true" keyProperty="id" parameterType="custList">
insert into ${tableName}
( t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19
, user_id, created, nick_name )
values ( #{t0}, #{t1}, #{t2}, #{t3}, #{t4}
, #{t5}, #{t6}, #{t7}, #{t8}, #{t9}
, #{t10}, #{t11}, #{t12}, #{t13}, #{t14}
, #{t15}, #{t16}, #{t17}, #{t18}, #{t19}
, #{userId}, now(), #{nickName} )
</insert>
<update id="updateCustList" parameterType="map">
update ${tableName}
set t0 = #{t0}, t1 = #{t1}, t2 = #{t2}, t3 = #{t3}, t4 = #{t4}
, t5 = #{t5}, t6 = #{t6}, t7 = #{t7}, t8 = #{t8}, t9 = #{t9}
, t10 = #{t10}, t11 = #{t11}, t12 = #{t12}, t13 = #{t13}, t14 = #{t14}
, t15 = #{t15}, t16 = #{t16}, t17 = #{t17}, t18 = #{t18}, t19 = #{t19}
, user_id = #{userId}, created = now()
where id = #{id}
</update>
<delete id="deleteCustList" parameterType="map" >
delete from ${tableName}
where id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<select id="checkDupCustList" parameterType="map" resultType="java.lang.Integer">
select count(1)
from ${tableName}
where ${checkCol}
</select>
<insert id="importOneCustList" useGeneratedKeys="true" keyProperty="id" parameterType="custList">
insert into ${tableName}
( t0, t1, t2, t3, t4, t5, t6, t7, t8, t9
, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19
, user_id, created, nick_name )
values ( #{t0}, #{t1}, #{t2}, #{t3}, #{t4}
, #{t5}, #{t6}, #{t7}, #{t8}, #{t9}
, #{t10}, #{t11}, #{t12}, #{t13}, #{t14}
, #{t15}, #{t16}, #{t17}, #{t18}, #{t19}
, #{userId}, now(), #{nickName} )
</insert>
</mapper>

View File

@@ -0,0 +1,25 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.FieldCall;
import com.fibo.ddp.common.model.datax.datamanage.FieldCallLog;
import com.fibo.ddp.common.model.datax.datamanage.request.FieldCallParam;
import java.util.List;
/**
* (FieldCallLog)表数据库访问层
*
* @author jgp
* @since 2021-12-08 14:18:29
*/
public interface FieldCallLogMapper extends BaseMapper<FieldCallLog> {
List<FieldCall> findFieldCallList(FieldCallParam param);
List<FieldCallLog> findFieldCallLogList(FieldCallParam param);
List<FieldCall> findFieldCallCountList(FieldCallParam param);
}

View File

@@ -0,0 +1,123 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldCallLogMapper">
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.FieldCallLog" id="FieldCallLogMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="fieldId" column="field_id" jdbcType="INTEGER"/>
<result property="inputParam" column="input_param" jdbcType="VARCHAR"/>
<result property="fieldValue" column="field_value" jdbcType="VARCHAR"/>
<result property="duration" column="duration" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<select id="findFieldCallList" parameterType="com.fibo.ddp.common.model.datax.datamanage.FieldCallLog"
resultType="com.fibo.ddp.common.model.datax.datamanage.FieldCall">
select f.id
, r.id as fieldRelId
, f.field_en as fieldEn
, f.field_cn as fieldCn
, f.field_typeid as fieldTypeId
, f.value_type as valueType
, f.value_scope as valueScope
, p.field_type as fieldType
, f.is_derivative
, f.is_output
, f.is_common
, f.formula
, f.formula_show
, f.used_fieldid
, f.orig_fieldid
, f.author
, f.is_use_sql
, f.data_source_id
, f.sql_statement
, f.sql_variable
, f.is_interface
, f.interface_id
, f.interface_parse_field
, f.json_value
,f.dict_variable
,IFNULL(fclog.callCount,0) AS call_count
from t_field f
inner JOIN t_field_user_rel r on f.id = r.field_id and r.status = 1 and r.organ_id = #{organId}
inner JOIN t_field_type p on f.field_typeid = p.id
left JOIN (select field_id,count(1) AS callCount from t_field_call_log
<where>
<if test="fieldId!=null">
and field_id = #{fieldId}
</if>
<if test="queryTimeStart!=null">
and create_time &gt;= #{queryTimeStart}
</if>
<if test="queryTimeEnd!=null">
and create_time &lt;= #{queryTimeEnd}
</if>
</where>
group by field_id) fclog on f.id = fclog.field_id
<where>
<if test="searchKey != null and searchKey != ''">
and f.field_cn like '%${searchKey}%'
</if>
<if test="fieldId != null">
and f.id != #{fieldId}
</if>
<if test="fieldType == 1">
AND f.is_use_sql = FALSE
AND f.is_derivative = FALSE
AND f.is_interface = FALSE
</if>
<if test="fieldType == 2">
AND f.is_use_sql = TRUE
</if>
<if test="fieldType == 3">
AND f.is_derivative = TRUE
</if>
<if test="fieldType == 4">
AND f.is_interface = TRUE
</if>
<if test="fieldType == 5">
AND p.type = 5
</if>
</where>
ORDER BY call_count DESC, f.created DESC
</select>
<select id="findFieldCallLogList" parameterType="com.fibo.ddp.common.model.datax.datamanage.FieldCallLog"
resultType="com.fibo.ddp.common.model.datax.datamanage.FieldCallLog">
select id, field_id,field_type,source_type,source_id,field_value,input_param,duration,create_time,update_time
from t_field_call_log
<where>
<if test="fieldId!=null">
and field_id = #{fieldId}
</if>
<if test="queryTimeStart!=null">
and create_time &gt;= #{queryTimeStart}
</if>
<if test="queryTimeEnd!=null">
and create_time &lt;= #{queryTimeEnd}
</if>
</where>
ORDER BY id DESC
</select>
<select id="findFieldCallCountList" parameterType="com.fibo.ddp.common.model.datax.datamanage.FieldCallLog"
resultType="com.fibo.ddp.common.model.datax.datamanage.FieldCall">
select fclog.callCount,f.field_cn,f.field_en,fclog.field_id from (select field_id,count(1) AS callCount from
t_field_call_log
<where>
<if test="fieldId!=null">
and field_id = #{fieldId}
</if>
<if test="queryTimeStart!=null">
and create_time &gt;= #{queryTimeStart}
</if>
<if test="queryTimeEnd!=null">
and create_time &lt;= #{queryTimeEnd}
</if>
</where>
group by field_id limit 10)fclog inner join t_field f on f.id = fclog.field_id
ORDER BY fclog.callCount DESC
</select>
</mapper>

View File

@@ -0,0 +1,34 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.FieldCond;
import java.util.List;
public interface FieldCondMapper extends BaseMapper<FieldCond> {
/**
* createFieldCond:(生成条件关系). <br/>
*
* @param
* @return 字段列表
*/
public boolean createFieldCond(List<FieldCond> fieldCondVoList);
/**
* deleteFieldCondById:(删除字段的条件设置). <br/>
*
* @param
* @return 是否删除成功
*/
public boolean deleteFieldCondById(Long id);
/**
* getFieldCondList:(找出字段条件设置(去重)). <br/>
*
* @param
* @return 字段列表
*/
public List<FieldCond> getFieldCondList(Long fieldId);
}

View File

@@ -0,0 +1,41 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldCondMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.FieldCond" id="fieldCondMap">
<id column="id" property="id"/>
<result column="field_id" property="fieldId"/>
<result column="condition_value" property="conditionValue"/>
<result column="content" property="content"/>
<result column="cond_field_id" property="condFieldId"/>
<result column="cond_field_operator" property="condFieldOperator"/>
<result column="cond_field_value" property="condFieldValue"/>
<result column="cond_field_logical" property="condFieldLogical"/>
<result column="created" property="created"/>
</resultMap>
<insert id="createFieldCond" parameterType="java.util.List">
insert into t_field_condition ( field_id, condition_value, content
, cond_field_id, cond_field_operator, cond_field_value, cond_field_logical
, created)
values
<foreach collection="list" item="fieldCond" index="index" separator=",">
( #{fieldCond.fieldId}, #{fieldCond.conditionValue}, #{fieldCond.content}
, #{fieldCond.condFieldId}, #{fieldCond.condFieldOperator}, #{fieldCond.condFieldValue},
#{fieldCond.condFieldLogical}
, now() )
</foreach>
</insert>
<delete id="deleteFieldCondById" parameterType="java.lang.Long">
delete from t_field_condition where field_id = #{id}
</delete>
<select id="getFieldCondList" parameterType="long" resultType="fieldCond">
select field_id as fieldId, condition_value as conditionValue, content
from t_field_condition
where field_id = #{id}
group by field_id,condition_value,content
</select>
</mapper>

View File

@@ -0,0 +1,170 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.common.requestParam.UpdateFolderParam;
import com.fibo.ddp.common.model.datax.datamanage.Field;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Map;
public interface FieldMapper extends BaseMapper<Field> {
/**
* findByFieldType:(根据字段类型名找出该用户可用的字段列表). <br/>
*
* @param paramMap 参数集合
* @return 字段列表
*/
public List<Field> findByFieldType(Map<String, Object> paramMap);
/**
* checkField:(查找引用该字段的所有字段). <br/>
*
* @param paramMap 参数集合
* @return 字段id逗号分隔字符串
*/
public String checkField(Map<String, Object> paramMap);
/**
* getSourceField:(查找构成该字段的子字段及原生字段). <br/>
*
* @param paramMap 参数集合
* @return
*/
public String getSourceField(Map<String, Object> paramMap);
/**
* findFieldTypeIdsByFieldId:(在引擎里找出一批字段id对应的唯一字段类型id串). <br/>
*
* @param paramMap 参数集合
* @return 字段类型id逗号分隔字符串
*/
public String findFieldTypeIdsByFieldId(Map<String, Object> paramMap);
/**
* findOrgFieldTypeIdsByIds:(在通用字段里找出一批字段id对应的唯一字段类型id串). <br/>
*
* @param paramMap 参数集合
* @return 字段类型id逗号分隔字符串
*/
public String findOrgFieldTypeIdsByIds(Map<String, Object> paramMap);
/**
* findFieldByIdsForCheckField:(找出一批字段id的字段列表包含引擎引用的通用字段engineId为空是不加engineId=null条件). <br/>
*
* @param paramMap 参数集合
* @return 字段列表
*/
public List<Field> findFieldByIdsForCheckField(Map<String, Object> paramMap);
/**
* findByFieldName:(根据字段英文或中文名找出字段对象). <br/>
*
* @param paramMap 参数集合
* @return 字段对象
*/
public Field findByFieldName(Map<String, Object> paramMap);
/**
* findByFieldCn:(根据字段中文名找出字段对象). <br/>
*
* @param paramMap 参数集合
* @return 字段对象
*/
public Field findByFieldCn(Map<String, Object> paramMap);
/**
* findByUser:(找出该用户可用字段列表). <br/>
*
* @param paramMap 参数集合
* @return 字段类型列表
*/
public List<Field> findByUser(Map<String, Object> paramMap);
/**
* findByFieldId:(根据字段Id查找字段对象). <br/>
*
* @param paramMap 参数集合
* @return 字段对象
*/
public Field findByFieldId(Map<String, Object> paramMap);
/**
* createField:(添加字段). <br/>
*
* @param fieldVo 字段实体对象
* @return 插入是否成功
*/
public boolean createField(Field fieldVo);
/**
* batchCreateField:(批量添加字段). <br/>
*
* @param fieldVoList 字段实体对象list集合
* @return 字段类型列表
*/
public boolean batchCreateField(List<Field> fieldVoList);
/**
* updateField:(修改字段). <br/>
*
* @param paramMap 参数集合
* @return 更新是否成功
*/
public boolean updateField(Map<String, Object> paramMap);
/**
* isExists:(根据字段英文或中文名查找字段是否存在). <br/>
*
* @param paramMap 参数集合
* @return 存在的记录条数
*/
public int isExists(Map<String, Object> paramMap);
/**
* getFieldList:(获取组织的所有字段). <br/>
*
* @param paramMap 参数集合
* @return
*/
public List<Field> getFieldList(Map<String, Object> paramMap);
public String findFieldNameById(Long fieldId);
int updateFieldFolder(UpdateFolderParam param);
List<Field> selectByIds(@Param("ids") Collection<Long> ids);
List<Field> selectByEns(@Param("ens") Collection<String> ens);
List<Field> selectByOrganCns(@Param("cns") Collection<String> cns, @Param("organId") Long organId);
// runner
/**
* findFieldByIds:(找出一批字段id对应的字段列表). <br/>
* @param paramMap 参数集合
* @return 字段列表
*/
public List<Field> findFieldByIdsbyorganId(Map<String, Object> paramMap);
/**
* findByFieldEn:(根据引擎和字段英文名找出引擎所用字段对象). <br/>
* @param paramMap 参数集合
* @return 字段对象
*/
public Field findByFieldEnbyorganId(Map<String, Object> paramMap);
/**
* findByFieldCn:(根据字段中文名找出字段对象). <br/>
* @param paramMap 参数集合
* @return 字段对象
*/
public Field findByFieldCnbyorganId(Map<String, Object> paramMap);
List<Field> selectFieldListByEns(@Param("ens")List<String> ens);
}

View File

@@ -0,0 +1,563 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.Field" id="fieldMap">
<id column="id" property="id"/>
<result column="field_en" property="fieldEn"/>
<result column="field_cn" property="fieldCn"/>
<result column="field_typeid" property="fieldTypeId"/>
<result column="value_type" property="valueType"/>
<result column="value_scope" property="valueScope"/>
<result column="is_derivative" property="isDerivative"/>
<result column="is_output" property="isOutput"/>
<result column="is_common" property="isCommon"/>
<result column="formula" property="formula"/>
<result column="formula_show" property="formulaShow"/>
<result column="orig_fieldid" property="origFieldId"/>
<result column="used_fieldid" property="usedFieldId"/>
<result column="author" property="author"/>
<result column="nickName" property="nickName"/>
<result column="created" property="created"/>
<result column="field_type" property="fieldType"/>
<result column="engine_id" property="engineId"/>
<result column="engineName" property="engineName"/>
<result column="status" property="status"/>
<result column="fieldRelId" property="fieldRelId"/>
<result column="is_use_sql" property="isUseSql"/>
<result column="data_source_id" property="dataSourceId"/>
<result column="sql_statement" property="sqlStatement"/>
<result column="is_interface" property="isInterface"/>
<result column="interface_id" property="interfaceId"/>
<result column="json_value" property="jsonValue"/>
<result column="dict_variable" property="dictVariable"/>
<result column="source_type" property="sourceType"/>
<result column="mq_source_id" property="mqSourceId"/>
<result column="interface_parse_field" property="interfaceParseField"/>
<collection property="fieldCondList" ofType="fieldCond" column="id"
select="com.fibo.ddp.common.dao.datax.datamanage.FieldCondMapper.getFieldCondList"></collection>
</resultMap>
<sql id="Base_Column">
id, field_en, field_cn, field_typeid, value_type, value_scope, is_derivative, is_output, is_common, formula, formula_show, used_fieldid, orig_fieldid, author, created, is_use_sql, data_source_id, sql_statement, sql_variable, is_interface, interface_id, interface_parse_field, json_value,dict_variable,
source_type,mq_source_id
</sql>
<select id="findByFieldType" parameterType="java.util.Map"
resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select f.id, f.field_en as fieldEn, f.field_cn as fieldCn, f.field_typeid as fieldTypeId
, p.field_type as fieldType
, f.value_type as valueType, f.value_scope as valueScope
, f.is_derivative as isDerivative
, f.is_output as isOutput
, f.is_common as isCommon, f.formula, f.formula_show as formulaShow
, f.author, u.nick_name as nickName ,f.created
, r.status
, f.is_use_sql, f.data_source_id, f.sql_statement
,f.is_interface,f.interface_id
,f.interface_parse_field
,f.json_value
,f.dict_variable
,f.mq_source_id
,f.source_type
from t_field f, t_field_user_rel r, t_field_type p, t_user u
where f.id = r.field_id
and f.field_typeid = p.id
and r.user_id = u.user_id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="searchKey != null">
and (f.field_en like '%${searchKey}%' or f.field_cn like '%${searchKey}%' )
</if>
<if test="fieldTypeId == null and engineId == null and isCommon == 1 and status == null">
and r.engine_id is null
and f.is_common = 1
and r.status != -1
</if>
<if test="fieldTypeId != null and engineId == null and isCommon == 1 and status == null">
and f.field_typeid = #{fieldTypeId}
and r.engine_id is null
and f.is_common = 1
and r.status != -1
</if>
<if test="fieldTypeId == null and engineId != null and isCommon == 0 and status == null">
and r.engine_id = #{engineId}
and r.status != -1
</if>
<if test="fieldTypeId == null and engineId != null and isCommon == 1 and status == 1">
and r.engine_id is null
and f.is_common = 1
and r.status = 1
</if>
<if test="fieldTypeId != null and engineId != null and isCommon == 1 and status == 1">
and f.field_typeid = #{fieldTypeId}
and r.engine_id is null
and f.is_common = 1
and r.status = 1
</if>
<if test="fieldTypeId != null and engineId != null and isCommon == 0 and status == null">
and f.field_typeid = #{fieldTypeId}
and r.engine_id = #{engineId}
and r.status != -1
</if>
<if test="fieldTypeId == null and engineId != null and isCommon == 0 and status == -1">
and r.engine_id = #{engineId}
and r.status = -1
</if>
<if test="fType == 1">
AND f.is_use_sql = FALSE
AND f.is_derivative = FALSE
AND f.is_interface = FALSE
AND p.type = 1
</if>
<if test="fType == 2">
AND f.is_use_sql = TRUE
</if>
<if test="fType == 3">
AND f.is_derivative = TRUE
</if>
<if test="fType == 4">
AND f.is_interface = TRUE
</if>
<if test="fType == 5">
AND p.type = 5
</if>
<if test="fType == 6">
AND p.type = 6
</if>
AND f.is_common = 1
<if test="fieldTypeId != null">
AND f.field_typeid = #{fieldTypeId}
</if>
ORDER BY f.created DESC
</select>
<select id="findFieldTypeIdsByFieldId" parameterType="map" resultType="String">
select group_concat(distinct(f.field_typeid)) as parentId
from t_field f,t_field_user_rel r
where f.id = r.field_id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and r.engine_id = #{engineId}
and f.id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="findByUser" parameterType="map" resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select f.id
, r.id as fieldRelId
, f.field_en as fieldEn
, f.field_cn as fieldCn
, f.field_typeid as fieldTypeId
, f.value_type as valueType
, f.value_scope as valueScope
, p.field_type as fieldType
, f.is_derivative
, f.is_output
, f.is_common
, f.formula
, f.formula_show
, f.used_fieldid
, f.orig_fieldid
, f.author
, f.is_use_sql
, f.data_source_id
, f.sql_statement
, f.sql_variable
, f.is_interface
, f.interface_id
, f.interface_parse_field
, f.json_value
,f.dict_variable
,f.mq_source_id
,f.source_type
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
and r.status = 1
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="searchKey != null">
and f.field_cn like '%${searchKey}%'
</if>
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
<if test="fieldId != null">
and f.id != #{fieldId}
</if>
ORDER BY f.created DESC
</select>
<select id="findByFieldId" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en, f.field_cn, f.field_typeid
, f.value_type, f.value_scope, f.is_derivative
, f.is_output, f.is_common, f.formula, f.formula_show
, f.orig_fieldid, used_fieldid
, r.engine_id
, p.field_type
, f.is_use_sql
, f.data_source_id
, f.sql_statement
, f.sql_variable
,f.is_interface
,f.interface_id
,f.json_value
,f.interface_parse_field
,f.dict_variable
,f.mq_source_id
,f.source_type
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
and f.id = #{id}
</select>
<select id="findFieldByIdsForCheckField" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en as fieldEn, f.field_cn as fieldCn, f.field_typeid as fieldTypeId
, f.value_type as valueType, f.value_scope as valueScope, f.is_derivative as isDerivative
, f.is_output as isOutput, f.is_common as isCommon, f.formula, f.formula_show as formulaShow
, r.engine_id as engineId, e.name as engineName
, p.field_type as fieldType
,f.is_interface,f.interface_id
,f.interface_parse_field
,f.json_value
,f.dict_variable
,f.mq_source_id
,f.source_type
from t_field f,t_field_type p
,t_field_user_rel r left join t_engine e on (r.engine_id = e.id)
where f.id = r.field_id
and f.field_typeid = p.id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and ( (f.is_common = 0 and r.engine_id is not null) or (f.is_common = 1 and r.engine_id is null) )
</if>
and f.id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="isExists" parameterType="map" resultType="java.lang.Integer">
select count(f.id)
from t_field f,t_field_user_rel r
where f.id = r.field_id
and r.status != -1
<if test="fieldEn != null">
and f.field_en = #{fieldEn}
</if>
<if test="fieldCn != null">
and f.field_cn = #{fieldCn}
</if>
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
<if test="Id != null">
and f.id != #{Id}
</if>
</select>
<select id="findByFieldName" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en as fieldEn, f.field_cn as fieldCn, f.field_typeid as fieldTypeId
, f.value_type as valueType, f.value_scope as valueScope, f.is_derivative as isDerivative
, f.is_output as isOutput, f.is_common as isCommon, f.formula, f.formula_show as formulaShow
,f.is_interface,f.interface_id
,f.interface_parse_field
,f.json_value
,f.dict_variable
,f.mq_source_id
,f.source_type
from t_field f,t_field_user_rel r
where f.id = r.field_id
and (f.field_en = #{fieldEn} or f.field_cn = #{fieldCn})
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
</select>
<insert id="createField" useGeneratedKeys="true" keyProperty="id"
parameterType="com.fibo.ddp.common.model.datax.datamanage.Field">
insert into t_field ( field_en, field_cn, field_typeid
, value_type, value_scope, is_derivative
, is_output, formula, formula_show, orig_fieldid, used_fieldid
, is_common, author, created, is_use_sql, data_source_id, sql_statement, sql_variable
, is_interface, interface_id, interface_parse_field, json_value, organ_id,dict_variable,source_type,mq_source_id)
values ( #{fieldEn}, #{fieldCn}, #{fieldTypeId}
, #{valueType}, #{valueScope}, #{isDerivative}
, #{isOutput}, #{formula}, #{formulaShow}, #{origFieldId}, #{usedFieldId}
, #{isCommon}, #{author}, now(), #{isUseSql}, #{dataSourceId}, #{sqlStatement}, #{sqlVariable}
, #{isInterface}, #{interfaceId}, #{interfaceParseField}, #{jsonValue}, #{organId},#{dictVariable},#{sourceType},#{mqSourceId})
</insert>
<insert id="batchCreateField" parameterType="java.util.List">
insert into t_field ( field_en, field_cn, field_typeid
, value_type, value_scope, is_derivative
, is_output, formula, formula_show, is_common, author, created,
, is_interface, interface_id, interface_parse_field, json_value,dict_variable,source_type,mq_source_id)
values
<foreach collection="list" item="field" index="index" separator=",">
(
#{field.fieldEn}, #{field.fieldCn}, #{field.fieldTypeId}
, #{field.valueType}, #{field.valueScope}, #{field.isDerivative}
, #{field.isOutput}, #{field.formula}, #{field.formulaShow}, #{field.isCommon}, #{field.author}, now()
, #{isInterface}, #{interfaceId}, #{interfaceParseField},
#{jsonValue},#{dictVariable},#{sourceType},#{mqSourceId}
)
</foreach>
</insert>
<update id="updateField" parameterType="java.util.Map">
update t_field
set field_en = #{fieldEn}, field_cn = #{fieldCn}, field_typeid = #{fieldTypeId}
, value_type = #{valueType}, value_scope = #{valueScope}, is_derivative = #{isDerivative}
, is_output = #{isOutput}, formula = #{formula}, formula_show = #{formulaShow}
, orig_fieldid = #{origFieldId}, used_fieldid = #{usedFieldId}, is_common = #{isCommon}
, is_use_sql = #{isUseSql}, data_source_id = #{dataSourceId}, sql_statement = #{sqlStatement}, sql_variable =
#{sqlVariable}
,is_interface = #{isInterface}, interface_id = #{interfaceId}, interface_parse_field = #{interfaceParseField},
json_value = #{jsonValue},dict_variable = #{dictVariable}
,source_type = #{sourceType},mq_source_id = #{mqSourceId}
where id = #{id}
<!-- where userId = (select field_id-->
<!-- from t_field_user_rel-->
<!-- where organId = ( select organId from t_user where user_id = #{userId} )-->
<!-- <if test="engineId != null">-->
<!-- and engine_id = #{engineId}-->
<!-- </if>-->
<!-- <if test="engineId == null">-->
<!-- and engine_id is null-->
<!-- </if>-->
<!-- and field_id = #{userId}-->
<!-- )-->
</update>
<select id="getFieldList" parameterType="map" resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select
t.id,
t.field_en as fieldEn,
t.field_cn as fieldCn,
t.field_typeid as fieldTypeId,
t.value_type as valueType,
t.value_scope as valueScope,
t.is_output as isOutput,
r.id as fieldRelId,
p.field_type as fieldType
,t.is_interface,t.interface_id
,t.interface_parse_field
,t.json_value
,t.dict_variable
,t.source_type
,t.mq_source_id
from t_field t LEFT JOIN t_field_user_rel r on t.id = r.field_id LEFT JOIN t_field_type p on t.field_typeid =
p.id where r.organ_id = #{organId} and status = 1
<if test="ids != null and ids !=''">
and t.id in (ids)
</if>
<if test="searchKey != null">
and t.field_cn like CONCAT('%',#{searchKey},'%' )
</if>
<if test="isOutput != null">
and t.is_output = #{isOutput}
</if>
<if test="engineId != null and engineId!=''">
and r.engine_id = #{engineId}
</if>
<if test="valueType != null">
and t.value_type = #{valueType}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
</select>
<select id="findByFieldCn" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en, f.field_cn, f.field_typeid
, f.value_type, f.value_scope, f.is_derivative
, f.is_output, f.is_common, f.formula, f.formula_show
, f.orig_fieldid,f.dict_variable ,f.source_type ,f.mq_source_id
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_cn = #{fieldCn}
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
and r.status = 1
</select>
<select id="checkField" parameterType="map" resultType="String">
select group_concat(f.id) as ids
from t_field f,t_field_user_rel r
where f.id = r.field_id
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and r.status = 1 and instr(f.used_fieldid,#{fieldId}) > 0
</select>
<select id="getSourceField" parameterType="map" resultType="String">
select used_fieldid as usedFieldId,orig_fieldid as origFieldId
from t_field f,t_field_user_rel r
where f.id = r.field_id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and f.id = #{fieldId}
and r.engine_id is null
</select>
<select id="findOrgFieldTypeIdsByIds" parameterType="map" resultType="String">
select group_concat(distinct(f.field_typeid))
from t_field f,t_field_user_rel r
where f.id = r.field_id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and f.id in
<foreach collection="fieldIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and r.engine_id is null
</select>
<select id="findFieldNameById" parameterType="long" resultType="string">
select t_field.field_en
from t_field
where id = #{fieldId}
</select>
<update id="updateFieldFolder">
update t_field
set field_typeid = #{folderId}
where id in
<foreach collection="ids" item="id" separator="," open="(" close=")">
#{id}
</foreach>
</update>
<select id="selectByIds" resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select
<include refid="Base_Column"></include>
from t_field
where id in
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
<select id="selectByEns" resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select
<include refid="Base_Column"></include>
from t_field
where field_en in
<foreach collection="ens" open="(" close=")" separator="," item="en">
#{en}
</foreach>
</select>
<select id="selectByOrganCns" resultType="com.fibo.ddp.common.model.datax.datamanage.Field">
select
<include refid="Base_Column"></include>
from t_field
where organ_id = #{organId}
and field_cn in
<foreach collection="cns" open="(" close=")" separator="," item="cn">
#{cn}
</foreach>
</select>
<select id="findFieldByIdsbyorganId" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en , f.field_cn , f.field_typeid
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show
, r.engine_id
, f.orig_fieldid
, p.field_type
, p.type
, f.is_use_sql, f.data_source_id, f.sql_statement, f.sql_variable, f.is_interface
, f.interface_id, f.interface_parse_field, f.json_value, f.dict_variable
,f.source_type,f.mq_source_id
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
and r.organ_id = #{organId}
<if test="isDerivative != null">
and f.is_derivative = #{isDerivative}
</if>
and f.id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="findByFieldEnbyorganId" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en , f.field_cn , f.field_typeid
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show, f.dict_variable
,f.source_type,f.mq_source_id
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_en = #{fieldEn}
and r.organ_id = #{organId}
and r.status = 1
</select>
<select id="findByFieldCnbyorganId" parameterType="map" resultMap="fieldMap">
select f.id, f.field_en , f.field_cn , f.field_typeid
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show
, f.orig_fieldid, f.dict_variable
,f.source_type,f.mq_source_id
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_cn = #{fieldCn}
and r.organ_id = #{organId}
and r.status = 1
</select>
<select id="selectFieldListByEns" parameterType="list" resultMap="fieldMap">
select f.id, f.field_en , f.field_cn , f.field_typeid
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show
, f.orig_fieldid
, p.field_type
, p.type
, f.is_use_sql, f.data_source_id, f.sql_statement, f.sql_variable, f.is_interface
, f.interface_id, f.interface_parse_field, f.json_value, f.dict_variable
,f.source_type,f.mq_source_id
from t_field f,t_field_type p
where f.field_typeid=p.id
and f.field_en in
<foreach collection="ens" item="en" separator="," open="(" close=")" >
#{en}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,77 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.FieldType;
import com.fibo.ddp.common.model.datax.datamanage.request.FieldTreeParam;
import java.util.List;
import java.util.Map;
public interface FieldTypeMapper extends BaseMapper<FieldType> {
/**
* getFieldTypeList:(查找用户的字段类型列表). <br/>
*
* @param paramMap 参数集合
* @return 字段类型列表
*/
public List<FieldType> getFieldTypeList(Map<String, Object> paramMap);
/**
* findTypeIdByParentId:(根据传入的字段类型父ID查找子类型ID). <br/>
*
* @param paramMap 参数集合
* @return 子字段类型ID
*/
public String findTypeIdByParentId(Map<String, Object> paramMap);
/**
* findTypeIdByParentId:(根据传入的字段类型类型ID查找父ID). <br/>
*
* @param paramMap 参数集合
* @return 子字段类型ID
*/
public String findParentIdByTypeId(Map<String, Object> paramMap);
/**
* createFieldType:(新增字段类型). <br/>
*
* @param fieldTypeVo 字段类型实体类
* @return 插入成功
*/
public boolean createFieldType(FieldType fieldTypeVo);
/**
* findIdByFieldType:(新增字段类型). <br/>
*
* @param paramMap paramMap
* @return 字段类型编号
*/
public long findIdByFieldType(Map<String, Object> paramMap);
/**
* updateFieldType:(更新字段类型名). <br/>
*
* @param paramMap 参数集合
* @return 更新成功
*/
public boolean updateFieldType(FieldTreeParam param);
/**
* backFieldTypeByTypeIds:(更新字段类型状态为启用状态(1)). <br/>
*
* @param paramMap 参数集合
* @return 更新成功
*/
public boolean backFieldTypeByTypeIds(Map<String, Object> paramMap);
/**
* isExists:(查找字段名是否存在). <br/>
*
* @param paramMap 参数集合
* @return 存在的记录条数
*/
public int isExists(Map<String, Object> paramMap);
List<FieldType> selectFieldTypeList(FieldTreeParam param);
}

View File

@@ -0,0 +1,131 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldTypeMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.FieldType" id="fieldTypeMap">
<id column="id" property="id"/>
<result column="field_type" property="fieldType"/>
<result column="parent_id" property="parentId"/>
<result column="is_common" property="isCommon"/>
<result column="type" property="type"/>
</resultMap>
<select id="getFieldTypeList" parameterType="map" resultMap="fieldTypeMap">
select t.id ,t.field_type ,t.parent_id ,t.is_common
from t_field_type_user_rel r, t_field_type t
where r.field_typeid = t.id
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="isCommon != null">
and t.is_common = #{isCommon}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="parentId == null">
and t.parent_id = 0
</if>
<if test="parentId != null">
and t.parent_id = #{parentId}
</if>
<if test="status != null">
and r.status = #{status}
</if>
order by t.is_common desc,r.created,t.id
</select>
<select id='findIdByFieldType' parameterType="map" resultType="java.lang.Long">
select IFNULL(MAX(t.id),0) as id
from t_field_type t,t_field_type_user_rel r
where t.id = r.field_typeid
and t.field_type = #{fieldType}
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
<if test="parentId == null">
and t.parent_id = 0
</if>
<if test="parentId != null">
and t.parent_id = #{parentId}
</if>
</select>
<select id='findTypeIdByParentId' parameterType="map" resultType="String">
select group_concat(t.id) as id
from t_field_type t,t_field_type_user_rel r
where t.id = r.field_typeid
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and r.engine_id = #{engineId}
and t.parent_id = #{parentId}
</select>
<select id='findParentIdByTypeId' parameterType="map" resultType="String">
select t.parent_id as parentId
from t_field_type t,t_field_type_user_rel r
where t.id = r.field_typeid
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
and t.id = ${fieldTypeId}
</select>
<insert id="createFieldType" useGeneratedKeys="true" keyProperty="id" parameterType="fieldType">
insert into t_field_type ( field_type, parent_id, is_common ,type)
values ( #{fieldType}, #{parentId}, #{isCommon} ,#{type})
</insert>
<update id="updateFieldType" parameterType="map">
update t_field_type
set field_type = #{fieldType}
where id = #{id}
</update>
<update id="backFieldTypeByTypeIds" parameterType="map">
update t_field_type_user_rel
set status = 1
where organ_id = ( select organ_id from t_user where user_id = #{userId} )
and engine_id = #{engineId}
and field_typeid in
<foreach collection="fieldTypeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and status = -1
</update>
<select id="isExists" parameterType="map" resultType="java.lang.Integer">
select count(ft.id)
from t_field_type ft,t_field_type_user_rel r
where ft.id = r.field_typeid
and r.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and ft.field_type = #{fieldType}
<if test="Id != null">
and ft.id != #{Id}
</if>
<if test="engineId != null">
and r.engine_id = #{engineId}
</if>
<if test="engineId == null">
and r.engine_id is null
</if>
and ft.parent_id = #{parentId}
</select>
<select id="selectFieldTypeList" resultMap="fieldTypeMap">
select id,field_type,parent_id,is_common,`type`
from t_field_type
where id in (select distinct field_typeid from t_field_type_user_rel where organ_id = #{organId} and status !=-1)
and `type` = #{type}
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.FieldTypeUser;
import com.fibo.ddp.common.model.datax.datamanage.request.FieldTreeParam;
import java.util.Map;
public interface FieldTypeUserMapper extends BaseMapper<FieldTypeUser> {
/**
* createFieldTypeUserRel:(新增字段类型). <br/>
*
* @param paramMap 参数集合
* @return 插入成功
*/
public boolean createFieldTypeUserRel(Map<String, Object> paramMap);
/**
* batchBindEngineFieldTypeUserRel:(把一批通用字段类型id中不存在的类型id批量绑定到引擎). <br/>
*
* @param paramMap 参数集合
* @return 插入成功
*/
public boolean batchBindEngineFieldTypeUserRel(Map<String, Object> paramMap);
/**
* updateFieldTypeUserRel:(更新字段类型名). <br/>
*
* @param paramMap 参数集合
* @return 更新成功
*/
public boolean updateFieldTypeUserRel(FieldTreeParam param);
}

View File

@@ -0,0 +1,41 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldTypeUserMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.FieldTypeUser" id="fieldTypeUserMap">
<id column="id" property="id"/>
<result column="field_typeid" property="fieldTypeId"/>
<result column="organ_id" property="organId"/>
<result column="engine_id" property="engineId"/>
<result column="user_id" property="userId"/>
</resultMap>
<insert id="createFieldTypeUserRel" useGeneratedKeys="true" keyProperty="id" parameterType="fieldTypeUser">
insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created )
values ( #{fieldTypeId}, #{organId}, #{engineId}, #{userId}, now() )
</insert>
<insert id="batchBindEngineFieldTypeUserRel" parameterType="map">
insert into t_field_type_user_rel ( field_typeid, organ_id, engine_id, user_id, created )
select field_typeid, organ_id, #{engineId}, #{userId}, now()
from t_field_type_user_rel r
where r.field_typeid in
<foreach collection="fieldTypeIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and field_typeid not in ( select field_typeid from t_field_type_user_rel where engine_id = #{engineId})
and engine_id is null
</insert>
<update id="updateFieldTypeUserRel">
update t_field_type_user_rel
set user_id = #{userId}, created = now()
<if test="status != null">
,status = #{status}
</if>
where organ_id =#{organId}
and field_typeid = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,62 @@
package com.fibo.ddp.common.dao.datax.datamanage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datamanage.FieldUser;
import java.util.List;
import java.util.Map;
public interface FieldUserMapper extends BaseMapper<FieldUser> {
/**
* createFieldUserRel:(绑定字段和用户关系). <br/>
*
* @param fieldUser 用户字段实体类
* @return 插入成功
* */
public boolean createFieldUserRel(FieldUser fieldUserVo);
/**
* batchCreateFieldUserRel:(批量导入字段信息后批量绑定字段和用户关系). <br/>
*
* @param paramMap 参数集合
* @return 插入成功
* */
public boolean batchCreateFieldUserRel(Map<String, Object> paramMap);
/**
* batchBindEngineFieldUserRel:(把一批通用字段id中未绑定的字段id批量绑定到引擎). <br/>
*
* @param paramMap 参数集合
* @return 插入成功
* */
public boolean batchBindEngineFieldUserRel(Map<String, Object> paramMap);
/**
* updateStatus:(单个或批量更新用户字段关系). <br/>
*
* @param paramMap 参数集合
* @return 更新成功
* */
public boolean updateStatus(Map<String, Object> paramMap);
/**
* deleteFieldByIds:(批量修改字段删除状态为启用状态(1)). <br/>
*
* @param paramMap 参数集合
* @return 更新是否成功
*/
public boolean backFieldByIds(Map<String, Object> paramMap);
/**
* 统计组织内指标数
*/
int countFieldByOrganId(Map<String, Object> paramMap);
/**
*
* @param paramMap
* @return
*/
List<Map<String,Object>> countFieldGroupByType(Map<String, Object> paramMap);
}

View File

@@ -0,0 +1,87 @@
<?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="com.fibo.ddp.common.dao.datax.datamanage.FieldUserMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.datax.datamanage.FieldUser" id="fieldUserMap">
<id column="id" property="id"/>
<result column="field_id" property="fieldId"/>
<result column="organ_id" property="organId"/>
<result column="engine_id" property="engineId"/>
<result column="user_id" property="userId"/>
<result column="status" property="status"/>
</resultMap>
<insert id="createFieldUserRel" useGeneratedKeys="true" keyProperty="id" parameterType="fieldUser">
insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated)
values (#{fieldId}, #{organId}, #{engineId}, #{userId}, #{status}, now(), now())
</insert>
<insert id="batchCreateFieldUserRel" parameterType="map">
insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated)
select id, #{organId}, #{engineId}, #{userId}, #{status}, now(), now()
from t_field t
where t.author = #{author}
and not exists ( select r.field_id from t_field_user_rel r where t.id = r.field_id )
</insert>
<insert id="batchBindEngineFieldUserRel" parameterType="map">
insert into t_field_user_rel (field_id, organ_id, engine_id, user_id, status, created, updated)
select id, #{organId}, #{engineId}, #{userId}, 1, now(), now()
from t_field f
where f.id in
<foreach collection="fieldIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and not exists ( select 1
from ( select f.id,f.field_en,f.field_cn
from t_field f,t_field_user_rel fu
where f.id = fu.field_id
and fu.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and fu.engine_id = ${engineId} )y
where f.field_en = y.field_en or f.field_cn = y.field_cn or f.id = y.id
)
</insert>
<update id="updateStatus" parameterType="map">
update t_field_user_rel
set status=#{status}
where organ_id = ( select organ_id from t_user where user_id = #{userId} )
<if test="engineId != null">
and engine_id = #{engineId}
</if>
<if test="engineId == null and status!=-1 and status!=0">
and engine_id is null
</if>
and field_id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</update>
<update id="backFieldByIds" parameterType="map">
update t_field_user_rel
set status = 1
where organ_id = ( select organ_id from t_user where user_id = #{userId} )
and engine_id = #{engineId}
and field_id in
<foreach collection="Ids" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and status = -1
</update>
<select id="countFieldByOrganId" parameterType="map" resultType="int">
select count(distinct tfur.field_id) from t_field_user_rel tfur inner join t_field tf on tfur.field_id = tf.id where tfur.status = 1 and tfur.organ_id = #{organId}
</select>
<select id="countFieldGroupByType" parameterType="map" resultType="map">
select tft.type fieldType,count(distinct tfur.field_id) fieldCount
from t_field_user_rel tfur
inner join t_field tf on tfur.field_id = tf.id
inner join t_field_type tft on tf.field_typeid = tft.id
where tfur.status = 1 and tfur.organ_id = #{organId}
GROUP BY tft.type
</select>
</mapper>

View File

@@ -0,0 +1,9 @@
package com.fibo.ddp.common.dao.datax.datasource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datasource.DataSource;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface DataSourceMapper extends BaseMapper<DataSource> {
}

View File

@@ -0,0 +1,15 @@
package com.fibo.ddp.common.dao.datax.datasource;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.datax.datasource.MqSource;
/**
* (MqSource)表数据库访问层
*
* @author jgp
* @since 2021-12-20 13:31:51
*/
public interface MqSourceMapper extends BaseMapper<MqSource> {
}

View File

@@ -0,0 +1,11 @@
package com.fibo.ddp.common.dao.datax.datasource;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public interface SimpleMapper {
List<LinkedHashMap<String, Object>> customSelect(Map<String, Object> paramsMap);
List<LinkedHashMap<String, Object>> test(Map<String, Object> paramsMap);
}

View File

@@ -0,0 +1,12 @@
<?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="com.fibo.ddp.common.dao.datax.datasource.SimpleMapper">
<select id="customSelect" resultType="java.util.LinkedHashMap">
${sqlStr}
</select>
<select id="test" resultType="java.util.LinkedHashMap">
${sqlStr}
</select>
</mapper>

View File

@@ -0,0 +1,17 @@
package com.fibo.ddp.common.dao.enginex.dataflow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.dataflow.EngineVersionContent;
import org.apache.ibatis.annotations.Mapper;
/**
* (EngineVersionContent)表数据库访问层
*
* @author jgp
* @since 2021-12-23 10:21:08
*/
@Mapper
public interface EngineVersionContentMapper extends BaseMapper<EngineVersionContent>{
}

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.enginex.marketing;
import com.fibo.ddp.common.model.enginex.marketing.entity.MarketingEngineNodeDateResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 营销引擎节点当天结果表(MarketingEngineNodeDateResult)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:13:23
*/
@Mapper
public interface MarketingEngineNodeDateResultMapper extends BaseMapper<MarketingEngineNodeDateResult>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.enginex.marketing.MarketingEngineNodeDateResultMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.enginex.marketing;
import com.fibo.ddp.common.model.enginex.marketing.entity.MarketingEngineNodeResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 营销引擎节点结果表(MarketingEngineNodeResult)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:13:24
*/
@Mapper
public interface MarketingEngineNodeResultMapper extends BaseMapper<MarketingEngineNodeResult>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.enginex.marketing.MarketingEngineNodeResultMapper">
</mapper>

View File

@@ -0,0 +1,16 @@
package com.fibo.ddp.common.dao.enginex.marketing;
import com.fibo.ddp.common.model.enginex.marketing.entity.MarketingEngineResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* 营销引擎结果表(MarketingEngineResult)表数据库访问层
*
* @author andy.wang
* @since 2022-01-07 18:13:24
*/
@Mapper
public interface MarketingEngineResultMapper extends BaseMapper<MarketingEngineResult>{
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.enginex.marketing.MarketingEngineResultMapper">
</mapper>

View File

@@ -0,0 +1,23 @@
package com.fibo.ddp.common.dao.enginex.personas;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.personas.PersonasEngineResultDetail;
import com.fibo.ddp.common.model.enginex.personas.vo.PersonasReport;
import com.fibo.ddp.common.model.enginex.personas.vo.PersonasReportParam;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* (PersonasEngineResultDetail)表数据库访问层
*
* @author jgp
* @since 2022-01-06 14:24:57
*/
@Mapper
public interface PersonasEngineResultDetailMapper extends BaseMapper<PersonasEngineResultDetail> {
List<PersonasReport> selectReportList(PersonasReportParam param);
}

View File

@@ -0,0 +1,43 @@
<?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="com.fibo.ddp.common.dao.enginex.personas.PersonasEngineResultDetailMapper">
<resultMap type="com.fibo.ddp.common.model.enginex.personas.vo.PersonasReport" id="PersonasEngineResultMap">
<result property="tagName" column="tag_name" jdbcType="VARCHAR"/>
<result property="tagVersionCode" column="tag_version_code" jdbcType="VARCHAR"/>
<result property="tagId" column="tag_id" jdbcType="INTEGER"/>
<result property="tagVersionId" column="tag_version_id" jdbcType="INTEGER"/>
<result property="tagValue" column="tag_value" jdbcType="VARCHAR"/>
<result property="hitCount" column="hit_count" jdbcType="INTEGER"/>
</resultMap>
<select id="selectReportList" resultMap="PersonasEngineResultMap" parameterType="com.fibo.ddp.common.model.enginex.personas.vo.PersonasReportParam">
select tag.tag_name,tagv.version_code,report.tag_id,report.tag_version_id,report.tag_value,report.hit_count
from
(select tag_id,tag_version_id,tag_value,count(1) as hit_count from t_personas_engine_result_detail
<where>
<if test="engineId != null and engineId != ''">
and engine_id = #{engineId}
</if>
<if test="engineVersionId != null and engineVersionId != ''">
and engine_version_id = #{engineVersionId}
</if>
<if test="batchNo != null and batchNo != ''">
and batch_no = #{batchNo}
</if>
<if test="queryStartTime != null and queryStartTime != ''">
and create_time &gt;= #{queryStartTime}
</if>
<if test="queryEndTime != null and queryEndTime != ''">
and create_time &lt;= #{queryEndTime}
</if>
</where>
group by tag_id,tag_version_id,tag_value
) report
join t_tag tag on report.tag_id = tag.id
join t_tag_version tagv on report.tag_version_id = tagv.id
</select>
</mapper>

View File

@@ -0,0 +1,19 @@
package com.fibo.ddp.common.dao.enginex.personas;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.personas.PersonasEngineResult;
import org.apache.ibatis.annotations.Mapper;
/**
* (PersonasEngineResult)表数据库访问层
*
* @author jgp
* @since 2022-01-06 14:23:09
*/
@Mapper
public interface PersonasEngineResultMapper extends BaseMapper<PersonasEngineResult>{
}

View File

@@ -0,0 +1,60 @@
package com.fibo.ddp.common.dao.enginex.risk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.risk.Engine;
import com.fibo.ddp.common.model.enginex.risk.IndexEngineReportVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EngineMapper extends BaseMapper<Engine> {
List<Engine> getEngineByList(Engine engineVo);
Engine getEngineById(Engine engineVo);
int updateEngine(Engine engineVo);
/**
* 创建引擎并返回ID
* @param engine
* @return
*/
int insertEngineAndReturnId(Engine engine);
/**
* 查询本公司引擎
*/
public List<Engine> getEngineList(@Param("organId") long organId,
@Param("searchString") String searchString,
@Param("list") List<Integer> list);
/**
* 查询首页引擎基本信息
* @param paramMap
* @return
*/
Map<String,Object> getIndexEngineBaseInfo(Map<String, Object> paramMap);
/**
* 查询首页最近几天引擎使用情况
* @param paramMap
* @return
*/
List<IndexEngineReportVo> getIndexRecentDayEngineUseInfo(Map<String, Object> paramMap);
/**
* 查询首页最近几个月引擎使用情况
* @param paramMap
* @return
*/
List<IndexEngineReportVo> getIndexRecentMonthEngineUseInfo(Map<String, Object> paramMap);
/**
* 查询首页引擎使用占比
* @param paramMap
* @return
*/
List<Map<String,Object>> getIndexEngineUseRatio(Map<String, Object> paramMap);
}

View File

@@ -0,0 +1,266 @@
<?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="com.fibo.ddp.common.dao.enginex.risk.EngineMapper">
<cache></cache>
<resultMap type="com.fibo.ddp.common.model.enginex.risk.Engine" id="engineMap">
<id column="id" property="id"/>
<result column="code" property="code"/>
<result column="name" property="name"/>
<result column="description" property="description"/>
<result column="status" property="status"/>
<result column="create_datetime" property="createDatetime"/>
<result column="update_datetime" property="updateDatetime"/>
<result column="creator" property="creator"/>
<result column="organ_id" property="organId"/>
<result column="user_id" property="userId"/>
<result column="callback_type" property="callbackType"/>
<result column="callback_url" property="callbackUrl"/>
<collection property="engineVersionList" ofType="com.fibo.ddp.common.model.enginex.risk.EngineVersion" column="id"
select="com.fibo.ddp.common.dao.enginex.risk.EngineVersionMapper.getEngineVersionListByEngineId">
</collection>
</resultMap>
<!-- 新增引擎并返回ID -->
<insert id="insertEngineAndReturnId" parameterType="engine" useGeneratedKeys="true" keyProperty="id">
INSERT INTO
t_engine
<trim prefix="(" suffix=")">
<if test="code != null">
code,
</if>
<if test="name != null">
name,
</if>
<if test="description != null">
description,
</if>
<if test="creator != null">
creator,
</if>
<if test="userId != null">
user_id,
</if>
<if test="organId != null">
organ_id,
</if>
<if test="status != null">
status,
</if>
<if test="callbackType != null">
callback_type,
</if>
<if test="callbackUrl != null">
callback_url,
</if>
<if test="exceptionCallbackUrl != null">
exception_callback_url,
</if>
create_datetime,update_datetime
</trim>
values
<trim prefix="(" suffix=")">
<if test="code != null">
#{code},
</if>
<if test="name != null">
#{name},
</if>
<if test="description != null">
#{description},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="userId != null">
#{userId},
</if>
<if test="organId != null">
#{organId},
</if>
<if test="status != null">
#{status},
</if>
<if test="callbackType != null">
#{callbackType},
</if>
<if test="callbackUrl != null">
#{callbackUrl},
</if>
<if test="exceptionCallbackUrl != null">
#{exceptionCallbackUrl},
</if>
now(),now()
</trim>
</insert>
<update id="updateEngine" parameterType="engine" >
UPDATE t_engine
<set>
<if test="code != null">
code = #{code},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="description != null">
description = #{description},
</if>
<if test="status != null">
status = #{status},
</if>
<if test="creator != null">
creator = #{creator},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="callbackType != null">
callback_type = #{callbackType},
</if>
<if test="callbackUrl != null">
callback_url = #{callbackUrl},
</if>
<if test="exceptionCallbackUrl != null">
exception_callback_url = #{exceptionCallbackUrl},
</if>
</set>
WHERE
organ_id= #{organId}
and id = #{id}
</update>
<select id="getEngineByList" parameterType="engine" resultMap="engineMap" >
SELECT
*
FROM
t_engine
where
status>-1 and
organ_id =#{organId}
<if test="searchString != null and searchString !=''">
and (code like CONCAT('%',TRIM('${searchString}'),'%' ) or name like CONCAT('%',TRIM('${searchString}'),'%' ))
</if>
order by update_datetime desc
</select>
<!-- 根据权限查询本公司引擎 -->
<select id="getEngineList" resultMap="engineMap">
SELECT
*
FROM
t_engine
where
status>-1 and
organ_id = #{organId}
<if test="searchString != null and searchString !=''">
and (code like CONCAT('%',TRIM('${searchString}'),'%' ) or name like CONCAT('%',TRIM('${searchString}'),'%'
))
</if>
order by update_datetime desc
</select>
<select id="getEngineById" resultMap="engineMap" parameterType="engine">
SELECT
*
FROM
t_engine
where
status > -1
and organ_id = #{organId}
and id = #{id}
</select>
<select id="getIndexEngineBaseInfo" parameterType="map" resultType="map">
SELECT
COUNT(DISTINCT e.`id`) AS engineNum,
COUNT(DISTINCT en.`node_id`) AS engineNodeNum,
COUNT(DISTINCT rt.`id`) AS engineResultNum
FROM
t_organization o
LEFT JOIN t_engine e
ON o.`organ_id` = e.`organ_id`
LEFT JOIN t_engine_version ev
ON e.`id` = ev.`engine_id`
LEFT JOIN t_engine_node en
ON ev.`version_id` = en.`version_id`
LEFT JOIN t_resultset rt
ON e.`id` = rt.`engine_id`
WHERE o.`organ_id` = #{organId}
</select>
<select id="getIndexRecentDayEngineUseInfo" parameterType="map" resultType="indexEngineReportVo">
SELECT
DATE_FORMAT(rt.`create_datetime`, '%Y-%m-%d') AS dayTime,
rt.`engine_id` AS engineId,
e.`name` AS engineName,
COUNT(DISTINCT rt.`id`) AS useNum
FROM
t_organization o
INNER JOIN t_engine e
ON o.`organ_id` = e.`organ_id`
INNER JOIN t_resultset rt
ON e.`id` = rt.`engine_id`
WHERE o.`organ_id` = #{organId}
AND rt.`create_datetime` >= DATE_SUB(NOW(),INTERVAL 7 DAY)
GROUP BY DATE_FORMAT(rt.`create_datetime`, '%Y-%m-%d'), rt.`engine_id`
</select>
<select id="getIndexRecentMonthEngineUseInfo" parameterType="map" resultType="indexEngineReportVo">
SELECT
DATE_FORMAT(rt.`create_datetime`, '%Y-%m') AS monthTime,
rt.`engine_id` AS engineId,
e.`name` AS engineName,
COUNT(DISTINCT rt.`id`) AS useNum
FROM
t_organization o
INNER JOIN t_engine e
ON o.`organ_id` = e.`organ_id`
INNER JOIN t_resultset rt
ON e.`id` = rt.`engine_id`
WHERE o.`organ_id` = #{organId}
AND rt.`create_datetime` >= DATE_SUB(NOW(),INTERVAL 6 MONTH)
GROUP BY DATE_FORMAT(rt.`create_datetime`, '%Y-%m'), rt.`engine_id`
</select>
<select id="getIndexEngineUseRatio" parameterType="map" resultType="map">
SELECT
engineId,
engineName,
useNum,
totleNum,
ROUND(useNum / totleNum * 100, 1) AS useRatio
FROM
(SELECT
*
FROM
(SELECT
rt.`engine_id` AS engineId,
e.`name` AS engineName,
COUNT(DISTINCT rt.`id`) AS useNum
FROM
t_organization o
INNER JOIN t_engine e
ON o.`organ_id` = e.`organ_id`
INNER JOIN t_resultset rt
ON e.`id` = rt.`engine_id`
WHERE o.`organ_id` = #{organId}
GROUP BY rt.`engine_id`) t1
INNER JOIN
(SELECT
COUNT(DISTINCT rt.`id`) AS totleNum
FROM
t_organization o
INNER JOIN t_engine e
ON o.`organ_id` = e.`organ_id`
INNER JOIN t_resultset rt
ON e.`id` = rt.`engine_id`
WHERE o.`organ_id` = #{organId}) t2
ON 1 = 1) tt
limit 4
</select>
</mapper>

View File

@@ -0,0 +1,51 @@
package com.fibo.ddp.common.dao.enginex.risk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.risk.EngineNode;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EngineNodeMapper extends BaseMapper<EngineNode> {
/**
* getEngineNodeListByEngineVersionId(根据版本id获取版本下的所有节点)
*
* @param engineVersionId 引擎版本id
* @return 节点集合
*
*/
List<EngineNode> getEngineNodeListByEngineVersionId(@Param("engineVersionId") Long engineVersionId);
int insertNodeAndReturnId(EngineNode engineNode);
// V2
int insertNodeAndReturnIdV2(EngineNode engineNode);
int updateNodeForNextOrderAndParams(List<EngineNode> eList);
int getMaxNodeOrder(@Param("versionId") Long versionId);
int renameNode(Map<String, Object> param);
int updateSnapshot(Map<String, Object> param);
int updateNextNodes(EngineNode engineNode);
int deleteNodesByNodeIds(@Param("commons") List<Long> commons);
List<EngineNode> getEngineTypedNodeListByEngineVersionId(@Param("versionId") Long versionId, @Param("types") List<Integer> types);
int updateParentIdByNodeId(Map<String, Object> map);
int updateNodePosition(EngineNode engineNode);
// runner
/**
* 根据版本id获取版本下的所有节点
* @param engineVersionId
* @return
*/
List<EngineNode> getEngineNodeListByVersionId(@Param("engineVersionId") Long engineVersionId);
}

View File

@@ -0,0 +1,151 @@
<?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="com.fibo.ddp.common.dao.enginex.risk.EngineNodeMapper">
<cache></cache>
<resultMap id="EngineNodeMap" type="com.fibo.ddp.common.model.enginex.risk.EngineNode">
<id column="node_id" jdbcType="INTEGER" property="nodeId" />
<result column="version_id" jdbcType="INTEGER" property="versionId" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="node_name" jdbcType="VARCHAR" property="nodeName" />
<result column="node_code" jdbcType="VARCHAR" property="nodeCode" />
<result column="node_order" jdbcType="INTEGER" property="nodeOrder" />
<result column="node_type" jdbcType="INTEGER" property="nodeType" />
<result column="node_x" jdbcType="DECIMAL" property="nodeX" />
<result column="node_y" jdbcType="DECIMAL" property="nodeY" />
<result column="node_json" jdbcType="LONGVARCHAR" property="nodeJson" />
<result column="node_script" jdbcType="LONGVARCHAR" property="nodeScript" />
<result column="next_nodes" jdbcType="LONGVARCHAR" property="nextNodes" />
<result column="params" jdbcType="LONGVARCHAR" property="params" />
<result column="snapshot" jdbcType="LONGVARCHAR" property="snapshot" />
</resultMap>
<sql id="Base_Column_List">
node_id, parent_id, version_id, node_name, node_code, node_order, node_type, node_x, node_y,node_json,node_script,next_nodes,params
</sql>
<select id="getEngineTypedNodeListByEngineVersionId" resultMap="EngineNodeMap">
select
<include refid="Base_Column_List" />
from t_engine_node
where version_id =#{versionId}
and node_type in
<foreach collection="types" item = "item" open="(" separator="," close=")">
#{item}
</foreach>
ORDER BY node_order ASC
</select>
<delete id = "deleteNodesByNodeIds" parameterType = "java.util.List">
<![CDATA[
delete from t_engine_node where node_id in
]]>
<foreach collection="commons" item = "item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<insert id="insert" parameterType="engineNode" useGeneratedKeys="true" keyProperty="nodeId">
insert into t_engine_node (node_id, parent_id,version_id, node_name,
node_code, node_order, node_type,
node_x, node_y, node_json,
node_script, next_nodes, params
)
values (#{nodeId,jdbcType=INTEGER},#{parentId,jdbcType=INTEGER}, #{versionId,jdbcType=INTEGER}, #{nodeName,jdbcType=VARCHAR},
#{nodeCode,jdbcType=VARCHAR}, #{nodeOrder,jdbcType=INTEGER}, #{nodeType,jdbcType=INTEGER},
#{nodeX,jdbcType=DECIMAL}, #{nodeY,jdbcType=DECIMAL}, #{nodeJson,jdbcType=LONGVARCHAR},
#{nodeScript,jdbcType=LONGVARCHAR}, #{nextNodes,jdbcType=LONGVARCHAR}, #{params,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertNodeAndReturnId" parameterType="engineNode" useGeneratedKeys="true" keyProperty="nodeId">
insert into t_engine_node (version_id,parent_id, node_name,
node_code, node_order, node_type,
node_x, node_y, node_json,
node_script, next_nodes, params
)
values (#{versionId,jdbcType=INTEGER},#{parentId,jdbcType=INTEGER}, #{nodeName,jdbcType=VARCHAR},
#{nodeCode,jdbcType=VARCHAR}, #{nodeOrder,jdbcType=INTEGER}, #{nodeType,jdbcType=INTEGER},
#{nodeX,jdbcType=DECIMAL}, #{nodeY,jdbcType=DECIMAL}, #{nodeJson,jdbcType=LONGVARCHAR},
#{nodeScript,jdbcType=LONGVARCHAR}, #{nextNodes,jdbcType=LONGVARCHAR}, #{params,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertNodeAndReturnIdV2" parameterType="engineNode" useGeneratedKeys="true" keyProperty="nodeId">
insert into t_engine_node (version_id,parent_id, node_name,
node_code, node_order, node_type,
node_x, node_y, node_json,
node_script, next_nodes, params
)
values (#{versionId,jdbcType=INTEGER},#{parentId,jdbcType=INTEGER}, #{nodeName,jdbcType=VARCHAR},
#{nodeCode,jdbcType=VARCHAR}, #{nodeOrder,jdbcType=INTEGER}, #{nodeType,jdbcType=INTEGER},
#{nodeX,jdbcType=DECIMAL}, #{nodeY,jdbcType=DECIMAL}, #{nodeJson,jdbcType=LONGVARCHAR},
#{nodeScript,jdbcType=LONGVARCHAR}, #{nextNodes,jdbcType=LONGVARCHAR}, #{params,jdbcType=LONGVARCHAR}
)
</insert>
<update id="updateNodePosition" parameterType="engineNode">
update t_engine_node
set node_x = #{nodeX,jdbcType=DECIMAL},
node_y = #{nodeY,jdbcType=DECIMAL}
where node_id = #{nodeId,jdbcType=INTEGER}
</update>
<update id="updateNextNodes" parameterType="engineNode">
update t_engine_node
set next_nodes = #{nextNodes}
where node_id = #{nodeId}
</update>
<update id="updateParentIdByNodeId" parameterType="java.util.Map">
update t_engine_node
set parent_id = #{parentId}
where node_id = #{nodeId}
</update>
<!-- 更新节点名称 -->
<update id="renameNode" parameterType="java.util.Map">
update t_engine_node
set node_name = #{nodeName,jdbcType=VARCHAR}
where node_id = #{nodeId,jdbcType=INTEGER}
</update>
<!-- 更新节点名称 -->
<update id="updateSnapshot" parameterType="java.util.Map">
update t_engine_node
set snapshot = #{snapshot,jdbcType=VARCHAR}
where node_id = #{nodeId,jdbcType=INTEGER}
</update>
<select id="getEngineNodeListByEngineVersionId" parameterType="long" resultMap="EngineNodeMap">
select <include refid="Base_Column_List"/>
from t_engine_node
where version_id = #{engineVersionId}
ORDER BY node_order ASC
</select>
<select id="getMaxNodeOrder" parameterType="long" resultType="int">
select Max(node_order) from t_engine_node where version_id =#{versionId}
</select>
<update id="updateNodeForNextOrderAndParams" parameterType="java.util.List">
<foreach collection="list" index="index" item="item" separator=";">
update t_engine_node set
<if test="item.nextNodes != null">
next_nodes = #{item.nextNodes},
</if>
<if test="item.params != null">
params = #{item.params},
</if>
<if test="item.nodeJson != null">
node_json = #{item.nodeJson},
</if>
parent_id = #{item.parentId }
where node_id = #{item.nodeId}
</foreach>
</update>
<select id="getEngineNodeListByVersionId" parameterType="long" resultMap="EngineNodeMap">
select <include refid="Base_Column_List"/> from t_engine_node where version_id =#{engineVersionId}
ORDER BY node_order ASC
</select>
</mapper>

View File

@@ -0,0 +1,71 @@
package com.fibo.ddp.common.dao.enginex.risk;
import com.fibo.ddp.common.model.analyse.AnalyseDecisionResult;
import com.fibo.ddp.common.model.enginex.risk.EngineResultSet;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EngineResultSetMapper {
/**
*
* 增加结果集
* @param resultSet 结果集对象
* @return 返回结果
* @see
*/
int insertResultSet(EngineResultSet resultSet);
/**
*
* 查询结果集列表
* @param resultSet 查询对象
* @return 返回结果集
* @see
*/
List<EngineResultSet> getResultSetByList(EngineResultSet resultSet);
/**
* 根据引擎编号和时间段获取结果集数据
* @param map
* @return
*/
List<EngineResultSet> getEngineResultSetBySegment(Map map);
/**
*
* 通过主键编号得到
* @param resultSet 对象
* @return 返回对象
* @see
*/
EngineResultSet getResultSetById(EngineResultSet resultSet);
List<EngineResultSet> getResultSetDetailsById(long resultSetId);
/**
* 查找引擎id的批量测试结果
* yuanlinfeng
* @param resultSetId
* @return
*/
List<EngineResultSet> getBatchTestResultSetByEngineId(Map<String,Object> paramMap);
/**
* 查找引擎批量测试批次号的所有测试结果
* yuanlinfeng
* @param resultSetId
* @return
*/
List<EngineResultSet> getBatchTestResultSetByBatchNo(Map<String,Object> paramMap);
/**
* 更新结果出参
* @param resultSet
*/
void updateResultOutput(EngineResultSet resultSet);
List<AnalyseDecisionResult> countDecisionCallNum();
void updateResultById(@Param("resultId") Integer resultId, @Param("rowKeyStr") String rowKeyStr);
}

View File

@@ -0,0 +1,218 @@
<?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="com.fibo.ddp.common.dao.enginex.risk.EngineResultSetMapper">
<resultMap type="com.fibo.ddp.common.model.enginex.risk.EngineResultSet" id="engineresultsetMap">
<id column="id" property="id"/>
<result column="input" property="input"/>
<result column="create_datetime" property="createDatetime"/>
<result column="result" property="result"/>
<result column="engine_id" property="engineId"/>
<result column="uuid" property="uuid"/>
<result column="engine_version" property="engineVersion"/>
<result column="engine_name" property="engineName"/>
<result column="engine_code" property="engineCode"/>
<result column="type" property="type"/>
<result column="sub_version" property="subVersion"/>
<result column="scorecardscore" property="scorecardscore"/>
<result column="batch_no" property="batchNo"/>
<result column="datilResult" property="datilResult"/>
<result column="start_time" property="startTime"/>
<result column="cost_time" property="costTime"/>
<result column="hbase_row_key" property="hbaseRowKey"/>
</resultMap>
<select id="getResultSetDetailsById" parameterType="Long" resultMap="engineresultsetMap">
select *
from t_resultset
where id = #{resultSetId}
</select>
<!-- 新增引擎并返回ID -->
<insert id="insertResultSet" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineResultSet" useGeneratedKeys="true" keyProperty="id">
INSERT INTO
t_resultset
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
uid,
</if>
<if test="pid != null">
pid,
</if>
<if test="input != null">
input,
</if>
<if test="output != null">
output,
</if>
<if test="result != null">
result,
</if>
<if test="engineId != null">
engine_id,
</if>
<if test="uuid != null">
uuid,
</if>
<if test="engineVersion != null">
engine_version,
</if>
<if test="engineName != null">
engine_name,
</if>
<if test="engineCode != null">
engine_code,
</if>
<if test="type != null">
type,
</if>
<if test="subVersion != null">
sub_version,
</if>
<if test="scorecardscore != null">
scorecardscore,
</if>
<if test="batchNo != null">
batch_no,
</if>
<if test="datilResult != null">
datilResult,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uid != null">
#{uid},
</if>
<if test="pid != null">
#{pid},
</if>
<if test="input != null">
#{input},
</if>
<if test="output != null">
#{output},
</if>
<if test="result != null">
#{result},
</if>
<if test="engineId != null">
#{engineId},
</if>
<if test="uuid != null">
#{uuid},
</if>
<if test="engineVersion != null">
#{engineVersion},
</if>
<if test="engineName != null">
#{engineName},
</if>
<if test="engineCode != null">
#{engineCode},
</if>
<if test="type != null">
#{type},
</if>
<if test="subVersion != null">
#{subVersion},
</if>
<if test="scorecardscore != null">
#{scorecardscore},
</if>
<if test="batchNo != null">
#{batchNo},
</if>
<if test="datilResult != null">
#{datilResult},
</if>
</trim>
</insert>
<select id="getResultSetByList" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineResultSet" resultMap="engineresultsetMap" >
SELECT
*
FROM
t_engine
where
status>-1 and
organ_id =#{organId}
<if test="startDate != null and startDate !=''">
<![CDATA[ and create_datetime >= #{startDate} ]]>
</if>
<if test="endDate != null and endDate !=''">
<![CDATA[ and create_datetime <= #{endDate} ]]>
</if>
order by create_datetime desc
</select>
<select id="getEngineResultSetBySegment" parameterType="map" resultMap="engineresultsetMap" >
SELECT
*
FROM
t_resultset
where
1=1
<if test="engineId != null">
<![CDATA[ and engine_id = #{engineId} ]]>
</if>
<if test="businessId != null and businessId !=''">
<![CDATA[ and pid like concat('%',#{businessId},'%') ]]>
</if>
<if test="startDate != null and startDate !=''">
<![CDATA[ and create_datetime >= #{startDate} ]]>
</if>
<if test="endDate != null and endDate !=''">
<![CDATA[ and create_datetime <= DATE_ADD(STR_TO_DATE(#{endDate}, '%Y-%m-%d'),interval 1 DAY) ]]>
</if>
order by create_datetime desc
</select>
<select id="getResultSetById" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineResultSet" resultMap="engineresultsetMap">
select * from t_resultset where id = #{id}
</select>
<select id="getBatchTestResultSetByEngineId" parameterType="map" resultMap="engineresultsetMap">
select batch_no, engine_id, engine_name, startTime, costTime
from(
select rs.batch_no, e.id as engine_id, e.name as engine_name
, min(rs.create_datetime) as start_time
, TIMESTAMPDIFF(second,min(rs.create_datetime),max(rs.create_datetime)) as cost_time
from t_resultset rs, t_engine e
where rs.engine_id = e.id
and ( batch_no is not null and batch_no != '' )
and e.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and rs.engine_id = #{engineId}
group by rs.batch_no, e.id, e.name
)x
order by x.startTime desc
</select>
<select id="getBatchTestResultSetByBatchNo" parameterType="map" resultMap="engineresultsetMap">
select rs.*
from t_resultset rs, t_engine e
where rs.engine_id = e.id
and e.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and rs.batch_no = #{batchNo}
</select>
<update id="updateResultOutput" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineResultSet">
update t_resultset t set t.`output` = #{output} where t.`id` = #{id}
</update>
<select id="countDecisionCallNum" resultType="com.fibo.ddp.common.model.analyse.AnalyseDecisionResult">
select
</select>
<update id="updateResultById">
UPDATE t_resultset
set hbase_row_key = #{rowKeyStr}
where id = #{resultId}
</update>
</mapper>

View File

@@ -0,0 +1,67 @@
package com.fibo.ddp.common.dao.enginex.risk;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.enginex.risk.EngineResultSetDTO;
import com.fibo.ddp.common.model.enginex.risk.EngineVersion;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface EngineVersionMapper extends BaseMapper<EngineVersion> {
int insertOne(EngineVersion record);
EngineVersion selectByPrimaryKey(long versionId);
int updateByPrimaryKeySelective(EngineVersion record);
int updateByPrimaryKey(EngineVersion record);
int undeployVersion(long engineId);
int updateBootState(@Param("versionId") long versionId, @Param("bootState") int bootState);
/**
* getEngineVersionListByEngineId(根据引擎id获取引擎下的所有版本)
*
* @param engineId 引擎id
* @return 版本集合
* */
List<EngineVersion> getEngineVersionListByEngineId(long engineId);
// 新增的V2
List<EngineVersion> getEngineVersionListByEngineIdV2(long engineId);
int insertEngineVersionAndReturnId(EngineVersion engineVersion);
EngineVersion getLatestEngineVersion(EngineVersion engineVersion);
EngineVersion getLatestEngineSubVersion(EngineVersion engineVersion);
/**
* 清除所有此版本下的小版本(除过0版本)
* @param map
* @return
*/
int cleanSubVersionByVersion(Map map);
/**
* 获取引擎对应的版本及引擎名信息
* yuanlinfeng
* @param paramMap
* @return
*/
public List<EngineVersion> getEngineVersionByEngineId(Map<String, Object> paramMap);
List<EngineVersion> selectAll();
List<EngineResultSetDTO> countDecisionResult();
/**
* 获取引擎正在运行中的版本
* @param engineId
* @return
*/
EngineVersion getRunningVersion(@Param("engineId") Long engineId);
}

View File

@@ -0,0 +1,273 @@
<?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="com.fibo.ddp.common.dao.enginex.risk.EngineVersionMapper">
<cache></cache>
<resultMap id="EngineVersionMap" type="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
<id column="version_id" jdbcType="INTEGER" property="versionId"/>
<result column="engine_id" jdbcType="INTEGER" property="engineId"/>
<result column="version" jdbcType="INTEGER" property="version"/>
<result column="sub_version" jdbcType="INTEGER" property="subVersion"/>
<result column="boot_state" jdbcType="INTEGER" property="bootState"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="layout" jdbcType="INTEGER" property="layout"/>
<result column="user_id" jdbcType="INTEGER" property="userId"/>
<result column="create_time" jdbcType="VARCHAR" property="createTime"/>
<result column="latest_user" jdbcType="INTEGER" property="latestUser"/>
<result column="latest_time" jdbcType="VARCHAR" property="latestTime"/>
<result column="engine_name" jdbcType="VARCHAR" property="engineName"/>
<result column="description" jdbcType="VARCHAR" property="engineDesc"/>
<collection property="engineNodeList" ofType="engineNode" column="version_id"
select="com.fibo.ddp.common.dao.enginex.risk.EngineNodeMapper.getEngineNodeListByEngineVersionId">
</collection>
</resultMap>
<sql id="Base_Column_List">
version_id, engine_id, version, boot_state, status, layout, user_id, create_time,
latest_user, latest_time, sub_version
</sql>
<select id="getLatestEngineSubVersion" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion" resultType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
select
<include refid="Base_Column_List" />
from t_engine_version
where engine_id = #{engineId,jdbcType=INTEGER}
and version = #{version,jdbcType=INTEGER}
order by sub_version desc
limit 1
</select>
<select id="getLatestEngineVersion" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion" resultType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
select
<include refid="Base_Column_List" />
from t_engine_version
where engine_id = #{engineId,jdbcType=INTEGER}
order by version desc
limit 1
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="EngineVersionMap">
select
<include refid="Base_Column_List" />
from t_engine_version
where version_id = #{versionId,jdbcType=INTEGER}
</select>
<delete id="cleanSubVersionByVersion" parameterType="java.util.Map">
delete from t_engine_version
where engine_id = #{engineId,jdbcType=INTEGER}
and version = #{version,jdbcType=INTEGER}
and sub_version != 0
</delete>
<insert id="insertOne" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
insert into t_engine_version (version_id, engine_id, version,
sub_version, boot_state, status, layout, user_id,
create_time, latest_user, latest_time
)
values (#{versionId,jdbcType=INTEGER}, #{engineId,jdbcType=INTEGER}, #{version,jdbcType=INTEGER},
#{subVersion,jdbcType=INTEGER},#{bootState,jdbcType=BIT}, #{status,jdbcType=BIT}, #{layout,jdbcType=BIT},
#{userId,jdbcType=INTEGER}, #{createTime,jdbcType=VARCHAR}, #{latestUser,jdbcType=INTEGER},
#{latestTime,jdbcType=VARCHAR}
)
</insert>
<insert id="insertEngineVersionAndReturnId" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion" useGeneratedKeys="true" keyProperty="versionId">
insert into t_engine_version
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="engineId != null">
engine_id,
</if>
<if test="version != null">
version,
</if>
<if test="subVersion != null">
sub_version,
</if>
<if test="bootState != null">
boot_state,
</if>
<if test="status != null">
status,
</if>
<if test="layout != null">
layout,
</if>
<if test="userId != null">
user_id,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="latestUser != null">
latest_user,
</if>
<if test="latestTime != null">
latest_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="engineId != null">
#{engineId,jdbcType=INTEGER},
</if>
<if test="version != null">
#{version,jdbcType=INTEGER},
</if>
<if test="subVersion != null">
#{subVersion,jdbcType=INTEGER},
</if>
<if test="bootState != null">
#{bootState,jdbcType=BIT},
</if>
<if test="status != null">
#{status,jdbcType=BIT},
</if>
<if test="layout != null">
#{layout,jdbcType=BIT},
</if>
<if test="userId != null">
#{userId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=VARCHAR},
</if>
<if test="latestUser != null">
#{latestUser,jdbcType=INTEGER},
</if>
<if test="latestTime != null">
#{latestTime,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
update t_engine_version
<set>
<if test="engineId != null">
engine_id = #{engineId,jdbcType=INTEGER},
</if>
<if test="version != null">
version = #{version,jdbcType=INTEGER},
</if>
<if test="subVersion != null">
sub_version = #{subVersion,jdbcType=INTEGER},
</if>
<if test="bootState != null">
boot_state = #{bootState,jdbcType=BIT},
</if>
<if test="status != null">
status = #{status,jdbcType=BIT},
</if>
<if test="layout != null">
layout = #{layout,jdbcType=BIT},
</if>
<if test="userId != null">
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=VARCHAR},
</if>
<if test="latestUser != null">
latest_user = #{latestUser,jdbcType=INTEGER},
</if>
<if test="latestTime != null">
latest_time = #{latestTime,jdbcType=VARCHAR},
</if>
</set>
where version_id = #{versionId,jdbcType=INTEGER}
</update>
<update id="undeployVersion" parameterType="java.lang.Long">
update t_engine_version
set boot_state = 0
where engine_id = #{engineId,jdbcType=INTEGER}
</update>
<update id="updateBootState">
update t_engine_version
set boot_state = #{bootState}
where version_id = #{versionId}
</update>
<update id="updateByPrimaryKey" parameterType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
update t_engine_version
set engine_id = #{engineId,jdbcType=INTEGER},
version = #{version,jdbcType=INTEGER},
sub_version = #{subVersion,jdbcType=INTEGER},
boot_state = #{bootState,jdbcType=BIT},
status = #{status,jdbcType=BIT},
layout = #{layout,jdbcType=BIT},
user_id = #{userId,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=VARCHAR},
latest_user = #{latestUser,jdbcType=INTEGER},
latest_time = #{latestTime,jdbcType=VARCHAR}
where version_id = #{versionId,jdbcType=INTEGER}
</update>
<select id="getEngineVersionListByEngineId" parameterType="long" resultMap="EngineVersionMap">
select <include refid="Base_Column_List"/> from t_engine_version where engine_id =#{id}
order by version,sub_version
</select>
<!-- 新增的V2 -->
<select id="getEngineVersionListByEngineIdV2" parameterType="long" resultType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
select
<include refid="Base_Column_List"/>
from t_engine_version where engine_id = #{id}
order by version,sub_version
</select>
<select id="getEngineVersionByEngineId" parameterType="map" resultMap="EngineVersionMap">
select ev.version_id
, ev.engine_id
, ev.version
, ev.sub_version
, ev.latest_time
, e.name AS engine_name
, e.description
from t_engine_version ev, t_engine e
where ev.engine_id = e.id
and e.organ_id = ( select organ_id from t_user where user_id = #{userId} )
and ev.engine_id = #{engineId}
order by ev.version_id desc
</select>
<select id="selectAll" resultType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
select version_id,engine_id from t_engine_version where status>-1;
</select>
<select id="countDecisionResult" resultType="com.fibo.ddp.common.model.enginex.risk.EngineResultSetDTO">
select
DATE_FORMAT(t.create_datetime,"%Y-%m-%d") as callDate,
engine_id,
engine_code,
engine_version,
engine_name,
result,
e.organ_id,
count(1) as total
from
t_resultset t
left join
t_engine e
on t.engine_id = e.id
where datediff(now(),t.create_datetime)=0
GROUP BY
DATE_FORMAT(t.create_datetime,"%Y-%m-%d"),
engine_id,
engine_code,
engine_version,
engine_name,
result;
</select>
<select id="getRunningVersion" parameterType="java.lang.Long" resultType="com.fibo.ddp.common.model.enginex.risk.EngineVersion">
select
<include refid="Base_Column_List" />
from t_engine_version
where engine_id = #{engineId,jdbcType=INTEGER}
and boot_state = 1
</select>
</mapper>

View File

@@ -0,0 +1,76 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fibo.ddp.common.model.enginex.risk.EngineNode;
import com.fibo.ddp.common.model.monitor.decisionflow.MonitorDecisionFlow;
import com.fibo.ddp.common.utils.constant.monitor.Constants;
import com.spring4all.spring.boot.starter.hbase.api.RowMapper;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
public class MonitorDecisionFlowHbaseMapper implements RowMapper<MonitorDecisionFlow>{
@Override
public MonitorDecisionFlow mapRow(Result result, int i) throws Exception {
MonitorDecisionFlow monitorDecisionFlow = new MonitorDecisionFlow();
MonitorDecisionFlow.BaseInfo baseInfo = new MonitorDecisionFlow.BaseInfo();
MonitorDecisionFlow.MonitorInfo monitorInfo = new MonitorDecisionFlow.MonitorInfo();
monitorDecisionFlow.setRowKey(Bytes.toString(result.getRow()));
baseInfo.setBusinessId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.BASE_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.BUSINESS_ID)
)
)
);
baseInfo.setEngineName(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.BASE_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.ENGINE_NAME)
)
)
);
baseInfo.setEngineVersionId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.BASE_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.ENGINE_VERSION_ID)
)
)
);
monitorDecisionFlow.setBaseInfo(baseInfo);
monitorInfo.setParams(
JSONObject.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.PARAMS)
)
)));
monitorInfo.setProcess(
JSONArray.parseArray(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.PROCESS)
)
)
, String.class
));
monitorInfo.setSnapshot(
JSONArray.parseArray(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorDecisionFlow.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorDecisionFlow.SNAPSHOT)
)
)
, EngineNode.class
));
monitorDecisionFlow.setMonitorInfo(monitorInfo);
return monitorDecisionFlow;
}
}

View File

@@ -0,0 +1,82 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fibo.ddp.common.model.monitor.decisionflow.MonitorNode;
import com.fibo.ddp.common.utils.constant.monitor.Constants;
import com.spring4all.spring.boot.starter.hbase.api.RowMapper;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
public class MonitorNodeHbaseMapper implements RowMapper<MonitorNode> {
@Override
public MonitorNode mapRow(Result result, int i) throws Exception {
MonitorNode monitorNode = new MonitorNode();
MonitorNode.BaseInfo baseInfo = new MonitorNode.BaseInfo();
MonitorNode.MonitorInfo monitorInfo = new MonitorNode.MonitorInfo();
monitorNode.setRowKey(Bytes.toString(result.getRow()));
baseInfo.setBusinessId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.BASE_INFO),
Bytes.toBytes(Constants.MonitorNode.BUSINESS_ID)
)
)
);
baseInfo.setNodeId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.BASE_INFO),
Bytes.toBytes(Constants.MonitorNode.NODE_ID)
)
)
);
baseInfo.setNodeName(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.BASE_INFO),
Bytes.toBytes(Constants.MonitorNode.NODE_NAME)
)
)
);
baseInfo.setNodeType(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.BASE_INFO),
Bytes.toBytes(Constants.MonitorNode.NODE_TYPE)
)
)
);
monitorNode.setBaseInfo(baseInfo);
monitorInfo.setParams(
JSONObject.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.PARAMS)
)
)));
monitorInfo.setResult(
JSON.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.RESULT)
)
)
)
);
monitorInfo.setSnapshot(
JSON.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.SNAPSHOT)
)
)
)
);
monitorNode.setMonitorInfo(monitorInfo);
return monitorNode;
}
}

View File

@@ -0,0 +1,114 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fibo.ddp.common.model.monitor.decisionflow.MonitorStrategy;
import com.fibo.ddp.common.utils.constant.monitor.Constants;
import com.spring4all.spring.boot.starter.hbase.api.RowMapper;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
public class MonitorStrategyHbaseMapper implements RowMapper<MonitorStrategy> {
@Override
public MonitorStrategy mapRow(Result result, int i) throws Exception {
MonitorStrategy monitorStrategy = new MonitorStrategy();
MonitorStrategy.BaseInfo baseInfo = new MonitorStrategy.BaseInfo();
MonitorStrategy.MonitorInfo monitorInfo = new MonitorStrategy.MonitorInfo();
monitorStrategy.setRowKey(Bytes.toString(result.getRow()));
//业务id
baseInfo.setBusinessId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.BUSINESS_ID)
)
)
);
//策略id
baseInfo.setStrategyId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.STRATEGY_ID)
)
)
);
//策略类型
baseInfo.setStrategyType(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.STRATEGY_TYPE)
)
)
);
//策略名称
baseInfo.setStrategyName(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.STRATEGY_NAME)
)
)
);
//节点id
baseInfo.setNodeId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.NODE_ID)
)
)
);
//节点类型
baseInfo.setNodeType(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.NODE_TYPE)
)
)
);
//引擎版本Id
baseInfo.setEngineVersionId(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorStrategy.BASE_INFO),
Bytes.toBytes(Constants.MonitorStrategy.ENGINE_VERSION_ID)
)
)
);
monitorStrategy.setBaseInfo(baseInfo);
monitorInfo.setParams(
JSONObject.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.PARAMS)
)
)));
monitorInfo.setResult(
JSON.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.RESULT)
)
)
)
);
monitorInfo.setSnapshot(
JSON.parseObject(
Bytes.toString(
result.getValue(
Bytes.toBytes(Constants.MonitorNode.MONITOR_INFO),
Bytes.toBytes(Constants.MonitorNode.SNAPSHOT)
)
)
)
);
monitorStrategy.setMonitorInfo(monitorInfo);
return monitorStrategy;
}
}

View File

@@ -0,0 +1,15 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.monitor.decisionflow.TMonitorEngine;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 决策流监控 Mapper 接口
* </p>
*/
@Mapper
public interface TMonitorEngineMapper extends BaseMapper<TMonitorEngine> {
}

View File

@@ -0,0 +1,5 @@
<?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="com.fibo.ddp.common.dao.monitor.decisionflow.TMonitorEngineMapper">
</mapper>

View File

@@ -0,0 +1,19 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.monitor.decisionflow.TMonitorNode;
import com.fibo.ddp.common.model.monitor.decisionflow.TMonitorNodeDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 决策流节点层面监控 Mapper 接口
* </p>
*/
@Mapper
public interface TMonitorNodeMapper extends BaseMapper<TMonitorNode> {
List<TMonitorNodeDTO> countNodeHit();
}

View File

@@ -0,0 +1,26 @@
<?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="com.fibo.ddp.common.dao.monitor.decisionflow.TMonitorNodeMapper">
<select id="countNodeHit" resultType="com.fibo.ddp.common.model.monitor.decisionflow.TMonitorNodeDTO">
select
DATE_FORMAT(t.create_time,"%Y-%m-%d") as callDate,
engine_id,
engine_version_id,
organ_id,
node_name,
node_id,
node_type,
count(1) as total
from
t_monitor_node t
where datediff(now(),t.create_time)=0
GROUP BY
DATE_FORMAT(t.create_time,"%Y-%m-%d"),
engine_id,
engine_version_id,
organ_id,
node_name,
node_id,
node_type
</select>
</mapper>

View File

@@ -0,0 +1,23 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.monitor.decisionflow.TMonitorStrategy;
import com.fibo.ddp.common.model.monitor.decisionflow.TMonitorStrategyDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* 决策流策略层面监控 Mapper 接口
* </p>
*/
@Mapper
public interface TMonitorStrategyMapper extends BaseMapper<TMonitorStrategy> {
List<TMonitorStrategyDTO> countRule();
List<TMonitorStrategyDTO> countScorecardHit();
List<TMonitorStrategyDTO> countDecisionTables();
}

View File

@@ -0,0 +1,73 @@
<?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="com.fibo.ddp.common.dao.monitor.decisionflow.TMonitorStrategyMapper">
<select id="countRule" resultType="com.fibo.ddp.common.model.monitor.decisionflow.TMonitorStrategyDTO">
select
DATE_FORMAT(t.create_time,"%Y-%m-%d") as callDate,
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result,
count(1) as total
from
t_monitor_strategy t
where datediff(now(),t.create_time)=0
and t.strategy_type = '2'
GROUP BY
DATE_FORMAT(t.create_time,"%Y-%m-%d"),
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result
</select>
<select id="countScorecardHit" resultType="com.fibo.ddp.common.model.monitor.decisionflow.TMonitorStrategyDTO">
select
DATE_FORMAT(t.create_time,"%Y-%m-%d") as callDate,
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result,
count(1) as total
from
t_monitor_strategy t
where datediff(now(),t.create_time)=0
and t.strategy_type = '4'
GROUP BY
DATE_FORMAT(t.create_time,"%Y-%m-%d"),
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result
</select>
<select id="countDecisionTables" resultType="com.fibo.ddp.common.model.monitor.decisionflow.TMonitorStrategyDTO">
select
DATE_FORMAT(t.create_time,"%Y-%m-%d") as callDate,
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result,
count(1) as total
from
t_monitor_strategy t
where datediff(now(),t.create_time)=0
and t.strategy_type = '16'
GROUP BY
DATE_FORMAT(t.create_time,"%Y-%m-%d"),
engine_id,
engine_version_id,
organ_id,
strategy_id,
strategy_name,
result
</select>
</mapper>

View File

@@ -0,0 +1,21 @@
package com.fibo.ddp.common.dao.monitor.decisionflow;
import com.fibo.ddp.common.model.monitor.decisionflow.UserInfo;
import com.fibo.ddp.common.utils.constant.monitor.Constants;
import com.spring4all.spring.boot.starter.hbase.api.RowMapper;
import org.apache.hadoop.hbase.util.Bytes;
public class UserInfoHbaseMapper implements RowMapper<UserInfo> {
private static byte[] NAME = Constants.UserInfoTable.TABLE_NAME.getBytes();
private static byte[] FAMILY_BASE_INFO = Constants.UserInfoTable.FAMILY_BASE_INFO.getBytes();
private static byte[] BASEINFO = Constants.UserInfoTable.BASEINFO.getBytes();
@Override
public UserInfo mapRow(org.apache.hadoop.hbase.client.Result result, int i) throws Exception {
UserInfo.BaseInfo baseInfo = new UserInfo.BaseInfo(
Bytes.toString(result.getValue(FAMILY_BASE_INFO,NAME))
);
return new UserInfo(baseInfo);
}
}

View File

@@ -0,0 +1,30 @@
package com.fibo.ddp.common.dao.monitor.logger;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fibo.ddp.common.model.monitor.logger.Logger;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* ClassName:LoggerMapper </br>
* Description:日志mapper
* */
public interface LoggerMapper extends BaseMapper<Logger> {
/**
* getLogList :(获取日志集合)
*
* @param param 参数集合
* @return
* */
public List<Logger> getLogList(Map<String, Object> param);
/**
* 查询最后登录时间
* @param userId
* @return
*/
public List<Date> getLastLoginInfo(Long userId);
}

Some files were not shown because too many files have changed in this diff Show More