pull/1/head
rekoe 2016-03-22 18:37:34 +08:00
parent 4baadb1e6c
commit 9b8ccd23e4
4 changed files with 107 additions and 7 deletions

View File

@ -1,7 +1,11 @@
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;
import org.nutz.dao.entity.annotation.Table;
import org.nutz.dao.entity.annotation.TableIndexes;
@ -12,7 +16,7 @@ import org.nutz.dao.entity.annotation.TableIndexes;
@Table("pj_usr")
@PK({ "usr", "pj" })
@TableIndexes({ @Index(name = "FK_Reference_5", fields = { "pj" }, unique = false) })
public class PjUsr extends Usr {
public class PjUsr implements Serializable {
/**
*
*/
@ -23,6 +27,98 @@ public class PjUsr extends Usr {
@Column
private String pj;
/**
* ID
*/
@Name
private String usr;
/**
*
*/
@Comment
private String name;
/**
* ()
*/
@Comment
private String psw;
/**
*
*/
@Comment
private String role;
@Comment
private String email;
/**
* @return ID
*/
public String getUsr() {
return usr;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
/**
* @param usr
* ID
*/
public void setUsr(String usr) {
this.usr = usr;
}
/**
* @return
*/
public String getName() {
return name;
}
/**
* @param name
*
*/
public void setName(String name) {
this.name = name;
}
/**
* @return ()
*/
public String getPsw() {
return psw;
}
/**
* @param psw
* ()
*/
public void setPsw(String psw) {
this.psw = psw;
}
/**
* @return
*/
public String getRole() {
return role;
}
/**
* @param role
*
*/
public void setRole(String role) {
this.role = role;
}
/**
* @return ID
*/

View File

@ -30,6 +30,7 @@ public class ChangePackage {
public void visit(File file) {
if (file.isDirectory())
return;
System.out.println(file);
String origin = Files.read(file);
String output = origin.replaceAll("WenQuanYi Micro Hei.ttf", "FZY4JW_0.ttf");
if (origin.equals(output))

View File

@ -18,6 +18,7 @@ import org.nutz.ioc.loader.annotation.IocBean;
import com.rekoe.domain.Pj;
import com.rekoe.domain.PjAuth;
import com.rekoe.domain.PjGrAuth;
import com.rekoe.utils.Constants;
/**
@ -283,9 +284,11 @@ public class ProjectAuthService extends BaseService<PjAuth> {
*/
public void saveByGr(PjAuth pjAuth) {
if (this.getByGr(pjAuth.getPj(), pjAuth.getGr(), pjAuth.getRes()) == null) {
dao().insert(pjAuth);
Sql sql = Sqls.create("insert into pj_gr_auth (pj,gr,res,rw) values (@pj,@gr,@res,@rw)");
sql.setParam("pj", pjAuth.getPj()).setParam("gr", pjAuth.getGr()).setParam("res", pjAuth.getRes()).setParam("rw", pjAuth.getRw());
dao().execute(sql);
} else {
dao().update(getEntityClass(), Chain.make("rw", pjAuth.getRw()), Cnd.where("pj", "=", pjAuth.getPj()).and("gr", "=", pjAuth.getGr()).and("res", "=", pjAuth.getRes()));
dao().update(PjGrAuth.class, Chain.make("rw", pjAuth.getRw()), Cnd.where("pj", "=", pjAuth.getPj()).and("gr", "=", pjAuth.getGr()).and("res", "=", pjAuth.getRes()));
}
}

View File

@ -33,8 +33,8 @@ public class UsrService extends BaseService<Usr> {
* @return (*)
*/
public List<Usr> getList(String pj) {
Sql sql = Sqls.create("select p.usr,p.name,p.role,CASE WHEN pu.psw IS NOT NULL THEN pu.psw ELSE p.psw END psw from (" + " select a.usr,a.role,a.psw,a.name from usr a " + " where " + " exists (select d.usr from pj_gr_usr d where d.usr=a.usr and d.pj=$pj) " + " or exists(select c.usr from pj_usr_auth c where a.usr=c.usr and c.pj=$pj) " + " ) p " + " left join pj_usr pu on (p.usr=pu.usr and pu.pj=$pj) where p.usr <> '*'" + " order by p.usr ");
sql.setVar("pj", pj);
Sql sql = Sqls.create("select p.usr,p.name,p.role,CASE WHEN pu.psw IS NOT NULL THEN pu.psw ELSE p.psw END psw from (" + " select a.usr,a.role,a.psw,a.name from usr a " + " where " + " exists (select d.usr from pj_gr_usr d where d.usr=a.usr and d.pj=@pj) " + " or exists(select c.usr from pj_usr_auth c where a.usr=c.usr and c.pj=@pj) " + " ) p " + " left join pj_usr pu on (p.usr=pu.usr and pu.pj=@pj) where p.usr <> '*'" + " order by p.usr ");
sql.setParam("pj", pj);
final List<Usr> list = new ArrayList<Usr>();
sql.setCallback(new SqlCallback() {
@ -60,8 +60,8 @@ public class UsrService extends BaseService<Usr> {
}
public List<Usr> getListByRootPath(String rootPath) {
Sql sql = Sqls.create("select p.usr,p.name,p.role,CASE WHEN pu.psw IS NOT NULL THEN pu.psw ELSE p.psw END psw from (" + " select a.usr,a.role,a.psw,a.name from usr a " + " where " + " exists (select d.usr from pj_gr_usr d where d.usr=a.usr and d.pj in (select distinct pj from pj where type=$type and path like $like)) " + " or exists(select c.usr from pj_usr_auth c where a.usr=c.usr and c.pj in (select distinct pj from pj where type=$type and path like $like)) " + " ) p " + " left join pj_usr pu on (p.usr=pu.usr) where p.usr <> '*'" + " order by p.usr ");
sql.setVar("like", rootPath + "%").setVar("type", com.rekoe.utils.Constants.HTTP_MUTIL);
Sql sql = Sqls.create("select p.usr,p.name,p.role,CASE WHEN pu.psw IS NOT NULL THEN pu.psw ELSE p.psw END psw from (" + " select a.usr,a.role,a.psw,a.name from usr a " + " where " + " exists (select d.usr from pj_gr_usr d where d.usr=a.usr and d.pj in (select distinct pj from pj where type=@type and path like @like)) " + " or exists(select c.usr from pj_usr_auth c where a.usr=c.usr and c.pj in (select distinct pj from pj where type=@type and path like @like)) " + " ) p " + " left join pj_usr pu on (p.usr=pu.usr) where p.usr <> '*'" + " order by p.usr ");
sql.setParam("like", rootPath + "%").setParam("type", com.rekoe.utils.Constants.HTTP_MUTIL);
final List<Usr> list = new ArrayList<Usr>();
sql.setCallback(new SqlCallback() {