merge
This commit is contained in:
@@ -14,7 +14,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -7,17 +7,21 @@ import com.xwbing.constant.CommonConstant;
|
||||
import com.xwbing.constant.CommonEnum;
|
||||
import com.xwbing.domain.entity.sys.SysAuthority;
|
||||
import com.xwbing.domain.entity.vo.ListSysAuthorityVo;
|
||||
import com.xwbing.domain.entity.vo.PageSysAuthorityVo;
|
||||
import com.xwbing.domain.entity.vo.RestMessageVo;
|
||||
import com.xwbing.domain.entity.vo.SysAuthVo;
|
||||
import com.xwbing.redis.RedisService;
|
||||
import com.xwbing.service.sys.SysAuthorityService;
|
||||
import com.xwbing.util.JsonResult;
|
||||
import com.xwbing.util.Pagination;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@@ -96,13 +100,17 @@ public class SysAuthorityControl {
|
||||
return JsonResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@LogInfo("根据是否启用查询所有权限")
|
||||
@ApiOperation(value = "根据是否启用查询所有权限", response = ListSysAuthorityVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@GetMapping("listByEnable")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysAuthority> authoritys = sysAuthorityService.listByEnable(enable);
|
||||
return JsonResult.toJSONObj(authoritys, "");
|
||||
@LogInfo("根据是否启用分页查询所有权限")
|
||||
@ApiOperation(value = "根据是否启用分页查询所有权限", response = PageSysAuthorityVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("pageByEnable")
|
||||
public JSONObject pageByEnable(String enable, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysAuthorityService.pageByEnable(enable, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据父节点查询子节点")
|
||||
|
||||
@@ -5,19 +5,22 @@ import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.domain.entity.sys.SysAuthority;
|
||||
import com.xwbing.domain.entity.sys.SysRole;
|
||||
import com.xwbing.domain.entity.sys.SysRoleAuthority;
|
||||
import com.xwbing.domain.entity.vo.ListSysRoleVo;
|
||||
import com.xwbing.domain.entity.vo.PageSysRoleVo;
|
||||
import com.xwbing.domain.entity.vo.RestMessageVo;
|
||||
import com.xwbing.domain.entity.vo.SysRoleVo;
|
||||
import com.xwbing.service.sys.SysAuthorityService;
|
||||
import com.xwbing.service.sys.SysRoleAuthorityService;
|
||||
import com.xwbing.service.sys.SysRoleService;
|
||||
import com.xwbing.util.JsonResult;
|
||||
import com.xwbing.util.Pagination;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@@ -85,17 +88,21 @@ public class SysRoleControl {
|
||||
return JsonResult.toJSONObj(sysRole, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据是否启用查询所有角色")
|
||||
@ApiOperation(value = "根据是否启用查询所有角色", response = ListSysRoleVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@GetMapping("listByEnable")
|
||||
public JSONObject listByEnable(String enable) {
|
||||
List<SysRole> sysRoles = sysRoleService.listAllByEnable(enable);
|
||||
return JsonResult.toJSONObj(sysRoles, "");
|
||||
@LogInfo("根据是否启用分页查询所有角色")
|
||||
@ApiOperation(value = "根据是否启用分页查询所有角色", response = PageSysRoleVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("pageByEnable")
|
||||
public JSONObject pageByEnable(String enable, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysRoleService.pageByEnable(enable, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
|
||||
@LogInfo("根据角色主键查找权限")
|
||||
@ApiOperation(value = "根据角色主键查找权限", response = ListSysRoleVo.class)
|
||||
@ApiOperation(value = "根据角色主键查找权限", response = PageSysRoleVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@GetMapping("listAuthorityByRoleId")
|
||||
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, String enable) {
|
||||
|
||||
@@ -12,16 +12,12 @@ import com.xwbing.service.sys.SysAuthorityService;
|
||||
import com.xwbing.service.sys.SysRoleService;
|
||||
import com.xwbing.service.sys.SysUserRoleService;
|
||||
import com.xwbing.service.sys.SysUserService;
|
||||
import com.xwbing.util.CommonDataUtil;
|
||||
import com.xwbing.util.JsonResult;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import com.xwbing.util.ThreadLocalUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.xwbing.util.*;
|
||||
import io.swagger.annotations.*;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -94,12 +90,18 @@ public class SysUserControl {
|
||||
return JsonResult.toJSONObj(sysUser, "");
|
||||
}
|
||||
|
||||
@LogInfo("列表查询所有用户")
|
||||
@ApiOperation(value = "列表查询所有用户", response = ListSysUserVo.class)
|
||||
@GetMapping("listAll")
|
||||
public JSONObject listAll() {
|
||||
List<SysUser> list = sysUserService.listAll();
|
||||
return JsonResult.toJSONObj(list, "");
|
||||
@LogInfo("查询所有用户")
|
||||
@ApiOperation(value = "查询所有用户", response = PageSysUserVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "name", value = "名字", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "sex", value = "性别", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("page")
|
||||
public JSONObject page(String name, String sex, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysUserService.page(name, sex, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
|
||||
@LogInfo("登录")
|
||||
@@ -212,7 +214,7 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的角色")
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的角色", response = ListSysRoleVo.class)
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的角色", response = PageSysRoleVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@GetMapping("listRoleByUserId")
|
||||
public JSONObject listRoleByUserId(@RequestParam String userId, String enable) {
|
||||
@@ -224,7 +226,7 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的权限")
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的权限", response = ListSysAuthorityVo.class)
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的权限", response = PageSysAuthorityVo.class)
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@GetMapping("listAuthorityByUserId")
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId, String enable) {
|
||||
|
||||
@@ -2,19 +2,21 @@ package com.xwbing.controller.sys;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.domain.entity.sys.SysUserLoginInOut;
|
||||
import com.xwbing.domain.entity.vo.ListSysUserLoginInOutVo;
|
||||
import com.xwbing.domain.entity.vo.PageSysUserLoginInOutVo;
|
||||
import com.xwbing.service.sys.SysUserLoginInOutService;
|
||||
import com.xwbing.util.JsonResult;
|
||||
import com.xwbing.util.Pagination;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
@@ -30,10 +32,14 @@ public class SysUserLoginInOutControl {
|
||||
private SysUserLoginInOutService inOutService;
|
||||
|
||||
@LogInfo("获取登录或登出信息")
|
||||
@ApiOperation(value = "获取登录或登出信息", response = ListSysUserLoginInOutVo.class)
|
||||
@GetMapping("listByType")
|
||||
public JSONObject listByType(@RequestParam int inout,@RequestParam String startDate,@RequestParam String endDate) {
|
||||
List<SysUserLoginInOut> sysUserLoginInOuts = inOutService.listByType(inout,startDate,endDate);
|
||||
return JsonResult.toJSONObj(sysUserLoginInOuts, "获取列表成功");
|
||||
@ApiOperation(value = "获取登录或登出信息", response = PageSysUserLoginInOutVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("pageByType")
|
||||
public JSONObject pageByType(@RequestParam int inout, @RequestParam String startDate, @RequestParam String endDate, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = inOutService.pageByType(inout, startDate, endDate, page);
|
||||
return JsonResult.toJSONObj(pagination, "获取列表成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,9 +63,11 @@ spring:
|
||||
size: 1
|
||||
#mybatis
|
||||
mybatis:
|
||||
mapper-locations: #classpath:mapper/*.xml
|
||||
mapper-locations: #classpath:mapper/**/*.xml
|
||||
type-aliases-package: #com.xwbing.domain.entity
|
||||
config-location: # classpath:mybatisConfig.xml
|
||||
pagehelper:
|
||||
helper-dialect: mysql
|
||||
#log
|
||||
logging:
|
||||
config: classpath:log4j2.xml
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package com.xwbing.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.xwbing.BaseTest;
|
||||
import com.xwbing.domain.entity.ExpressInfo;
|
||||
import com.xwbing.domain.entity.sys.DataDictionary;
|
||||
import com.xwbing.domain.entity.sys.SysRole;
|
||||
import com.xwbing.domain.entity.sys.SysUserLoginInOut;
|
||||
import com.xwbing.domain.entity.vo.ExpressInfoVo;
|
||||
import com.xwbing.domain.mapper.sys.SysUserLoginInOutMapper;
|
||||
import com.xwbing.rabbit.Sender;
|
||||
import com.xwbing.redis.RedisService;
|
||||
import com.xwbing.service.rest.ExpressDeliveryService;
|
||||
import com.xwbing.service.rest.QRCodeZipService;
|
||||
import com.xwbing.service.sys.DataDictionaryService;
|
||||
import com.xwbing.service.sys.SysRoleService;
|
||||
import com.xwbing.util.Pagination;
|
||||
import com.xwbing.util.RSAUtil;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -24,7 +30,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
@@ -46,12 +54,26 @@ public class ServiceTest extends BaseTest {
|
||||
private SysRoleService sysRoleService;
|
||||
@Resource
|
||||
private DataDictionaryService dictionaryService;
|
||||
@Resource
|
||||
private SysUserLoginInOutMapper loginInOutMapper;
|
||||
|
||||
@Test
|
||||
public void page() {
|
||||
log.info("分页功能测试");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("inout", 1);
|
||||
Page<SysUserLoginInOut> page = PageHelper.startPage(1, 10).doSelectPage(() -> loginInOutMapper.findByInoutType(map));
|
||||
PageInfo<SysUserLoginInOut> pageInfo = PageHelper.startPage(1, 10).doSelectPageInfo(() -> loginInOutMapper.findByInoutType(map));
|
||||
Pagination page1 = new Pagination(pageInfo);
|
||||
Pagination page2 = new Pagination(page);
|
||||
long count = PageHelper.count(() -> loginInOutMapper.findByInoutType(map));
|
||||
}
|
||||
|
||||
@Transactional("jpaTransactionManager")
|
||||
@Test
|
||||
public void jpaTransactionTest() {
|
||||
log.info("jpa数据源事务回滚");
|
||||
DataDictionary dictionary=new DataDictionary();
|
||||
DataDictionary dictionary = new DataDictionary();
|
||||
dictionary.setDescription("serviceTest");
|
||||
dictionary.setEnable("Y");
|
||||
dictionary.setCode("serviceTest");
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.xwbing.BaseTest;
|
||||
import com.xwbing.domain.entity.sys.SysRole;
|
||||
import com.xwbing.domain.mapper.sys.SysRoleMapper;
|
||||
import com.xwbing.service.sys.SysRoleService;
|
||||
import com.xwbing.util.Pagination;
|
||||
import com.xwbing.util.RestMessage;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
@@ -39,7 +40,7 @@ public class SysRoleServiceTest extends BaseTest {
|
||||
Assert.assertTrue(rest.getMessage(), rest.isSuccess());
|
||||
Assert.assertNotSame("修改失败", sysRole, sysRoleService.getById(rest.getId()));
|
||||
//listAllByEnable
|
||||
Assert.assertNotNull(sysRoleService.listAllByEnable("Y"));
|
||||
Assert.assertNotNull(sysRoleService.pageByEnable("Y", new Pagination<>()));
|
||||
//removeById
|
||||
Assert.assertTrue("删除失败", sysRoleService.removeById(rest.getId()).isSuccess());
|
||||
//............................
|
||||
|
||||
Reference in New Issue
Block a user