接口
package cn. csy. account. service;
import java. math. BigDecimal;
public interface AccountService {
public void transBalance ( Long from, Long to, BigDecimal balance) ;
}
使用注解的方式
实现类
import cn. csy. account. mapper. AccountMapper;
import cn. csy. account. service. AccountService;
import org. springframework. beans. factory. annotation. Autowired;
import org. springframework. stereotype. Service;
import org. springframework. transaction. annotation. Propagation;
import org. springframework. transaction. annotation. Transactional;
import java. math. BigDecimal;
@Service
@Transactional ( propagation = Propagation. REQUIRED)
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountMapper accountMapper;
@Override
public void transBalance ( Long from, Long to, BigDecimal balance) {
accountMapper.