Blame view

AdministerController.java 4.32 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
package com.meishu.controller;


import com.meishu.common.ResponseData;
import com.meishu.common.ResponseVO;
import com.meishu.common.interceptor.LoginRequired;
import com.meishu.dto.administer.AddAdministerDTO;
import com.meishu.dto.administer.ChangeStatusDTO;
import com.meishu.dto.administer.PublishTasksDTO;
import com.meishu.dto.administer.UpdateAdministerDTO;
import com.meishu.dto.exercise.UpdateStatusDTO;
import com.meishu.dto.test.PublishTestDTO;
import com.meishu.model.AdministerDO;
import com.meishu.model.SmsCodeDO;
import com.meishu.service.AdministerService;
import com.meishu.util.ConstantUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 中心管理账户表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2021-04-25
 */
@RestController
@Api(tags= "管理平台用户")
@RequestMapping("/administer")
public class AdministerController {

    @Autowired
    private AdministerService administerService;

    @PostMapping("sendMsg")
    @ApiOperation("发送短信验证码  {telephone}")
    public ResponseVO sendMsg(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.sendMsg(administerDO));
    }

    @PostMapping("login")
    @ApiOperation("登录 {telephone  code}")
    public ResponseVO login(@RequestBody SmsCodeDO smsCodeDO){
        return ResponseData.generateCreatedResponse(0,administerService.login(smsCodeDO));
    }

    @PostMapping("passwordLogin")
    @ApiOperation("密码登录  telephone  password")
    public ResponseVO passwordLogin(@RequestBody AdministerDO administerDO){
        return ResponseData.generateCreatedResponse(0,administerService.passwordLogin(administerDO));
    }

    @PostMapping("/getPermissions")
    @ApiOperation("权限查询")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getPermissions() {
        return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
    }

    @PostMapping("getParentPermission")
    @ApiOperation("获取所有父权限")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getParentPermission(){
        return ResponseData.generateCreatedResponse(0,administerService.getParentPermission());
    }

    @PostMapping("addAdminister")
    @ApiOperation("添加成员 {telephone,userName,img,departmentId  campusIds[]校区数组  departmentIds[] 部门id  subjectIds[]  科目id intro 简介 roleIds[]  角色id} ")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO addAdminister(@RequestBody AddAdministerDTO addAdministerDTO){
        return ResponseData.generateCreatedResponse(0,administerService.addAdminister(addAdministerDTO));
    }

    @PostMapping("getPermissionTree")
    @ApiOperation("获取所有权限列表")
    public ResponseVO getPermissionTree(){
        return ResponseData.generateCreatedResponse(0,administerService.getPermissionTree());
    }

    @PostMapping("/changeStatus")
    @ApiOperation("操作离职  ids  status")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO changeStatus(@RequestBody ChangeStatusDTO changeStatusDTO){
        return ResponseData.generateCreatedResponse(0,administerService.changeStatus(changeStatusDTO));
    }

    @PostMapping("updateAdminister")
    @ApiOperation("修改成员信息  id telephone,userName,img,departmentId campusIds[]  departmentIds[] 部门id  intro简介 roleIds[]  角色id")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO updateAdminister(@RequestBody UpdateAdministerDTO updateAdministerDTO){
        return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(updateAdministerDTO));
    }

    @PostMapping("getAllAdminister")
    @ApiOperation("获取所有老师")
    @LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
    public ResponseVO getAllAdminister(){
        return ResponseData.generateCreatedResponse(0,administerService.getAllAdminister());
    }


}