Example #1
0
 @Override
 public List<AutoWidgetType> getAutoWidgetTypes(
     int typeId, int brandId, int volumeId, int yearId) {
   AutoWidgetTypeExample example = new AutoWidgetTypeExample();
   example
       .createCriteria()
       .andAutoyearREqualTo(yearId)
       .andAutobrandREqualTo(brandId)
       .andAutovolumeREqualTo(volumeId)
       .andAutotypeREqualTo(typeId);
   List<AutoWidgetType> list = autoWidgetTypeMapper.selectByExample(example);
   return list;
 }
Example #2
0
  @Override
  public List<UIWidgetType> listAutoWidgetTypes(int sStatus, Boolean hot, boolean face) {

    List<UIWidgetType> ret = new ArrayList<UIWidgetType>();

    AutoWidgetTypeExample query = new AutoWidgetTypeExample();
    Criteria criteria1 = query.createCriteria();
    criteria1.andSStatusEqualTo(sStatus).andFaceEqualTo(face);
    if (hot != null) {
      criteria1.andHotEqualTo(hot);
    }
    List<AutoWidgetType> list = autoWidgetTypeMapper.selectByExample(query);
    for (AutoWidgetType type : list) {
      String _type = type.getName();

      // =============AutoWidgetAbs===========
      AutoWidgetAbsExample example = new AutoWidgetAbsExample();
      AutoWidgetAbsExample.Criteria criteria2 = example.createCriteria();
      criteria2.andFaceEqualTo(face);
      if (hot != null) {
        criteria2.andHotEqualTo(hot);
      }
      criteria2.andWidgetTypeEqualTo(type.getId());

      List<AutoWidgetAbs> autoWidgets = autoWidgetAbsMapper.selectByExample(example);
      List<UIWidget> _uiWidgets = new ArrayList<UIWidget>(autoWidgets.size());
      for (AutoWidgetAbs awAbs : autoWidgets) {
        _uiWidgets.add(new UIWidget(awAbs));
      }

      UIWidgetType e = new UIWidgetType(_type, _uiWidgets);
      e.setsStatus(type.getsStatus());
      ret.add(e);
    }
    return ret;
  }