由于功能的需求是需要把两张表的数据结合起来,然后再同一个表格展示 。所以屡一下思路就是先声明一个同类型的空的list做最后输出给表格的list,再声明两个list集合,方别对应一张表,然后把数据查出来,遍历list,把数据一条一条的添加到需要展示的list里面。
利用as Name来把他们的字段名称统一。
//第一张表的sql语句
private String TJXM = "select a.BodyCheckItemName as Name,a.BodyCheckItemNum as Code, CureItemsPrice as JG,OrTreatment "+
" from SYS_BodyCheckItem a, SYS_ItemCommon b where a.ItemCommonID = b.ItemCommonID and BodyCheckItemID = ?"+
" order by a.BodyCheckItemID desc offset (?-1)*? row fetch next ? row only";
//第二表的sql语句
private String TJTC = "Select BCheckComboName as Name,ComboNum as Code,CashSum as JG from SYS_BodyCheckCombo where BCheckComboID = ?"+
" order by BCheckComboID desc offset (?-1)*? row fetch next ? row only";
private String SQL2 = "select * from PW_Recipe a ,PW_A