|
|
@@ -25,10 +25,14 @@ public class TbClassQueryDaoImpl implements TbClassQueryDao {
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
selSql.append(" SELECT t.* ");
|
|
|
selSql.append(" ,( SELECT COUNT(DISTINCT(v.id)) from tb_lib_vip v where v.stat=1 AND v.lib_id=t.id ) as student_num ");
|
|
|
- selSql.append(" ,( SELECT COUNT(DISTINCT(a.user_id)) from tb_lib_manager a where a.state=1 AND a.type in (2,10,15) AND a.lib_id=t.id ) as teacher_num ");
|
|
|
+ selSql.append(" ,( select COUNT(DISTINCT(t12.vip_id)) from tb_lib_vip_service t12 where t12.lib_id=t.id and t12.type in('C024','C025') and t12.species='S003' and t12.stat=2 ) as invalid_student_num ");
|
|
|
+ selSql.append(" ,( SELECT COUNT(a.teacher_id) from tb_class_teacher a where a.status=1 and a.type=1 AND a.lib_id=t.id ) as teacher_num ");
|
|
|
+ selSql.append(" ,( SELECT COUNT(DISTINCT(a.user_id)) from tb_lib_manager a where a.state=1 AND a.type in (4) AND a.lib_id=t.id ) as principal_num ");
|
|
|
+ selSql.append(" ,( SELECT COUNT(DISTINCT(a.user_id)) from tb_lib_manager a where a.state=1 AND a.type in (19) AND a.lib_id=t.id ) as leader_num ");
|
|
|
+ selSql.append(" ,( SELECT COUNT(a.teacher_id) from tb_class_teacher a where a.status=1 and a.type=2 AND a.lib_id=t.id ) as headmaster_num ");
|
|
|
selSql.append(" ,IFNULL(( SELECT SUM(m.port_num) from fx_merchant m WHERE m.lib_id=t.id GROUP BY m.lib_id),0) as port_num ");
|
|
|
selSql.append(" from tb_lib_join t ");
|
|
|
- selSql.append(" where t.type=1 ");
|
|
|
+ selSql.append(" where 1=1 ");
|
|
|
if(!"".equals(searchParam.get("leagueNname"))){
|
|
|
selSql.append(" AND t.league_name like CONCAT('%',?,'%') ");
|
|
|
queryParams.add(searchParam.get("leagueNname"));
|
|
|
@@ -108,8 +112,21 @@ public class TbClassQueryDaoImpl implements TbClassQueryDao {
|
|
|
StringBuffer selSql = new StringBuffer();
|
|
|
List<Object> queryParams = new ArrayList<Object>();
|
|
|
selSql.append(" SELECT * from tb_lib_manager t ");
|
|
|
- selSql.append(" where t.state=1 AND t.type in (2,10,15) AND t.lib_id=? ");
|
|
|
+ selSql.append(" where t.state=1 AND t.lib_id=? ");
|
|
|
queryParams.add(searchParam.get("libId"));
|
|
|
+
|
|
|
+ if("1".equals(searchParam.get("type"))){
|
|
|
+ selSql.append(" AND t.type in (4) ");
|
|
|
+ }else
|
|
|
+ if("2".equals(searchParam.get("type"))){
|
|
|
+ selSql.append(" AND t.type in (19) ");
|
|
|
+ }else
|
|
|
+ if("3".equals(searchParam.get("type"))){
|
|
|
+ selSql.append(" AND t.type in (4,19,2,10,15) ");
|
|
|
+ }else
|
|
|
+ if("4".equals(searchParam.get("type"))){
|
|
|
+ selSql.append(" AND t.type in (2,10,15) ");
|
|
|
+ }
|
|
|
if(!"".equals(searchParam.get("name"))){
|
|
|
selSql.append(" AND t.name LIKE CONCAT('%',?,'%') ");
|
|
|
queryParams.add(searchParam.get("name"));
|
|
|
@@ -117,7 +134,29 @@ public class TbClassQueryDaoImpl implements TbClassQueryDao {
|
|
|
selSql.append(" GROUP BY t.user_id ORDER BY t.create_time DESC ");
|
|
|
return dao.findPage(selSql.toString(),queryParams.toArray(), pageable);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<Map<String, Object>> findHeadmasterByPage(Map<String, Object> searchParam, Pageable pageable) {
|
|
|
+ StringBuffer selSql = new StringBuffer();
|
|
|
+ List<Object> queryParams = new ArrayList<Object>();
|
|
|
+ selSql.append(" SELECT u.*,c.grade,c.class_name,c.id as cid from tb_class_teacher t LEFT JOIN tb_user u ON t.teacher_id=u.id LEFT JOIN tb_class c ON t.class_id=c.id ");
|
|
|
+ selSql.append(" where t.status=1 AND t.lib_id=? ");
|
|
|
+ queryParams.add(searchParam.get("libId"));
|
|
|
+ if(!"".equals(searchParam.get("type"))){
|
|
|
+ selSql.append(" AND t.type=? ");
|
|
|
+ queryParams.add(searchParam.get("type"));
|
|
|
+ }
|
|
|
+ if(!"".equals(searchParam.get("name"))){
|
|
|
+ selSql.append(" AND u.user_name LIKE CONCAT('%',?,'%') ");
|
|
|
+ queryParams.add(searchParam.get("name"));
|
|
|
+ }
|
|
|
+ selSql.append(" ORDER BY t.create_time DESC ");
|
|
|
+ return dao.findPage(selSql.toString(),queryParams.toArray(), pageable);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public Page<Map<String, Object>> findTeacherErrorByPage(Map<String, Object> searchParam, Pageable pageable) {
|
|
|
StringBuffer selSql = new StringBuffer();
|
|
|
@@ -168,7 +207,33 @@ public class TbClassQueryDaoImpl implements TbClassQueryDao {
|
|
|
return dao.findPage(selSql.toString(),queryParams.toArray(), pageable);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @Override
|
|
|
+ public Page<Map<String, Object>> findInvalidStudentByPage(Map<String, Object> params, Pageable initPage) {
|
|
|
+ StringBuffer selSql = new StringBuffer();
|
|
|
+ List<Object> queryParams = new ArrayList<Object>();
|
|
|
+ selSql.append("select t2.parent_role,t2.parent_name,t.class_name ,t.id class_id, t2.id,t2.child_name ,t2.img_url ,t2.grade,t2.sex,t2.school,IF(t3.mobile is null,t2.phone,t3.mobile) phone\n");
|
|
|
+ selSql.append(" from tb_lib_vip t2 \n");
|
|
|
+ selSql.append(" left join (select tc.class_name,tc.id,tcs.vip_id\n");
|
|
|
+ selSql.append(" from tb_class_student tcs,tb_class tc\n");
|
|
|
+ selSql.append(" where tcs.status in (1,2)\n");
|
|
|
+ selSql.append(" and tcs.lib_id=?\n");
|
|
|
+ selSql.append(" and tc.status=1\n");
|
|
|
+ selSql.append(" and tcs.class_id=tc.id\n");
|
|
|
+ selSql.append(" ) t on t2.id=t.vip_id\n");
|
|
|
+ selSql.append(" left join tb_user t3 on t2.user_id=t3.id\n");
|
|
|
+ selSql.append(" left join (select lib_id, vip_id, min(stat) stat from tb_lib_vip_service where lib_id=? and type in('C024','C025') and stat=2 and species='S003' group by lib_id,vip_id) t4\n");
|
|
|
+ selSql.append(" on t2.id = t4.vip_id\n");
|
|
|
+ selSql.append(" where 1=1\n");
|
|
|
+ selSql.append(" and t4.lib_id=?\n");
|
|
|
+ queryParams.add(params.get("libId"));
|
|
|
+ queryParams.add(params.get("libId"));
|
|
|
+ queryParams.add(params.get("libId"));
|
|
|
+ if(!"".equals(params.get("name"))){
|
|
|
+ selSql.append(" AND t2.child_name LIKE CONCAT('%',?,'%') ");
|
|
|
+ queryParams.add(params.get("name"));
|
|
|
+ }
|
|
|
+ return dao.findPage(selSql.toString(),queryParams.toArray(), initPage);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
}
|