|
@@ -0,0 +1,93 @@
|
|
|
+package com.citu.module.menduner.system.controller.admin.userinfo;
|
|
|
+
|
|
|
+import com.citu.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
+import com.citu.framework.common.pojo.PageParam;
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
+import com.citu.framework.common.util.object.BeanUtils;
|
|
|
+import com.citu.framework.excel.core.util.ExcelUtils;
|
|
|
+import com.citu.module.menduner.system.dal.dataobject.userinfo.UserInfoDO;
|
|
|
+import com.citu.module.menduner.system.service.userinfo.UserInfoService;
|
|
|
+import com.citu.module.menduner.system.controller.admin.userinfo.vo.UserInfoPageReqVO;
|
|
|
+import com.citu.module.menduner.system.controller.admin.userinfo.vo.UserInfoRespVO;
|
|
|
+import com.citu.module.menduner.system.controller.admin.userinfo.vo.UserInfoSaveReqVO;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import static com.citu.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
+
|
|
|
+@Tag(name = "管理后台 - 用户信息-个人档案")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/menduner.system/user-info")
|
|
|
+@Validated
|
|
|
+public class UserInfoController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private UserInfoService userInfoService;
|
|
|
+
|
|
|
+ @PostMapping("/create")
|
|
|
+ @Operation(summary = "创建用户信息-个人档案")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:create')")
|
|
|
+ public CommonResult<Long> createUserInfo(@Valid @RequestBody UserInfoSaveReqVO createReqVO) {
|
|
|
+ return success(userInfoService.createUserInfo(createReqVO));
|
|
|
+ }
|
|
|
+
|
|
|
+ @PutMapping("/update")
|
|
|
+ @Operation(summary = "更新用户信息-个人档案")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:update')")
|
|
|
+ public CommonResult<Boolean> updateUserInfo(@Valid @RequestBody UserInfoSaveReqVO updateReqVO) {
|
|
|
+ userInfoService.updateUserInfo(updateReqVO);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @DeleteMapping("/delete")
|
|
|
+ @Operation(summary = "删除用户信息-个人档案")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:delete')")
|
|
|
+ public CommonResult<Boolean> deleteUserInfo(@RequestParam("id") Long id) {
|
|
|
+ userInfoService.deleteUserInfo(id);
|
|
|
+ return success(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/get")
|
|
|
+ @Operation(summary = "获得用户信息-个人档案")
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:query')")
|
|
|
+ public CommonResult<UserInfoRespVO> getUserInfo(@RequestParam("id") Long id) {
|
|
|
+ UserInfoDO userInfo = userInfoService.getUserInfo(id);
|
|
|
+ return success(BeanUtils.toBean(userInfo, UserInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/page")
|
|
|
+ @Operation(summary = "获得用户信息-个人档案分页")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:query')")
|
|
|
+ public CommonResult<PageResult<UserInfoRespVO>> getUserInfoPage(@Valid UserInfoPageReqVO pageReqVO) {
|
|
|
+ PageResult<UserInfoDO> pageResult = userInfoService.getUserInfoPage(pageReqVO);
|
|
|
+ return success(BeanUtils.toBean(pageResult, UserInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export-excel")
|
|
|
+ @Operation(summary = "导出用户信息-个人档案 Excel")
|
|
|
+ @PreAuthorize("@ss.hasPermission('menduner.system:user-info:export')")
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
+ public void exportUserInfoExcel(@Valid UserInfoPageReqVO pageReqVO,
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ List<UserInfoDO> list = userInfoService.getUserInfoPage(pageReqVO).getList();
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "用户信息-个人档案.xls", "数据", UserInfoRespVO.class,
|
|
|
+ BeanUtils.toBean(list, UserInfoRespVO.class));
|
|
|
+ }
|
|
|
+
|
|
|
+}
|