♻️ Refactoring code. mybatis plus 3.x refactor
This commit is contained in:
1 parent
ff47da2767
commit
c981e6137d
77 files changed
+463
-1340
No files matched your search
@@ -13,10 +13,6 @@ trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.{yml,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# 对后缀名为 md 的文件生效
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
@@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~
|
||||
~ Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
~
|
||||
~ Redistribution and use in source and binary forms, with or without
|
||||
~ modification, are permitted provided that the following conditions are met:
|
||||
~
|
||||
~ Redistributions of source code must retain the above copyright notice,
|
||||
~ this list of conditions and the following disclaimer.
|
||||
~ Redistributions in binary form must reproduce the above copyright
|
||||
~ notice, this list of conditions and the following disclaimer in the
|
||||
~ documentation and/or other materials provided with the distribution.
|
||||
~ Neither the name of the pig4cloud.com developer nor the names of its
|
||||
~ contributors may be used to endorse or promote products derived from
|
||||
~ this software without specific prior written permission.
|
||||
~ Author: lengleng (wangiegie@gmail.com)
|
||||
~
|
||||
-->
|
||||
<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>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pigx-common-aspect</artifactId>
|
||||
<description>公共切面包</description>
|
||||
<packaging>jar</packaging>
|
||||
<dependencies>
|
||||
<!--servlet-api-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--mybatis plus extension,包含了mybatis plus core-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- slf4j-api -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
</project>
|
||||
-64
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
package com.pig4cloud.pigx.common.aspect.config;
|
||||
|
||||
import com.pig4cloud.pigx.common.aspect.resolver.PaginationArgumentResolver;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* WebMvcConfig
|
||||
*
|
||||
* @author: lishangbu
|
||||
* @date: 2018/10/18
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfig implements WebMvcConfigurer {
|
||||
@Override
|
||||
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(new PaginationArgumentResolver());
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果继承了WebMvcConfigurationSupport,则在yml中配置的相关内容会失效。 需要重新指定静态资源
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
// 重写默认的相关配置
|
||||
registry.addResourceHandler("/**").addResourceLocations(
|
||||
"classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/");
|
||||
// 放行swagger相关资源
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置servlet处理
|
||||
*/
|
||||
@Override
|
||||
public void configureDefaultServletHandling(
|
||||
DefaultServletHandlerConfigurer configurer) {
|
||||
configurer.enable();
|
||||
}
|
||||
}
|
||||
-80
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
package com.pig4cloud.pigx.common.aspect.resolver;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||
import org.springframework.web.context.request.NativeWebRequest;
|
||||
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
|
||||
import org.springframework.web.method.support.ModelAndViewContainer;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* PaginationArgumentResolver
|
||||
* 分页参数解析器
|
||||
*
|
||||
* @author: lishangbu
|
||||
* @date: 2018/10/18
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class PaginationArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
private static final String CURRENT = "current";
|
||||
|
||||
/**
|
||||
* 每页显示条数
|
||||
*/
|
||||
private static final String SIZE = "size";
|
||||
|
||||
/**
|
||||
* 入参筛选
|
||||
*
|
||||
* @param parameter 参数集合
|
||||
* @return 格式化后的参数
|
||||
*/
|
||||
@Override
|
||||
public boolean supportsParameter(MethodParameter parameter) {
|
||||
return parameter.getParameterType().equals(Page.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param parameter 入参集合
|
||||
* @param mavContainer model 和 view
|
||||
* @param webRequest web相关
|
||||
* @param binderFactory 入参解析
|
||||
* @return 包装对象
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) throws Exception {
|
||||
HttpServletRequest request = webRequest.getNativeRequest(HttpServletRequest.class);
|
||||
try {
|
||||
return new Page(Long.valueOf(Optional.ofNullable(request.getParameter(CURRENT)).orElse("1")),
|
||||
Long.valueOf(Optional.ofNullable(request.getParameter(SIZE)).orElse("10")));
|
||||
} catch (NumberFormatException e) {
|
||||
return new Page();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.pig4cloud.pigx.common.aspect.config.WebMvcConfig
|
||||
@@ -33,7 +33,6 @@
|
||||
<description>pigx 公共聚合模块</description>
|
||||
|
||||
<modules>
|
||||
<module>pigx-common-aspect</module>
|
||||
<module>pigx-common-cache</module>
|
||||
<module>pigx-common-core</module>
|
||||
<module>pigx-common-gateway</module>
|
||||
|
||||
+12
@@ -20,7 +20,9 @@
|
||||
package com.pig4cloud.pigx.admin.config;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.core.parser.ISqlParser;
|
||||
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
@@ -88,4 +90,14 @@ public class MybatisPlusConfigurer {
|
||||
public DataScopeInterceptor dataScopeInterceptor() {
|
||||
return new DataScopeInterceptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除插件
|
||||
*
|
||||
* @return LogicSqlInjector
|
||||
*/
|
||||
@Bean
|
||||
public ISqlInjector sqlInjector() {
|
||||
return new LogicSqlInjector();
|
||||
}
|
||||
}
|
||||
+6
-8
@@ -19,7 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.pig4cloud.pigx.admin.api.dto.DeptTree;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDept;
|
||||
import com.pig4cloud.pigx.admin.service.SysDeptService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -31,7 +30,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -55,7 +53,7 @@ public class DeptController {
|
||||
* @return SysDept
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysDept> get(@PathVariable Integer id) {
|
||||
public R get(@PathVariable Integer id) {
|
||||
return new R<>(sysDeptService.getById(id));
|
||||
}
|
||||
|
||||
@@ -66,7 +64,7 @@ public class DeptController {
|
||||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public R<List<DeptTree>> getTree() {
|
||||
public R getTree() {
|
||||
return new R<>(sysDeptService.selectTree());
|
||||
}
|
||||
|
||||
@@ -76,7 +74,7 @@ public class DeptController {
|
||||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/user-tree")
|
||||
public R<List<DeptTree>> userTree() {
|
||||
public R userTree() {
|
||||
return new R<>(sysDeptService.selectUserTree());
|
||||
}
|
||||
|
||||
@@ -89,7 +87,7 @@ public class DeptController {
|
||||
@SysLog("添加部门")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_add')")
|
||||
public R<Boolean> add(@Valid @RequestBody SysDept sysDept) {
|
||||
public R add(@Valid @RequestBody SysDept sysDept) {
|
||||
return new R<>(sysDeptService.insertDept(sysDept));
|
||||
}
|
||||
|
||||
@@ -102,7 +100,7 @@ public class DeptController {
|
||||
@SysLog("删除部门")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_del')")
|
||||
public R<Boolean> delete(@PathVariable Integer id) {
|
||||
public R delete(@PathVariable Integer id) {
|
||||
return new R<>(sysDeptService.deleteDeptById(id));
|
||||
}
|
||||
|
||||
@@ -115,7 +113,7 @@ public class DeptController {
|
||||
@SysLog("编辑部门")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_dept_edit')")
|
||||
public R<Boolean> edit(@Valid @RequestBody SysDept sysDept) {
|
||||
public R edit(@Valid @RequestBody SysDept sysDept) {
|
||||
sysDept.setUpdateTime(LocalDateTime.now());
|
||||
return new R<>(sysDeptService.updateDeptById(sysDept));
|
||||
}
|
||||
|
||||
+11
-12
@@ -20,8 +20,8 @@
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
import com.pig4cloud.pigx.admin.service.SysDictService;
|
||||
@@ -35,7 +35,6 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -59,7 +58,7 @@ public class DictController {
|
||||
* @return 字典信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysDict> dict(@PathVariable Integer id) {
|
||||
public R dict(@PathVariable Integer id) {
|
||||
return new R<>(sysDictService.getById(id));
|
||||
}
|
||||
|
||||
@@ -70,8 +69,8 @@ public class DictController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<SysDict>> getSysDictPage(Page<SysDict> page, SysDict sysDict) {
|
||||
return new R<>(sysDictService.getSysDictPage(page,sysDict));
|
||||
public R<IPage> getSysDictPage(Page page, SysDict sysDict) {
|
||||
return new R<>(sysDictService.page(page, Wrappers.query(sysDict)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,10 +81,10 @@ public class DictController {
|
||||
*/
|
||||
@GetMapping("/type/{type}")
|
||||
@Cacheable(value = "dict_details", key = "#type")
|
||||
public R<List<SysDict>> findDictByType(@PathVariable String type) {
|
||||
SysDict condition = new SysDict();
|
||||
condition.setType(type);
|
||||
return new R<>(sysDictService.list(new QueryWrapper<>(condition)));
|
||||
public R findDictByType(@PathVariable String type) {
|
||||
return new R<>(sysDictService.list(Wrappers
|
||||
.<SysDict>query().lambda()
|
||||
.eq(SysDict::getType, type)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,7 +97,7 @@ public class DictController {
|
||||
@PostMapping
|
||||
@CacheEvict(value = "dict_details", key = "#sysDict.type")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dict_add')")
|
||||
public R<Boolean> dict(@Valid @RequestBody SysDict sysDict) {
|
||||
public R dict(@Valid @RequestBody SysDict sysDict) {
|
||||
return new R<>(sysDictService.save(sysDict));
|
||||
}
|
||||
|
||||
@@ -113,7 +112,7 @@ public class DictController {
|
||||
@DeleteMapping("/{id}/{type}")
|
||||
@CacheEvict(value = "dict_details", key = "#type")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dict_del')")
|
||||
public R<Boolean> deleteDict(@PathVariable Integer id, @PathVariable String type) {
|
||||
public R deleteDict(@PathVariable Integer id, @PathVariable String type) {
|
||||
return new R<>(sysDictService.removeById(id));
|
||||
}
|
||||
|
||||
@@ -127,7 +126,7 @@ public class DictController {
|
||||
@SysLog("修改字典")
|
||||
@CacheEvict(value = "dict_details", key = "#sysDict.type")
|
||||
@PreAuthorize("@pms.hasPermission('sys_dict_edit')")
|
||||
public R<Boolean> editDict(@Valid @RequestBody SysDict sysDict) {
|
||||
public R editDict(@Valid @RequestBody SysDict sysDict) {
|
||||
return new R<>(sysDictService.updateById(sysDict));
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -20,7 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pigx.admin.api.vo.PreLogVo;
|
||||
@@ -45,19 +45,20 @@ import java.util.List;
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/log")
|
||||
@Api(value = "log",description = "日志管理模块")
|
||||
@Api(value = "log", description = "日志管理模块")
|
||||
public class LogController {
|
||||
private final SysLogService sysLogService;
|
||||
|
||||
/**
|
||||
* 简单分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param sysLog 系统日志
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<SysLog>> getSysLogPage(Page<SysLog> page, SysLog sysLog) {
|
||||
return new R<>(sysLogService.getSysLogPage(page,sysLog));
|
||||
public R getSysLogPage(Page page, SysLog sysLog) {
|
||||
return new R<>(sysLogService.page(page, Wrappers.query(sysLog)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,7 +69,7 @@ public class LogController {
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_log_del')")
|
||||
public R<Boolean> delete(@PathVariable Long id) {
|
||||
public R delete(@PathVariable Long id) {
|
||||
return new R<>(sysLogService.removeById(id));
|
||||
}
|
||||
|
||||
@@ -79,7 +80,7 @@ public class LogController {
|
||||
* @return success/false
|
||||
*/
|
||||
@PostMapping
|
||||
public R<Boolean> save(@Valid @RequestBody SysLog sysLog) {
|
||||
public R save(@Valid @RequestBody SysLog sysLog) {
|
||||
return new R<>(sysLogService.save(sysLog));
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ public class LogController {
|
||||
* @return success/false
|
||||
*/
|
||||
@PostMapping("/logs")
|
||||
public R<Boolean> saveLogs(@RequestBody List<PreLogVo> preLogVoList) {
|
||||
public R saveLogs(@RequestBody List<PreLogVo> preLogVoList) {
|
||||
return new R<>(sysLogService.insertLogs(preLogVoList));
|
||||
}
|
||||
}
|
||||
+9
-10
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pig4cloud.pigx.admin.api.dto.MenuTree;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysMenu;
|
||||
import com.pig4cloud.pigx.admin.api.vo.MenuVO;
|
||||
@@ -58,7 +58,7 @@ public class MenuController {
|
||||
* @return 当前用户的树形菜单
|
||||
*/
|
||||
@GetMapping
|
||||
public R<List<MenuTree>> userMenu() {
|
||||
public R userMenu() {
|
||||
// 获取符合条件的菜单
|
||||
Set<MenuVO> all = new HashSet<>();
|
||||
SecurityUtils.getRoles()
|
||||
@@ -77,9 +77,8 @@ public class MenuController {
|
||||
* @return 树形菜单
|
||||
*/
|
||||
@GetMapping(value = "/tree")
|
||||
public R<List<MenuTree>> getTree() {
|
||||
return new R<>(TreeUtil.bulidTree(sysMenuService.list(new QueryWrapper<SysMenu>()
|
||||
.lambda().eq(SysMenu::getDelFlag,CommonConstant.STATUS_NORMAL)), -1));
|
||||
public R getTree() {
|
||||
return new R<>(TreeUtil.bulidTree(sysMenuService.list(Wrappers.emptyWrapper()), -1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +88,7 @@ public class MenuController {
|
||||
* @return 属性集合
|
||||
*/
|
||||
@GetMapping("/tree/{roleId}")
|
||||
public List<Integer> roleTree(@PathVariable Integer roleId) {
|
||||
public List roleTree(@PathVariable Integer roleId) {
|
||||
return sysMenuService.findMenuByRoleId(roleId)
|
||||
.stream()
|
||||
.map(MenuVO::getMenuId)
|
||||
@@ -103,7 +102,7 @@ public class MenuController {
|
||||
* @return 菜单详细信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysMenu> menu(@PathVariable Integer id) {
|
||||
public R menu(@PathVariable Integer id) {
|
||||
return new R<>(sysMenuService.getById(id));
|
||||
}
|
||||
|
||||
@@ -116,7 +115,7 @@ public class MenuController {
|
||||
@SysLog("新增菜单")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_add')")
|
||||
public R<Boolean> menu(@Valid @RequestBody SysMenu sysMenu) {
|
||||
public R menu(@Valid @RequestBody SysMenu sysMenu) {
|
||||
return new R<>(sysMenuService.save(sysMenu));
|
||||
}
|
||||
|
||||
@@ -129,7 +128,7 @@ public class MenuController {
|
||||
@SysLog("删除菜单")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_del')")
|
||||
public R<Boolean> menuDel(@PathVariable Integer id) {
|
||||
public R menuDel(@PathVariable Integer id) {
|
||||
return new R<>(sysMenuService.deleteMenu(id));
|
||||
}
|
||||
|
||||
@@ -142,7 +141,7 @@ public class MenuController {
|
||||
@SysLog("更新菜单")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_menu_edit')")
|
||||
public R<Boolean> menuUpdate(@Valid @RequestBody SysMenu sysMenu) {
|
||||
public R menuUpdate(@Valid @RequestBody SysMenu sysMenu) {
|
||||
return new R<>(sysMenuService.updateMenuById(sysMenu));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ public class MobileController {
|
||||
|
||||
@SysLog("发送验证码")
|
||||
@GetMapping("/{mobile}")
|
||||
public R<Boolean> code(@PathVariable String mobile) {
|
||||
public R code(@PathVariable String mobile) {
|
||||
return mobileService.sendSmsCode(mobile);
|
||||
}
|
||||
}
|
||||
+9
-8
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
import com.pig4cloud.pigx.admin.service.SysOauthClientDetailsService;
|
||||
@@ -54,20 +54,21 @@ public class OauthClientDetailsController {
|
||||
* @return SysOauthClientDetails
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysOauthClientDetails> get(@PathVariable Integer id) {
|
||||
public R get(@PathVariable Integer id) {
|
||||
return new R<>(sysOauthClientDetailsService.getById(id));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 简单分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param sysOauthClientDetails 系统终端
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<SysOauthClientDetails>> getSysOauthClientDetailsPage(Page<SysOauthClientDetails> page, SysOauthClientDetails sysOauthClientDetails) {
|
||||
return new R<>(sysOauthClientDetailsService.getSysOauthClientDetailsPage(page,sysOauthClientDetails));
|
||||
public R getSysOauthClientDetailsPage(Page page, SysOauthClientDetails sysOauthClientDetails) {
|
||||
return new R<>(sysOauthClientDetailsService.page(page, Wrappers.query(sysOauthClientDetails)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,7 @@ public class OauthClientDetailsController {
|
||||
@SysLog("添加终端")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_add')")
|
||||
public R<Boolean> add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
public R add(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
return new R<>(sysOauthClientDetailsService.save(sysOauthClientDetails));
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public class OauthClientDetailsController {
|
||||
@SysLog("删除终端")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_del')")
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
public R delete(@PathVariable String id) {
|
||||
return new R<>(sysOauthClientDetailsService.deleteClientDetailsById(id));
|
||||
}
|
||||
|
||||
@@ -105,7 +106,7 @@ public class OauthClientDetailsController {
|
||||
@SysLog("编辑终端")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_client_edit')")
|
||||
public R<Boolean> edit(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
public R edit(@Valid @RequestBody SysOauthClientDetails sysOauthClientDetails) {
|
||||
return new R<>(sysOauthClientDetailsService.updateClientDetailsById(sysOauthClientDetails));
|
||||
}
|
||||
}
|
||||
+10
-14
@@ -19,8 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRole;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleMenuService;
|
||||
@@ -32,9 +31,6 @@ import lombok.AllArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2017/11/5
|
||||
@@ -54,7 +50,7 @@ public class RoleController {
|
||||
* @return 角色信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysRole> role(@PathVariable Integer id) {
|
||||
public R role(@PathVariable Integer id) {
|
||||
return new R<>(sysRoleService.getById(id));
|
||||
}
|
||||
|
||||
@@ -67,7 +63,7 @@ public class RoleController {
|
||||
@SysLog("添加角色")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_add')")
|
||||
public R<Boolean> role(@RequestBody SysRole sysRole) {
|
||||
public R role(@RequestBody SysRole sysRole) {
|
||||
return new R<>(sysRoleService.save(sysRole));
|
||||
}
|
||||
|
||||
@@ -80,7 +76,7 @@ public class RoleController {
|
||||
@SysLog("修改角色")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_edit')")
|
||||
public R<Boolean> roleUpdate(@RequestBody SysRole sysRole) {
|
||||
public R roleUpdate(@RequestBody SysRole sysRole) {
|
||||
return new R<>(sysRoleService.updateById(sysRole));
|
||||
}
|
||||
|
||||
@@ -93,7 +89,7 @@ public class RoleController {
|
||||
@SysLog("删除角色")
|
||||
@DeleteMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_del')")
|
||||
public R<Boolean> roleDel(@PathVariable Integer id) {
|
||||
public R roleDel(@PathVariable Integer id) {
|
||||
return new R<>(sysRoleService.deleteRoleById(id));
|
||||
}
|
||||
|
||||
@@ -103,8 +99,8 @@ public class RoleController {
|
||||
* @return 角色列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public R<List<SysRole>> roleList() {
|
||||
return new R<>(sysRoleService.list(new QueryWrapper<>()));
|
||||
public R roleList() {
|
||||
return new R<>(sysRoleService.list(Wrappers.emptyWrapper()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,8 +110,8 @@ public class RoleController {
|
||||
* @return 分页对象
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage> rolePage(Page page) {
|
||||
return new R<>(sysRoleService.page(page, new QueryWrapper<>()));
|
||||
public R rolePage(Page page) {
|
||||
return new R<>(sysRoleService.page(page, Wrappers.emptyWrapper()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -128,7 +124,7 @@ public class RoleController {
|
||||
@SysLog("更新角色菜单")
|
||||
@PutMapping("/upd-menu")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_perm')")
|
||||
public R<Boolean> roleMenuUpd(Integer roleId, @RequestParam(value = "menuIds", required = false) String menuIds) {
|
||||
public R roleMenuUpd(Integer roleId, @RequestParam(value = "menuIds", required = false) String menuIds) {
|
||||
SysRole sysRole = sysRoleService.getById(roleId);
|
||||
return new R<>(sysRoleMenuService.insertRoleMenus(sysRole.getRoleCode(), roleId, menuIds));
|
||||
}
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class SysRouteConfController {
|
||||
*/
|
||||
@GetMapping
|
||||
public R routes() {
|
||||
return new R<>(sysRouteConfService.routes());
|
||||
return new R<>(sysRouteConfService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-7
@@ -17,9 +17,8 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
import com.pig4cloud.pigx.admin.service.SysSocialDetailsService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -53,8 +52,8 @@ public class SysSocialDetailsController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<SysSocialDetails>> getSysSocialDetailsPage(Page<SysSocialDetails> page, SysSocialDetails sysSocialDetails) {
|
||||
return new R<>(sysSocialDetailsService.getSysSocialDetailsPage(page, sysSocialDetails));
|
||||
public R getSysSocialDetailsPage(Page page, SysSocialDetails sysSocialDetails) {
|
||||
return new R<>(sysSocialDetailsService.page(page, Wrappers.query(sysSocialDetails)));
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +64,7 @@ public class SysSocialDetailsController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<SysSocialDetails> info(@PathVariable("id") Integer id) {
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
return new R<>(sysSocialDetailsService.getById(id));
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ public class SysSocialDetailsController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/info/{inStr}")
|
||||
public R<UserInfo> social(@PathVariable String inStr) {
|
||||
public R social(@PathVariable String inStr) {
|
||||
return new R<>(sysSocialDetailsService.findUserInfo(inStr));
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ public class SysSocialDetailsController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/bind")
|
||||
public R<Boolean> bind(String state, String code) {
|
||||
public R bind(String state, String code) {
|
||||
return new R<>(sysSocialDetailsService.bindSocial(state, code));
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -17,8 +17,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.feign.RemoteTokenService;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -49,7 +47,7 @@ public class TokenController {
|
||||
* @return token集合
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<Page> token(@RequestParam Map<String, Object> params) {
|
||||
public R token(@RequestParam Map<String, Object> params) {
|
||||
return remoteTokenService.selectPage(params, SecurityConstants.FROM_IN);
|
||||
}
|
||||
|
||||
@@ -62,7 +60,7 @@ public class TokenController {
|
||||
@SysLog("删除用户token")
|
||||
@DeleteMapping("/{token}")
|
||||
@PreAuthorize("@pms.hasPermission('sys_token_del')")
|
||||
public R<Boolean> delete(@PathVariable String token) {
|
||||
public R delete(@PathVariable String token) {
|
||||
return remoteTokenService.deleteTokenById(token, SecurityConstants.FROM_IN);
|
||||
}
|
||||
}
|
||||
+17
-39
@@ -21,15 +21,11 @@ package com.pig4cloud.pigx.admin.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserDTO;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUserRole;
|
||||
import com.pig4cloud.pigx.admin.api.vo.UserVO;
|
||||
import com.pig4cloud.pigx.admin.service.SysUserService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
@@ -38,14 +34,10 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -56,7 +48,6 @@ import java.util.List;
|
||||
@RequestMapping("/user")
|
||||
@Api(value = "user", description = "用户管理模块")
|
||||
public class UserController {
|
||||
private static final PasswordEncoder ENCODER = new BCryptPasswordEncoder();
|
||||
private final SysUserService userService;
|
||||
|
||||
/**
|
||||
@@ -68,8 +59,8 @@ public class UserController {
|
||||
* @return 用户名
|
||||
*/
|
||||
@GetMapping(value = {"/info", "/info/{username}"})
|
||||
public R<UserInfo> user(@PathVariable(required = false) String username,
|
||||
@RequestHeader(required = false) String from) {
|
||||
public R user(@PathVariable(required = false) String username,
|
||||
@RequestHeader(required = false) String from) {
|
||||
// 查询用户不为空时判断是不是内部请求
|
||||
if (StrUtil.isNotBlank(username) && !StrUtil.equals(SecurityConstants.FROM_IN, from)) {
|
||||
return new R<>(null, "error");
|
||||
@@ -78,10 +69,8 @@ public class UserController {
|
||||
if (StrUtil.isBlank(username)) {
|
||||
username = SecurityUtils.getUser().getUsername();
|
||||
}
|
||||
|
||||
SysUser condition = new SysUser();
|
||||
condition.setUsername(username);
|
||||
SysUser sysUser = userService.getOne(new QueryWrapper<>(condition));
|
||||
SysUser sysUser = userService.getOne(Wrappers.<SysUser>query()
|
||||
.lambda().eq(SysUser::getUsername, username));
|
||||
if (sysUser == null) {
|
||||
return new R<>();
|
||||
}
|
||||
@@ -95,7 +84,7 @@ public class UserController {
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<UserVO> user(@PathVariable Integer id) {
|
||||
public R user(@PathVariable Integer id) {
|
||||
return new R<>(userService.selectUserVoById(id));
|
||||
}
|
||||
|
||||
@@ -106,7 +95,7 @@ public class UserController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/details/{username}")
|
||||
public R<SysUser> user(@PathVariable String username) {
|
||||
public R user(@PathVariable String username) {
|
||||
SysUser condition = new SysUser();
|
||||
condition.setUsername(username);
|
||||
return new R<>(userService.getOne(new QueryWrapper<>(condition)));
|
||||
@@ -123,7 +112,7 @@ public class UserController {
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_del')")
|
||||
@ApiOperation(value = "删除用户", notes = "根据ID删除用户")
|
||||
@ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
public R<Boolean> userDel(@PathVariable Integer id) {
|
||||
public R userDel(@PathVariable Integer id) {
|
||||
SysUser sysUser = userService.getById(id);
|
||||
return new R<>(userService.deleteUserById(sysUser));
|
||||
}
|
||||
@@ -137,19 +126,8 @@ public class UserController {
|
||||
@SysLog("添加用户")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_add')")
|
||||
public R<Boolean> user(@RequestBody UserDTO userDto) {
|
||||
SysUser sysUser = new SysUser();
|
||||
BeanUtils.copyProperties(userDto, sysUser);
|
||||
sysUser.setDelFlag(CommonConstant.STATUS_NORMAL);
|
||||
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
|
||||
userService.save(sysUser);
|
||||
userDto.getRole().forEach(roleId -> {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(sysUser.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
userRole.insert();
|
||||
});
|
||||
return new R<>(Boolean.TRUE);
|
||||
public R user(@RequestBody UserDTO userDto) {
|
||||
return new R<>(userService.saveUser(userDto));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,20 +139,20 @@ public class UserController {
|
||||
@SysLog("更新用户信息")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('sys_user_edit')")
|
||||
public R<Boolean> userUpdate(@Valid @RequestBody UserDTO userDto) {
|
||||
public R userUpdate(@Valid @RequestBody UserDTO userDto) {
|
||||
return new R<>(userService.updateUser(userDto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户
|
||||
*
|
||||
* @param page 参数集
|
||||
* @param username 用户名
|
||||
* @param page 参数集
|
||||
* @param userDTO 查询参数列表
|
||||
* @return 用户集合
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage> userPage(Page<List<UserVO>> page, @RequestParam(required = false) String username,@RequestParam(required = false) String deptId) {
|
||||
return new R<>(userService.getUsersWithRolePage(page,username,deptId));
|
||||
public R userPage(Page page, UserDTO userDTO) {
|
||||
return new R<>(userService.getUsersWithRolePage(page, userDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,7 +163,7 @@ public class UserController {
|
||||
*/
|
||||
@SysLog("修改个人信息")
|
||||
@PutMapping("/edit")
|
||||
public R<Boolean> editInfo(@Valid @RequestBody UserDTO userDto) {
|
||||
public R editInfo(@Valid @RequestBody UserDTO userDto) {
|
||||
return userService.updateUserInfo(userDto);
|
||||
}
|
||||
|
||||
@@ -194,7 +172,7 @@ public class UserController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/ancestor/{username}")
|
||||
public R<List<SysUser>> ancestorUsers(@PathVariable String username) {
|
||||
public R ancestorUsers(@PathVariable String username) {
|
||||
return new R<>(userService.ancestorUsers(username));
|
||||
}
|
||||
}
|
||||
+3
-4
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
import com.pig4cloud.pigx.admin.service.SysUserService;
|
||||
@@ -55,10 +55,9 @@ public class SmsLoginHandler extends AbstractLoginHandler {
|
||||
*/
|
||||
@Override
|
||||
public UserInfo info(String identify) {
|
||||
SysUser condition = new SysUser();
|
||||
condition.setPhone(identify);
|
||||
SysUser sysUser = sysUserService
|
||||
.getOne(new QueryWrapper<>(condition));
|
||||
.getOne(Wrappers.<SysUser>query()
|
||||
.lambda().eq(SysUser::getPhone, identify));
|
||||
|
||||
if (sysUser == null) {
|
||||
log.info("手机号未注册:{}", identify);
|
||||
|
||||
+3
-3
@@ -19,6 +19,7 @@ package com.pig4cloud.pigx.admin.handler;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
@@ -74,10 +75,9 @@ public class WeChatLoginHandler extends AbstractLoginHandler {
|
||||
*/
|
||||
@Override
|
||||
public UserInfo info(String openId) {
|
||||
SysUser condition = new SysUser();
|
||||
condition.setWxOpenid(openId);
|
||||
SysUser sysUser = sysUserService
|
||||
.getOne(new QueryWrapper<>(condition));
|
||||
.getOne(Wrappers.<SysUser>query()
|
||||
.lambda().eq(SysUser::getWxOpenid, openId));
|
||||
|
||||
if (sysUser == null) {
|
||||
log.info("微信未绑定:{}", openId);
|
||||
|
||||
-10
@@ -20,10 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -34,12 +31,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @since 2017-11-19
|
||||
*/
|
||||
public interface SysDictMapper extends BaseMapper<SysDict> {
|
||||
/**
|
||||
* 系统字典简单分页查询
|
||||
* @param sysDict 系统字典
|
||||
* @return
|
||||
*/
|
||||
IPage<SysDict> getSysDictPage(Page page, @Param("sysDict") SysDict sysDict);
|
||||
|
||||
|
||||
}
|
||||
-9
@@ -20,10 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -34,10 +31,4 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @since 2017-11-20
|
||||
*/
|
||||
public interface SysLogMapper extends BaseMapper<SysLog> {
|
||||
/**
|
||||
* 系统日志简单分页查询
|
||||
* @param sysLog 系统日志
|
||||
* @return
|
||||
*/
|
||||
IPage<SysLog> getSysLogPage(Page page, @Param("sysLog") SysLog sysLog);
|
||||
}
|
||||
-10
@@ -21,10 +21,7 @@ package com.pig4cloud.pigx.admin.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -35,12 +32,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @since 2018-05-15
|
||||
*/
|
||||
public interface SysOauthClientDetailsMapper extends BaseMapper<SysOauthClientDetails> {
|
||||
/**
|
||||
* 系统终端简单分页查询
|
||||
* @param sysOauthClientDetails 系统终端
|
||||
* @return
|
||||
*/
|
||||
IPage<SysOauthClientDetails> getSysOauthClientDetailsPage(Page page, @Param("sysOauthClientDetails") SysOauthClientDetails sysOauthClientDetails);
|
||||
|
||||
|
||||
}
|
||||
+1
-9
@@ -18,11 +18,8 @@
|
||||
package com.pig4cloud.pigx.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 系统社交登录账号表
|
||||
@@ -32,10 +29,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysSocialDetailsMapper extends BaseMapper<SysSocialDetails> {
|
||||
/**
|
||||
* 社交登录简单分页查询
|
||||
* @param sysSocialDetails 社交登录
|
||||
* @return
|
||||
*/
|
||||
IPage<SysSocialDetails> getSysSocialDetailsPage(Page page, @Param("sysSocialDetails") SysSocialDetails sysSocialDetails);
|
||||
|
||||
}
|
||||
+4
-3
@@ -22,6 +22,7 @@ package com.pig4cloud.pigx.admin.mapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserDTO;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
import com.pig4cloud.pigx.admin.api.vo.UserVO;
|
||||
import com.pig4cloud.pigx.common.core.datascope.DataScope;
|
||||
@@ -49,12 +50,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
|
||||
/**
|
||||
* 分页查询用户信息(含角色)
|
||||
*
|
||||
* @param page 分页
|
||||
* @param username 用户名
|
||||
* @param page 分页
|
||||
* @param userDTO 查询参数
|
||||
* @param dataScope
|
||||
* @return list
|
||||
*/
|
||||
IPage<List<UserVO>> getUserVosPage(Page page, @Param("username") String username,@Param("deptId")String deptId,DataScope dataScope);
|
||||
IPage<List<UserVO>> getUserVosPage(Page page, @Param("query") UserDTO userDTO, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 通过ID查询用户信息
|
||||
|
||||
-10
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
|
||||
@@ -33,12 +31,4 @@ import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
* @since 2017-11-19
|
||||
*/
|
||||
public interface SysDictService extends IService<SysDict> {
|
||||
|
||||
/**
|
||||
* 系统字典简单分页查询
|
||||
* @param sysDict 系统字典
|
||||
* @return
|
||||
*/
|
||||
IPage<SysDict> getSysDictPage(Page<SysDict> page, SysDict sysDict);
|
||||
|
||||
}
|
||||
-8
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pigx.admin.api.vo.PreLogVo;
|
||||
@@ -37,12 +35,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysLogService extends IService<SysLog> {
|
||||
|
||||
/**
|
||||
* 系统日志简单分页查询
|
||||
* @param sysLog 系统日志
|
||||
* @return
|
||||
*/
|
||||
IPage<SysLog> getSysLogPage(Page<SysLog> page, SysLog sysLog);
|
||||
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
|
||||
-10
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
|
||||
@@ -33,14 +31,6 @@ import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
* @since 2018-05-15
|
||||
*/
|
||||
public interface SysOauthClientDetailsService extends IService<SysOauthClientDetails> {
|
||||
/**
|
||||
* 系统终端简单分页查询
|
||||
* @param sysOauthClientDetails 系统终端
|
||||
* @return
|
||||
*/
|
||||
IPage<SysOauthClientDetails> getSysOauthClientDetailsPage(Page<SysOauthClientDetails> page, SysOauthClientDetails sysOauthClientDetails);
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID删除客户端
|
||||
*
|
||||
|
||||
-9
@@ -17,8 +17,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
@@ -31,13 +29,6 @@ import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
*/
|
||||
public interface SysSocialDetailsService extends IService<SysSocialDetails> {
|
||||
|
||||
/**
|
||||
* 社交登录简单分页查询
|
||||
* @param sysSocialDetails 社交登录
|
||||
* @return
|
||||
*/
|
||||
IPage<SysSocialDetails> getSysSocialDetailsPage(Page<SysSocialDetails> page, SysSocialDetails sysSocialDetails);
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
*
|
||||
|
||||
+13
-5
@@ -46,11 +46,11 @@ public interface SysUserService extends IService<SysUser> {
|
||||
/**
|
||||
* 分页查询用户信息(含有角色信息)
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param username 用户名
|
||||
* @param page 分页对象
|
||||
* @param userDTO 参数列表
|
||||
* @return
|
||||
*/
|
||||
IPage<List<UserVO>> getUsersWithRolePage(Page<List<UserVO>> page, String username,String deptId);
|
||||
IPage getUsersWithRolePage(Page page, UserDTO userDTO);
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
@@ -63,7 +63,7 @@ public interface SysUserService extends IService<SysUser> {
|
||||
/**
|
||||
* 更新当前用户基本信息
|
||||
*
|
||||
* @param userDto 用户信息
|
||||
* @param userDto 用户信息
|
||||
* @return Boolean
|
||||
*/
|
||||
R<Boolean> updateUserInfo(UserDTO userDto);
|
||||
@@ -71,7 +71,7 @@ public interface SysUserService extends IService<SysUser> {
|
||||
/**
|
||||
* 更新指定用户信息
|
||||
*
|
||||
* @param userDto 用户信息
|
||||
* @param userDto 用户信息
|
||||
* @return
|
||||
*/
|
||||
Boolean updateUser(UserDTO userDto);
|
||||
@@ -91,4 +91,12 @@ public interface SysUserService extends IService<SysUser> {
|
||||
* @return R
|
||||
*/
|
||||
List<SysUser> ancestorUsers(String username);
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param userDto DTO 对象
|
||||
* @return success/fail
|
||||
*/
|
||||
Boolean saveUser(UserDTO userDto);
|
||||
}
|
||||
+4
-4
@@ -19,7 +19,7 @@ package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysUserMapper;
|
||||
import com.pig4cloud.pigx.admin.service.MobileService;
|
||||
@@ -58,9 +58,9 @@ public class MobileServiceImpl implements MobileService {
|
||||
*/
|
||||
@Override
|
||||
public R<Boolean> sendSmsCode(String mobile) {
|
||||
SysUser condition = new SysUser();
|
||||
condition.setPhone(mobile);
|
||||
List<SysUser> userList = userMapper.selectList(new QueryWrapper<>(condition));
|
||||
List<SysUser> userList = userMapper.selectList(Wrappers
|
||||
.<SysUser>query().lambda()
|
||||
.eq(SysUser::getPhone, mobile));
|
||||
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
log.info("手机号未注册:{}", mobile);
|
||||
|
||||
+3
-2
@@ -20,7 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDept;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDeptRelation;
|
||||
@@ -58,7 +58,8 @@ public class SysDeptRelationServiceImpl extends ServiceImpl<SysDeptRelationMappe
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
condition.setDescendant(sysDept.getParentId());
|
||||
List<SysDeptRelation> relationList = sysDeptRelationMapper
|
||||
.selectList(new QueryWrapper<>(condition))
|
||||
.selectList(Wrappers.<SysDeptRelation>query().lambda()
|
||||
.eq(SysDeptRelation::getDescendant, sysDept.getParentId()))
|
||||
.stream().map(relation -> {
|
||||
relation.setDescendant(sysDept.getDeptId());
|
||||
return relation;
|
||||
|
||||
+6
-14
@@ -20,7 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.dto.DeptTree;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDept;
|
||||
@@ -29,7 +29,6 @@ import com.pig4cloud.pigx.admin.api.vo.TreeUtil;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysDeptMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysDeptRelationService;
|
||||
import com.pig4cloud.pigx.admin.service.SysDeptService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -79,10 +78,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteDeptById(Integer id) {
|
||||
//级联删除部门
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
condition.setAncestor(id);
|
||||
List<Integer> idList = sysDeptRelationService
|
||||
.list(new QueryWrapper<>(condition))
|
||||
.list(Wrappers.<SysDeptRelation>query().lambda()
|
||||
.eq(SysDeptRelation::getAncestor, id))
|
||||
.stream()
|
||||
.map(SysDeptRelation::getDescendant)
|
||||
.collect(Collectors.toList());
|
||||
@@ -122,10 +120,7 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
*/
|
||||
@Override
|
||||
public List<DeptTree> selectTree() {
|
||||
return getDeptTree(this.list(
|
||||
new QueryWrapper<SysDept>()
|
||||
.lambda().eq(SysDept::getDelFlag, CommonConstant.STATUS_NORMAL)
|
||||
));
|
||||
return getDeptTree(this.list(Wrappers.emptyWrapper()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -136,11 +131,9 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
@Override
|
||||
public List<DeptTree> selectUserTree() {
|
||||
Integer deptId = SecurityUtils.getUser().getDeptId();
|
||||
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
condition.setAncestor(deptId);
|
||||
List<Integer> descendantIdList = sysDeptRelationService
|
||||
.list(new QueryWrapper<>(condition))
|
||||
.list(Wrappers.<SysDeptRelation>query().lambda()
|
||||
.eq(SysDeptRelation::getAncestor, deptId))
|
||||
.stream().map(SysDeptRelation::getDescendant)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -155,7 +148,6 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
* @return
|
||||
*/
|
||||
private List<DeptTree> getDeptTree(List<SysDept> depts) {
|
||||
|
||||
List<DeptTree> treeList = depts.stream()
|
||||
.filter(dept -> !dept.getDeptId().equals(dept.getParentId()))
|
||||
.map(dept -> {
|
||||
|
||||
-12
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysDict;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysDictMapper;
|
||||
@@ -37,15 +35,5 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> implements SysDictService {
|
||||
/**
|
||||
* 系统字典简单分页查询
|
||||
* @param sysDict 系统字典
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysDict> getSysDictPage(Page<SysDict> page, SysDict sysDict){
|
||||
return baseMapper.getSysDictPage(page,sysDict);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-11
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysLog;
|
||||
import com.pig4cloud.pigx.admin.api.vo.PreLogVo;
|
||||
@@ -43,15 +41,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
public class SysLogServiceImpl extends ServiceImpl<SysLogMapper, SysLog> implements SysLogService {
|
||||
/**
|
||||
* 系统日志简单分页查询
|
||||
* @param sysLog 系统日志
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysLog> getSysLogPage(Page<SysLog> page, SysLog sysLog){
|
||||
return baseMapper.getSysLogPage(page,sysLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量插入前端错误日志
|
||||
|
||||
+7
-11
@@ -19,8 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysMenu;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
||||
@@ -61,19 +60,16 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
@CacheEvict(value = "menu_details", allEntries = true)
|
||||
public Boolean deleteMenu(Integer id) {
|
||||
// 查询父节点为当前节点的节点
|
||||
SysMenu conditon = new SysMenu();
|
||||
conditon.setParentId(id);
|
||||
List<Integer> menuIdList = this.list(new QueryWrapper<>(conditon))
|
||||
List<Integer> menuIdList = this.list(Wrappers.<SysMenu>query()
|
||||
.lambda().eq(SysMenu::getParentId, id))
|
||||
.stream().map(SysMenu::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
menuIdList.add(id);
|
||||
|
||||
//删除关联ROLE_MENU 数据
|
||||
menuIdList.forEach(menu -> {
|
||||
SysRoleMenu conditon2 = new SysRoleMenu();
|
||||
conditon2.setMenuId(menu);
|
||||
sysRoleMenuMapper.delete(new UpdateWrapper<>(conditon2));
|
||||
});
|
||||
menuIdList.add(id);
|
||||
menuIdList.forEach(menu -> sysRoleMenuMapper
|
||||
.delete(Wrappers.<SysRoleMenu>query()
|
||||
.lambda().eq(SysRoleMenu::getMenuId, menu)));
|
||||
//删除当前菜单及其子菜单
|
||||
return this.removeByIds(menuIdList);
|
||||
}
|
||||
|
||||
-13
@@ -19,8 +19,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysOauthClientDetails;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysOauthClientDetailsMapper;
|
||||
@@ -40,17 +38,6 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class SysOauthClientDetailsServiceImpl extends ServiceImpl<SysOauthClientDetailsMapper, SysOauthClientDetails> implements SysOauthClientDetailsService {
|
||||
|
||||
|
||||
/**
|
||||
* 系统终端简单分页查询
|
||||
* @param sysOauthClientDetails 系统终端
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysOauthClientDetails> getSysOauthClientDetailsPage(Page<SysOauthClientDetails> page, SysOauthClientDetails sysOauthClientDetails){
|
||||
return baseMapper.getSysOauthClientDetailsPage(page,sysOauthClientDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID删除客户端
|
||||
*
|
||||
|
||||
+3
-5
@@ -20,7 +20,7 @@
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysRoleMenuMapper;
|
||||
@@ -58,14 +58,12 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@CacheEvict(value = "menu_details", key = "#roleId + '_menu'")
|
||||
public Boolean insertRoleMenus(String role, Integer roleId, String menuIds) {
|
||||
SysRoleMenu condition = new SysRoleMenu();
|
||||
condition.setRoleId(roleId);
|
||||
this.remove(new UpdateWrapper<>(condition));
|
||||
this.remove(Wrappers.<SysRoleMenu>query().lambda()
|
||||
.eq(SysRoleMenu::getRoleId, role));
|
||||
|
||||
if (StrUtil.isBlank(menuIds)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
List<SysRoleMenu> roleMenuList = Arrays
|
||||
.stream(menuIds.split(","))
|
||||
.map(menuId -> {
|
||||
|
||||
+5
-6
@@ -19,7 +19,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRole;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
||||
@@ -53,7 +53,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysRole> findRolesByUserId(Integer userId) {
|
||||
public List findRolesByUserId(Integer userId) {
|
||||
return baseMapper.findRolesByUserId(userId);
|
||||
}
|
||||
|
||||
@@ -67,10 +67,9 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
@CacheEvict(value = "menu_details", allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteRoleById(Integer id) {
|
||||
SysRoleMenu condition = new SysRoleMenu();
|
||||
condition.setRoleId(id);
|
||||
|
||||
sysRoleMenuMapper.delete(new UpdateWrapper<>(condition));
|
||||
sysRoleMenuMapper.delete(Wrappers
|
||||
.<SysRoleMenu>update().lambda()
|
||||
.eq(SysRoleMenu::getRoleId, id));
|
||||
return this.removeById(id);
|
||||
}
|
||||
}
|
||||
+2
-4
@@ -19,8 +19,8 @@ package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRouteConf;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysRouteConfMapper;
|
||||
@@ -69,9 +69,7 @@ public class SysRouteConfServiceImpl extends ServiceImpl<SysRouteConfMapper, Sys
|
||||
*/
|
||||
@Override
|
||||
public List<SysRouteConf> routes() {
|
||||
SysRouteConf condition = new SysRouteConf();
|
||||
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
|
||||
return baseMapper.selectList(new QueryWrapper<>(condition));
|
||||
return baseMapper.selectList(Wrappers.emptyWrapper());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-61
@@ -17,10 +17,6 @@
|
||||
|
||||
package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserInfo;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysSocialDetails;
|
||||
@@ -29,8 +25,6 @@ import com.pig4cloud.pigx.admin.handler.LoginHandler;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysSocialDetailsMapper;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysUserMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysSocialDetailsService;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.EnumLoginType;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,7 +32,6 @@ import org.springframework.cache.CacheManager;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -54,35 +47,21 @@ public class SysSocialDetailsServiceImpl extends ServiceImpl<SysSocialDetailsMap
|
||||
private final RestTemplate restTemplate;
|
||||
private final SysUserMapper sysUserMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 社交登录简单分页查询
|
||||
*
|
||||
* @param sysSocialDetails 社交登录
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<SysSocialDetails> getSysSocialDetailsPage(Page<SysSocialDetails> page, SysSocialDetails sysSocialDetails) {
|
||||
return baseMapper.getSysSocialDetailsPage(page, sysSocialDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定社交账号
|
||||
*
|
||||
* @param appId appId
|
||||
* @param code code
|
||||
* @param type type
|
||||
* @param code code
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean bindSocial(String appId, String code) {
|
||||
Map<String, String> result = getOpenId(appId, code);
|
||||
|
||||
public Boolean bindSocial(String type, String code) {
|
||||
String identify = loginHandlerMap.get(type).identify(code);
|
||||
SysUser sysUser = sysUserMapper.selectById(SecurityUtils.getUser().getId());
|
||||
sysUser.setWxOpenid(result.get("openId"));
|
||||
|
||||
sysUser.setWxOpenid(identify);
|
||||
sysUserMapper.updateById(sysUser);
|
||||
//更新緩存
|
||||
cacheManager.getCache("user_details").evict(result.get("openId"));
|
||||
cacheManager.getCache("user_details").evict(sysUser.getUsername());
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -99,38 +78,4 @@ public class SysSocialDetailsServiceImpl extends ServiceImpl<SysSocialDetailsMap
|
||||
String loginStr = inStrs[1];
|
||||
return loginHandlerMap.get(type).handle(loginStr);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过appid 、code 获得openID
|
||||
*
|
||||
* @param appId
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getOpenId(String appId, String code) {
|
||||
SysSocialDetails condition = new SysSocialDetails();
|
||||
condition.setAppId(appId);
|
||||
SysSocialDetails socialDetails = this.baseMapper.selectOne(new QueryWrapper<>(condition));
|
||||
|
||||
String openId = null;
|
||||
//微信登录
|
||||
if (EnumLoginType.WECHAT.getType().equals(socialDetails.getType())) {
|
||||
String url = String.format(SecurityConstants.WX_AUTHORIZATION_CODE_URL
|
||||
, socialDetails.getAppId(), socialDetails.getAppSecret(), code);
|
||||
String result = restTemplate.getForObject(url, String.class);
|
||||
log.debug("微信响应报文:{}", result);
|
||||
|
||||
Object obj = JSONUtil.parseObj(result).get("openid");
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
openId = obj.toString();
|
||||
}
|
||||
|
||||
Map<String, String> result = new HashMap<>(2);
|
||||
result.put("type", socialDetails.getType());
|
||||
result.put("openId", openId);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
+45
-20
@@ -21,9 +21,8 @@ package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.dto.UserDTO;
|
||||
@@ -33,6 +32,7 @@ import com.pig4cloud.pigx.admin.api.vo.MenuVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.UserVO;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysUserMapper;
|
||||
import com.pig4cloud.pigx.admin.service.*;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstant;
|
||||
import com.pig4cloud.pigx.common.core.datascope.DataScope;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
|
||||
@@ -45,6 +45,7 @@ import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashSet;
|
||||
@@ -67,6 +68,30 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
private final SysUserRoleService sysUserRoleService;
|
||||
private final SysDeptRelationService sysDeptRelationService;
|
||||
|
||||
/**
|
||||
* 保存用户信息
|
||||
*
|
||||
* @param userDto DTO 对象
|
||||
* @return success/fail
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean saveUser(UserDTO userDto) {
|
||||
SysUser sysUser = new SysUser();
|
||||
BeanUtils.copyProperties(userDto, sysUser);
|
||||
sysUser.setDelFlag(CommonConstant.STATUS_NORMAL);
|
||||
sysUser.setPassword(ENCODER.encode(userDto.getPassword()));
|
||||
baseMapper.insert(sysUser);
|
||||
List<SysUserRole> userRoleList = userDto.getRole()
|
||||
.stream().map(roleId -> {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(sysUser.getUserId());
|
||||
userRole.setRoleId(roleId);
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
return sysUserRoleService.saveBatch(userRoleList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过查用户的全部信息
|
||||
*
|
||||
@@ -103,17 +128,22 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
return userInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询用户信息(含有角色信息)
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param userDTO 参数列表
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<List<UserVO>> getUsersWithRolePage(Page<List<UserVO>> page, String username,String deptId) {
|
||||
public IPage getUsersWithRolePage(Page page, UserDTO userDTO) {
|
||||
DataScope dataScope = new DataScope();
|
||||
dataScope.setScopeName("deptId");
|
||||
dataScope.setIsOnly(true);
|
||||
dataScope.setDeptIds(getChildDepts());
|
||||
IPage<List<UserVO>> userVosPage = baseMapper.getUserVosPage(page, username,deptId, dataScope);
|
||||
return userVosPage.setTotal(Long.valueOf(userVosPage.getRecords().size()));
|
||||
return baseMapper.getUserVosPage(page, userDTO, dataScope);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过ID查询用户信息
|
||||
*
|
||||
@@ -171,9 +201,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
}
|
||||
this.updateById(sysUser);
|
||||
|
||||
SysUserRole condition = new SysUserRole();
|
||||
condition.setUserId(userDto.getUserId());
|
||||
sysUserRoleService.remove(new UpdateWrapper<>(condition));
|
||||
sysUserRoleService.remove(Wrappers.<SysUserRole>update().lambda()
|
||||
.eq(SysUserRole::getUserId, userDto.getUserId()));
|
||||
userDto.getRole().forEach(roleId -> {
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
userRole.setUserId(sysUser.getUserId());
|
||||
@@ -191,20 +220,17 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
*/
|
||||
@Override
|
||||
public List<SysUser> ancestorUsers(String username) {
|
||||
SysUser condition = new SysUser();
|
||||
condition.setUsername(username);
|
||||
SysUser sysUser = this.getOne(new QueryWrapper<>(condition));
|
||||
SysUser sysUser = this.getOne(Wrappers.<SysUser>query().lambda()
|
||||
.eq(SysUser::getUsername, username));
|
||||
|
||||
Integer deptId = sysUser.getDeptId();
|
||||
SysDept sysDept = sysDeptService.getById(deptId);
|
||||
SysDept sysDept = sysDeptService.getById(sysUser.getDeptId());
|
||||
if (sysDept == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Integer parentId = sysDept.getParentId();
|
||||
SysUser condition2 = new SysUser();
|
||||
condition2.setDeptId(parentId);
|
||||
return this.list(new QueryWrapper<>(condition2));
|
||||
return this.list(Wrappers.<SysUser>query().lambda()
|
||||
.eq(SysUser::getDeptId, parentId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,10 +241,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||
private List<Integer> getChildDepts() {
|
||||
Integer deptId = SecurityUtils.getUser().getDeptId();
|
||||
//获取当前部门的子部门
|
||||
SysDeptRelation condition = new SysDeptRelation();
|
||||
condition.setAncestor(deptId);
|
||||
return sysDeptRelationService
|
||||
.list(new QueryWrapper<>(condition))
|
||||
.list(Wrappers.<SysDeptRelation>query().lambda()
|
||||
.eq(SysDeptRelation::getAncestor, deptId))
|
||||
.stream()
|
||||
.map(SysDeptRelation::getDescendant)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@@ -35,54 +35,4 @@
|
||||
<result property="remarks" column="remarks"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<!--sysDict简单分页查询-->
|
||||
<select id="getSysDictPage" resultMap="sysDictMap">
|
||||
SELECT
|
||||
id,
|
||||
`value`,
|
||||
label,
|
||||
`type`,
|
||||
description,
|
||||
sort,
|
||||
create_time,
|
||||
update_time,
|
||||
remarks,
|
||||
del_flag
|
||||
FROM sys_dict
|
||||
<where>
|
||||
<if test="sysDict.id!=null and sysDict.id.trim() != ''">
|
||||
AND id = #{sysDict.id}
|
||||
</if>
|
||||
<if test="sysDict.value!=null and sysDict.value.trim() != ''">
|
||||
AND value = #{sysDict.value}
|
||||
</if>
|
||||
<if test="sysDict.label!=null and sysDict.label.trim() != ''">
|
||||
AND label = #{sysDict.label}
|
||||
</if>
|
||||
<if test="sysDict.type!=null and sysDict.type.trim() != ''">
|
||||
AND type = #{sysDict.type}
|
||||
</if>
|
||||
<if test="sysDict.description!=null and sysDict.description.trim() != ''">
|
||||
AND description = #{sysDict.description}
|
||||
</if>
|
||||
<if test="sysDict.sort!=null and sysDict.sort.trim() != ''">
|
||||
AND sort = #{sysDict.sort}
|
||||
</if>
|
||||
<if test="sysDict.createTime!=null and sysDict.createTime.trim() != ''">
|
||||
AND create_time = #{sysDict.createTime}
|
||||
</if>
|
||||
<if test="sysDict.updateTime!=null and sysDict.updateTime.trim() != ''">
|
||||
AND update_time = #{sysDict.updateTime}
|
||||
</if>
|
||||
<if test="sysDict.remarks!=null and sysDict.remarks.trim() != ''">
|
||||
AND remarks = #{sysDict.remarks}
|
||||
</if>
|
||||
<if test="sysDict.delFlag!=null and sysDict.delFlag.trim() != ''">
|
||||
AND del_flag = #{sysDict.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -40,74 +40,4 @@
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="exception" column="exception"/>
|
||||
</resultMap>
|
||||
|
||||
<!--sysLog简单分页查询-->
|
||||
<select id="getSysLogPage" resultMap="sysLogMap">
|
||||
SELECT
|
||||
id,
|
||||
type,
|
||||
title,
|
||||
service_id,
|
||||
create_by,
|
||||
create_time,
|
||||
update_time,
|
||||
remote_addr,
|
||||
user_agent,
|
||||
request_uri,
|
||||
method,
|
||||
params,
|
||||
time,
|
||||
del_flag,
|
||||
exception
|
||||
FROM sys_log
|
||||
<where>
|
||||
<if test="sysLog.id != null and sysLog.id.trim() != ''">
|
||||
AND id = #{sysLog.id}
|
||||
</if>
|
||||
<if test="sysLog.type != null and sysLog.type.trim() != ''">
|
||||
AND type = #{sysLog.type}
|
||||
</if>
|
||||
<if test="sysLog.title != null and sysLog.title.trim() != ''">
|
||||
AND title = #{sysLog.title}
|
||||
</if>
|
||||
<if test="sysLog.serviceId != null and sysLog.serviceId.trim() != ''">
|
||||
AND service_id = #{sysLog.serviceId}
|
||||
</if>
|
||||
<if test="sysLog.createBy != null and sysLog.createBy.trim() != ''">
|
||||
AND create_by = #{sysLog.createBy}
|
||||
</if>
|
||||
<if test="sysLog.createTime != null and sysLog.createTime.trim() != ''">
|
||||
AND create_time = #{sysLog.createTime}
|
||||
</if>
|
||||
<if test="sysLog.updateTime != null and sysLog.updateTime.trim() != ''">
|
||||
AND update_time = #{sysLog.updateTime}
|
||||
</if>
|
||||
<if test="sysLog.remoteAddr != null and sysLog.remoteAddr.trim() != ''">
|
||||
AND remote_addr LIKE CONCAT('%',#{sysLog.remoteAddr},'%')
|
||||
</if>
|
||||
<if test="sysLog.userAgent != null and sysLog.userAgent.trim() != ''">
|
||||
AND user_agent = #{sysLog.userAgent}
|
||||
</if>
|
||||
<if test="sysLog.requestUri != null and sysLog.requestUri.trim() != ''">
|
||||
AND request_uri LIKE CONCAT('%',#{sysLog.requestUri},'%')
|
||||
</if>
|
||||
<if test="sysLog.method != null and sysLog.method.trim() != ''">
|
||||
AND method = #{sysLog.method}
|
||||
</if>
|
||||
<if test="sysLog.params != null and sysLog.params.trim() != ''">
|
||||
AND params = #{sysLog.params}
|
||||
</if>
|
||||
<if test="sysLog.time != null and sysLog.time.trim() != ''">
|
||||
AND time = #{sysLog.time}
|
||||
</if>
|
||||
<if test="sysLog.delFlag != null and sysLog.delFlag.trim() != ''">
|
||||
AND del_flag = #{sysLog.delFlag}
|
||||
</if>
|
||||
<if test="sysLog.exception != null and sysLog.exception.trim() != ''">
|
||||
AND exception = #{sysLog.exception}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -36,58 +36,4 @@
|
||||
<result property="additionalInformation" column="additional_information"/>
|
||||
<result property="autoapprove" column="autoapprove"/>
|
||||
</resultMap>
|
||||
|
||||
<!--sysOauthClientDetails简单分页查询-->
|
||||
<select id="getSysOauthClientDetailsPage" resultMap="sysOauthClientDetailsMap">
|
||||
SELECT
|
||||
client_id,
|
||||
resource_ids,
|
||||
client_secret,
|
||||
scope,
|
||||
authorized_grant_types,
|
||||
web_server_redirect_uri,
|
||||
authorities,
|
||||
access_token_validity,
|
||||
refresh_token_validity,
|
||||
additional_information,
|
||||
autoapprove
|
||||
FROM sys_oauth_client_details
|
||||
<where>
|
||||
<if test="sysOauthClientDetails.clientId != null and sysOauthClientDetails.clientId != ''">
|
||||
AND client_id = #{sysOauthClientDetails.clientId}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.resourceIds != null and sysOauthClientDetails.resourceIds != ''">
|
||||
AND resource_ids = #{sysOauthClientDetails.resourceIds}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.clientSecret != null and sysOauthClientDetails.clientSecret != ''">
|
||||
AND client_secret = #{sysOauthClientDetails.clientSecret}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.scope != null and sysOauthClientDetails.scope != ''">
|
||||
AND scope = #{sysOauthClientDetails.scope}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.authorizedGrantTypes != null and sysOauthClientDetails.authorizedGrantTypes != ''">
|
||||
AND authorized_grant_types = #{sysOauthClientDetails.authorizedGrantTypes}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.webServerRedirectUri != null and sysOauthClientDetails.webServerRedirectUri != ''">
|
||||
AND web_server_redirect_uri = #{sysOauthClientDetails.webServerRedirectUri}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.authorities != null and sysOauthClientDetails.authorities != ''">
|
||||
AND authorities = #{sysOauthClientDetails.authorities}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.accessTokenValidity != null and sysOauthClientDetails.accessTokenValidity != ''">
|
||||
AND access_token_validity = #{sysOauthClientDetails.accessTokenValidity}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.refreshTokenValidity != null and sysOauthClientDetails.refreshTokenValidity != ''">
|
||||
AND refresh_token_validity = #{sysOauthClientDetails.refreshTokenValidity}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.additionalInformation != null and sysOauthClientDetails.additionalInformation != ''">
|
||||
AND additional_information = #{sysOauthClientDetails.additionalInformation}
|
||||
</if>
|
||||
<if test="sysOauthClientDetails.autoapprove != null and sysOauthClientDetails.autoapprove != ''">
|
||||
AND autoapprove = #{sysOauthClientDetails.autoapprove}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -34,50 +34,4 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<!--sysSocialDetails简单分页查询-->
|
||||
<select id="getSysSocialDetailsPage" resultMap="sysSocialDetailsMap">
|
||||
SELECT
|
||||
id,
|
||||
type,
|
||||
remark,
|
||||
app_id,
|
||||
app_secret,
|
||||
redirect_url,
|
||||
create_time,
|
||||
update_time,
|
||||
del_flag
|
||||
FROM sys_social_details
|
||||
<where>
|
||||
<if test="sysSocialDetails.id != null and sysSocialDetails.id != ''">
|
||||
AND id = #{sysSocialDetails.id}
|
||||
</if>
|
||||
<if test="sysSocialDetails.type != null and sysSocialDetails.type != ''">
|
||||
AND type = #{sysSocialDetails.type}
|
||||
</if>
|
||||
<if test="sysSocialDetails.remark != null and sysSocialDetails.remark != ''">
|
||||
AND remark = #{sysSocialDetails.remark}
|
||||
</if>
|
||||
<if test="sysSocialDetails.appId != null and sysSocialDetails.appId != ''">
|
||||
AND app_id = #{sysSocialDetails.appId}
|
||||
</if>
|
||||
<if test="sysSocialDetails.appSecret != null and sysSocialDetails.appSecret != ''">
|
||||
AND app_secret = #{sysSocialDetails.appSecret}
|
||||
</if>
|
||||
<if test="sysSocialDetails.redirectUrl != null and sysSocialDetails.redirectUrl != ''">
|
||||
AND redirect_url = #{sysSocialDetails.redirectUrl}
|
||||
</if>
|
||||
<if test="sysSocialDetails.createTime != null and sysSocialDetails.createTime != ''">
|
||||
AND create_time = #{sysSocialDetails.createTime}
|
||||
</if>
|
||||
<if test="sysSocialDetails.updateTime != null and sysSocialDetails.updateTime != ''">
|
||||
AND update_time = #{sysSocialDetails.updateTime}
|
||||
</if>
|
||||
<if test="sysSocialDetails.delFlag != null and sysSocialDetails.delFlag != ''">
|
||||
AND del_flag = #{sysSocialDetails.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -65,74 +65,31 @@
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserVo">
|
||||
SELECT
|
||||
`user`.user_id,
|
||||
`user`.username,
|
||||
`user`.`password`,
|
||||
`user`.salt,
|
||||
`user`.phone,
|
||||
`user`.avatar,
|
||||
`user`.wx_openid,
|
||||
`user`.qq_openid,
|
||||
`user`.dept_id,
|
||||
`user`.create_time AS ucreate_time,
|
||||
`user`.update_time AS uupdate_time,
|
||||
`user`.del_flag AS udel_flag,
|
||||
`user`.lock_flag AS lock_flag,
|
||||
`user`.dept_id AS deptId,
|
||||
`user`.tenant_id AS tenantId,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_code,
|
||||
r.role_desc,
|
||||
r.create_time AS rcreate_time,
|
||||
r.update_time AS rupdate_time
|
||||
FROM
|
||||
sys_user AS `user`
|
||||
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`.user_id
|
||||
LEFT JOIN sys_role AS r ON r.role_id = ur.role_id
|
||||
</sql>
|
||||
<sql id="userRoleSql">
|
||||
`user`.user_id,
|
||||
`user`.username,
|
||||
`user`.`password`,
|
||||
`user`.salt,
|
||||
`user`.phone,
|
||||
`user`.avatar,
|
||||
`user`.wx_openid,
|
||||
`user`.qq_openid,
|
||||
`user`.dept_id,
|
||||
`user`.create_time AS ucreate_time,
|
||||
`user`.update_time AS uupdate_time,
|
||||
`user`.del_flag AS udel_flag,
|
||||
`user`.lock_flag AS lock_flag,
|
||||
`user`.dept_id AS deptId,
|
||||
`user`.tenant_id AS tenantId,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_code,
|
||||
r.role_desc,
|
||||
r.create_time AS rcreate_time,
|
||||
r.update_time AS rupdate_time
|
||||
</sql>
|
||||
|
||||
<select id="selectUserVoByUsername" resultMap="userVoResultMap">
|
||||
<include refid="selectUserVo"/>
|
||||
WHERE `user`.username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="selectUserVoById" resultMap="userVoResultMap">
|
||||
SELECT
|
||||
`user`.user_id,
|
||||
`user`.username,
|
||||
`user`.`password`,
|
||||
`user`.salt,
|
||||
`user`.phone,
|
||||
`user`.avatar,
|
||||
`user`.wx_openid,
|
||||
`user`.qq_openid,
|
||||
`user`.create_time AS ucreate_time,
|
||||
`user`.update_time AS uupdate_time,
|
||||
`user`.del_flag AS udel_flag,
|
||||
`user`.lock_flag AS lock_flag,
|
||||
`user`.tenant_id AS tenantId,
|
||||
r.role_id,
|
||||
r.role_name,
|
||||
r.role_code,
|
||||
r.role_desc,
|
||||
r.create_time AS rcreate_time,
|
||||
r.update_time AS rupdate_time,
|
||||
d.name AS deptName,
|
||||
d.dept_id AS deptId
|
||||
FROM
|
||||
sys_user AS `user`
|
||||
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`.user_id
|
||||
LEFT JOIN sys_role AS r ON r.role_id = ur.role_id
|
||||
LEFT JOIN sys_dept AS d ON d.dept_id = `user`.dept_id
|
||||
WHERE
|
||||
`user`.user_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getUserVosPage" resultMap="userVoResultMap">
|
||||
SELECT
|
||||
<sql id="userRoleDeptSql">
|
||||
`user`.user_id,
|
||||
`user`.username,
|
||||
`user`.`password`,
|
||||
@@ -154,6 +111,33 @@
|
||||
r.update_time AS rupdate_time,
|
||||
d.name AS deptName,
|
||||
d.dept_id AS deptId
|
||||
</sql>
|
||||
|
||||
<select id="selectUserVoByUsername" resultMap="userVoResultMap">
|
||||
SELECT
|
||||
<include refid="userRoleSql"/>
|
||||
FROM
|
||||
sys_user AS `user`
|
||||
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`.user_id
|
||||
LEFT JOIN sys_role AS r ON r.role_id = ur.role_id
|
||||
WHERE `user`.username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="selectUserVoById" resultMap="userVoResultMap">
|
||||
SELECT
|
||||
<include refid="userRoleDeptSql"/>
|
||||
FROM
|
||||
sys_user AS `user`
|
||||
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`.user_id
|
||||
LEFT JOIN sys_role AS r ON r.role_id = ur.role_id
|
||||
LEFT JOIN sys_dept AS d ON d.dept_id = `user`.dept_id
|
||||
WHERE
|
||||
`user`.user_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getUserVosPage" resultMap="userVoResultMap">
|
||||
SELECT
|
||||
<include refid="userRoleSql"/>
|
||||
FROM
|
||||
sys_user AS `user`
|
||||
LEFT JOIN sys_user_role AS ur ON ur.user_id = `user`.user_id
|
||||
@@ -161,11 +145,11 @@
|
||||
LEFT JOIN sys_dept AS d ON d.dept_id = `user`.dept_id
|
||||
WHERE
|
||||
r.del_flag = 0
|
||||
<if test="username != null and username != ''">
|
||||
and `user`.username LIKE CONCAT('%',#{username},'%')
|
||||
<if test="query.username != null and query.username != ''">
|
||||
and `user`.username LIKE CONCAT('%',#{query.username},'%')
|
||||
</if>
|
||||
<if test="deptId != null and deptId != ''">
|
||||
and `user`.dept_id = #{deptId}
|
||||
<if test="query.deptId != null and query.deptId != ''">
|
||||
and `user`.dept_id = #{query.deptId}
|
||||
</if>
|
||||
ORDER BY `user`.create_time DESC
|
||||
</select>
|
||||
|
||||
+12
@@ -17,7 +17,9 @@
|
||||
|
||||
package com.pig4cloud.pigx.act.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.core.parser.ISqlParser;
|
||||
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.tenant.TenantSqlParser;
|
||||
@@ -73,4 +75,14 @@ public class MybatisPlusConfigurer {
|
||||
paginationInterceptor.setSqlParserList(sqlParserList);
|
||||
return paginationInterceptor;
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除插件
|
||||
*
|
||||
* @return LogicSqlInjector
|
||||
*/
|
||||
@Bean
|
||||
public ISqlInjector sqlInjector() {
|
||||
return new LogicSqlInjector();
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
import com.pig4cloud.pigx.act.service.LeaveBillService;
|
||||
@@ -44,13 +44,14 @@ public class LeaveBillController {
|
||||
|
||||
/**
|
||||
* 请假审批单简单分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param leaveBill 请假审批单
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<LeaveBill>> getLeaveBillPage(Page<LeaveBill> page, LeaveBill leaveBill) {
|
||||
return new R<>(leaveBillService.getLeaveBillPage(page,leaveBill));
|
||||
public R getLeaveBillPage(Page page, LeaveBill leaveBill) {
|
||||
return new R<>(leaveBillService.page(page, Wrappers.query(leaveBill)));
|
||||
}
|
||||
|
||||
|
||||
@@ -62,8 +63,7 @@ public class LeaveBillController {
|
||||
*/
|
||||
@GetMapping("/{leaveId}")
|
||||
public R info(@PathVariable("leaveId") Integer leaveId) {
|
||||
LeaveBill leaveBill = leaveBillService.getById(leaveId);
|
||||
return new R<>(leaveBill);
|
||||
return new R<>(leaveBillService.getById(leaveId));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,8 +87,7 @@ public class LeaveBillController {
|
||||
*/
|
||||
@PutMapping
|
||||
public R update(@RequestBody LeaveBill leaveBill) {
|
||||
leaveBillService.updateById(leaveBill);
|
||||
return new R<>(Boolean.TRUE);
|
||||
return new R<>(leaveBillService.updateById(leaveBill));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-10
@@ -17,12 +17,10 @@
|
||||
|
||||
package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pig4cloud.pigx.act.dto.ModelForm;
|
||||
import com.pig4cloud.pigx.act.service.ModelService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -45,25 +43,24 @@ public class ModelController {
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public String createModel(@RequestParam String name, @RequestParam String key,
|
||||
@RequestParam String desc, @RequestParam String category) {
|
||||
Model model = modelService.create(name, key, desc, category);
|
||||
return model.getId();
|
||||
public R createModel(@RequestParam String name, @RequestParam String key,
|
||||
@RequestParam String desc, @RequestParam String category) {
|
||||
return new R(modelService.create(name, key, desc, category));
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public R<IPage<Model>> list(@RequestParam Map<String, Object> params) {
|
||||
return new R<> (modelService.selectPage(params));
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(modelService.selectPage(params));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Boolean> delete(@PathVariable("id") String id) {
|
||||
public R delete(@PathVariable("id") String id) {
|
||||
return new R<>(modelService.delete(id));
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("/deploy/{id}")
|
||||
public R<Boolean> deploy(@PathVariable("id") String id) {
|
||||
public R deploy(@PathVariable("id") String id) {
|
||||
return new R<>(modelService.deploy(id));
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -18,8 +18,6 @@
|
||||
package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pig4cloud.pigx.act.dto.ProcessDefDTO;
|
||||
import com.pig4cloud.pigx.act.service.ProcessService;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.EnumResourceType;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -44,7 +42,7 @@ public class ProcessController {
|
||||
private final ProcessService processService;
|
||||
|
||||
@GetMapping
|
||||
public R<IPage<ProcessDefDTO>> list(@RequestParam Map<String, Object> params) {
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(processService.getProcessByPage(params));
|
||||
}
|
||||
|
||||
@@ -64,12 +62,12 @@ public class ProcessController {
|
||||
}
|
||||
|
||||
@PutMapping("/status/{procDefId}/{status}")
|
||||
public R<Boolean> updateState(@PathVariable String procDefId, @PathVariable String status) {
|
||||
public R updateState(@PathVariable String procDefId, @PathVariable String status) {
|
||||
return new R<>(processService.updateStatus(status, procDefId));
|
||||
}
|
||||
|
||||
@DeleteMapping("/{deploymentId}")
|
||||
public R<Boolean> deleteProcIns(@PathVariable String deploymentId) {
|
||||
public R deleteProcIns(@PathVariable String deploymentId) {
|
||||
return new R<>(processService.deleteProcIns(deploymentId));
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -18,7 +18,6 @@
|
||||
package com.pig4cloud.pigx.act.controller;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.pig4cloud.pigx.act.dto.LeaveBillDto;
|
||||
import com.pig4cloud.pigx.act.service.ActTaskService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -44,7 +43,7 @@ public class TaskController {
|
||||
private final ActTaskService actTaskService;
|
||||
|
||||
@GetMapping("/todo")
|
||||
public R<IPage> todo(@RequestParam Map<String, Object> params) {
|
||||
public R todo(@RequestParam Map<String, Object> params) {
|
||||
return new R<>(actTaskService.findTaskByName(params, SecurityUtils.getUsername()));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.pig4cloud.pigx.act.dto;
|
||||
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,7 @@ import java.util.List;
|
||||
* LeaveBillDto
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LeaveBillDto extends LeaveBill {
|
||||
/**
|
||||
* 任务ID
|
||||
|
||||
+1
-1
@@ -35,8 +35,8 @@ import java.time.LocalDateTime;
|
||||
* @date 2018-09-27 15:20:44
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("oa_leave_bill")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LeaveBill extends Model<LeaveBill> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
-9
@@ -1,11 +1,8 @@
|
||||
package com.pig4cloud.pigx.act.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 请假流程
|
||||
@@ -15,11 +12,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
*/
|
||||
@Mapper
|
||||
public interface LeaveBillMapper extends BaseMapper<LeaveBill> {
|
||||
/**
|
||||
* 请假审批单简单分页查询
|
||||
* @param leaveBill 请假审批单
|
||||
* @return
|
||||
*/
|
||||
IPage<LeaveBill> getLeaveBillPage(Page page, @Param("leaveBill") LeaveBill leaveBill);
|
||||
|
||||
}
|
||||
+1
-9
@@ -1,7 +1,5 @@
|
||||
package com.pig4cloud.pigx.act.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
|
||||
@@ -12,12 +10,6 @@ import com.pig4cloud.pigx.act.entity.LeaveBill;
|
||||
* @date 2018-09-27 15:20:44
|
||||
*/
|
||||
public interface LeaveBillService extends IService<LeaveBill> {
|
||||
/**
|
||||
* 请假审批单简单分页查询
|
||||
*
|
||||
* @param leaveBill 请假审批单
|
||||
* @return
|
||||
*/
|
||||
IPage<LeaveBill> getLeaveBillPage(Page<LeaveBill> page, LeaveBill leaveBill);
|
||||
|
||||
}
|
||||
|
||||
-11
@@ -32,15 +32,4 @@ import org.springframework.stereotype.Service;
|
||||
@Service("leaveBillService")
|
||||
public class LeaveBillServiceImpl extends ServiceImpl<LeaveBillMapper, LeaveBill> implements LeaveBillService {
|
||||
|
||||
/**
|
||||
* 请假审批单简单分页查询
|
||||
*
|
||||
* @param leaveBill 请假审批单
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<LeaveBill> getLeaveBillPage(Page<LeaveBill> page, LeaveBill leaveBill) {
|
||||
return baseMapper.getLeaveBillPage(page, leaveBill);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,56 +4,14 @@
|
||||
<mapper namespace="com.pig4cloud.pigx.act.mapper.LeaveBillMapper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="com.pig4cloud.pigx.act.entity.LeaveBill" id="leaveBillMap">
|
||||
<id property="leaveId" column="leave_id"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="days" column="days"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
<!--leaveBill简单分页查询-->
|
||||
<select id="getLeaveBillPage" resultMap="leaveBillMap">
|
||||
SELECT
|
||||
leave_id,
|
||||
username,
|
||||
days,
|
||||
content,
|
||||
state,
|
||||
create_time,
|
||||
update_time,
|
||||
del_flag
|
||||
FROM oa_leave_bill
|
||||
<where>
|
||||
<if test="leaveBill.leaveId != null and leaveBill.leaveId != ''">
|
||||
AND leave_id = #{leaveBill.leaveId}
|
||||
</if>
|
||||
<if test="leaveBill.username != null and leaveBill.username != ''">
|
||||
AND username = #{leaveBill.username}
|
||||
</if>
|
||||
<if test="leaveBill.days != null and leaveBill.days != ''">
|
||||
AND days = #{leaveBill.days}
|
||||
</if>
|
||||
<if test="leaveBill.content != null and leaveBill.content != ''">
|
||||
AND content = #{leaveBill.content}
|
||||
</if>
|
||||
<if test="leaveBill.state != null and leaveBill.state != ''">
|
||||
AND state = #{leaveBill.state}
|
||||
</if>
|
||||
<if test="leaveBill.createTime != null and leaveBill.createTime != ''">
|
||||
AND create_time = #{leaveBill.createTime}
|
||||
</if>
|
||||
<if test="leaveBill.updateTime != null and leaveBill.updateTime != ''">
|
||||
AND update_time = #{leaveBill.updateTime}
|
||||
</if>
|
||||
<if test="leaveBill.delFlag != null and leaveBill.delFlag != ''">
|
||||
AND del_flag = #{leaveBill.delFlag}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<resultMap type="com.pig4cloud.pigx.act.entity.LeaveBill" id="leaveBillMap">
|
||||
<id property="leaveId" column="leave_id"/>
|
||||
<result property="username" column="username"/>
|
||||
<result property="days" column="days"/>
|
||||
<result property="content" column="content"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+12
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.pig4cloud.pigx.codegen.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -38,4 +40,14 @@ public class MybatisPlusConfigurer {
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除插件
|
||||
*
|
||||
* @return LogicSqlInjector
|
||||
*/
|
||||
@Bean
|
||||
public ISqlInjector sqlInjector() {
|
||||
return new LogicSqlInjector();
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -18,12 +18,12 @@
|
||||
package com.pig4cloud.pigx.codegen.controller;
|
||||
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.codegen.entity.GenConfig;
|
||||
import com.pig4cloud.pigx.codegen.service.SysGeneratorService;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -48,8 +48,8 @@ public class SysGeneratorController {
|
||||
* @return 数据库表
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage> list(Page page, String tableName) {
|
||||
return new R<>(sysGeneratorService.queryPage(page,tableName));
|
||||
public R list(Page page, String tableName) {
|
||||
return new R<>(sysGeneratorService.queryPage(page, tableName));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,8 +60,8 @@ public class SysGeneratorController {
|
||||
byte[] data = sysGeneratorService.generatorCode(genConfig);
|
||||
|
||||
response.reset();
|
||||
response.setHeader("Content-Disposition", String.format("attachment; filename=%s.zip", genConfig.getTableName()));
|
||||
response.addHeader("Content-Length", "" + data.length);
|
||||
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename=%s.zip", genConfig.getTableName()));
|
||||
response.addHeader(HttpHeaders.CONTENT_LENGTH, String.valueOf(data.length));
|
||||
response.setContentType("application/octet-stream; charset=UTF-8");
|
||||
|
||||
IoUtil.write(response.getOutputStream(), Boolean.TRUE, data);
|
||||
|
||||
@@ -49,8 +49,8 @@ public class ${className}Controller {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<${className}>> get${className}Page(Page<${className}> page, ${className} ${classname}) {
|
||||
return new R<>(${classname}Service.get${className}Page(page,${classname}));
|
||||
public R get${className}Page(Page page, ${className} ${classname}) {
|
||||
return new R<>(${classname}Service.page(page,Wrappers.query(${classname})));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ${className}Controller {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{${pk.lowerAttrName}}")
|
||||
public R<${className}> getById(@PathVariable("${pk.lowerAttrName}") ${pk.attrType} ${pk.lowerAttrName}){
|
||||
public R getById(@PathVariable("${pk.lowerAttrName}") ${pk.attrType} ${pk.lowerAttrName}){
|
||||
return new R<>(${classname}Service.getById(${pk.lowerAttrName}));
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @date ${datetime}
|
||||
*/
|
||||
public interface ${className}Mapper extends BaseMapper<${className}> {
|
||||
/**
|
||||
* ${comments}简单分页查询
|
||||
* @param ${classname} ${comments}
|
||||
* @return
|
||||
*/
|
||||
IPage<${className}> get${className}Page(Page page, @Param("${classname}") ${className} ${classname});
|
||||
|
||||
|
||||
}
|
||||
@@ -32,27 +32,4 @@
|
||||
#end
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
<!--${classname}简单分页查询-->
|
||||
<select id="get${className}Page" resultMap="${classname}Map">
|
||||
SELECT
|
||||
#foreach($column in $columns)
|
||||
#if($foreach.count==$!{columns.size()})
|
||||
${column.columnName}
|
||||
#else
|
||||
${column.columnName},
|
||||
#end
|
||||
#end
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
#foreach($column in $columns)
|
||||
<if test="${classname}.$column.lowerAttrName != null and ${classname}.${column.lowerAttrName}.trim() != ''">
|
||||
AND ${column.columnName} = #{${classname}.$column.lowerAttrName}
|
||||
</if>
|
||||
#end
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -29,12 +29,4 @@ import ${package}.${moduleName}.entity.${className};
|
||||
*/
|
||||
public interface ${className}Service extends IService<${className}> {
|
||||
|
||||
/**
|
||||
* ${comments}简单分页查询
|
||||
* @param ${classname} ${comments}
|
||||
* @return
|
||||
*/
|
||||
IPage<${className}> get${className}Page(Page<${className}> page, ${className} ${classname});
|
||||
|
||||
|
||||
}
|
||||
@@ -32,14 +32,4 @@ import org.springframework.stereotype.Service;
|
||||
@Service("${classname}Service")
|
||||
public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${className}> implements ${className}Service {
|
||||
|
||||
/**
|
||||
* ${comments}简单分页查询
|
||||
* @param ${classname} ${comments}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<${className}> get${className}Page(Page<${className}> page, ${className} ${classname}){
|
||||
return baseMapper.get${className}Page(page,${classname});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,20 @@
|
||||
<!--
|
||||
- Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
-
|
||||
- Redistribution and use in source and binary forms, with or without
|
||||
- modification, are permitted provided that the following conditions are met:
|
||||
-
|
||||
- Redistributions of source code must retain the above copyright notice,
|
||||
- this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
- notice, this list of conditions and the following disclaimer in the
|
||||
- documentation and/or other materials provided with the distribution.
|
||||
- Neither the name of the pig4cloud.com developer nor the names of its
|
||||
- contributors may be used to endorse or promote products derived from
|
||||
- this software without specific prior written permission.
|
||||
- Author: lengleng (wangiegie@gmail.com)
|
||||
-->
|
||||
|
||||
<template>
|
||||
<div class="app-container pull-auto">
|
||||
<basic-container>
|
||||
@@ -6,9 +23,8 @@
|
||||
:data="tableData"
|
||||
:table-loading="tableLoading"
|
||||
:option="tableOption"
|
||||
@current-change="currentChange"
|
||||
@on-load="getList"
|
||||
@refresh-change="refreshChange"
|
||||
@size-change="sizeChange"
|
||||
@row-update="handleUpdate"
|
||||
@row-save="handleSave"
|
||||
@row-del="rowDel">
|
||||
@@ -53,122 +69,109 @@
|
||||
currentPage: 1, // 当前页数
|
||||
pageSize: 20 // 每页显示多少条
|
||||
},
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 20
|
||||
},
|
||||
tableLoading: false,
|
||||
tableOption: tableOption
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
mounted: function() { },
|
||||
computed: {
|
||||
...mapGetters(['permissions'])
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.tableLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.tableData = response.data.data.records
|
||||
this.page.total = response.data.data.total
|
||||
this.tableLoading = false
|
||||
})
|
||||
},
|
||||
currentChange(val) {
|
||||
this.page.current = val
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
sizeChange(val) {
|
||||
this.page.size = val
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
/**
|
||||
* @title 打开新增窗口
|
||||
* @detail 调用crud的handleadd方法即可
|
||||
*
|
||||
**/
|
||||
handleAdd: function() {
|
||||
this.$refs.crud.rowAdd()
|
||||
},
|
||||
handleEdit(row, index) {
|
||||
this.$refs.crud.rowEdit(row, index)
|
||||
},
|
||||
handleDel(row, index) {
|
||||
this.$refs.crud.rowDel(row, index)
|
||||
},
|
||||
rowDel: function(row, index) {
|
||||
var _this = this
|
||||
this.$confirm('是否确认删除ID为' + row.$pk.lowerAttrName + '的记录', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(function() {
|
||||
return delObj(row.$pk.lowerAttrName)
|
||||
methods: {
|
||||
getList(page, params) {
|
||||
this.tableLoading = true
|
||||
fetchList(Object.assign({
|
||||
page: page.currentPage,
|
||||
limit: page.pageSize
|
||||
}, params)).then(response => {
|
||||
this.tableData = response.data.records
|
||||
this.page.total = response.data.total
|
||||
this.tableLoading = false
|
||||
})
|
||||
.then(data => {
|
||||
_this.tableData.splice(index, 1)
|
||||
_this.$message({
|
||||
showClose: true,
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
},
|
||||
/**
|
||||
* @title 打开新增窗口
|
||||
* @detail 调用crud的handleadd方法即可
|
||||
*
|
||||
**/
|
||||
handleAdd: function() {
|
||||
this.$refs.crud.rowAdd()
|
||||
},
|
||||
handleEdit(row, index) {
|
||||
this.$refs.crud.rowEdit(row, index)
|
||||
},
|
||||
handleDel(row, index) {
|
||||
this.$refs.crud.rowDel(row, index)
|
||||
},
|
||||
rowDel: function(row, index) {
|
||||
var _this = this
|
||||
this.$confirm('是否确认删除ID为' + row.$pk.lowerAttrName, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
.then(function() {
|
||||
return delObj(row.$pk.lowerAttrName)
|
||||
})
|
||||
.then(data => {
|
||||
_this.tableData.splice(index, 1)
|
||||
_this.$message({
|
||||
showClose: true,
|
||||
message: '删除成功',
|
||||
type: 'success'
|
||||
})
|
||||
this.getList(this.page)
|
||||
})
|
||||
.catch(function(err) { })
|
||||
},
|
||||
/**
|
||||
* @title 数据更新
|
||||
* @param row 为当前的数据
|
||||
* @param index 为当前更新数据的行数
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleUpdate: function(row, index, done) {
|
||||
putObj(row).then(data => {
|
||||
this.tableData.splice(index, 1, Object.assign({}, row))
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @title 数据添加
|
||||
* @param row 为当前的数据
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleSave: function(row, done) {
|
||||
addObj(row).then(data => {
|
||||
this.tableData.push(Object.assign({}, row))
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 刷新回调
|
||||
*/
|
||||
refreshChange() {
|
||||
this.getList(this.page)
|
||||
})
|
||||
.catch(function(err) { })
|
||||
},
|
||||
/**
|
||||
* @title 数据更新
|
||||
* @param row 为当前的数据
|
||||
* @param index 为当前更新数据的行数
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleUpdate: function(row, index, done) {
|
||||
putObj(row).then(data => {
|
||||
this.tableData.splice(index, 1, Object.assign({}, row))
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '修改成功',
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* @title 数据添加
|
||||
* @param row 为当前的数据
|
||||
* @param done 为表单关闭函数
|
||||
*
|
||||
**/
|
||||
handleSave: function(row, done) {
|
||||
addObj(row).then(data => {
|
||||
this.tableData.push(Object.assign({}, row))
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '添加成功',
|
||||
type: 'success'
|
||||
})
|
||||
done()
|
||||
this.getList(this.page)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 刷新回调
|
||||
*/
|
||||
refreshChange() {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
</style>
|
||||
|
||||
+12
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.pig4cloud.pigx.daemon.config;
|
||||
|
||||
import com.baomidou.mybatisplus.core.injector.ISqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.injector.LogicSqlInjector;
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -38,4 +40,14 @@ public class MybatisPlusConfigurer {
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
}
|
||||
|
||||
/**
|
||||
* 逻辑删除插件
|
||||
*
|
||||
* @return LogicSqlInjector
|
||||
*/
|
||||
@Bean
|
||||
public ISqlInjector sqlInjector() {
|
||||
return new LogicSqlInjector();
|
||||
}
|
||||
}
|
||||
+7
-9
@@ -18,7 +18,7 @@
|
||||
package com.pig4cloud.pigx.daemon.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
@@ -26,8 +26,6 @@ import com.pig4cloud.pigx.daemon.service.ExecutionLogService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
@@ -48,8 +46,8 @@ public class ExecutionLogController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<ExecutionLog>> getExecutionLogPage(Page<ExecutionLog> page, ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.getExecutionLogPage(page, executionLog));
|
||||
public R getExecutionLogPage(Page page, ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.page(page, Wrappers.query(executionLog)));
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +58,7 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<ExecutionLog> info(@PathVariable("id") String id) {
|
||||
public R info(@PathVariable("id") String id) {
|
||||
return new R<>(executionLogService.getById(id));
|
||||
}
|
||||
|
||||
@@ -71,7 +69,7 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping
|
||||
public R<Boolean> save(@RequestBody ExecutionLog executionLog) {
|
||||
public R save(@RequestBody ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.save(executionLog));
|
||||
}
|
||||
|
||||
@@ -82,7 +80,7 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody ExecutionLog executionLog) {
|
||||
public R update(@RequestBody ExecutionLog executionLog) {
|
||||
return new R<>(executionLogService.updateById(executionLog));
|
||||
}
|
||||
|
||||
@@ -93,7 +91,7 @@ public class ExecutionLogController {
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Boolean> delete(@PathVariable String id) {
|
||||
public R delete(@PathVariable String id) {
|
||||
return new R<>(executionLogService.removeById(id));
|
||||
}
|
||||
|
||||
|
||||
+9
-8
@@ -17,7 +17,7 @@
|
||||
|
||||
package com.pig4cloud.pigx.daemon.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
@@ -38,13 +38,14 @@ public class StatusTraceLogController {
|
||||
|
||||
/**
|
||||
* 任务轨迹处理简单分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param statusTraceLog 任务轨迹处理
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public R<IPage<StatusTraceLog>> getStatusTraceLogPage(Page<StatusTraceLog> page, StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.getStatusTraceLogPage(page,statusTraceLog));
|
||||
public R getStatusTraceLogPage(Page<StatusTraceLog> page, StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.page(page, Wrappers.query(statusTraceLog)));
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +56,7 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@GetMapping("/{id}")
|
||||
public R<StatusTraceLog> info(@PathVariable("id") String id) {
|
||||
public R info(@PathVariable("id") String id) {
|
||||
return new R<>(statusTraceLogService.getById(id));
|
||||
}
|
||||
|
||||
@@ -66,7 +67,7 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@PostMapping
|
||||
public R<Boolean> save(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
public R save(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.save(statusTraceLog));
|
||||
}
|
||||
|
||||
@@ -77,7 +78,7 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
public R update(@RequestBody StatusTraceLog statusTraceLog) {
|
||||
return new R<>(statusTraceLogService.updateById(statusTraceLog));
|
||||
}
|
||||
|
||||
@@ -88,7 +89,7 @@ public class StatusTraceLogController {
|
||||
* @return R
|
||||
*/
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Boolean> delete(@PathVariable("id") String id) {
|
||||
public R delete(@PathVariable("id") String id) {
|
||||
return new R<>(statusTraceLogService.removeById(id));
|
||||
}
|
||||
|
||||
|
||||
-10
@@ -1,10 +1,7 @@
|
||||
package com.pig4cloud.pigx.daemon.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 任务日志处理
|
||||
@@ -13,12 +10,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @date 2018/11/22
|
||||
*/
|
||||
public interface ExecutionLogMapper extends BaseMapper<ExecutionLog> {
|
||||
/**
|
||||
* 任务日志处理简单分页查询
|
||||
* @param executionLog 任务日志处理
|
||||
* @return
|
||||
*/
|
||||
IPage<ExecutionLog> getExecutionLogPage(Page page, @Param("executionLog") ExecutionLog executionLog);
|
||||
|
||||
|
||||
}
|
||||
-10
@@ -1,10 +1,7 @@
|
||||
package com.pig4cloud.pigx.daemon.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 任务轨迹处理
|
||||
@@ -13,12 +10,5 @@ import org.apache.ibatis.annotations.Param;
|
||||
* @date 2018/11/22
|
||||
*/
|
||||
public interface StatusTraceLogMapper extends BaseMapper<StatusTraceLog> {
|
||||
/**
|
||||
* 任务轨迹处理简单分页查询
|
||||
* @param statusTraceLog 任务轨迹处理
|
||||
* @return
|
||||
*/
|
||||
IPage<StatusTraceLog> getStatusTraceLogPage(Page page, @Param("statusTraceLog") StatusTraceLog statusTraceLog);
|
||||
|
||||
|
||||
}
|
||||
-10
@@ -1,7 +1,5 @@
|
||||
package com.pig4cloud.pigx.daemon.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
|
||||
@@ -13,12 +11,4 @@ import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
*/
|
||||
public interface ExecutionLogService extends IService<ExecutionLog> {
|
||||
|
||||
/**
|
||||
* 任务日志处理简单分页查询
|
||||
* @param executionLog 任务日志处理
|
||||
* @return
|
||||
*/
|
||||
IPage<ExecutionLog> getExecutionLogPage(Page<ExecutionLog> page, ExecutionLog executionLog);
|
||||
|
||||
|
||||
}
|
||||
-10
@@ -1,7 +1,5 @@
|
||||
package com.pig4cloud.pigx.daemon.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
|
||||
@@ -13,12 +11,4 @@ import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
*/
|
||||
public interface StatusTraceLogService extends IService<StatusTraceLog> {
|
||||
|
||||
/**
|
||||
* 任务轨迹处理简单分页查询
|
||||
* @param statusTraceLog 任务轨迹处理
|
||||
* @return
|
||||
*/
|
||||
IPage<StatusTraceLog> getStatusTraceLogPage(Page<StatusTraceLog> page, StatusTraceLog statusTraceLog);
|
||||
|
||||
|
||||
}
|
||||
-14
@@ -1,7 +1,5 @@
|
||||
package com.pig4cloud.pigx.daemon.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.daemon.entity.ExecutionLog;
|
||||
import com.pig4cloud.pigx.daemon.mapper.ExecutionLogMapper;
|
||||
@@ -17,16 +15,4 @@ import org.springframework.stereotype.Service;
|
||||
@Service("executionLogService")
|
||||
public class ExecutionLogServiceImpl extends ServiceImpl<ExecutionLogMapper, ExecutionLog> implements ExecutionLogService {
|
||||
|
||||
|
||||
/**
|
||||
* 任务日志处理简单分页查询
|
||||
*
|
||||
* @param executionLog 任务日志处理
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<ExecutionLog> getExecutionLogPage(Page<ExecutionLog> page, ExecutionLog executionLog) {
|
||||
return baseMapper.getExecutionLogPage(page, executionLog);
|
||||
}
|
||||
|
||||
}
|
||||
-14
@@ -1,7 +1,5 @@
|
||||
package com.pig4cloud.pigx.daemon.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.daemon.entity.StatusTraceLog;
|
||||
import com.pig4cloud.pigx.daemon.mapper.StatusTraceLogMapper;
|
||||
@@ -19,16 +17,4 @@ import org.springframework.stereotype.Service;
|
||||
@AllArgsConstructor
|
||||
public class StatusTraceLogServiceImpl extends ServiceImpl<StatusTraceLogMapper, StatusTraceLog> implements StatusTraceLogService {
|
||||
|
||||
private final StatusTraceLogMapper statusTraceLogMapper;
|
||||
|
||||
/**
|
||||
* 任务轨迹处理简单分页查询
|
||||
* @param statusTraceLog 任务轨迹处理
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public IPage<StatusTraceLog> getStatusTraceLogPage(Page<StatusTraceLog> page, StatusTraceLog statusTraceLog){
|
||||
return statusTraceLogMapper.getStatusTraceLogPage(page,statusTraceLog);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,59 +17,4 @@
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="completeTime" column="complete_time"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!--executionLog简单分页查询-->
|
||||
<select id="getExecutionLogPage" resultMap="executionLogMap">
|
||||
SELECT
|
||||
id,
|
||||
job_name,
|
||||
task_id,
|
||||
hostname,
|
||||
ip,
|
||||
sharding_item,
|
||||
execution_source,
|
||||
failure_cause,
|
||||
is_success,
|
||||
start_time,
|
||||
complete_time
|
||||
FROM job_execution_log
|
||||
<where>
|
||||
<if test="executionLog.id != null and executionLog.id != ''">
|
||||
AND id = #{executionLog.id}
|
||||
</if>
|
||||
<if test="executionLog.jobName != null and executionLog.jobName != ''">
|
||||
AND job_name = #{executionLog.jobName}
|
||||
</if>
|
||||
<if test="executionLog.taskId != null and executionLog.taskId != ''">
|
||||
AND task_id = #{executionLog.taskId}
|
||||
</if>
|
||||
<if test="executionLog.hostname != null and executionLog.hostname != ''">
|
||||
AND hostname = #{executionLog.hostname}
|
||||
</if>
|
||||
<if test="executionLog.ip != null and executionLog.ip != ''">
|
||||
AND ip = #{executionLog.ip}
|
||||
</if>
|
||||
<if test="executionLog.shardingItem != null and executionLog.shardingItem != ''">
|
||||
AND sharding_item = #{executionLog.shardingItem}
|
||||
</if>
|
||||
<if test="executionLog.executionSource != null and executionLog.executionSource != ''">
|
||||
AND execution_source = #{executionLog.executionSource}
|
||||
</if>
|
||||
<if test="executionLog.failureCause != null and executionLog.failureCause != ''">
|
||||
AND failure_cause = #{executionLog.failureCause}
|
||||
</if>
|
||||
<if test="executionLog.isSuccess != null and executionLog.isSuccess != ''">
|
||||
AND is_success = #{executionLog.isSuccess}
|
||||
</if>
|
||||
<if test="executionLog.startTime != null and executionLog.startTime != ''">
|
||||
AND start_time = #{executionLog.startTime}
|
||||
</if>
|
||||
<if test="executionLog.completeTime != null and executionLog.completeTime != ''">
|
||||
AND complete_time = #{executionLog.completeTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -4,70 +4,17 @@
|
||||
<mapper namespace="com.pig4cloud.pigx.daemon.mapper.StatusTraceLogMappper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="com.pig4cloud.pigx.daemon.entity.StatusTraceLog" id="statusTraceLogMap">
|
||||
<id property="id" column="id"/>
|
||||
<result property="jobName" column="job_name"/>
|
||||
<result property="originalTaskId" column="original_task_id"/>
|
||||
<result property="taskId" column="task_id"/>
|
||||
<result property="slaveId" column="slave_id"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="executionType" column="execution_type"/>
|
||||
<result property="shardingItem" column="sharding_item"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="message" column="message"/>
|
||||
<result property="creationTime" column="creation_time"/>
|
||||
</resultMap>
|
||||
|
||||
<!--statusTraceLog简单分页查询-->
|
||||
<select id="getStatusTraceLogPage" resultMap="statusTraceLogMap">
|
||||
SELECT
|
||||
id,
|
||||
job_name,
|
||||
original_task_id,
|
||||
task_id,
|
||||
slave_id,
|
||||
source,
|
||||
execution_type,
|
||||
sharding_item,
|
||||
state,
|
||||
message,
|
||||
creation_time
|
||||
FROM job_status_trace_log
|
||||
<where>
|
||||
<if test="statusTraceLog.id != null and statusTraceLog.id != ''">
|
||||
AND id = #{statusTraceLog.id}
|
||||
</if>
|
||||
<if test="statusTraceLog.jobName != null and statusTraceLog.jobName != ''">
|
||||
AND job_name = #{statusTraceLog.jobName}
|
||||
</if>
|
||||
<if test="statusTraceLog.originalTaskId != null and statusTraceLog.originalTaskId != ''">
|
||||
AND original_task_id = #{statusTraceLog.originalTaskId}
|
||||
</if>
|
||||
<if test="statusTraceLog.taskId != null and statusTraceLog.taskId != ''">
|
||||
AND task_id = #{statusTraceLog.taskId}
|
||||
</if>
|
||||
<if test="statusTraceLog.slaveId != null and statusTraceLog.slaveId != ''">
|
||||
AND slave_id = #{statusTraceLog.slaveId}
|
||||
</if>
|
||||
<if test="statusTraceLog.source != null and statusTraceLog.source != ''">
|
||||
AND source = #{statusTraceLog.source}
|
||||
</if>
|
||||
<if test="statusTraceLog.executionType != null and statusTraceLog.executionType != ''">
|
||||
AND execution_type = #{statusTraceLog.executionType}
|
||||
</if>
|
||||
<if test="statusTraceLog.shardingItem != null and statusTraceLog.shardingItem != ''">
|
||||
AND sharding_item = #{statusTraceLog.shardingItem}
|
||||
</if>
|
||||
<if test="statusTraceLog.state != null and statusTraceLog.state != ''">
|
||||
AND state = #{statusTraceLog.state}
|
||||
</if>
|
||||
<if test="statusTraceLog.message != null and statusTraceLog.message != ''">
|
||||
AND message = #{statusTraceLog.message}
|
||||
</if>
|
||||
<if test="statusTraceLog.creationTime != null and statusTraceLog.creationTime != ''">
|
||||
AND creation_time = #{statusTraceLog.creationTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<resultMap type="com.pig4cloud.pigx.daemon.entity.StatusTraceLog" id="statusTraceLogMap">
|
||||
<id property="id" column="id"/>
|
||||
<result property="jobName" column="job_name"/>
|
||||
<result property="originalTaskId" column="original_task_id"/>
|
||||
<result property="taskId" column="task_id"/>
|
||||
<result property="slaveId" column="slave_id"/>
|
||||
<result property="source" column="source"/>
|
||||
<result property="executionType" column="execution_type"/>
|
||||
<result property="shardingItem" column="sharding_item"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="message" column="message"/>
|
||||
<result property="creationTime" column="creation_time"/>
|
||||
</resultMap>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user