commit
This commit is contained in:
+24
-5
@@ -2,8 +2,12 @@ package io.v.nutz.wakershome.controller.review;
|
||||
|
||||
import io.v.nutz.annontation.ViReturn;
|
||||
import io.v.nutz.modules.models.PageForm;
|
||||
import io.v.nutz.wakershome.model.review.CommentPeo;
|
||||
import io.v.nutz.wakershome.service.review.CommentZbService;
|
||||
import io.v.nutz.web.commons.utils.ShiroUtil;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
@@ -30,28 +34,43 @@ public class WakesHomeReviewController {
|
||||
|
||||
@At("")
|
||||
@Ok("beetl:/platform/wakeshome/review/doReview.html")
|
||||
// @RequiresPermissions("wakeshome.review.doReview")
|
||||
public void index() {
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
// @RequiresPermissions("wakeshome.review.doReview")
|
||||
public Object pageData(PageForm pageForm,
|
||||
@Param(value = "annual", required = false) String annual,
|
||||
@Param(value = "assessment", required = false) String assessment){
|
||||
Sql sql = Sqls.create("SELECT * FROM `comment_zb` $condition");
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
zb.* ,
|
||||
if((select count(1) from comment_peo peo where peo.zbId = zb.id and peo.userId = @userId) > 0,true,false) as isReview
|
||||
FROM
|
||||
`comment_zb` zb
|
||||
$condition
|
||||
""").setParam("userId",ShiroUtil.getUserId());
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(annual) && Strings.isNotBlank(annual)) {
|
||||
cnd.and("annual", "=", annual);
|
||||
cnd.and("zb.annual", "=", annual);
|
||||
}
|
||||
if (Strings.isNotBlank(assessment) && Strings.isNotBlank(assessment)) {
|
||||
cnd.where().andLike("assessment", assessment);
|
||||
cnd.where().andLike("zb.assessment", assessment);
|
||||
} else {
|
||||
cnd.desc("annual");
|
||||
cnd.desc("zb.annual");
|
||||
}
|
||||
sql.setCondition(cnd);
|
||||
return commentZbService.listPageMap(pageForm.getPageNumber(), pageForm.getPageSize(), sql);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
// @RequiresPermissions("wakeshome.review.doReview")
|
||||
public Object getPeoId(String id){
|
||||
CommentPeo peo = commentZbService.dao().fetch(CommentPeo.class, Cnd.where("zbId", "=", id).and("userId", "=", ShiroUtil.getUserId()));
|
||||
return peo.getId();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user