/** * 按图片类型查询图片信息 * * @param String * @return List<LEDPicSchema> */ public List<LEDPicSchema> find(String typeCode) { List<LEDPicSchema> listLEDPicSchema = new ArrayList<LEDPicSchema>(); ExeSQL mExeSQL = new ExeSQL(); String sql = "select * from ledpic where typecode=? "; String[] param1 = {"String", typeCode}; ArrayList<String[]> sqlParamList = new ArrayList<String[]>(); sqlParamList.add(param1); SSRS tSSRS = mExeSQL.execSQL(sql, sqlParamList); if (tSSRS != null || tSSRS.MaxRow > 0) { for (int i = 1; i <= tSSRS.MaxRow; i++) { LEDPicSchema tLEDPicSchema = new LEDPicSchema(); tLEDPicSchema.setPicCode(tSSRS.getRowData(i)[0]); tLEDPicSchema.setName(tSSRS.getRowData(i)[1]); tLEDPicSchema.setTypecode(tSSRS.getRowData(i)[2]); tLEDPicSchema.setUseFlag(tSSRS.getRowData(i)[3]); tLEDPicSchema.setField1(tSSRS.getRowData(i)[4]); tLEDPicSchema.setField2(tSSRS.getRowData(i)[5]); tLEDPicSchema.setField3(tSSRS.getRowData(i)[6]); tLEDPicSchema.setMakeDate(tSSRS.getRowData(i)[7]); tLEDPicSchema.setMakeTime(tSSRS.getRowData(i)[8]); listLEDPicSchema.add(tLEDPicSchema); } return listLEDPicSchema; } return null; }
/** 刪除对应类型所有图片 此方法先把对应类型的所有的图片名称拿出来, 返回给上一层以备删除文件目录中的图片文件之用, 然后再删除所有图片的数据库中的信息 */ public List<String> deletePicsByType(String typecode) { List<String> picNames = new ArrayList<String>(); String sql = "select name from ledpic where typecode=? "; String[] param1 = {"String", typecode}; ArrayList<String[]> sqlParamList = new ArrayList<String[]>(); sqlParamList.add(param1); ExeSQL mExeSQL = new ExeSQL(); SSRS tSSRS = mExeSQL.execSQL(sql, sqlParamList); for (int i = 1; i <= tSSRS.MaxRow; i++) { System.out.println(tSSRS.getRowData(i)[0]); picNames.add(tSSRS.getRowData(i)[0]); } sql = "delete from ledpic where typecode=? "; mExeSQL.execUpdateSQL(sql, sqlParamList); return picNames; }