StdLayoutDao.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package cn.hmsoft.mr.data.dao.std;
  2. import cn.hmsoft.jdbc.entity.Pager;
  3. import cn.hmsoft.helper.StringHelper;
  4. import cn.hmsoft.jdbc.entity.QueryOrder;
  5. import org.springframework.stereotype.Repository;
  6. import cn.hmsoft.jdbc.core.PlatformDaoSupport;
  7. import cn.hmsoft.mr.data.model.std.StdLayout;
  8. /**
  9. * 数据库处理.
  10. *
  11. * @author: shudonghui
  12. * @date: 2023-07-19 13:44:53
  13. * @version: 1.0
  14. * @email: shudonghui@qmth.com.cn
  15. * @Company: www.hmsoft.cn
  16. */
  17. @Repository
  18. public class StdLayoutDao extends PlatformDaoSupport<StdLayout> {
  19. /**
  20. * 构建QueryOrder(order,type)过滤.
  21. *
  22. * @param query
  23. * @param start
  24. * @param limit
  25. * @param queryOrder
  26. * @param school_id
  27. * @param batch_id
  28. * @return
  29. */
  30. public Pager page(String query, Integer start, Integer limit, QueryOrder queryOrder, Integer school_id, Integer batch_id) {
  31. String sql = "select * from std_layout where 1=1 ";
  32. // if (StringHelper.isEmpty(query)) {
  33. // return this.pageMapBySql(queryOrder, start, limit, sql);
  34. // } else {
  35. // return this.pageMapBySql(queryOrder, start, limit,
  36. // sql + "where 1 like ?", generateLikeParamter(query));
  37. // }
  38. if (school_id != null) {
  39. sql += " and school_id=" + school_id;
  40. }
  41. if (batch_id != null) {
  42. sql += " and batch_id=" + batch_id;
  43. }
  44. if (!StringHelper.isEmpty(query)) {
  45. sql += " and (std_no like ? ) ";
  46. String value = this.generateLikeParamter(query.trim());
  47. return this.pageMapBySql(queryOrder, start, limit, sql.toString(), value);
  48. } else {
  49. return super.pageMapBySql(queryOrder, start, limit, sql.toString());
  50. }
  51. }
  52. }