package com.yihu.hos.system.dao; import com.yihu.hos.system.dao.intf.IAppServiceDao; import com.yihu.hos.web.framework.dao.SQLGeneralDAO; import com.yihu.hos.web.framework.model.Result; import org.springframework.stereotype.Repository; import org.springframework.util.StringUtils; import java.util.Map; /** * @author HZY * @vsrsion 1.0 * Created at 2016/8/16. */ @Repository("appServiceDao") public class AppServiceDao extends SQLGeneralDAO implements IAppServiceDao { public static final String BEAN_ID = "appServiceDao"; @Override public Result getAppServiceList(Map params) throws Exception { StringBuilder sb = new StringBuilder("from SystemServiceEndpoint t where 1=1 "); if (!StringUtils.isEmpty(params.get("valid"))) //是否有效 { sb.append(" and t.valid = '" + params.get("valid") + "'"); } Object name = params.get("name"); Object appId = params.get("appId"); if (!StringUtils.isEmpty(appId)) { sb.append(" and t.appId='"+ appId+ "'"); } if (!StringUtils.isEmpty(name)) { sb.append(" and (t.name like '%" + name + "%' or t.code like '%" + name + "%')"); } sb.append(" order by t.createDate desc"); return super.getDataGridResult(sb.toString(), Integer.valueOf(params.get("page").toString()), Integer.valueOf(params.get("rows").toString())); } }