public IApp findByVendor() throws Exception { StringBuffer sql = new StringBuffer(); sql.append("select * from app"); sql.append(" where isdeleted=?isdeleted"); sql.append(" and comcode=?comcode"); sql.append(" order by appid desc"); IApp findListings = (IApp) Database.sql(IApp.class, sql.toString()); findListings.setComcode(this.getComcode()); findListings.setIsDeleted(false); findListings.select(); return findListings; }
public IApp findNewApps() throws Exception { StringBuffer sql = new StringBuffer(); sql.append( "select app.*, comtable.comname, comtable.description, comtable.repmail from app, comtable"); sql.append(" where app.comcode = comtable.comcode"); sql.append(" and status=?status"); sql.append(" and app.isdeleted=?isdeleted"); sql.append( " and DATE_FORMAT(createdate,'%Y-%m-%d') between DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY) and CURRENT_DATE"); // from 15days ago IApp findListing = (IApp) Database.sql(IApp.class, sql.toString()); findListing.setStatus(STATUS_PUBLISHED); findListing.setIsDeleted(false); findListing.select(); return findListing; }
public static IApp findApp(String categoryId, String keyword) throws Exception { StringBuffer sql = new StringBuffer(); sql.append("select * from app"); sql.append(" where status=?status"); sql.append(" and isdeleted=?isdeleted"); if (categoryId != null && !categoryId.equals("0")) sql.append(" and categoryId=?categoryId"); if (keyword != null) sql.append(" and appName like ?AppName"); IApp findListing = (IApp) Database.sql(IApp.class, sql.toString()); findListing.set("categoryId", categoryId); findListing.setAppName("%" + keyword + "%"); findListing.setStatus(STATUS_PUBLISHED); findListing.setIsDeleted(false); findListing.select(); return findListing; }