public static Msg<List<Addresslibrary>> getAddress(Context context, String userid, Integer type) { DSLContext dSLContext = context.getJc().getDefaultClient().getContext(); Msg<List<Addresslibrary>> msg = new Msg<List<Addresslibrary>>(); List<Addresslibrary> al = dSLContext .select() .from(ADDRESSLIBRARY) .where( ADDRESSLIBRARY .USERID .eq(userid) .and(ADDRESSLIBRARY.TYPE.eq(type)) .and(ADDRESSLIBRARY.ISDEL.eq(0).or(ADDRESSLIBRARY.ISDEL.isNull()))) .orderBy(ADDRESSLIBRARY.TEL.asc()) .fetchInto(Addresslibrary.class); if (al.size() >= 1) { msg.setResult(true); msg.setValue(al); } else { msg.setResult(false); } return msg; }
public static Msg<Addresslibrary> getDefaultSender( Context context, String userid, Integer isdefault) { DSLContext dSLContext = context.getJc().getDefaultClient().getContext(); Msg<Addresslibrary> msg = new Msg<Addresslibrary>(); List<Addresslibrary> al = dSLContext .select() .from(ADDRESSLIBRARY) .where( ADDRESSLIBRARY .USERID .eq(userid) .and(ADDRESSLIBRARY.TYPE.eq(1)) .and(ADDRESSLIBRARY.ISDEFAULT.eq(1)) .and(ADDRESSLIBRARY.ISDEL.eq(0))) .fetchInto(Addresslibrary.class); if (al.size() >= 1) { msg.setResult(true); msg.setValue(al.get(0)); } else { msg.setResult(false); } return msg; }