pull/1/head
rekoe 2016-03-22 18:50:58 +08:00
parent 9b8ccd23e4
commit 08b38ee8ce
4 changed files with 20 additions and 18 deletions

View File

@ -15,6 +15,7 @@ import org.nutz.mvc.NutConfig;
import org.nutz.mvc.Setup;
import org.nutz.plugins.view.freemarker.FreeMarkerConfigurer;
import com.rekoe.domain.PjUsr;
import com.rekoe.domain.User;
import com.rekoe.service.UserService;
@ -41,6 +42,8 @@ public class MvcSetup implements Setup {
});
ioc.get(FreeMarkerConfigurer.class, "mapTags");
Dao dao = ioc.get(Dao.class);
dao.drop(PjUsr.class);
dao.create(PjUsr.class, true);
// dao.clear(OAuthUser.class);
Daos.createTablesInPackage(dao, User.class.getPackage().getName(), false);
if (0 == dao.count(User.class)) {

View File

@ -3,7 +3,6 @@ package com.rekoe.domain;
import java.io.Serializable;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Index;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.PK;
@ -35,20 +34,20 @@ public class PjUsr implements Serializable {
/**
*
*/
@Comment
@Column
private String name;
/**
* ()
*/
@Comment
@Column
private String psw;
/**
*
*/
@Comment
@Column
private String role;
@Comment
@Column
private String email;
/**

View File

@ -2,7 +2,7 @@ package com.rekoe.domain;
import java.io.Serializable;
import org.nutz.dao.entity.annotation.Comment;
import org.nutz.dao.entity.annotation.Column;
import org.nutz.dao.entity.annotation.Name;
import org.nutz.dao.entity.annotation.Table;
@ -25,20 +25,20 @@ public class Usr implements Serializable {
/**
*
*/
@Comment
@Column
private String name;
/**
* ()
*/
@Comment
@Column
private String psw;
/**
*
*/
@Comment
@Column
private String role;
@Comment
@Column
private String email;
/**

View File

@ -39,8 +39,8 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
* @return
*/
public PjGrUsr get(String pj, String gr, String 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 and a.usr=$usr");
sql.setVar("pj", pj).setVar("gr", gr).setVar("usr", 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 and a.usr=@usr");
sql.setParam("pj", pj).setParam("gr", gr).setParam("usr", usr);
sql.setCallback(new SqlCallback() {
@Override
@ -63,8 +63,8 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
* @return
*/
public List<PjGrUsr> getList(String pj, String gr) {
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.setVar("pj", pj).setVar("gr", gr);
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);
final List<PjGrUsr> list = new ArrayList<PjGrUsr>();
sql.setCallback(new SqlCallback() {
@ -88,8 +88,8 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
* @return
*/
public List<PjGrUsr> getList(String pj) {
Sql sql = Sqls.create("select a.pj,a.gr,b.usr,c.name as usrname from pj_gr a left join pj_gr_usr b on (a.pj=b.pj and a.gr=b.gr) left join usr c on (b.usr = c.usr) where a.pj=$pj order by a.gr,b.usr");
sql.setVar("pj", pj);
Sql sql = Sqls.create("select a.pj,a.gr,b.usr,c.name as usrname from pj_gr a left join pj_gr_usr b on (a.pj=b.pj and a.gr=b.gr) left join usr c on (b.usr = c.usr) where a.pj=@pj order by a.gr,b.usr");
sql.setParam("pj", pj);
final List<PjGrUsr> list = new ArrayList<PjGrUsr>();
sql.setCallback(new SqlCallback() {
@ -113,8 +113,8 @@ public class ProjectGroupUsrService extends BaseService<PjGrUsr> {
* @return svn root
*/
public List<PjGrUsr> getListByRootPath(String rootPath) {
Sql sql = Sqls.create("select a.pj,a.gr,b.usr,c.name as usrname from pj_gr a left join pj_gr_usr b on (a.pj=b.pj and a.gr=b.gr) left join usr c on (b.usr=c.usr) " + " where a.pj in (select distinct pj from pj where type=$type and path like $like) order by a.pj,a.gr,b.usr");
sql.setVar("type", Constants.HTTP_MUTIL).setVar("like", rootPath + "%");
Sql sql = Sqls.create("select a.pj,a.gr,b.usr,c.name as usrname from pj_gr a left join pj_gr_usr b on (a.pj=b.pj and a.gr=b.gr) left join usr c on (b.usr=c.usr) " + " where a.pj in (select distinct pj from pj where type=@type and path like @like) order by a.pj,a.gr,b.usr");
sql.setParam("type", Constants.HTTP_MUTIL).setParam("like", rootPath + "%");
final List<PjGrUsr> list = new ArrayList<PjGrUsr>();
sql.setCallback(new SqlCallback() {