权限设置

pull/3/head
rekoe 2016-04-27 16:07:47 +08:00
parent 974f158069
commit 4f819b33f9
4 changed files with 12 additions and 5 deletions

View File

@ -137,7 +137,6 @@ public class AdminProjectAct extends BaseAction {
entity.setPj(pj);
entity.setRes("");
entity.setRw("");
req.setAttribute("entity", entity);
}
if (StringUtils.isBlank(res)) {
String path = req.getParameter("path");
@ -156,6 +155,7 @@ public class AdminProjectAct extends BaseAction {
req.setAttribute("pjreslist", projectAuthService.getResList(pj));
req.setAttribute("pjgrlist", projectGroupService.getList(pj));
req.setAttribute("usrList", usrService.getList());
req.setAttribute("entity", entity);
return pj;
}

View File

@ -4,7 +4,6 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.nutz.dao.Cnd;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
@ -37,7 +36,7 @@ public class AdminProjectGroupUsrAct extends BaseAction {
public Pagination list(@Param(value = "pageNumber", df = "1") int page, @Param("pj") String pj, @Param("gr") String gr, HttpServletRequest req) {
req.setAttribute("pj", pj);
req.setAttribute("gr", gr);
return projectGroupUsrService.getObjListByPager(page, 20, Cnd.where("pj", "=", pj).and("gr", "=", gr));
return projectGroupUsrService.getList(pj, gr, page);
}
@Inject

View File

@ -89,6 +89,7 @@ public class ProjectAuthService extends BaseService<PjAuth> {
return list;
}
});
dao().execute(sql);
return list;
}

View File

@ -9,10 +9,13 @@ import java.util.List;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.dao.Sqls;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.IocBean;
import com.rekoe.common.page.Pagination;
import com.rekoe.domain.PjGrUsr;
import com.rekoe.utils.Constants;
@ -62,9 +65,11 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
*
* @return
*/
public List<PjGrUsr> getList(String pj, String gr) {
public Pagination getList(String pj, String gr, int page) {
Pager pager = dao().createPager(page, 20);
Sql sql = Sqls.create("select a.pj,a.usr,a.gr,b.name as usrname from pj_gr_usr a left join usr b on (a.usr = b.usr) where a.pj=@pj and a.gr=@gr order by a.usr");
sql.setParam("pj", pj).setParam("gr", gr);
sql.setPager(pager);
final List<PjGrUsr> list = new ArrayList<PjGrUsr>();
sql.setCallback(new SqlCallback() {
@ -76,8 +81,10 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
return list;
}
});
Long counts = Daos.queryCount(dao(), sql.getSourceSql());
pager.setRecordCount(Integer.parseInt(counts.toString()));
dao().execute(sql);
return list;
return new Pagination(page, 20, pager.getRecordCount(), list);
}
/**