image.png
    接口:

    1. package com.wzy.springcloud.service;
    2. import com.wzy.springcloud.Entities.Payment;
    3. import com.wzy.springcloud.dao.PaymentDao;
    4. import org.apache.ibatis.annotations.Mapper;
    5. import org.apache.ibatis.annotations.Param;
    6. import org.springframework.stereotype.Service;
    7. import javax.annotation.Resource;
    8. @Mapper
    9. public interface PaymentService {
    10. public int create(Payment payment);
    11. public Payment getPaymentById(@Param("id") Long id);
    12. }

    实现类:

    1. package com.wzy.springcloud.service.impl;
    2. import com.wzy.springcloud.Entities.Payment;
    3. import com.wzy.springcloud.dao.PaymentDao;
    4. import com.wzy.springcloud.service.PaymentService;
    5. import org.springframework.stereotype.Service;
    6. import javax.annotation.Resource;
    7. @Service
    8. public class PaymentServiceImpl implements PaymentService {
    9. @Resource
    10. private PaymentDao paymentDao;
    11. public int create(Payment payment){
    12. return paymentDao.create(payment);
    13. }
    14. public Payment getPaymentById(Long id){
    15. return paymentDao.getPaymentById(id);
    16. }
    17. }