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 */ @GetMapping(value = "/zpqd/{OrgCode}") @ApiOperation(value = "1.招聘渠道字典", httpMethod = "GET", notes = "招聘渠道字典") @ApiOperationSupport(order = 1) public Result<Object> zpqd(@PathVariable Integer OrgCode) { try { QueryWrapper<ZpglZpqd> queryWrapper = new QueryWrapper<>(); queryWrapper.lambda().eq(ZpglZpqd::getDeleteFlag, 0).eq(ZpglZpqd::getOrgCode, OrgCode); 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("招聘-添加招聘渠道失败"); } } }