Blame view

CollegesDictController.java 4.59 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 110
package com.subsidy.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.constant.Platform;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.college.GetCollegesListDTO;
import com.subsidy.dto.project.ProjectCollegeListDTO;
import com.subsidy.model.CollegesDictDO;
import com.subsidy.model.ProjectDO;
import com.subsidy.service.CollegesDictService;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
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;
import io.swagger.annotations.Api;

/**
 * <p>
 * 院校字典表 前端控制器
 * </p>
 *
 * @author Tuyp
 * @since 2025-01-08
 */
@RestController
@Api(tags = "院校字典表")
@RequestMapping("/collegesDict")
public class CollegesDictController {

    @Autowired
    public CollegesDictService collegesDictService;

    @PostMapping(value = "/getCollegesList")
    @ApiOperation("查询所有就读院校: name/院校名称 pageSize pageNum")
    public ResponseVO getCollegesList(@RequestBody GetCollegesListDTO getCollegesListDTO) {
        Page page = new Page(getCollegesListDTO.getPageNum(), getCollegesListDTO.getPageSize());

        QueryWrapper<CollegesDictDO> queryWrapper = new QueryWrapper();

        if (StringUtils.isNotBlank(getCollegesListDTO.getName())) {
            queryWrapper.lambda().like(CollegesDictDO::getName, getCollegesListDTO.getName());
        }
//        queryWrapper.lambda().eq(CollegesDictDO::getLoginStatus,1);
        return ResponseData.generateCreatedResponse(0, collegesDictService.page(page, queryWrapper));
    }

    @PostMapping(value = "/login")
    @ApiOperation("院校端 --- 登录: account/账户, password/密码")
    public ResponseVO login(@RequestBody CollegesDictDO collegesDictDO) {
        return ResponseData.generateCreatedResponse(0, collegesDictService.login(collegesDictDO));
    }

    @PostMapping(value = "updateCollegeById")
    @ApiOperation("院校端 --- 更新院校信息: id/ID, account/账户,code/代码, name/名称, password/密码")
    public ResponseVO updateCollegeById(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.updateById(collegesDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping(value = "addContact")
    @ApiOperation("院校端 --- 新增联系人:id  院校idleaderName/领导姓名、leaderPost/领导职务、leaderPhone/领导手机号、contactName/联系人姓名、contactPost/联系人职务、contactPhone/联系人手机号")
    public ResponseVO addContact(@RequestBody CollegesDictDO collegesDictDO) {
        collegesDictService.addContact(collegesDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

//    @PostMapping(value = "/createColleges")
//    @ApiOperation("中心端 --- 新建院校: name/搜索名称, code/院校代码、 phone/手机号")
//    public ResponseVO createColleges(@RequestBody CollegesDictDO collegesDictDO) {
//        collegesDictService.createColleges(collegesDictDO);
//        return ResponseData.generateCreatedResponse(0);
//    }
//
//    @PostMapping(value = "/delete")
//    @ApiOperation("中心端 --- 删除院校: id/院校ID")
//    public ResponseVO delete(@RequestBody CollegesDictDO collegesDictDO) {
//        collegesDictService.removeById(collegesDictDO.getId());
//        return ResponseData.generateCreatedResponse(0);
//    }

//    @PostMapping(value = "/exportCollege")
//    @ApiOperation("导出院校名录")
//    public ResponseVO exportCollege() {
//        collegesDictService.exportCollege();
//        return ResponseData.generateCreatedResponse(0);
//    }


    @PostMapping(value = "/exportProjectCollegeList")
    @ApiOperation("院校端 --- 批量导出院校项目: ids[]")
    public void exportProjectCollegeList(@RequestBody ProjectCollegeListDTO projectCollegeListDTO) {
        collegesDictService.exportProjectCollegeList(projectCollegeListDTO);
    }

    @PostMapping(value = "/exportSchoolProjectSummary")
    @ApiOperation("院校端 --- 批量导出院校项目汇总表 collegeId")
    public void exportSchoolProjectSummary(@RequestBody ProjectDO projectDO) {
        collegesDictService.exportSchoolProjectSummary(projectDO);
    }


}