CheckBizUserController.java 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package com.idea.oa.searchuser;
  2. import com.rockstar.biz.model.BizUser;
  3. import com.rockstar.biz.model.BizUserExample;
  4. import com.rockstar.biz.service.BizUserService;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.validation.annotation.Validated;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestMapping;
  9. import org.springframework.web.bind.annotation.RestController;
  10. import java.util.List;
  11. /**
  12. * 暂用- bizUser用户名重复校验
  13. */
  14. @RestController
  15. @RequestMapping("captcha")
  16. @Validated
  17. public class CheckBizUserController {
  18. @Autowired
  19. private BizUserService bizUserService;
  20. @PostMapping(value = "checkBizUserByBizUserName",produces = {"application/json;charset=UTF-8"})
  21. public Object getBizUserByBizUserName(String userName) {
  22. BizUserExample bizUserExample = new BizUserExample();
  23. bizUserExample.createCriteria().andUsernameEqualTo(userName);
  24. List<BizUser> bizUsers = bizUserService.selectByExample(bizUserExample);
  25. if(bizUsers!=null&&bizUsers.size()>0){
  26. return 0;
  27. }else {
  28. return 1;
  29. }
  30. }
  31. }