commit
This commit is contained in:
@@ -13,10 +13,14 @@ import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
||||
import org.nutz.dao.Chain;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.dao.util.cri.SqlExpressionGroup;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.json.Json;
|
||||
import org.nutz.lang.Lang;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.mvc.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -99,11 +103,44 @@ public class MMeetingMineController {
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object findMyMeetPeriod(@Param("meetingId") String meetingId) {
|
||||
public Object findMyMeetPeriod(@Param("meetingId") String meetingId,
|
||||
@Param("userId") String userId,
|
||||
@Param("helpLeave") Boolean helpLeave) {
|
||||
if (StrUtil.isBlank(meetingId)) {
|
||||
return Result.error("参数错误");
|
||||
}
|
||||
return meetingMineService.findMyMeetPeriod(meetingId);
|
||||
return meetingMineService.findMyMeetPeriod(meetingId, helpLeave, userId);
|
||||
}
|
||||
|
||||
@At("/searchUser")
|
||||
@Ok("json:full")
|
||||
@ViReturn
|
||||
@RequiresAuthentication
|
||||
public Object searchUser(@Param("query") String query, @Param("meetId") String meetId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
u.id,
|
||||
u.username,
|
||||
u.loginname,
|
||||
u.sex,
|
||||
u.unionname,
|
||||
u.unitname
|
||||
FROM
|
||||
`meeting_time_period_user` pu
|
||||
LEFT JOIN USER u ON pu.userId = u.id
|
||||
$condition
|
||||
limit 50
|
||||
""").setParam("meetId", meetId);
|
||||
Cnd cnd = Cnd.NEW();
|
||||
if (Strings.isNotBlank(query)) {
|
||||
SqlExpressionGroup group = new SqlExpressionGroup();
|
||||
group.orLike("u.username", query);
|
||||
group.orLike("u.loginname", query);
|
||||
cnd.and(group);
|
||||
}
|
||||
cnd.and("meetingId", "=", meetId);
|
||||
sql.setCondition(cnd);
|
||||
return meetingMineService.listMap(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ public interface MeetingMineService extends ViService {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Object> findMyMeetPeriod(String meetingId);
|
||||
List<Object> findMyMeetPeriod(String meetingId, Boolean helpLeave, String userId);
|
||||
|
||||
/**
|
||||
* 请假
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Object> findMyMeetPeriod(String meetingId) {
|
||||
public List<Object> findMyMeetPeriod(String meetingId, Boolean helpLeave, String userId) {
|
||||
Sql sql = Sqls.create("""
|
||||
SELECT
|
||||
tp.id AS tpid,
|
||||
@@ -94,7 +94,7 @@ public class MeetingMineServiceImpl extends ViServiceImpl implements MeetingMine
|
||||
""");
|
||||
Cnd cnd = Cnd.NEW();
|
||||
cnd.and("tp.meetingId", "=", meetingId);
|
||||
cnd.and("tpu.userId", "=", ShiroUtil.getPrincipalProperty("id"));
|
||||
cnd.and("tpu.userId", "=", helpLeave ? userId : ShiroUtil.getPrincipalProperty("id"));
|
||||
sql.setCondition(cnd);
|
||||
return listMap(sql);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user