| 57 | | 使用: |
| 58 | | * 在使用的地方包装自己的VO。。。 |
| 59 | | {{{ |
| 60 | | public List genVisitCountWEB(List from,int defaultPercent) |
| 61 | | public List genVisitCountWEB(long[] from,int defaultPercent) |
| 62 | | }}} |
| 63 | | |
| 64 | | * 不需要眼花缭乱地传参数,各种条件自由组合,有需要才加参数,处理的时候不需要每个参数判断是否存在。。。 |
| 65 | | {{{ |
| 66 | | ProductTypeSqlBuilder productTypeSqlBuilder = new ProductTypeSqlBuilder(); |
| 67 | | |
| 68 | | productTypeSqlBuilder |
| 69 | | .setBrand(123) |
| 70 | | .setProductPriceBetween(1000, 2000)//全国价区间 |
| 71 | | .setSmallType(456) |
| 72 | | .orderByLastCount() |
| 73 | | .page(0,100); |
| 74 | | |
| 75 | | long[] productIds = execQuery(productTypeSqlBuilder.getSqlBuilder().getSql, |
| 76 | | productTypeSqlBuilder.getSqlBuilder().getValues()); |
| 77 | | |
| 78 | | return filterAdIds(filterBrandIds(productIds, bandBrandIds), |
| 79 | | fixedIds, sequenceIds); |
| 80 | | }}} |
| 81 | | |
| 82 | | ---- |
| 83 | | 以上方式经过实践发现设计有问题: |
| 84 | | 1. 不应用继承关系,父类builder返回的实例不通用 |
| 85 | | 2. 不同domain组合后会导致太多类,封装过度 |
| 86 | | |
| 87 | | 后续思路: |