MajorDictController.java 1.78 KB
package com.zhongzhi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.MajorDictDO;
import com.zhongzhi.service.MajorDictService;
import com.zhongzhi.vo.ResponseVO;
import io.swagger.annotations.Api;
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;

/**
 * <p>
 * 专业字典表 前端控制器
 * </p>
 *
 * @author DengMin
 * @since 2021-04-28
 */
@RestController
@Api(tags = "就读专业")
@RequestMapping("/majorDict")
public class MajorDictController {

    @Autowired
    private MajorDictService majorDictService;

    @PostMapping(value = "/getMajorList")
    @ApiOperation("查询全部就读专业: major/专业名称、education/学历、code/院校代码")
    public ResponseVO getMajorList(@RequestBody MajorDictDO majorDictDO) {
        return ResponseData.generateCreatedResponse(0, majorDictService.list(new QueryWrapper<MajorDictDO>()
                .lambda()
                .eq(StringUtils.isNotBlank(majorDictDO.getEducation()), MajorDictDO::getEducation, majorDictDO.getEducation())
                .eq(StringUtils.isNotBlank(majorDictDO.getCode()), MajorDictDO::getCode, majorDictDO.getCode())
                .like(StringUtils.isNotBlank(majorDictDO.getMajor()), MajorDictDO::getMajor, majorDictDO.getMajor())));
    }

}