权限设置

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

View File

@ -4,7 +4,6 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions; 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.Inject;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At; 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) { 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("pj", pj);
req.setAttribute("gr", gr); req.setAttribute("gr", gr);
return projectGroupUsrService.getObjListByPager(page, 20, Cnd.where("pj", "=", pj).and("gr", "=", gr)); return projectGroupUsrService.getList(pj, gr, page);
} }
@Inject @Inject

View File

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

View File

@ -9,10 +9,13 @@ import java.util.List;
import org.nutz.dao.Cnd; import org.nutz.dao.Cnd;
import org.nutz.dao.Dao; import org.nutz.dao.Dao;
import org.nutz.dao.Sqls; import org.nutz.dao.Sqls;
import org.nutz.dao.pager.Pager;
import org.nutz.dao.sql.Sql; import org.nutz.dao.sql.Sql;
import org.nutz.dao.sql.SqlCallback; import org.nutz.dao.sql.SqlCallback;
import org.nutz.dao.util.Daos;
import org.nutz.ioc.loader.annotation.IocBean; import org.nutz.ioc.loader.annotation.IocBean;
import com.rekoe.common.page.Pagination;
import com.rekoe.domain.PjGrUsr; import com.rekoe.domain.PjGrUsr;
import com.rekoe.utils.Constants; import com.rekoe.utils.Constants;
@ -62,9 +65,11 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
* *
* @return * @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 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.setParam("pj", pj).setParam("gr", gr);
sql.setPager(pager);
final List<PjGrUsr> list = new ArrayList<PjGrUsr>(); final List<PjGrUsr> list = new ArrayList<PjGrUsr>();
sql.setCallback(new SqlCallback() { sql.setCallback(new SqlCallback() {
@ -76,8 +81,10 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
return list; return list;
} }
}); });
Long counts = Daos.queryCount(dao(), sql.getSourceSql());
pager.setRecordCount(Integer.parseInt(counts.toString()));
dao().execute(sql); dao().execute(sql);
return list; return new Pagination(page, 20, pager.getRecordCount(), list);
} }
/** /**