merge
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.xwbing.domain.entity.sys;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -14,11 +15,15 @@ import lombok.EqualsAndHashCode;
|
||||
public class SysUserLoginInOut extends BaseEntity {
|
||||
private static final long serialVersionUID = -2719103095945780275L;
|
||||
public static String table = "sys_user_login_in_out";
|
||||
@ApiModelProperty(example = "127.0.0.1", required = true)
|
||||
private String ip;
|
||||
@ApiModelProperty(value = "登录登出类型(登录:1|登出:2)", example = "1", required = true)
|
||||
private int inoutType;
|
||||
private String userId;
|
||||
//临时字段
|
||||
@ApiModelProperty(value = "用户名字")
|
||||
private transient String userIdName;
|
||||
@ApiModelProperty(value = "记录时间")
|
||||
private transient String recordTime;
|
||||
private transient String inoutTypeName;
|
||||
private transient String startDate;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.xwbing.domain.entity.vo;
|
||||
|
||||
import com.xwbing.domain.entity.sys.SysRole;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 项目名称: boot-module-demo
|
||||
* 创建时间: 2018/1/18 15:52
|
||||
* 作者: xiangwb
|
||||
* 说明:
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class ListSysRoleVo extends RestMessageVo {
|
||||
@ApiModelProperty(value = "返回数据")
|
||||
private List<SysRole> data;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.xwbing.domain.entity.vo;
|
||||
|
||||
import com.xwbing.domain.entity.sys.SysAuthority;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -20,11 +20,7 @@ public class SysAuthVo extends SysAuthority {
|
||||
}
|
||||
|
||||
public SysAuthVo(SysAuthority orig) {
|
||||
try {
|
||||
BeanUtils.copyProperties(this, orig);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
BeanUtils.copyProperties(orig, this);
|
||||
}
|
||||
|
||||
private List<SysAuthVo> children;
|
||||
|
||||
@@ -52,9 +52,11 @@ public class SysUserLoginInOutService {
|
||||
* @param inout
|
||||
* @return
|
||||
*/
|
||||
public Pagination pageByType(int inout, String startDate, String endDate, Pagination page) {
|
||||
public Pagination page(Integer inout, String startDate, String endDate, Pagination page) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("inout", inout);
|
||||
if (inout != null) {
|
||||
map.put("inout", inout);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(startDate)) {
|
||||
map.put("startDate", startDate + " 00:00:00");
|
||||
}
|
||||
@@ -64,12 +66,13 @@ public class SysUserLoginInOutService {
|
||||
PageInfo<SysUserLoginInOut> pageInfo = PageHelper.startPage(page.getCurrentPage(), page.getPageSize()).doSelectPageInfo(() -> loginInOutMapper.findByInoutType(map));
|
||||
List<SysUserLoginInOut> list = pageInfo.getList();
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
list.forEach(inOut -> {
|
||||
list.forEach(loginInOut -> {
|
||||
//登录登出
|
||||
CommonEnum.LoginInOutEnum inOutEnum = Arrays.stream(CommonEnum.LoginInOutEnum.values()).filter(obj -> obj.getValue() == inout).findFirst().get();
|
||||
inOut.setInoutTypeName(inOutEnum.getName());
|
||||
CommonEnum.LoginInOutEnum inOutEnum = Arrays.stream(CommonEnum.LoginInOutEnum.values()).filter(obj -> obj.getValue() == loginInOut.getInoutType()).findFirst().get();
|
||||
loginInOut.setInoutTypeName(inOutEnum.getName());
|
||||
});
|
||||
}
|
||||
return page.result(page, pageInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,13 +52,18 @@
|
||||
SELECT a.inout_type,a.ip,date_format(a.create_time,'%Y-%m-%d %H:%i:%s') recordTime,b.name userIdName
|
||||
FROM sys_user_login_in_out a left join sys_user_info b on
|
||||
(a.user_id=b.id)
|
||||
where a.inout_type=#{inout}
|
||||
<if test="startDate!=null">
|
||||
and a.create_time>=#{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null">
|
||||
and a.create_time <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
<where>
|
||||
<if test="inout!=null">
|
||||
a.inout_type=#{inout}
|
||||
</if>
|
||||
<if test="startDate!=null">
|
||||
and a.create_time>=#{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null">
|
||||
and a.create_time <![CDATA[ <= ]]> #{endDate}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY a.create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.xwbing.controller.sys;
|
||||
package com.xwbing.controller.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
@@ -103,11 +103,11 @@ public class SysAuthorityControl {
|
||||
@LogInfo("根据是否启用分页查询所有权限")
|
||||
@ApiOperation(value = "根据是否启用分页查询所有权限", response = PageSysAuthorityVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", example = "10", paramType = "query", dataType = "int")
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", defaultValue = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", defaultValue = "10", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("pageByEnable")
|
||||
public JSONObject pageByEnable(@RequestParam(required = false, defaultValue = "Y") String enable, @ApiIgnore Pagination page) {
|
||||
public JSONObject pageByEnable(@RequestParam(required = false) String enable, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysAuthorityService.pageByEnable(enable, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class SysAuthorityControl {
|
||||
@LogInfo("递归查询所有权限")
|
||||
@ApiOperation(value = "递归查询所有权限", response = ListSysAuthorityVo.class)
|
||||
@GetMapping("listTree")
|
||||
public JSONObject listTree(@RequestParam(required = false, defaultValue = "Y") String enable) {
|
||||
public JSONObject listTree(@RequestParam(required = false) String enable) {
|
||||
List<SysAuthVo> authVos;
|
||||
//先去缓存里拿
|
||||
boolean exists = redisService.exists(CommonConstant.AUTHORITY_THREE);
|
||||
|
||||
@@ -91,11 +91,11 @@ public class SysRoleControl {
|
||||
@LogInfo("根据是否启用分页查询所有角色")
|
||||
@ApiOperation(value = "根据是否启用分页查询所有角色", response = PageSysRoleVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", example = "10", paramType = "query", dataType = "int")
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", defaultValue = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", defaultValue = "10", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("pageByEnable")
|
||||
public JSONObject pageByEnable(@RequestParam(required = false, defaultValue = "Y") String enable, @ApiIgnore Pagination page) {
|
||||
public JSONObject pageByEnable(@RequestParam(required = false) String enable, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysRoleService.pageByEnable(enable, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
@@ -103,7 +103,7 @@ public class SysRoleControl {
|
||||
@LogInfo("根据角色主键查找权限")
|
||||
@ApiOperation(value = "根据角色主键查找权限", response = PageSysRoleVo.class)
|
||||
@GetMapping("listAuthorityByRoleId")
|
||||
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, @RequestParam(required = false, defaultValue = "Y") String enable) {
|
||||
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, @RequestParam(required = false) String enable) {
|
||||
if (StringUtils.isEmpty(roleId)) {
|
||||
return JsonResult.toJSONObj("角色主键不能为空");
|
||||
}
|
||||
|
||||
@@ -93,11 +93,11 @@ public class SysUserControl {
|
||||
@LogInfo("查询所有用户")
|
||||
@ApiOperation(value = "查询所有用户", response = PageSysUserVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", example = "10", paramType = "query", dataType = "int")
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", defaultValue = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页显示的条数", defaultValue = "10", paramType = "query", dataType = "int")
|
||||
})
|
||||
@GetMapping("page")
|
||||
public JSONObject page(@RequestParam(required = false) String name, @RequestParam(required = false, defaultValue = "0") String sex, @ApiIgnore Pagination page) {
|
||||
public JSONObject page(@RequestParam(required = false) String name, @RequestParam(required = false) String sex, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = sysUserService.page(name, sex, page);
|
||||
return JsonResult.toJSONObj(pagination, "");
|
||||
}
|
||||
@@ -212,9 +212,9 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的角色")
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的角色", response = PageSysRoleVo.class)
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的角色", response = ListSysRoleVo.class)
|
||||
@GetMapping("listRoleByUserId")
|
||||
public JSONObject listRoleByUserId(@RequestParam String userId, @RequestParam(required = false, defaultValue = "Y") String enable) {
|
||||
public JSONObject listRoleByUserId(@RequestParam String userId, @RequestParam(required = false) String enable) {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return JsonResult.toJSONObj("用户主键不能为空");
|
||||
}
|
||||
@@ -223,9 +223,9 @@ public class SysUserControl {
|
||||
}
|
||||
|
||||
@LogInfo("根据用户主键查找所拥有的权限")
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的权限", response = PageSysAuthorityVo.class)
|
||||
@ApiOperation(value = "根据用户主键查找所拥有的权限", response = ListSysAuthorityVo.class)
|
||||
@GetMapping("listAuthorityByUserId")
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId, @RequestParam(required = false, defaultValue = "Y") String enable) {
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId, @RequestParam(required = false) String enable) {
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return JsonResult.toJSONObj("用户主键不能为空");
|
||||
}
|
||||
|
||||
@@ -34,12 +34,12 @@ public class SysUserLoginInOutControl {
|
||||
@LogInfo("获取登录或登出信息")
|
||||
@ApiOperation(value = "获取登录或登出信息", response = PageSysUserLoginInOutVo.class)
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", example = "10", paramType = "query", dataType = "int")
|
||||
@ApiImplicitParam(name = "currentPage", value = "当前页", defaultValue = "1", paramType = "query", dataType = "int"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页数", defaultValue = "10", 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);
|
||||
@GetMapping("page")
|
||||
public JSONObject page(@RequestParam(required = false) Integer inout, @RequestParam(required = false) String startDate, @RequestParam(required = false) String endDate, @ApiIgnore Pagination page) {
|
||||
Pagination pagination = inOutService.page(inout, startDate, endDate, page);
|
||||
return JsonResult.toJSONObj(pagination, "获取列表成功");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user