123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.lsw.model;
- import com.jfinal.kit.StrKit;
- import com.jfinal.plugin.activerecord.Page;
- import com.lsw.model.base.BaseApply;
- import java.util.List;
- /**
- * Generated by JFinal.
- */
- @SuppressWarnings("serial")
- public class Apply extends BaseApply<Apply> {
- public static final Apply dao = new Apply().dao();
- public Page<Apply> jsonList(int page, int row, String name, String sidx, String sord) {
- String select = "SELECT a.*,p.name AS processName,u.realName";
- StringBuilder sb = new StringBuilder();
- sb.append(" FROM tb_apply a");
- sb.append(" LEFT JOIN tb_process p ON p.id=a.processId");
- sb.append(" LEFT JOIN sys_user u ON u.id=a.userId");
- sb.append(" WHERE 1=1");
- if (StrKit.notBlank(name)) {
- sb.append(" AND a.name like '%" + name + "%'");
- }
- sb.append(" ORDER BY a." + sidx + " " + sord);
- return dao.paginate(page, row, select, sb.toString());
- }
- public List<Apply> jsonList(int userId,String name) {
- StringBuilder sb = new StringBuilder();
- sb.append(" SELECT a.*,p.name AS processName,u.realName");
- sb.append(" FROM tb_apply a");
- sb.append(" LEFT JOIN tb_process p ON p.id=a.processId");
- sb.append(" LEFT JOIN sys_user u ON u.id=a.userId");
- sb.append(" WHERE 1=1");
- if (StrKit.notBlank(name)) {
- sb.append(" AND a.name like '%" + name + "%'");
- }
- sb.append(" AND u.id="+userId);
- sb.append(" ORDER BY a.mDate desc");
- return dao.find(sb.toString());
- }
- public List<Apply> jsonList() {
- StringBuilder sb = new StringBuilder();
- sb.append(" SELECT a.*,p.name AS processName,u.realName");
- sb.append(" FROM tb_apply a");
- sb.append(" LEFT JOIN tb_process p ON p.id=a.processId");
- sb.append(" LEFT JOIN sys_user u ON u.id=a.userId");
- sb.append(" ORDER BY a.id DESC");
- return dao.find(sb.toString());
- }
- public Apply selectById(int id) {
- StringBuilder sb = new StringBuilder();
- sb.append(" SELECT a.*,p.name AS processName,u.realName");
- sb.append(" FROM tb_apply a");
- sb.append(" LEFT JOIN tb_process p ON p.id=a.processId");
- sb.append(" LEFT JOIN sys_user u ON u.id=a.userId");
- sb.append(" WHERE a.id=?");
- return dao.findFirst(sb.toString(), id);
- }
- }
|