开发进度三
作者:互联网
今天完善了一下账务的信息,添加了一个备注功能
源码如下
import java.util.*; public class ItemDao extends AbstractDao { /** * 创建一条记录 * @param name 流水号 * @param amount 金额 * @param date 日期 * @param type 类型 * @param remark 备注 */ public int add(String name,String pass,int amount, String date,String type,String desc,String remark) { String sql = "insert into user_table values(null,?,?,?,?,?,?,?);"; Object[] values = {name,pass,amount,date,type,desc,remark}; int affect = dml(sql,values); return affect ; } public int modify(String date,String description, int amount,String type,String remark,int id) { int affect = 0; String sql = "update user_table set date = ?,description = ?," + "amount = ?,type = ? ,remark = ? where id = ?;"; Object[] values = { date,description,amount,type,remark,id}; affect = dml(sql,values); return affect ; } /** 删除一条记录 */ public void delete(int id) { String sql = "delete from user_table where id = ?"; Object[] values = {id}; dml(sql,values); } /** 返回一条记录 */ public Vector query(int id) { String sql = "select date,description,amount,type,remark from user_table where id = ?"; Object[] values = {id}; Vector v = queryRowData(sql,values); return v; } public Vector query_id(String d1,String user) { String sql = "select id from user_table where date like ? and name = ?"; Object[] values = {d1,user}; Vector v = queryStrData(sql,values); return v ; } public Vector[] query_data(String d1,String user) { String sql = "select * from user_table where date like ? and name = ?"; Object[] values = {d1,user}; Vector[] v = queryTabData(sql,values); return v ; } /** * 无限制选择 * @return 选择的结果集合 */ public Vector[] query_pub() { String sql = "select * from user_table"; Vector v[] = queryTabData(sql,null); return v ; } }
程序完成后运行结果如下
现在可以进行增加和删除功能,具备了记账本的基本条件。
标签:String,int,values,user,sql,开发进度,id 来源: https://www.cnblogs.com/wxy2000/p/10421089.html