package com.sjy.payment.controller;
import com.sjy.payment.service.PaymentService;
import com.sjy.springcloud.pojo.CommonResult;
import com.sjy.springcloud.pojo.Payment;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@Slf4j
public class PaymentControler {
@Autowired
private PaymentService paymentService;
@PostMapping("/payment/create")
public CommonResult create(@RequestBody Payment dept){
int i = paymentService.create(dept);
log.info("***************插入成功*******"+i);
if(i>0){
return new CommonResult(200,"插入数据库成功",i);
}else{
return new CommonResult(444,"插入数据库失败",null);
}
}
@GetMapping("/payment/get/{id}")
public CommonResult queryById(@PathVariable("id") Long id){
Payment payment = paymentService.queryById(id);
log.info("***************查询成功*********"+payment);
if(payment!=null){
return new CommonResult(200,"查询成功",payment);
}else{
return new CommonResult(444,"查询失败",null);
}
}
}
springcloud搭建
需积分: 8 162 浏览量
2022-07-21
16:49:57
上传
评论
收藏 29KB RAR 举报
埃罗芒
- 粉丝: 1
- 资源: 1
评论0