AppServiceDao.java 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.yihu.hos.system.dao;
  2. import com.yihu.hos.system.dao.intf.IAppServiceDao;
  3. import com.yihu.hos.web.framework.dao.SQLGeneralDAO;
  4. import com.yihu.hos.web.framework.model.Result;
  5. import org.springframework.stereotype.Repository;
  6. import org.springframework.util.StringUtils;
  7. import java.util.Map;
  8. /**
  9. * @author HZY
  10. * @vsrsion 1.0
  11. * Created at 2016/8/16.
  12. */
  13. @Repository("appServiceDao")
  14. public class AppServiceDao extends SQLGeneralDAO implements IAppServiceDao {
  15. public static final String BEAN_ID = "appServiceDao";
  16. @Override
  17. public Result getAppServiceList(Map<String, Object> params) throws Exception {
  18. StringBuilder sb = new StringBuilder("from SystemServiceEndpoint t where 1=1 ");
  19. if (!StringUtils.isEmpty(params.get("valid"))) //是否有效
  20. {
  21. sb.append(" and t.valid = '" + params.get("valid") + "'");
  22. }
  23. Object name = params.get("name");
  24. Object appId = params.get("appId");
  25. if (!StringUtils.isEmpty(appId)) {
  26. sb.append(" and t.appId='"+ appId+ "'");
  27. }
  28. if (!StringUtils.isEmpty(name)) {
  29. sb.append(" and (t.name like '%" + name + "%' or t.code like '%" + name + "%')");
  30. }
  31. sb.append(" order by t.createDate desc");
  32. return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString())); }
  33. }