package com.softegg.freetogo.SendDemand.controller; import com.softegg.freetogo.SendDemand.service.SendDemandService; import com.softegg.freetogo.Demand.Dao.DemandsRepository; import com.softegg.freetogo.Demand.bean.Demands; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Map; /** * @description:登录服务前后端交互 * @author:wuyifan * @date:2024/5/10 23:09 */ @RestController //@CrossOrigin(origins = "*") @RequestMapping("/SendDemand") public class SendDemandController { @Autowired SendDemandService sendDemandService; /** * @description: 发送需求的交互逻辑 * @param: map * @return: java.lang.String * @author: zhanglinhao * @date: 2024/5/9 22:45 */ @PostMapping("register") public int SendDemand(@RequestBody Map map) { return switch (sendDemandService.sendnewDemandAccount(map.get("city").toString(), map.get("phone").toString())){ case 1005 -> 1;//需求发送成功 default -> 0; }; } }