From 381d0465a589a1862e9d79394619ae4bcc04350b Mon Sep 17 00:00:00 2001
From: lizijie <lzjiiie@163.com>
Date: Wed, 07 Apr 2021 08:39:51 +0800
Subject: [PATCH] 角色功能修改

---
 screen-manage/src/main/java/com/moral/api/controller/AccountController.java |  109 ++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 93 insertions(+), 16 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 5b3ff22..8307df0 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,33 +1,110 @@
 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.vo.account.AccountQueryVO;
+import com.moral.api.pojo.vo.account.AccountUpdateVO;
 import com.moral.api.service.ManageAccountService;
+import com.moral.constant.ResponseCodeEnum;
 import com.moral.constant.ResultMessage;
-import com.moral.util.ObjectUtils;
-import io.netty.util.internal.ObjectUtil;
-import io.swagger.annotations.Api;
+import io.swagger.annotations.*;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.annotation.Resource;
-import java.util.Map;
-
 @Slf4j
-@Api(tags = {"������������"})
+@Api(tags = {"������������������"})
 @RestController
 @RequestMapping("/account")
 public class AccountController {
-    @Resource
+    @Autowired
     ManageAccountService accountService;
 
-    @PostMapping("login")
-    public ResultMessage login(@RequestBody Map<String,Object> paramters){
-        if(!ObjectUtils.checkParamAndMap(paramters,"account","password"))
-            return  ResultMessage.fail("���������������");
-        Map<String, Object> result = accountService.login(paramters);
-        if((int)result.get("accountId")<0)
-            return ResultMessage.fail(result);
-        return ResultMessage.ok(result);
+    @PostMapping("insert")
+    public ResultMessage insert(@RequestBody AccountInsertForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������������
+        AccountInsertDTO conditionDTO = form.paramValid();
+        if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
+            return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null);
+        }
+
+        //������������������
+        AccountDTO dto = accountService.insertAccount(form);
+
+        //������������������������
+        AccountInsertVO accountInsertVO = AccountInsertVO.convert(dto);
+
+        return new ResultMessage(dto.getCode(), dto.getMsg(), accountInsertVO);
     }
 
+    @PostMapping("update")
+    public ResultMessage update(@RequestBody AccountUpdateForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������������
+        AccountUpdateDTO conditionDTO = form.paramValid();
+        if (conditionDTO.getCode() != ResponseCodeEnum.SUCCESS.getCode()) {
+            return new ResultMessage(conditionDTO.getCode(), conditionDTO.getMsg(), null);
+        }
+
+        //������������������
+        AccountDTO dto = accountService.updateAccount(form);
+
+        //���������������������������
+        AccountUpdateVO vo = AccountUpdateVO.convert(dto);
+
+        return new ResultMessage(dto.getCode(), dto.getMsg(), vo);
+    }
+
+    @PostMapping("delete")
+    public ResultMessage delete(@RequestBody AccountDeleteForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������
+        AccountDTO dto = accountService.deleteAccount(form);
+
+        //���������������������������
+        AccountDeleteVO vo = AccountDeleteVO.convert(dto);
+
+        return new ResultMessage(dto.getCode(), dto.getMsg(), vo);
+    }
+
+    @GetMapping("query")
+    public ResultMessage query(AccountQueryForm form) {
+        //������������������������
+        if (!form.valid())
+            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),
+                    ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
+
+        //������������������
+        AccountQueryDTO accountQueryDTO = accountService.queryAccount(form);
+
+        //���������������������������
+        AccountQueryVO accountQueryVO = AccountQueryVO.convert(accountQueryDTO);
+
+
+        return new ResultMessage(accountQueryDTO.getCode(), accountQueryDTO.getMsg(), accountQueryVO);
+    }
+
+
+
+
 
 }

--
Gitblit v1.8.0