@Override public List<UIWidgetType> allAutoWidgets() { List<UIWidgetType> ret = new ArrayList<UIWidgetType>(); AutoWidgetTypeExample query = null; 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.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; }
@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; }
@Override public List<AutoWidgetAbs> getAutoWidgetAbss(int widgetTypeId) { AutoWidgetAbsExample example = new AutoWidgetAbsExample(); example.createCriteria().andWidgetTypeEqualTo(widgetTypeId); return autoWidgetAbsMapper.selectByExample(example); }