public void setMoney(double money) {
this.money = money;
}
}
AccountService.java(接口)
/**
-
@author 闲言
-
@Description 业务层接口
-
@create 2021-02-03 12:12
*/
public interface AccountService {
/**
-
根据id查询
-
@param id 账户id
-
@return 账户
*/
@Select(“select * from account where id = #{id}”)
Account findById(Integer id);
/**
-
查询所有账户
-
@return 账户列表
*/
@Select("select * from account ")
List findAll();
/**
-
插入数据
-
@param account 账户
*/
@Insert(“insert into account values(#{id},#{name},#{money})”)
void insert(Account account);
}
AccountServiceImpl.java(实现类)
/**
-
@author 闲言
-
@Description 业务层实现类
-
@create 2021-02-03 12:13
*/
@Service(“accountService”)
public class AccountServiceImpl implements AccountService {
@Autowired
private AccountDao accountDao;
@Override
public Account findById(Integer id) {
return accountDao.findById(id);
}
@Override
public List findAll() {
return accountDao.findAll();
}
@Override
public void insert(Account account) {
accountDao.insert(account);
}
}
AccountDao.java(dao层接口)
/**
-
@author 闲言
-
@Description 持久层接口
-
@create 2021-02-03 12:13
*/
@Repository
public interface AccountDao {
/**
-
根据id查询
-
@par