com.nebula.boxes.mvc.wms.WmsRecruitController Maven / Gradle / Ivy
The newest version!
package com.nebula.boxes.mvc.wms;
import com.nebula.boxes.iface.model.entry.RecruitEntry;
import com.nebula.boxes.iface.model.query.RecruitQuery;
import com.nebula.boxes.iface.model.view.RecruitView;
import com.nebula.boxes.iface.server.RecruitIFace;
import com.spring.boxes.dollar.ValidateUtils;
import com.spring.boxes.dollar.enums.AuditStateEnum;
import com.spring.boxes.dollar.enums.EnableEnum;
import com.spring.boxes.dollar.enums.YesOrNoEnum;
import com.spring.boxes.dollar.support.ApiException;
import com.spring.boxes.dollar.support.ApiResult;
import com.spring.boxes.dollar.support.Pagination;
import com.spring.boxes.dollar.term.ScopeKey;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/api/wms/hunt")
public class WmsRecruitController {
@Autowired
private RecruitIFace recruitIFace;
@ApiOperation(value = "系统管理-职位信息-查看")
@RequiresPermissions("admin:recruit:view")
@GetMapping(value = "/recruit/queryList")
public ApiResult> recruitList(@ModelAttribute RecruitQuery query,
@RequestParam(name = "page", required = false, defaultValue = "1") int page,
@RequestParam(name = "size", required = false, defaultValue = "15") int size) {
long appId = ScopeKey.getAppId();
long userId = ScopeKey.getUserId();
query.setUserId(userId);
Pagination pagination = recruitIFace.queryMiniView(appId, 0, query, page, size);
return ApiResult.success(pagination);
}
@ApiOperation(value = "系统管理-职位信息-查看")
@RequiresPermissions("admin:recruit:view")
@GetMapping(value = "/recruit/queryById")
public ApiResult> recruitSelect(@RequestParam(name = "id") long id) {
long appId = ScopeKey.getAppId();
RecruitView one = recruitIFace.queryFullView(appId, id, 0);
return ApiResult.success(one);
}
@ApiOperation(value = "系统管理-职位信息-编辑")
@RequiresPermissions("admin:recruit:edit")
@PostMapping(value = "/recruit/updateData")
public ApiResult> recruitUpdate(@RequestBody RecruitEntry entry, BindingResult binding) {
if (binding.hasErrors()) {
throw new ApiException(ValidateUtils.wrapErrorFirst(binding));
}
long userId = ScopeKey.getUserId();
entry.setUserId(userId);
boolean isOk = recruitIFace.updateRecruit(entry);
return ApiResult.success(isOk);
}
@ApiOperation(value = "系统管理-职位信息-审批状态")
@RequiresPermissions("admin:recruit:edit")
@GetMapping(value = "/recruit/updateAudit")
public ApiResult> recruitAudit(@RequestParam(name = "ids") List ids,
@RequestParam(name = "audit") int audit){
AuditStateEnum auditEnum = AuditStateEnum.Opt.INSTANCE().valueGet(audit);
boolean isOk = recruitIFace.updateAuditByIds(ids, auditEnum);
return ApiResult.success(isOk);
}
@ApiOperation(value = "系统管理-职位信息-上/下线")
@RequiresAuthentication
@GetMapping(value = "/recruit/updateOnline")
public ApiResult> recruitOnline(@RequestParam(name = "ids") List ids,
@RequestParam(name = "online") int online) {
YesOrNoEnum onlineEnum = YesOrNoEnum.Opt.INSTANCE().valueGet(online);
boolean isOk = recruitIFace.updateOnlineByIds(ids, onlineEnum);
return ApiResult.success(isOk);
}
@ApiOperation(value = "系统管理-职位信息-有效/无效")
@RequiresPermissions("admin:recruit:edit")
@GetMapping(value = "/recruit/updateEnable")
public ApiResult> recruitEnabled(@RequestParam(name = "ids") List ids,
@RequestParam(name = "enabled") int enabled) {
EnableEnum enableEnum = EnableEnum.Opt.INSTANCE().valueGet(enabled);
boolean isOk = recruitIFace.updateEnableByIds(ids, enableEnum);
return ApiResult.success(isOk);
}
}