CustomRecommendController.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.crm.custom.controller;
  2. import com.crm.custom.service.CustomRecommendService;
  3. import com.crm.login.rely.backend.controller.BaseLoginController;
  4. import com.crm.rely.backend.core.constant.Constants;
  5. import com.crm.rely.backend.core.dto.base.BaseResultDto;
  6. import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
  7. import com.crm.rely.backend.model.dto.custom.CustomInfoLoginDto;
  8. import com.crm.rely.backend.model.dto.custom.CustomInfoRecommendDto;
  9. import com.crm.rely.backend.model.entity.custom.CustomInfoListEntity;
  10. import com.crm.rely.backend.model.entity.custom.CustomInfoLoginListEntity;
  11. import com.crm.rely.backend.model.entity.custom.info.CustomInfoEntity;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.validation.annotation.Validated;
  14. import org.springframework.web.bind.annotation.PostMapping;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RequestMapping;
  17. import org.springframework.web.bind.annotation.RestController;
  18. @RestController
  19. @RequestMapping("/recommend")
  20. public class CustomRecommendController extends BaseLoginController {
  21. @Autowired
  22. private CustomRecommendService service;
  23. @PostMapping("/search/list")
  24. public BaseResultDto searchPageList(@RequestBody @Validated CustomInfoLoginListEntity entity, CustomInfoEntity infoEntity) throws Exception {
  25. if (infoEntity.getIbId() == null) {
  26. return BaseResultDto.error(Constants.NOT_PERMIT);
  27. }
  28. entity.setAgentId(infoEntity.getIbId());
  29. ResultWithPagerDto<CustomInfoLoginDto> result = service.searchPageList(entity);
  30. return result;
  31. }
  32. @PostMapping("/real/search/list")
  33. public BaseResultDto searchPageList(@RequestBody @Validated CustomInfoListEntity entity, CustomInfoEntity infoEntity) throws Exception {
  34. if (infoEntity.getIbId() == null) {
  35. return BaseResultDto.error(Constants.NOT_PERMIT);
  36. }
  37. entity.setAgentId(infoEntity.getIbId());
  38. ResultWithPagerDto<CustomInfoRecommendDto> result = service.searchPageList(entity);
  39. return result;
  40. }
  41. }