2024年3月25日发(作者:)

一、后台数据库操作方法(private端):

1.以下为后台查询方法

BaseDAOdao = new BaseDAO();//只能在private端使用

String querySql="select * from demo_quotation where dr = 0";//完整正确的sql语

Object result1 = eQuery("select vbillcode from demo_quotation where

pk_salequotation='某个主键'", new ColumnProcessor());//查询语句只能返回一行一列

结果

List result2 = (List) eQuery(querySql, new

ArrayListProcessor());//查询语句可以返回多行多列

//for(Object[] obj : result2){ obj[0]...obj[n]}

Map result3 = (Map) eQuery("select *

from demo_quotation where pk_salequotation='某个主键'", new

MapProcessor());//查询语句只返回一行结果

List> result4 = (List>)

eQuery(querySql, new MapListProcessor());//查询语句可以返回多行结果

//for(Map map : result4){("字段名")}

QuotationHVO result5 = (QuotationHVO) eQuery("select * from

demo_quotation where pk_salequotation='某个主键'", new

BeanProcessor());//查询语句只返回一个VO

List result6 = (List)

eQuery(querySql,newBeanListProcessor());//查询语

句返回多个VO

Set result =

(Set) eQuery(sql, new BaseProcessor() {

private static final long serialVersionUID = 1L;

@Override

public Object processResultSet(ResultSetrs) throws SQLException {

Set result = new HashSet();

String cproductid = null;

while (()) {

cproductid = ing("cproductid");

(cproductid);

}

return result;

}

});

return result;

}

2.以下为新增更新删除方法(手写sql)

eUpdate("sql");

二、前台数据库操作方法(client端):

IUAPQueryBSbs = tance().lookup();

eQuery(sql, processor);//processor跟第一点的basedao用法一致

三、

//后台通过主表主键查询aggvo

BillQuery query = new

BillQuery<>();

query .query(keys);

//前台通过主表主键查询aggvo

HYPubBO_illVOByPrimaryKey(class, hids)

//或者前后台都能用

IBillQueryServicebillQuery =

tance().lookup();

以下例子可以防SQL注入(前后台都有个SQLParameter 参数能使用)

StringBuildersql = new StringBuilder();

("select * from esoc_dispatchrecgoods ")

.append(" where dispatchnoteid=?").append(" and dr=?");

SQLParameterparam = new SQLParameter();

am(pk_dispatchnoteid);

am(0);

ListdrgvoList = (List) dao

.executeQuery(ng(), param, new BeanListProcessor(

));

//

ass);

//

//

//

//

//

EvaObjectVOgroupVO = (EvaObjectVO)eQuery("select

List> lists = (List

new BeanProcessor());

* from pe_eva_object where PK_SCH_EVA='1001AA1000000007ROOO'",

List list_scy = (List)eQuery(sql, new

((Object[])list_(0))[3].toString();

ArrayListProcessor());

IUAPQueryBSqueryBS =

(IUAPQueryBS)tance().lookup(

BillQuery query;

query = new BillQuery();

bills = (pks);

Object>>) eQuery(ng(), new MapListProcessor());