拆分think模块包
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
package com.gxwebsoft.common.system.controller;
|
||||
|
||||
import com.gxwebsoft.common.core.web.BaseController;
|
||||
import com.gxwebsoft.common.system.service.UserGroupService;
|
||||
import com.gxwebsoft.common.system.entity.UserGroup;
|
||||
import com.gxwebsoft.common.system.param.UserGroupParam;
|
||||
import com.gxwebsoft.common.core.web.ApiResult;
|
||||
import com.gxwebsoft.common.core.web.PageResult;
|
||||
import com.gxwebsoft.common.core.web.PageParam;
|
||||
import com.gxwebsoft.common.core.web.BatchParam;
|
||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户分组管理表控制器
|
||||
*
|
||||
* @author 科技小王子
|
||||
* @since 2023-10-28 15:16:39
|
||||
*/
|
||||
@Api(tags = "用户分组管理表管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/system/user-group")
|
||||
public class UserGroupController extends BaseController {
|
||||
@Resource
|
||||
private UserGroupService userGroupService;
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("分页查询用户分组管理表")
|
||||
@GetMapping("/page")
|
||||
public ApiResult<PageResult<UserGroup>> page(UserGroupParam param) {
|
||||
PageParam<UserGroup, UserGroupParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return success(userGroupService.page(page, page.getWrapper()));
|
||||
// 使用关联查询
|
||||
//return success(userGroupService.pageRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("查询全部用户分组管理表")
|
||||
@GetMapping()
|
||||
public ApiResult<List<UserGroup>> list(UserGroupParam param) {
|
||||
PageParam<UserGroup, UserGroupParam> page = new PageParam<>(param);
|
||||
page.setDefaultOrder("create_time desc");
|
||||
return success(userGroupService.list(page.getOrderWrapper()));
|
||||
// 使用关联查询
|
||||
//return success(userGroupService.listRel(param));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:list')")
|
||||
@OperationLog
|
||||
@ApiOperation("根据id查询用户分组管理表")
|
||||
@GetMapping("/{id}")
|
||||
public ApiResult<UserGroup> get(@PathVariable("id") Integer id) {
|
||||
return success(userGroupService.getById(id));
|
||||
// 使用关联查询
|
||||
//return success(userGroupService.getByIdRel(id));
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("添加用户分组管理表")
|
||||
@PostMapping()
|
||||
public ApiResult<?> save(@RequestBody UserGroup userGroup) {
|
||||
if (userGroupService.save(userGroup)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("修改用户分组管理表")
|
||||
@PutMapping()
|
||||
public ApiResult<?> update(@RequestBody UserGroup userGroup) {
|
||||
if (userGroupService.updateById(userGroup)) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("删除用户分组管理表")
|
||||
@DeleteMapping("/{id}")
|
||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||
if (userGroupService.removeById(id)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:save')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量添加用户分组管理表")
|
||||
@PostMapping("/batch")
|
||||
public ApiResult<?> saveBatch(@RequestBody List<UserGroup> list) {
|
||||
if (userGroupService.saveBatch(list)) {
|
||||
return success("添加成功");
|
||||
}
|
||||
return fail("添加失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:update')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量修改用户分组管理表")
|
||||
@PutMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<UserGroup> batchParam) {
|
||||
if (batchParam.update(userGroupService, "group_id")) {
|
||||
return success("修改成功");
|
||||
}
|
||||
return fail("修改失败");
|
||||
}
|
||||
|
||||
@PreAuthorize("hasAuthority('sys:userGroup:remove')")
|
||||
@OperationLog
|
||||
@ApiOperation("批量删除用户分组管理表")
|
||||
@DeleteMapping("/batch")
|
||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||
if (userGroupService.removeByIds(ids)) {
|
||||
return success("删除成功");
|
||||
}
|
||||
return fail("删除失败");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user