From 163fdb454556e9047098dbdbacfcdebe2a781cf6 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Wed, 09 Jun 2021 13:46:02 +0800 Subject: [PATCH] screen-manage 更新登陆逻辑 --- screen-manage/src/main/java/com/moral/api/controller/AccountController.java | 45 +++++++++++++++++++++++---------------------- 1 files changed, 23 insertions(+), 22 deletions(-) diff --git a/screen-manage/src/main/java/com/moral/api/controller/AccountController.java b/screen-manage/src/main/java/com/moral/api/controller/AccountController.java index 8307df0..3d6d8af 100644 --- a/screen-manage/src/main/java/com/moral/api/controller/AccountController.java +++ b/screen-manage/src/main/java/com/moral/api/controller/AccountController.java @@ -1,15 +1,11 @@ package com.moral.api.controller; import com.moral.api.pojo.dto.account.*; -import com.moral.api.pojo.dto.organization.OrganizationDTO; -import com.moral.api.pojo.form.account.AccountDeleteForm; -import com.moral.api.pojo.form.account.AccountInsertForm; -import com.moral.api.pojo.form.account.AccountQueryForm; -import com.moral.api.pojo.form.account.AccountUpdateForm; -import com.moral.api.pojo.vo.account.AccountDeleteVO; -import com.moral.api.pojo.vo.account.AccountInsertVO; +import com.moral.api.pojo.dto.accountRole.AccountRoleDTO; +import com.moral.api.pojo.form.account.*; +import com.moral.api.pojo.form.accountRole.AccountRoleUpdateForm; import com.moral.api.pojo.vo.account.AccountQueryVO; -import com.moral.api.pojo.vo.account.AccountUpdateVO; +import com.moral.api.service.ManageAccountRoleService; import com.moral.api.service.ManageAccountService; import com.moral.constant.ResponseCodeEnum; import com.moral.constant.ResultMessage; @@ -18,13 +14,17 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + @Slf4j @Api(tags = {"������������������"}) @RestController +@CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping("/account") public class AccountController { @Autowired ManageAccountService accountService; + @Autowired + ManageAccountRoleService manageAccountRoleService; @PostMapping("insert") public ResultMessage insert(@RequestBody AccountInsertForm form) { @@ -34,7 +34,7 @@ ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); //������������������������ - AccountInsertDTO conditionDTO = form.paramValid(); + AccountDTO conditionDTO = form.paramValid(); if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) { return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null); } @@ -42,10 +42,7 @@ //������������������ AccountDTO dto = accountService.insertAccount(form); - //������������������������ - AccountInsertVO accountInsertVO = AccountInsertVO.convert(dto); - - return new ResultMessage(dto.getCode(), dto.getMsg(), accountInsertVO); + return new ResultMessage(dto.getCode(), dto.getMsg(), null); } @PostMapping("update") @@ -56,7 +53,7 @@ ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); //������������������������ - AccountUpdateDTO conditionDTO = form.paramValid(); + AccountDTO conditionDTO = form.paramValid(); if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) { return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null); } @@ -64,10 +61,7 @@ //������������������ AccountDTO dto = accountService.updateAccount(form); - //��������������������������� - AccountUpdateVO vo = AccountUpdateVO.convert(dto); - - return new ResultMessage(dto.getCode(), dto.getMsg(), vo); + return new ResultMessage(dto.getCode(), dto.getMsg(), null); } @PostMapping("delete") @@ -80,10 +74,7 @@ //������������������ AccountDTO dto = accountService.deleteAccount(form); - //��������������������������� - AccountDeleteVO vo = AccountDeleteVO.convert(dto); - - return new ResultMessage(dto.getCode(), dto.getMsg(), vo); + return new ResultMessage(dto.getCode(), dto.getMsg(), null); } @GetMapping("query") @@ -103,8 +94,18 @@ return new ResultMessage(accountQueryDTO.getCode(), accountQueryDTO.getMsg(), accountQueryVO); } + @PostMapping("updateRole") + public ResultMessage updateRole(@RequestBody AccountRoleUpdateForm form){ + //������������������������ + if (!form.valid()) + return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), + ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); + //������������������ + AccountRoleDTO dto = manageAccountRoleService.updateAccountRole(form); + return new ResultMessage(dto.getCode(), dto.getMsg(), null); + } } -- Gitblit v1.8.0