package com.sqx.modules.resumes.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.sqx.common.utils.DateUtils;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.resumes.entity.RuleClassify;
import com.sqx.modules.resumes.entity.RulePost;
import com.sqx.modules.resumes.service.RuleClassifyService;
import com.sqx.modules.resumes.service.RulePostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@Api(value = "岗位分类", tags = {"岗位分类"})
@RequestMapping(value = "/admin/rule/")
public class RuleController {

    @Autowired
    private RuleClassifyService ruleClassifyService;

    @ApiOperation("添加岗位")
    @PostMapping("addClassify")
    public Result addClassify(RuleClassify ruleClassify) {
        return ruleClassifyService.addClassify(ruleClassify);
    }

    @ApiOperation("管理员获取一级岗位列表")
    @GetMapping("adminGetClassifyList")
    public Result adminGetClassifyList(Integer page, Integer limit, RuleClassify classify) {
        return Result.success().put("data", ruleClassifyService.adminGetClassifyList(page, limit, classify));
    }

    @ApiOperation("管理员根据一级分类获取下级分类")
    @GetMapping("adminGetParentId")
    public Result adminGetParentId(Integer page, Integer limit, RuleClassify classify) {
        return Result.success().put("data", ruleClassifyService.adminGetParentId(page, limit, classify));
    }

    @ApiOperation("修改岗位")
    @PostMapping("updateClassify")
    public Result updateClassify(RuleClassify ruleClassify) {
        return ruleClassifyService.updateClassify(ruleClassify);
    }

    @ApiOperation("删除岗位")
    @GetMapping("deleteClassify")
    public Result deleteClassify(Long intentionId) {
        return ruleClassifyService.deleteClassify(intentionId);
    }

    @ApiOperation("获取当前岗位已有的标题")
    @GetMapping("getClassifyHasTitle")
    public Result getClassifyHasTitle(Long ruleClassifyId) {
        return Result.success().put("data", ruleClassifyService.getClassifyHasTitle(ruleClassifyId));
    }
}
