package com.transaction_.dao.impl;

import com.transaction_.dao.AccountDao;
import com.transaction_.entity.AccountEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AccountDaoImpl implements AccountDao {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public int saveAccount(AccountEntity accountEntity) {
        String addsql = "insert into account(user_name,balance) values(?,?)";
        Object[] args = {accountEntity.getUserName(),accountEntity.getBalance()};
        return jdbcTemplate.update(addsql,args);
        //返回值update代表添加了几行
    }
}
