Blame view

MajorDictController.java 1.78 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
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())));
    }

}