package com.bonus.boot.manager.health.controller;

import com.bonus.boot.manager.basic.entity.PersonnelLibraryBean;
import com.bonus.boot.manager.health.entity.SpecialPositionsBean;
import com.bonus.boot.manager.health.service.SpecialPositionsService;
import com.bonus.boot.manager.manager.annotation.LogAnnotation;
import com.bonus.boot.manager.manager.entity.R;
import com.bonus.boot.manager.physical.service.RetiremenService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xliu
 * @Data 2023/6/2 9:30
 */
@RestController
@RequestMapping("specialPositions")
public class SpecialPositionsController {
    /**
     * 服务对象
     */
    @Resource
    private SpecialPositionsService service;


    @LogAnnotation
    @PostMapping("getMsgContent")
    @ApiOperation(value = "特殊岗位-列表")
    public R getList(SpecialPositionsBean o){
        System.err.println("特殊岗位-列表="+o);
        List<SpecialPositionsBean> list = service.getList(o);
        return list.size() > 0 ? R.okTable(list, list.size()):R.failTable("暂无数据");
    }

    /**
     * 添加特殊岗位
     * @param o
     * @return
     */
    @LogAnnotation
    @RequestMapping(value = "addSpecialPost", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "特殊岗位-新增")
    public R addSpecialPost(@RequestBody SpecialPositionsBean o){
        System.err.println("特殊岗位-新增="+o);
        R r= service.addSpecialPost(o);
        return  r;
    }


    /**
     * 添加特殊岗位-修改
     * @param o
     * @return
     */
    @LogAnnotation
    @RequestMapping(value = "modifySpecialPost", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "特殊岗位-修改")
    public R modifySpecialPost(@RequestBody SpecialPositionsBean o){
        System.err.println("特殊岗位-修改="+o);
        R r= service.modifySpecialPost(o);
        return  r;
    }


    /**
     * 添加特殊岗-删除
     * @param o
     * @return
     */
    @LogAnnotation
    @RequestMapping(value = "del", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "特殊岗位-删除")
    public R del( SpecialPositionsBean o){
        System.err.println("特殊岗位-删除="+o);
        int num= service.del(o);
        return num > 0 ? R.okTable("删除成功", num):R.failTable("删除失败");
    }

}

