ZpglZpqdController.java 2.49 KB
Newer Older
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
package cn.timer.api.controller.zpgl;

import cn.timer.api.bean.zpgl.ZpglZpqd;
import cn.timer.api.config.annotation.CurrentUser;
import cn.timer.api.config.annotation.UserBean;
import cn.timer.api.config.exception.CustomException;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.transaction.Transactional;
import java.util.List;

/**
 * 招聘管理
 *
 * @author wuqingjun
 * @email 284718418@qq.com
 * @date 2022-03-28 15:14:40
 */
@Api(tags = "招聘管理")
@Transactional(rollbackOn = Exception.class)
@RestController
@RequestMapping(value = "/zpgl", produces = {"application/json"})
public class ZpglZpqdController {

    /**
     * 招聘-招聘渠道字典
     *
     * @param
     * @return
     */
284718418@qq.com committed
37
    @GetMapping(value = "/zpqd/{OrgCode}")
38 39
    @ApiOperation(value = "1.招聘渠道字典", httpMethod = "GET", notes = "招聘渠道字典")
    @ApiOperationSupport(order = 1)
284718418@qq.com committed
40
    public Result<Object> zpqd(@PathVariable Integer OrgCode) {
41 42
        try {
            QueryWrapper<ZpglZpqd> queryWrapper = new QueryWrapper<>();
284718418@qq.com committed
43
            queryWrapper.lambda().eq(ZpglZpqd::getDeleteFlag, 0).eq(ZpglZpqd::getOrgCode, OrgCode);
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
            List<ZpglZpqd> zpglZpqd = ZpglZpqd.builder().build().selectList(queryWrapper);
            return ResultUtil.data(zpglZpqd, "查询成功");
        } catch (Exception e) {
            e.printStackTrace();
            throw new CustomException("招聘-招聘渠道字典失败");
        }
    }

    /**
     * 招聘-添加招聘渠道
     *
     * @param
     * @return
     */
    @PostMapping(value = "/zpqd/save")
    @ApiOperation(value = "2.招聘-添加招聘渠道", httpMethod = "POST", notes = "招聘-添加招聘渠道")
    @ApiOperationSupport(order = 2)
    public Result<Object> save(@CurrentUser UserBean userBean, @RequestBody ZpglZpqd zpglZpqd) {
        try {
            zpglZpqd.setCreateUserId(userBean.getEmpNum());
            zpglZpqd.setUpdateUserId(userBean.getEmpNum());
            zpglZpqd.setOrgCode(userBean.getOrgCode());
            return zpglZpqd.insert() ? ResultUtil.success() : ResultUtil.error();
        } catch (Exception e) {
            e.printStackTrace();
            throw new CustomException("招聘-添加招聘渠道失败");
        }
    }

}