MemberController.java 3.96 KB
package com.subsidy.controller;


import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.company.AttendMembersDTO;
import com.subsidy.dto.member.*;
import com.subsidy.model.CompanyMemberMappingDO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
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 2024-01-11
 */
@RestController
@Api(tags = "学生表")
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @PostMapping("departMembers")
    @ApiOperation("某公司的离职记录  pageSize pageNum  companyId  userName 姓名/手机号/身份证号")
    public ResponseVO departMembers(@RequestBody DepartMembersDTO departMembersDTO){
        return ResponseData.generateCreatedResponse(0,memberService.departMembers(departMembersDTO));
    }

    @PostMapping("exportDepartMembers")
    @ApiOperation("导出离职人员记录   companyId  userName 姓名/手机号/身份证号  ")
    public void exportDepartMembers(@RequestBody DepartMembersDTO departMembersDTO){
        memberService.exportDepartMembers(departMembersDTO);
    }

    @PostMapping("attendMembers")
    @ApiOperation("查看某个企业已经参加过该培训的学生   companyId departmentId userName pageSize pageNum")
    public ResponseVO attendMembers(@RequestBody AttendMembersDTO attendMembersDTO){
        return ResponseData.generateCreatedResponse(0,memberService.attendMembers(attendMembersDTO));
    }

    @PostMapping("memberAttendInfo")
    @ApiOperation("某个学员在该企业参加培训的详情  memberId  学员id companyId 公司id")
    public ResponseVO memberAttendInfo(@RequestBody CompanyMemberMappingDO companyMemberMappingDO){
        return ResponseData.generateCreatedResponse(0,memberService.memberAttendInfo(companyMemberMappingDO));
    }

    @PostMapping("getAll")
    @ApiOperation("查询某部门成员 pageNum pageSize departmentId userName status startDate endDate")
    @LoginRequired
    public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
        return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
    }

    @PostMapping("deleteMember")
    @ApiOperation("删除成员 id ")
    @LoginRequired
    public ResponseVO deleteMember(@RequestBody MemberDO memberDO){
        return ResponseData.generateCreatedResponse(0,memberService.deleteMember(memberDO));
    }

    @PostMapping("addMember")
    @ApiOperation("新增成员 companyId userName accountName accountNameEn telephone gender image idCard departmentIds jobIds workNo inductionDate email")
    @LoginRequired
    public ResponseVO addMember(@RequestBody AddMemberDTO addMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.addMember(addMemberDTO));
    }

    @PostMapping("updateMember")
    @ApiOperation("编辑成员 {id companyId userName accountName accountNameEn telephone gender image idCard idCardPhoto status departmentIds jobIds}")
    @LoginRequired
    public ResponseVO updateMember(@RequestBody AddMemberDTO addMemberDTO){
        return ResponseData.generateCreatedResponse(0,memberService.updateMember(addMemberDTO));
    }

    @PostMapping("changeDepartments")
    @ApiOperation("修改部门   desDepId[] 目的部门 memberIds[] 成员id")
    @LoginRequired
    public ResponseVO changeDepartments(@RequestBody ChangeDepartmentsDTO changeDepartmentsDTO){
        return ResponseData.generateCreatedResponse(0,memberService.changeDepartments(changeDepartmentsDTO));
    }

}