PostPreferenceController.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.sqx.modules.firstLogin.control;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.sqx.common.utils.Result;
  4. import com.sqx.modules.app.annotation.Login;
  5. import com.sqx.modules.firstLogin.entity.PostPreference;
  6. import com.sqx.modules.firstLogin.service.PostPreferenceService;
  7. import io.swagger.annotations.ApiOperation;
  8. import org.springframework.beans.factory.annotation.Autowired;
  9. import org.springframework.web.bind.annotation.*;
  10. @RestController
  11. @RequestMapping("app/postPreference")
  12. public class PostPreferenceController {
  13. @Autowired
  14. private PostPreferenceService postPreferenceServer;
  15. @Login
  16. @GetMapping("getPostPreference")
  17. @ApiOperation("获取岗位偏向")
  18. public Result getPostPreference(Long ruleClassifyId){
  19. return Result.success().put("data",postPreferenceServer.getBaseMapper().selectList(new QueryWrapper<PostPreference>().eq("rule_classify_id",ruleClassifyId).eq("is_use",1)));
  20. }
  21. @PostMapping("addPostPreference")
  22. @ApiOperation("增加岗位偏向")
  23. public Result addPostPreference(@RequestBody PostPreference postPreference){
  24. postPreference.setIsUse(1);
  25. postPreferenceServer.saveOrUpdate(postPreference);
  26. return Result.success("修改完成");
  27. }
  28. @PostMapping("deletePostPreference")
  29. @ApiOperation("增加岗位偏向")
  30. public Result deletePostPreference(Long postPreferenceId){
  31. PostPreference postPreference =postPreferenceServer.getById(postPreferenceId);
  32. postPreference.setIsUse(0);
  33. postPreferenceServer.updateById(postPreference);
  34. return Result.success("修改完成");
  35. }
  36. }