YearDictController.java 1.53 KB
package com.zhongzhi.controller;


import com.zhongzhi.common.utils.ResponseData;
import com.zhongzhi.model.YearDictDO;
import com.zhongzhi.service.YearDictService;
import com.zhongzhi.vo.ResponseVO;
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 DengMin
 * @since 2023-04-11
 */
@RestController
@RequestMapping("/yearDict")
@Api(tags = "年份管理")
public class YearDictController {

    @Autowired
    private YearDictService yearDictService;

    @PostMapping("queryYears")
    @ApiOperation("查询年份")
    public ResponseVO queryYears(){
        return ResponseData.generateCreatedResponse(0,yearDictService.queryYears());
    }

    @PostMapping("updateYear")
    @ApiOperation("编辑年份 id year status")
    public ResponseVO updateYear(@RequestBody YearDictDO yearDictDO){
        yearDictService.updateYear(yearDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

    @PostMapping("addYear")
    @ApiOperation("添加年份 year status ")
    public ResponseVO addYear(@RequestBody YearDictDO yearDictDO){
        yearDictService.addYear(yearDictDO);
        return ResponseData.generateCreatedResponse(0);
    }

}