This commit is contained in:
xiangwbs
2018-06-25 21:04:11 +08:00
parent c774f40f6f
commit bfb30d33d9
7 changed files with 26 additions and 42 deletions
@@ -18,7 +18,7 @@ import javax.validation.constraints.Pattern;
@EqualsAndHashCode(callSuper = true)
@Data
@Entity(name = "system_config")
public class SysConfig extends BaseEntity {
public class SysConfig extends JpaBaseEntity {
private static final long serialVersionUID = -7587016038432881980L;
@ApiModelProperty(value = "配置项的code", example = "email_config", required = true)
@NotBlank(message = "配置项的code不能为空")
@@ -56,8 +56,7 @@ public class TestControl {
@LogInfo("获取数据库图片")
@GetMapping("getDbPic")
@ApiImplicitParam(name = "type", value = "图片类型", paramType = "query", dataType = "string")
public void getDbPic(HttpServletResponse response, @RequestParam String name, String type) throws IOException {
public void getDbPic(HttpServletResponse response, @RequestParam String name, @RequestParam(required = false) String type) throws IOException {
if (StringUtils.isNotEmpty(name)) {
List<FilesUpload> files = uploadMapper.findByName(name, type);
if (CollectionUtils.isNotEmpty(files)) {
@@ -68,9 +68,8 @@ public class DataDictionaryControl {
@LogInfo("校验编码")
@ApiOperation(value = "校验编码", response = RestMessageVo.class)
@ApiImplicitParam(name = "id", value = "主键", paramType = "query", dataType = "string")
@PostMapping("uniqueCode")
public JSONObject uniqueCode(@RequestParam String code, String id) {
public JSONObject uniqueCode(@RequestParam String code, @RequestParam(required = false) String id) {
RestMessage result = new RestMessage();
boolean b = dataDictionaryService.uniqueCode(code, id);
result.setSuccess(b);
@@ -79,12 +78,8 @@ public class DataDictionaryControl {
@LogInfo("根据父id列表查询")
@ApiOperation(value = "根据父id列表查询", response = ListDataDictionaryVo.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "parentId", value = "父id", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", dataType = "string")
})
@GetMapping("findListByParent")
public JSONObject findListByParent(String enable, String parentId) {
public JSONObject findListByParent(@RequestParam(required = false, defaultValue = "Y") String enable, @RequestParam(required = false) String parentId) {
if (StringUtils.isEmpty(parentId)) {
parentId = CommonConstant.ROOT;
}
@@ -94,9 +89,8 @@ public class DataDictionaryControl {
@LogInfo("根据编码查询字典列表")
@ApiOperation(value = "根据编码查询字典列表", response = ListDataDictionaryVo.class)
@ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", dataType = "string")
@GetMapping("findListByCode")
public JSONObject findListByCode(@RequestParam String code, String enable) {
public JSONObject findListByCode(@RequestParam String code, @RequestParam(required = false, defaultValue = "Y") String enable) {
if (StringUtils.isEmpty(code)) {
return JsonResult.toJSONObj("编码不能为空");
}
@@ -103,21 +103,19 @@ public class SysAuthorityControl {
@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")
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "页数", example = "10", paramType = "query", dataType = "int")
})
@GetMapping("pageByEnable")
public JSONObject pageByEnable(String enable, @ApiIgnore Pagination page) {
public JSONObject pageByEnable(@RequestParam(required = false, defaultValue = "Y") String enable, @ApiIgnore Pagination page) {
Pagination pagination = sysAuthorityService.pageByEnable(enable, page);
return JsonResult.toJSONObj(pagination, "");
}
@LogInfo("根据父节点查询子节点")
@ApiOperation(value = "根据父节点查询子节点", response = ListSysAuthorityVo.class)
@ApiImplicitParam(name = "parentId", value = "父id,可为空", paramType = "query", dataType = "string")
@GetMapping("listByParentId")
public JSONObject listByParentId(String parentId) {
public JSONObject listByParentId(@RequestParam(required = false) String parentId) {
if (StringUtils.isEmpty(parentId)) {
parentId = CommonConstant.ROOT;
}
@@ -130,20 +128,19 @@ public class SysAuthorityControl {
@LogInfo("递归查询所有权限")
@ApiOperation(value = "递归查询所有权限", response = ListSysAuthorityVo.class)
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
@GetMapping("listTree")
public JSONObject listTree(String enable) {
List<SysAuthVo> authoritys;
public JSONObject listTree(@RequestParam(required = false, defaultValue = "Y") String enable) {
List<SysAuthVo> authVos;
//先去缓存里拿
boolean exists = redisService.exists(CommonConstant.AUTHORITY_THREE);
if (exists) {
String result = redisService.get(CommonConstant.AUTHORITY_THREE);
authoritys = JSONArray.parseArray(result, SysAuthVo.class);
authVos = JSONArray.parseArray(result, SysAuthVo.class);
} else {
authoritys = sysAuthorityService.listChildren(CommonConstant.ROOT, enable);
authVos = sysAuthorityService.listChildren(CommonConstant.ROOT, enable);
// 设置缓存
redisService.set(CommonConstant.AUTHORITY_THREE, JSONArray.toJSONString(authoritys));
redisService.set(CommonConstant.AUTHORITY_THREE, JSONArray.toJSONString(authVos));
}
return JsonResult.toJSONObj(authoritys, "");
return JsonResult.toJSONObj(authVos, "");
}
}
@@ -91,21 +91,19 @@ public class SysRoleControl {
@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")
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "页数", example = "10", paramType = "query", dataType = "int")
})
@GetMapping("pageByEnable")
public JSONObject pageByEnable(String enable, @ApiIgnore Pagination page) {
public JSONObject pageByEnable(@RequestParam(required = false, defaultValue = "Y") String enable, @ApiIgnore Pagination page) {
Pagination pagination = sysRoleService.pageByEnable(enable, page);
return JsonResult.toJSONObj(pagination, "");
}
@LogInfo("根据角色主键查找权限")
@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) {
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, @RequestParam(required = false, defaultValue = "Y") String enable) {
if (StringUtils.isEmpty(roleId)) {
return JsonResult.toJSONObj("角色主键不能为空");
}
@@ -93,13 +93,11 @@ public class SysUserControl {
@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")
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "页数", example = "10", paramType = "query", dataType = "int")
})
@GetMapping("page")
public JSONObject page(String name, String sex, @ApiIgnore Pagination page) {
public JSONObject page(@RequestParam(required = false) String name, @RequestParam(required = false, defaultValue = "0") String sex, @ApiIgnore Pagination page) {
Pagination pagination = sysUserService.page(name, sex, page);
return JsonResult.toJSONObj(pagination, "");
}
@@ -215,9 +213,8 @@ public class SysUserControl {
@LogInfo("根据用户主键查找所拥有的角色")
@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) {
public JSONObject listRoleByUserId(@RequestParam String userId, @RequestParam(required = false, defaultValue = "Y") String enable) {
if (StringUtils.isEmpty(userId)) {
return JsonResult.toJSONObj("用户主键不能为空");
}
@@ -227,9 +224,8 @@ public class SysUserControl {
@LogInfo("根据用户主键查找所拥有的权限")
@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) {
public JSONObject listAuthorityByUserId(@RequestParam String userId, @RequestParam(required = false, defaultValue = "Y") String enable) {
if (StringUtils.isEmpty(userId)) {
return JsonResult.toJSONObj("用户主键不能为空");
}
@@ -34,8 +34,8 @@ public class SysUserLoginInOutControl {
@LogInfo("获取登录或登出信息")
@ApiOperation(value = "获取登录或登出信息", response = PageSysUserLoginInOutVo.class)
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "当前页", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "页数", paramType = "query", dataType = "int")
@ApiImplicitParam(name = "currentPage", value = "当前页", example = "1", paramType = "query", dataType = "int"),
@ApiImplicitParam(name = "pageSize", value = "页数", example = "10", paramType = "query", dataType = "int")
})
@GetMapping("pageByType")
public JSONObject pageByType(@RequestParam int inout, @RequestParam String startDate, @RequestParam String endDate, @ApiIgnore Pagination page) {