This commit is contained in:
xiangwbs
2017-11-26 21:33:29 +08:00
parent 8510a58e90
commit e71ba5ed18
8 changed files with 43 additions and 37 deletions
@@ -23,18 +23,18 @@ import javax.validation.constraints.Pattern;
public class SysConfig extends BaseEntity {
private static final long serialVersionUID = -7587016038432881980L;
public static String table = "system_config";
@ApiModelProperty(value = "配置项的code",example = "email_config")
@ApiModelProperty(value = "配置项的code",example = "email_config",required = true)
@NotBlank(message = "配置项的code不能为空")
@Length(min = 1, max = 50, message = "code长度为1-50")
private String code;
@ApiModelProperty(value = "配置项的值",example = "{}")
@ApiModelProperty(value = "配置项的值",example = "{}",required = true)
@NotBlank(message = "配置项的value不能为空")
private String value;
@ApiModelProperty(value = "配置项的描述(名称)",example = "邮箱配置")
@ApiModelProperty(value = "配置项的描述(名称)",example = "邮箱配置",required = true)
@NotBlank(message = "配置项的name不能为空")
@Length(min = 1, max = 20, message = "value长度为1-20")
private String name;
@ApiModelProperty(value = "是否启用",example = "Y")
@ApiModelProperty(value = "是否启用",example = "Y",required = true)
@NotBlank(message = "是否启用不能为空")
@Pattern(regexp = "[Y|N]", message = "是否启用格式为Y|N")
private String enable;
@@ -26,22 +26,22 @@ import java.util.List;
public class SysUser extends BaseEntity {
private static final long serialVersionUID = -2447528751353457021L;
public static String table = "sys_user_info";
@ApiModelProperty(value = "用户名",example = "xxx",required = true)
@NotBlank(message = "用户名不能为空")
@Length(min = 1, max = 20, message = "用户名长度为1-20")
@Column(name = "user_name")
@ApiModelProperty(value = "用户名",example = "xxx")
private String userName;
@ApiModelProperty(value = "姓名",example = "xxx",required = true)
@NotBlank(message = "姓名不能为空")
@Length(min = 1, max = 20, message = "姓名长度为1-5")
@ApiModelProperty(value = "姓名",example = "xxx")
private String name;
@ApiModelProperty(value = "邮箱",example = "@163.com",required = true)
@NotBlank(message = "邮箱不能为空")
@Email(message = "邮箱格式有误")
@ApiModelProperty(value = "邮箱",example = "@163.com")
private String mail;
@ApiModelProperty(value = "性别",example = "1",required = true)
@NotBlank(message = "性别不能为空")
@Pattern(regexp = "[01]", message = "性别格式为0|1,0代表女,1代表男")
@ApiModelProperty(value = "性别",example = "1")
private String sex;
@ApiModelProperty(value = "盐值",hidden = true)
private String salt;
@@ -105,9 +105,9 @@ public class TestControl {
System.out.println(de);
}
@LogInfo("httpClient")
@PostMapping("httpClient")
public JSONObject httpClient(@RequestBody JSONObject param) {
@LogInfo("httpUtil")
@PostMapping("httpUtil")
public JSONObject httpUtil(@RequestBody JSONObject param) {
// String url = "http://localhost:8080/user/listAll";
// return HttpClientUtil.get(url);
String url = "http://localhost:8080/user/save";
@@ -47,8 +47,8 @@ public class SysAuthorityControl {
}
@LogInfo("删除权限")
@GetMapping("removeById")
@ApiOperation(value = "删除权限")
@GetMapping("removeById")
public JSONObject removeById(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -60,8 +60,8 @@ public class SysAuthorityControl {
}
@LogInfo("修改权限")
@PostMapping("update")
@ApiOperation(value = "修改权限")
@PostMapping("update")
public JSONObject update(@RequestBody SysAuthority sysAuthority) {
if (StringUtils.isEmpty(sysAuthority.getId()))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -88,9 +88,9 @@ public class SysAuthorityControl {
}
@LogInfo("根据是否启用查询所有权限")
@GetMapping("listByEnable")
@ApiOperation(value = "根据是否启用查询所有权限")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@GetMapping("listByEnable")
public JSONObject listByEnable(String enable) {
List<SysAuthority> authoritys = sysAuthorityService.listByEnable(enable);
return JSONObjResult.toJSONObj(authoritys, true, "");
@@ -108,9 +108,9 @@ public class SysAuthorityControl {
}
@LogInfo("递归查询所有权限")
@GetMapping("listTree")
@ApiOperation(value = "递归查询所有权限")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@GetMapping("listTree")
public JSONObject listTree(String enable) {
List<SysAuthVo> authoritys;
//先去缓存里拿
@@ -1,6 +1,7 @@
package com.xwbing.controller.sys;
import com.alibaba.fastjson.JSONObject;
import com.xwbing.annotation.LogInfo;
import com.xwbing.domain.entity.sys.SysConfig;
import com.xwbing.service.sys.SysConfigService;
import com.xwbing.util.JSONObjResult;
@@ -32,6 +33,7 @@ public class SysConfigControl {
@Resource
private SysConfigService sysConfigService;
@LogInfo("新增系统配置信息")
@ApiOperation(value = "新增", notes = "新增系统配置信息")
// @ApiImplicitParams({
// @ApiImplicitParam(name = "code", value = "配置项的key,长度为1-50", paramType = "query", required = true, dataType = "string"),
@@ -47,6 +49,7 @@ public class SysConfigControl {
return JSONObjResult.toJSONObj(result);
}
@LogInfo("根据code删除系统配置信息")
@ApiOperation(value = "删除", notes = "根据code删除系统配置信息")
@ApiImplicitParam(name = "code", value = "配置项的code", paramType = "query", required = true, dataType = "string")
@GetMapping("removeByCode")
@@ -60,6 +63,7 @@ public class SysConfigControl {
return JSONObjResult.toJSONObj(result);
}
@LogInfo("修改系统配置信息")
@ApiOperation(value = "修改", notes = "修改系统配置信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "配置项的key,长度为1-50", paramType = "query", required = true, dataType = "string"),
@@ -76,6 +80,7 @@ public class SysConfigControl {
return JSONObjResult.toJSONObj(result);
}
@LogInfo("根据key查找系统配置信息")
@ApiOperation(value = "查找", notes = "根据key查找系统配置信息")
@ApiImplicitParam(name = "code", value = "配置项的code", paramType = "query", required = true, dataType = "string")
@GetMapping("getByCode")
@@ -92,6 +97,7 @@ public class SysConfigControl {
return JSONObjResult.toJSONObj(one, true, "");
}
@LogInfo("根据是否启用查找配置列表")
@ApiOperation(value = "查找列表", notes = "根据是否启用查找配置列表")
@ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", required = true, dataType = "string")
@GetMapping("listByEnable")
@@ -38,16 +38,16 @@ public class SysRoleControl {
private SysRoleAuthorityService sysRoleAuthorityService;
@LogInfo("添加角色")
@PostMapping("save")
@ApiOperation(value = "添加角色")
@PostMapping("save")
public JSONObject save(@RequestBody SysRole sysRole) {
RestMessage result = sysRoleService.save(sysRole);
return JSONObjResult.toJSONObj(result);
}
@LogInfo("删除角色")
@GetMapping("removeById")
@ApiOperation(value = "删除角色")
@GetMapping("removeById")
public JSONObject removeById(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -56,8 +56,8 @@ public class SysRoleControl {
}
@LogInfo("修改角色")
@PostMapping("update")
@ApiOperation(value = "修改角色")
@PostMapping("update")
public JSONObject update(@RequestBody SysRole sysRole) {
if (StringUtils.isEmpty(sysRole.getId()))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -66,8 +66,8 @@ public class SysRoleControl {
}
@LogInfo("获取角色详情")
@GetMapping("getById")
@ApiOperation(value = "获取角色详情")
@GetMapping("getById")
public JSONObject getById(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -78,18 +78,18 @@ public class SysRoleControl {
}
@LogInfo("根据是否启用查询所有角色")
@GetMapping("listByEnable")
@ApiOperation(value = "根据是否启用查询所有角色")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@GetMapping("listByEnable")
public JSONObject listByEnable(String enable) {
List<SysRole> sysRoles = sysRoleService.listAllByEnable(enable);
return JSONObjResult.toJSONObj(sysRoles, true, "");
}
@LogInfo("根据角色主键查找权限")
@PostMapping("listAuthorityByRoleId")
@ApiOperation(value = "根据角色主键查找权限")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@PostMapping("listAuthorityByRoleId")
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, String enable) {
if (StringUtils.isEmpty(roleId))
return JSONObjResult.toJSONObj("角色主键不能为空");
@@ -101,8 +101,8 @@ public class SysRoleControl {
}
@LogInfo("保存角色权限")
@PostMapping("saveAuthority")
@ApiOperation(value = "保存角色权限")
@PostMapping("saveAuthority")
public JSONObject saveAuthority(@RequestParam String authorityIds, @RequestParam String roleId) {
if (StringUtils.isEmpty(authorityIds))
return JSONObjResult.toJSONObj("权限主键集合不能为空");
@@ -49,16 +49,16 @@ public class SysUserControl {
private SysAuthorityService sysAuthorityService;
@LogInfo("添加用户")
@PostMapping("save")
@ApiOperation(value = "添加用户")
@PostMapping("save")
public JSONObject save(@RequestBody @Valid SysUser sysUser) {
RestMessage result = sysUserService.save(sysUser);
return JSONObjResult.toJSONObj(result);
}
@LogInfo("删除用户")
@GetMapping("removeById")
@ApiOperation(value = "删除用户")
@GetMapping("removeById")
public JSONObject removeById(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -67,8 +67,8 @@ public class SysUserControl {
}
@LogInfo("修改用户信息")
@PostMapping("update")
@ApiOperation(value = "修改用户信息")
@PostMapping("update")
public JSONObject update(@RequestBody @Valid SysUser sysUser) {
if (StringUtils.isEmpty(sysUser.getId()))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -77,8 +77,8 @@ public class SysUserControl {
}
@LogInfo("获取用户详情")
@GetMapping("getById")
@ApiOperation(value = "获取用户详情")
@GetMapping("getById")
public JSONObject getById(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -89,16 +89,16 @@ public class SysUserControl {
}
@LogInfo("列表查询所有用户")
@GetMapping("listAll")
@ApiOperation(value = "列表查询所有用户")
@GetMapping("listAll")
public JSONObject listAll() {
List<SysUser> list = sysUserService.listAll();
return JSONObjResult.toJSONObj(list, true, "");
}
@LogInfo("登录")
@PostMapping("login")
@ApiOperation(value = "登录")
@PostMapping("login")
public JSONObject login(HttpServletRequest request, @RequestParam String userName, @RequestParam String passWord, @RequestParam String checkCode) {
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(passWord))
return JSONObjResult.toJSONObj("用户名或密码不能为空");
@@ -109,16 +109,16 @@ public class SysUserControl {
}
@LogInfo("登出")
@GetMapping("logout")
@ApiOperation(value = "登出")
@GetMapping("logout")
public JSONObject logout(HttpServletRequest request) {
RestMessage logout = sysUserService.logout(request);
return JSONObjResult.toJSONObj(logout);
}
@LogInfo("修改密码")
@PostMapping("updatePassWord")
@ApiOperation(value = "修改密码")
@PostMapping("updatePassWord")
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord, @RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -129,8 +129,8 @@ public class SysUserControl {
}
@LogInfo("重置密码")
@GetMapping("resetPassWord")
@ApiOperation(value = "重置密码")
@GetMapping("resetPassWord")
public JSONObject resetPassWord(@RequestParam String id) {
if (StringUtils.isEmpty(id))
return JSONObjResult.toJSONObj("主键不能为空");
@@ -139,8 +139,8 @@ public class SysUserControl {
}
@LogInfo("获取当前登录用户信息")
@GetMapping("getLoginUserInfo")
@ApiOperation(value = "获取当前登录用户信息")
@GetMapping("resetPassWord")
public JSONObject getLoginUserInfo() {
SysUser sysUser = sysUserService.getOne((String) CommonDataUtil.getToken(CommonConstant.CURRENT_USER_ID));
if (sysUser == null)
@@ -166,8 +166,8 @@ public class SysUserControl {
}
@LogInfo("保存用户角色")
@PostMapping("saveRole")
@ApiOperation(value = "保存用户角色")
@PostMapping("saveRole")
public JSONObject saveRole(@RequestParam String roleIds, @RequestParam String userId) {
if (StringUtils.isEmpty(roleIds))
return JSONObjResult.toJSONObj("角色主键不能为空");
@@ -192,9 +192,9 @@ public class SysUserControl {
}
@LogInfo("根据用户主键查找所拥有的角色")
@PostMapping("listRoleByUserId")
@ApiOperation(value = "根据用户主键查找所拥有的角色")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@PostMapping("listRoleByUserId")
public JSONObject listRoleByUserId(@RequestParam String userId, String enable) {
if (StringUtils.isEmpty(userId))
return JSONObjResult.toJSONObj("用户主键不能为空");
@@ -203,9 +203,9 @@ public class SysUserControl {
}
@LogInfo("根据用户主键查找所拥有的权限")
@PostMapping("listAuthorityByUserId")
@ApiOperation(value = "根据用户主键查找所拥有的权限")
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@PostMapping("listAuthorityByUserId")
public JSONObject listAuthorityByUserId(@RequestParam String userId, String enable) {
if (StringUtils.isEmpty(userId))
return JSONObjResult.toJSONObj("用户主键不能为空");
@@ -214,8 +214,8 @@ public class SysUserControl {
}
@LogInfo("导出用户excel表")
@GetMapping("exportReport")
@ApiOperation(value = "导出用户excel表")
@GetMapping("exportReport")
public void exportReport(HttpServletResponse response) {
sysUserService.exportReport(response);
}
@@ -29,8 +29,8 @@ public class SysUserLoginInOutControl {
private SysUserLoginInOutService inOutService;
@LogInfo("获取登录或登出信息")
@GetMapping("listByType")
@ApiOperation(value = "获取登录或登出信息")
@GetMapping("listByType")
public JSONObject listByType(@RequestParam int inout) {
List<SysUserLoginInOut> sysUserLoginInOuts = inOutService.listByType(inout);
return JSONObjResult.toJSONObj(sysUserLoginInOuts, true, "获取列表成功");