Ejemplo n.º 1
0
  @Override
  public List<Item> listWithSkuByOrder(long orderId) {
    String exp =
        "select i.id as 'i.id', i.sku_id as 'i.sku_id', i.sku_more_id as 'i.sku_more_id'\n"
            + "     , i.dprice as 'i.dprice', i.dcount as 'i.dcount', i.payment as 'i.payment'\n"
            + "     , i.return_time as 'i.return_time', i.return_reason as 'i.return_reason'"
            + "     , i.return_desc as 'i.return_desc'\n"
            + "     , i.state as 'i.state', i.order_id as 'i.order_id'\n"
            + "     , g.cate_code as 's.cate_code', g.gname as 's.gname', sku.img as 's.img'\n"
            + "     , sku.model as 's.model', sku.sprice as 's.sprice', sm.size as 's.size'\n"
            + "from t_item i\n"
            + "inner join t_sku sku on sku.id = i.sku_id\n"
            + "inner join t_sku_more sm on sm.id = i.sku_more_id\n"
            + "inner join t_goods g on g.id = sku.goods_id\n"
            + "where i.order_id = @orderId";

    Sql sql = Sqls.queryRecord(exp);
    sql.params().set("orderId", orderId);

    dao.execute(sql);
    List<Record> list = sql.getList(Record.class);
    List<Item> itemList = new ArrayList<Item>();
    for (Record re : list) {
      Item item = re.toEntity(dao.getEntity(Item.class), "i.");
      Sku4Item skuInfo = re.toEntity(dao.getEntity(Sku4Item.class), "s.");
      item.setSku(skuInfo);
      itemList.add(item);
    }

    return itemList;
  }
Ejemplo n.º 2
0
 /**
  * 用没有处理过的Nutz.sql带分页
  *
  * @param dao
  * @param s
  * @param page
  * @param size
  * @return
  */
 public static Record getRecordsByNutSql(Dao dao, Sql s, int page, int size) {
   int total = getRecordSize(dao, s.toString());
   s.setCallback(Sqls.callback.entities());
   s.setPager(dao.createPager(page, size));
   s.setEntity(dao.getEntity(Record.class));
   dao.execute(s);
   Record rd = new Record();
   List<Record> records = s.getList(Record.class);
   rd.put("total", total);
   rd.put("rows", records);
   return rd;
 }
Ejemplo n.º 3
0
 public Object invoke(Connection conn, ResultSet rs, Pojo pojo, Statement stmt)
     throws SQLException {
   if (null != rs && rs.next()) {
     return Record.create(rs);
   }
   return null;
 }
Ejemplo n.º 4
0
 private Parameter record2Object(Record rd) {
   Parameter p = new Parameter();
   p.setParameterID((Long) rd.get("parameterID"));
   p.setCreateDate((Date) rd.get("createDate"));
   p.setFmin(rd.getString("Fmin"));
   p.setM3000F(rd.getString("M3000F"));
   p.setM3000F1(rd.getString("M3000F1"));
   p.setM3000F2(rd.getString("M3000F2"));
   p.setM1500F2(rd.getString("M1500F2"));
   p.setMUF3000F1(rd.getString("MUF3000F1"));
   p.setMUF3000F2(rd.getString("MUF3000F2"));
   for (String fie : paField) {
     try {
       BeanUtils.setProperty(p, fie, rd.get(fie));
     } catch (IllegalAccessException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     } catch (InvocationTargetException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
   }
   return p;
 }