From 0db9efb5af748eb0f77dab3ecb11ee12d8824a9c Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Thu, 18 Nov 2021 15:01:46 +0800
Subject: [PATCH] 1.统计
---
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml | 35 +
src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml | 8
src/main/java/org/springblade/modules/FTP/MysqlCenlint.java | 1
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml | 690 ++++++++++++++++----------------------
src/main/java/org/springblade/modules/information/controller/InformationController.java | 324 -----------------
src/main/java/org/springblade/modules/system/controller/UserController.java | 2
src/main/java/org/springblade/modules/system/entity/User.java | 1
src/main/java/org/springblade/modules/system/vo/UserVO.java | 1
8 files changed, 334 insertions(+), 728 deletions(-)
diff --git a/src/main/java/org/springblade/modules/FTP/MysqlCenlint.java b/src/main/java/org/springblade/modules/FTP/MysqlCenlint.java
index 7490cbf..d092a4b 100644
--- a/src/main/java/org/springblade/modules/FTP/MysqlCenlint.java
+++ b/src/main/java/org/springblade/modules/FTP/MysqlCenlint.java
@@ -108,6 +108,7 @@
User user = new User();
String userId = splitSql[0].substring(2, splitSql[0].length() - 1);
user.setId(Long.parseLong(userId));
+ System.out.println("身份证:"+subCardid);
//远程调用接口
String body = InvestigateUtil.httpGetOne(subCardid);
JSONObject jsonObject = new JSONObject(body);
diff --git a/src/main/java/org/springblade/modules/information/controller/InformationController.java b/src/main/java/org/springblade/modules/information/controller/InformationController.java
index f189748..9e23a47 100644
--- a/src/main/java/org/springblade/modules/information/controller/InformationController.java
+++ b/src/main/java/org/springblade/modules/information/controller/InformationController.java
@@ -702,31 +702,6 @@
return sortedMap;
}
-//
-// /**
-// * 统计保安员资格异常的数量
-// *
-// * @param jurisdiction
-// * @param deptid
-// * @param type 1:当天 2:当月 3:全部
-// * @return
-// */
-// @PostMapping("/selectExtype")
-// public R selectExtype(String jurisdiction, String deptid, String type) {
-// Map<String, Object> map = new HashMap<String, Object>();
-// Integer count = 0;
-// List<Map<String, Object>> lists = new ArrayList<>();
-// List<Map<Object, Object>> maps = informationService.selectExtype(jurisdiction, deptid, type);
-// for (int i = 0; i < maps.size(); i++) {
-// String num = maps.get(i).get("num").toString();
-// count += Integer.valueOf(num);
-// }
-// map.put("count", count);
-// map.put("list", maps);
-// lists.add(map);
-// return R.data(lists);
-// }
-
/**
* 统计用户资格异常的数量
*
@@ -738,100 +713,6 @@
}
- /**
- * 统计保安员表现差的数量
- *
- * @param jurisdiction
- * @param deptid
- * @param type 1:当天 2:当月 3:全部
- * @return
- *//*
- @PostMapping("/selectBx")
- public R selectBx(String jurisdiction, String deptid, String type) {
- Map<String, Object> map = new HashMap<String, Object>();
- Integer count = 0;
- List<Map<String, Object>> lists = new ArrayList<>();
- List<Map<Object, Object>> maps = informationService.selectBx(jurisdiction, deptid, type);
- for (int i = 0; i < maps.size(); i++) {
- String num = maps.get(i).get("num").toString();
- count += Integer.valueOf(num);
- }
- map.put("count", count);
- map.put("list", maps);
- lists.add(map);
- return R.data(lists);
- }*/
-
-
-// /**
-// * 分局预警统计
-// */
-// @PostMapping("/selectFj")
-// public R selectFj() {
-// //辖区信息
-// List<Map<Object, Object>> list = informationService.selectJur();
-// List<Map<String, Object>> lists = new ArrayList<>();
-// for (int i = 0; i < list.size(); i++) {
-// Integer count = 0;
-// Map<String, Object> map = new HashMap<String, Object>();
-// //辖区id
-// String jurisdiction = list.get(i).get("id").toString();
-// //辖区名称
-// String jurname = list.get(i).get("dept_name").toString();
-// //保安员表现差预警数量
-// List<Map<Object, Object>> mapbx = informationService.selectBx(jurisdiction, "", "");
-// for (int ibx = 0; ibx < mapbx.size(); ibx++) {
-// String num = mapbx.get(ibx).get("num").toString();
-// count += Integer.valueOf(num);
-// }
-// //保安员资格异常的数量
-// List<Map<Object, Object>> mapEx = informationService.selectExtype(jurisdiction, "", "");
-// for (int iex = 0; iex < mapEx.size(); iex++) {
-// String num = mapEx.get(iex).get("num").toString();
-// count += Integer.valueOf(num);
-// }
-// //保安公司未持证数量
-// List<Map<Object, String>> mapgs = informationService.selectInCount(jurisdiction, "");
-// count += mapgs.size();
-// //未缴社保数量
-// List<Map<String, Object>> mapsb = informationService.selectCs(jurisdiction, "");
-// for (int isb = 0; isb < mapsb.size(); isb++) {
-// //交社保数
-// String numjs = mapsb.get(isb).get("numj").toString();
-// Integer numj = Integer.parseInt(numjs);
-// //单位总人数
-// String numzs = mapsb.get(isb).get("numz").toString();
-// Integer numz = Integer.parseInt(numzs);
-// //统计未交社保人数
-// int i1 = numz - numj;
-// count += i1;
-// }
-// map.put("Count", count);
-// map.put("jurname", jurname);
-// lists.add(map);
-// }
-// return R.data(lists);
-// }
-
-
-// /**
-// * 派遣數量統計
-// */
-// @PostMapping("/selectPCount")
-// public R selectPCount(String jurisdiction, String deptid) {
-// Map<String, Object> map = new HashMap<String, Object>();
-// List<Map<String, Object>> lists = new ArrayList<>();
-// Map map1 = informationService.selectPcount(jurisdiction, deptid);
-// String pnum = map1.get("pnum").toString();
-// Integer a = Integer.valueOf(pnum);
-// Map map2 = informationService.selectWPcount(jurisdiction, deptid);
-// String wpnum = map2.get("wpnum").toString();
-// Integer b = Integer.valueOf(wpnum);
-// map.put("PCount", a);
-// map.put("WPCount", b);
-// lists.add(map);
-// return R.data(lists);
-// }
// /**
// * 单位列表
@@ -885,33 +766,6 @@
return R.data(list);
}
-// /**
-// * 公司运营情况进入图表
-// */
-// @PostMapping("/selectTb")
-// public R<IPage> selectTb(String jurisdiction, String enterpriseName, Query query) {
-// IPage list = informationService.selectTb(Condition.getPage(query), jurisdiction, enterpriseName);
-// return R.data(list);
-// }
-//
-// /**
-// * 公司经济情况进入图表
-// */
-// @PostMapping("/selectJj")
-// public R<IPage> selectJj(String jurisdiction, String enterpriseName, Query query) {
-// IPage list = informationService.selectJj(Condition.getPage(query), jurisdiction, enterpriseName);
-// return R.data(list);
-// }
-//
-// /**
-// * 业务统计情况
-// */
-// @PostMapping("/selectYw")
-// public R<IPage> selectYw(String jurisdiction, String deptid,String stats, Query query) {
-// IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid,stats);
-// return R.data(list);
-// }
-
/**
* 保安员详情
*/
@@ -940,19 +794,6 @@
return R.data(list);
}
-// /**
-// * 公司处罚数量统计
-// */
-// @PostMapping("/selectCf")
-// public R selectCf(String jurisdiction) {
-// Map<String, Object> map = new HashMap<String, Object>();
-// Integer count = 0;
-// List<Map<String, Object>> lists = new ArrayList<>();
-// List<Map<Object, Object>> maps = informationService.selectCf(jurisdiction);
-// map.put("count", maps.size());
-// return R.data(map);
-// }
-
/**
* 公司材料不全数量统计
*/
@@ -971,86 +812,6 @@
lists.add(map);
return R.data(lists);
}
-
-// /**
-// * 违规经营
-// */
-// @PostMapping("/selectWg")
-// public R selectWg(String jurisdiction) {
-// List<Map<Object, Object>> list = informationService.selectWg(jurisdiction);
-// List list1 = new ArrayList();
-// int count=0;
-// Map map = new HashMap();
-// for (int i = 0; i < list.size(); i++) {
-// //总数
-// String znums = list.get(i).get("znum").toString();
-// int znum = Integer.parseInt(znums);
-// //持证人数
-// String cznums = list.get(i).get("cznum").toString();
-// int cznum = Integer.parseInt(cznums);
-// //缴纳社保人数
-// String sbnums = list.get(i).get("sbnum").toString();
-// int sbnum = Integer.parseInt(sbnums);
-// //保安总人数为0
-// if (znum==0){
-// continue;
-// }
-// else {
-// int a = znum / 2;
-// if (cznum<=a || sbnum<=a){
-// count++;
-// list1.add(list.get(i));
-// }
-// }
-// }
-// map.put("count",count);
-// map.put("list",list1);
-// return R.data(map);
-// }
-
-// /**
-// * 经营不善
-// */
-// @PostMapping("/selectJy")
-// public R selectJy(String jurisdiction) {
-// List<Map<Object, Object>> list = informationService.selectJy(jurisdiction);
-// List list1 = new ArrayList();
-// Map map = new HashMap();
-// int count = 0;
-// for (int i = 0; i < list.size(); i++) {
-// String num = list.get(i).get("fwnum").toString();
-// int a = Integer.parseInt(num);
-// if (a == 0) {
-// count++;
-// list1.add(list.get(i));
-// }
-// }
-// map.put("count", count);
-// map.put("List", list1);
-// return R.data(map);
-// }
-
-// /**
-// * 有实无名
-// */
-// @PostMapping("/selectYs")
-// public R selectYs(String jurisdiction) {
-// List<Map<Object, Object>> list = informationService.selectYs(jurisdiction);
-// List list1 = new ArrayList();
-// Map map = new HashMap();
-// int count = 0;
-// for (int i = 0; i < list.size(); i++) {
-// String num = list.get(i).get("znum").toString();
-// int a = Integer.parseInt(num);
-// if (a == 0) {
-// count++;
-// list1.add(list.get(i));
-// }
-// }
-// map.put("count", count);
-// map.put("List", list1);
-// return R.data(map);
-// }
/**
* @return
@@ -1117,57 +878,6 @@
return R.data(lists);
}
-// /**
-// * 分局预警统计
-// */
-// @PostMapping("/selectFj")
-// public R selectFj() {
-// //辖区信息
-// List<Map<Object, Object>> list = informationService.selectJur();
-// List<Map<String, Object>> lists = new ArrayList<>();
-// for (int i = 0; i < list.size(); i++) {
-// Integer count = 0;
-// Map<String, Object> map = new HashMap<String, Object>();
-// //辖区id
-// String id = list.get(i).get("id").toString();
-// //辖区名称
-// String jurname = list.get(i).get("dept_name").toString();
-// String childer = informationService.selJurchilder(id);
-// String[] split = childer.split(",");
-// String strArrays = "";
-// for (int j = 0; j < split.length; j++) {
-// strArrays += "'" + split[j] + "',";
-// }
-// String jurisdiction = strArrays.substring(0, strArrays.length() - 1);
-// //保安员表现差预警数量
-// List<Map<Object, Object>> mapbx = informationService.selectBx(jurisdiction, "", "");
-// for (int ibx = 0; ibx < mapbx.size(); ibx++) {
-// String num = mapbx.get(ibx).get("num").toString();
-// count += Integer.valueOf(num);
-// }
-// //保安员资格异常的数量
-// List<Map<Object, Object>> mapEx = informationService.selectExtype(jurisdiction, "", "");
-// for (int iex = 0; iex < mapEx.size(); iex++) {
-// String num = mapEx.get(iex).get("num").toString();
-// count += Integer.valueOf(num);
-// }
-// //保安公司未持证数量
-// List<Map<Object, String>> mapgs = informationService.selectInCount(jurisdiction, "");
-// count += mapgs.size();
-// //未缴社保数量
-// List<Map<String, Object>> mapsb = informationService.selectCs(jurisdiction, "");
-// for (int isb = 0; isb < mapsb.size(); isb++) {
-// //交社保数
-// String numjs = mapsb.get(isb).get("numj").toString();
-// Integer numj = Integer.parseInt(numjs);
-// count += numj;
-// }
-// map.put("Count", count);
-// map.put("jurname", jurname);
-// lists.add(map);
-// }
-// return R.data(lists);
-// }
/**
* 首页保安持证统计接口
@@ -1306,7 +1016,7 @@
*/
@PostMapping("/selectWg")
public R selectWg(String jurisdiction) {
- if (jurisdiction.equals("1372091709474910209")) {
+ if (jurisdiction.equals("1372091709474910209") || jurisdiction.equals("") ) {
List<Map<Object, Object>> list = informationService.selectWg(jurisdiction);
List list1 = new ArrayList();
int count = 0;
@@ -1572,14 +1282,14 @@
IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid, stats, startTime, endTime);
return R.data(list);
} else {
- String childer = informationService.selJurchilder(jurisdiction);
- String[] split = childer.split(",");
- String strArrays = "";
- for (int j = 0; j < split.length; j++) {
- strArrays += "'" + split[j] + "',";
- }
- String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
- IPage list = informationService.selectYw(Condition.getPage(query), jurisdictiond, deptid, stats, startTime, endTime);
+// String childer = informationService.selJurchilder(jurisdiction);
+// String[] split = childer.split(",");
+// String strArrays = "";
+// for (int j = 0; j < split.length; j++) {
+// strArrays += "'" + split[j] + "',";
+// }
+// String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
+ IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid, stats, startTime, endTime);
return R.data(list);
}
}
@@ -1588,12 +1298,12 @@
public R selectPCount(String jurisdiction, String deptid) {
Map<String, Object> map = new HashMap<String, Object>();
List<Map<String, Object>> lists = new ArrayList<>();
- String childer = informationService.selJurchilder(jurisdiction);
- String[] split = childer.split(",");
- String strArrays = "";
- for (int j = 0; j < split.length; j++) {
- strArrays += "'" + split[j] + "',";
- }
+// String childer = informationService.selJurchilder(jurisdiction);
+// String[] split = childer.split(",");
+// String strArrays = "";
+// for (int j = 0; j < split.length; j++) {
+// strArrays += "'" + split[j] + "',";
+// }
Integer pnums = 0;
Integer wpnums = 0;
if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) {
@@ -1607,8 +1317,8 @@
wpnums += b;
}
} else {
- String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
- List<Map<String, Object>> list = informationService.seleP(jurisdictiond, deptid);
+ //String jurisdictiond = strArrays.substring(0, strArrays.length() - 1);
+ List<Map<String, Object>> list = informationService.seleP(jurisdiction, deptid);
for (int i = 0; i < list.size(); i++) {
String pnum = list.get(i).get("pnum").toString();
Integer a = Integer.parseInt(pnum);
diff --git a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
index f5d00b7..d8a5c81 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -190,161 +190,6 @@
group by jurisdiction
</select>
- <!-- <!–统计上个月和这个月交社保的人数以及缴纳金额–>-->
- <!-- <select id="selectTo" resultType="java.util.HashMap">-->
- <!-- SELECT IFNULL(A.lastmonth, 0) AS lastmonth,-->
- <!-- IFNULL(B.thismouth, 0) AS thismouth,-->
- <!-- IFNULL(A.amount, 0) AS lastamount,-->
- <!-- IFNULL(B.amount, 0) AS thisamount,-->
- <!-- IFNULL( C.userthismouth, 0 ) AS userthismouth,-->
- <!-- IFNULL( D.userlastmouth, 0 ) AS userlastmouth,-->
- <!-- IFNULL( E.userpcthismouth, 0 ) AS userpcthismouth,-->
- <!-- IFNULL( F.userpclastmouth, 0 ) AS userpclastmouth-->
- <!-- FROM (-->
- <!-- SELECT COUNT(*) AS lastmonth,-->
- <!-- amount,-->
- <!-- deptid-->
- <!-- FROM-->
- <!-- sys_socil-->
- <!-- WHERE-->
- <!-- deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY i.departmentid )-->
- <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( insuredtime, '%Y%m' ) ) = 1-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and deptid =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- amount,-->
- <!-- deptid-->
- <!-- ) A-->
- <!-- left JOIN (-->
- <!-- SELECT COUNT(*) AS thismouth,-->
- <!-- amount,-->
- <!-- deptid-->
- <!-- FROM-->
- <!-- sys_socil-->
- <!-- WHERE-->
- <!-- deptid IN ( SELECT i.departmentid FROM sys_information i LEFT JOIN sys_jurisdiction j ON j.id= i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY i.departmentid )-->
- <!-- AND DATE_FORMAT( insuredtime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and deptid =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- amount,-->
- <!-- deptid-->
- <!-- ) B ON A.deptid = B.deptid-->
- <!-- LEFT JOIN (-->
- <!-- SELECT COUNT(*) AS userthismouth,-->
- <!-- dept_id-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- dept_id IN (-->
- <!-- SELECT-->
- <!-- i.departmentid-->
- <!-- FROM-->
- <!-- sys_information i-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- i.departmentid-->
- <!-- )-->
- <!-- AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND status=1-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- dept_id-->
- <!-- ) C ON C.dept_id = A.deptid-->
- <!-- LEFT JOIN(-->
- <!-- SELECT COUNT(*) AS userlastmouth,-->
- <!-- dept_id-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- dept_id IN (-->
- <!-- SELECT-->
- <!-- i.departmentid-->
- <!-- FROM-->
- <!-- sys_information i-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- i.departmentid-->
- <!-- )-->
- <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND status=1-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- dept_id-->
- <!-- ) D ON D.dept_id = A.deptid-->
- <!-- LEFT JOIN (-->
- <!-- SELECT COUNT(*) AS userpcthismouth,-->
- <!-- dept_id-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- dept_id IN (-->
- <!-- SELECT-->
- <!-- i.departmentid-->
- <!-- FROM-->
- <!-- sys_information i-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- i.departmentid-->
- <!-- )-->
- <!-- AND DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' ) AND dispatch=0-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- dept_id-->
- <!-- ) E ON E.dept_id = A.deptid-->
- <!-- LEFT JOIN(-->
- <!-- SELECT COUNT(*) AS userpclastmouth,dept_id-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- dept_id IN (-->
- <!-- SELECT i.departmentid-->
- <!-- FROM-->
- <!-- sys_information i-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = i.jurisdiction-->
- <!-- where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and i.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- i.departmentid-->
- <!-- )-->
- <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1 AND dispatch=0-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- GROUP BY-->
- <!-- dept_id-->
- <!-- ) F ON F.dept_id = A.deptid-->
- <!-- </select> -->
<!--统计上个月和这个月交社保的人数以及缴纳金额-->
<select id="selectTo" resultType="java.util.HashMap">
SELECT
@@ -452,27 +297,52 @@
) F ON F.dept_id = H.departmentid
LEFT JOIN (
SELECT
- COUNT(*) AS usernum,
- dept_id
+ J.znum+J.fznum as usernum,
+ J.dept_id
FROM
- blade_user
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
WHERE
- STATUS = 1
- AND is_deleted = 0 AND role_id='1412226235153731586'
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
GROUP BY
- dept_id
- ) I ON I.dept_id = H.departmentid
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J) I ON I.dept_id = H.departmentid
LEFT JOIN (
SELECT
COUNT( * ) AS userpcthismouth,
dept_id
FROM
- blade_user
+ sys_dispatcher
WHERE
- DATE_FORMAT( update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
- AND dispatch = 0
- AND STATUS = 1
- AND is_deleted = 0 AND role_id='1412226235153731586'
+ DATE_FORMAT( dispatcherTime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
+ AND STATUS = 0
GROUP BY
dept_id
) G ON G.dept_id = H.departmentid
@@ -481,12 +351,10 @@
COUNT( * ) AS userpclastmouth,
dept_id
FROM
- blade_user
+ sys_dispatcher
WHERE
- PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( update_time, '%Y%m' ) ) = 1
- AND dispatch = 0
- AND STATUS = 1
- AND is_deleted = 0 AND role_id='1412226235153731586'
+ PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( dispatcherTime, '%Y%m' ) ) = 1
+ AND STATUS = 0
GROUP BY
dept_id
) J ON J.dept_id = H.departmentid
@@ -495,16 +363,16 @@
COUNT(*) AS userpcnum,
dept_id
FROM
- blade_user
- WHERE dispatch = 0
- AND STATUS = 1
- AND is_deleted = 0 AND role_id='1412226235153731586'
+ sys_dispatcher
+ WHERE STATUS = 0
GROUP BY
dept_id
) P ON P.dept_id = H.departmentid
+ LEFT JOIN blade_dept d ON H.departmentid = d.id
+ LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
@@ -626,60 +494,6 @@
</select>
- <!--总保安数量-->
- <!-- <select id="queryCountB" resultType="java.util.HashMap">-->
- <!-- SELECT-->
- <!-- C.thisnum,-->
- <!-- C.lastnum,-->
- <!-- d.dept_name AS deptname,-->
- <!-- j.dept_name AS jurname-->
- <!-- FROM-->
- <!-- (-->
- <!-- SELECT-->
- <!-- IFNULL( A.thisnum, 0 ) AS thisnum,-->
- <!-- IFNULL( B.lastnum, 0 ) AS lastnum,-->
- <!-- A.dept_id,-->
- <!-- A.jurisdiction-->
- <!-- FROM-->
- <!-- (-->
- <!-- SELECT-->
- <!-- COUNT( * ) AS thisnum,-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- role_id = '1412226235153731586' and status=1 and is_deleted=0-->
- <!-- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )-->
- <!-- GROUP BY-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- ) A-->
- <!-- LEFT JOIN (-->
- <!-- SELECT-->
- <!-- COUNT( * ) AS lastnum,-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- FROM-->
- <!-- blade_user-->
- <!-- WHERE-->
- <!-- role_id = '1412226235153731586' and status=1 and is_deleted=0-->
- <!-- AND PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( create_time, '%Y%m' ) ) = 1-->
- <!-- GROUP BY-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- ) B ON A.dept_id = B.dept_id-->
- <!-- ) C-->
- <!-- LEFT JOIN blade_dept d ON C.dept_id = d.id-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = C.jurisdiction-->
- <!-- WHERE 1 =1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and C.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and C.dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- </select>-->
<select id="queryCountB" resultType="java.util.HashMap">
SELECT IFNULL(A.thisnum, 0) AS thisnum,
IFNULL(B.lastnum, 0) AS lastnum,
@@ -706,22 +520,51 @@
AND is_deleted = 0
AND PERIOD_DIFF(date_format(now(), '%Y%m'), date_format(rtime, '%Y%m')) = 1
GROUP BY dept_id
- ) B ON B.dept_id = H.departmentid LEFT JOIN (
+ ) B ON B.dept_id = H.departmentid
+ LEFT JOIN (
SELECT
- COUNT( * ) AS num,
- dept_id
+ J.znum+J.fznum as num,
+ J.dept_id
FROM
- blade_user
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
WHERE
- role_id = '1412226235153731586'
- AND STATUS = 1
- AND is_deleted = 0
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
GROUP BY
- dept_id
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J
) C ON C.dept_id = H.departmentid
- where 1=1
+ LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
+ WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
@@ -788,7 +631,7 @@
LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
@@ -803,10 +646,11 @@
IFNULL( C.num, 0 ) AS num,
H.departmentid,
H.jurisdiction,
- d.dept_name AS deptname,
+ H.enterpriseName AS deptname,
j.dept_name AS jurname
FROM
- ( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
+ ( SELECT departmentid, jurisdiction,enterpriseName FROM sys_information GROUP BY departmentid,
+ jurisdiction,enterpriseName ) H
LEFT JOIN (
SELECT
COUNT(*) AS thisnum,
@@ -851,11 +695,10 @@
GROUP BY
dept_id
) C ON H.departmentid = C.dept_id
- LEFT JOIN blade_dept d ON H.departmentid = d.id
LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
@@ -909,10 +752,10 @@
LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and C.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
- and C.deptid =#{deptid}
+ and H.departmentid =#{deptid}
</if>
</select>
@@ -961,7 +804,7 @@
LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
@@ -978,78 +821,47 @@
( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
LEFT JOIN (
SELECT
- SUM(num) AS thisnum,
+ COUNT(*) AS thisnum,
dept_id
FROM
sys_dispatcher
WHERE
DATE_FORMAT( dispatcherTime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )
+ AND `status`=0
GROUP BY
dept_id
) G ON G.dept_id = H.departmentid
LEFT JOIN (
SELECT
- SUM(num) AS lastnum,
+ COUNT(*) AS lastnum,
dept_id
FROM
sys_dispatcher
WHERE
PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( dispatcherTime, '%Y%m' ) ) = 1
+ AND `status`=0
GROUP BY
dept_id
) J ON J.dept_id = H.departmentid
LEFT JOIN (
SELECT
- SUM(num) AS num,
+ COUNT(*) AS num,
dept_id
FROM
sys_dispatcher
+ where `status`=0
GROUP BY
dept_id
) C ON C.dept_id = H.departmentid
+ LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction
WHERE 1 = 1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
</if>
</select>
- <!-- <select id="queryCountPq" resultType="java.util.HashMap">-->
- <!-- SELECT C.thisnum,-->
- <!-- C.lastnum,-->
- <!-- d.dept_name as deptname,-->
- <!-- j.dept_name as jurname-->
- <!-- FROM (-->
- <!-- SELECT IFNULL(A.thisnum, 0) AS thisnum,-->
- <!-- IFNULL(B.lastnum, 0) AS lastnum,-->
- <!-- A.dept_id,-->
- <!-- A.jurisdiction-->
- <!-- FROM (-->
- <!-- SELECT SUM(num) AS thisnum,-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- FROM sys_dispatcher-->
- <!-- WHERE DATE_FORMAT( dispatcherTime, '%Y%m' ) = DATE_FORMAT( CURDATE( ), '%Y%m' )-->
- <!-- GROUP BY dept_id, jurisdiction-->
- <!-- ) A-->
- <!-- left JOIN (-->
- <!-- SELECT SUM(num) AS lastnum,-->
- <!-- dept_id,-->
- <!-- jurisdiction-->
- <!-- FROM sys_dispatcher-->
- <!-- WHERE PERIOD_DIFF( date_format( now( ), '%Y%m' ), date_format( dispatcherTime, '%Y%m' ) ) = 1-->
- <!-- GROUP BY dept_id, jurisdiction-->
- <!-- ) B ON A.dept_id = B.dept_id) C-->
- <!-- LEFT JOIN blade_dept d ON C.dept_id = d.id-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = C.jurisdiction where 1=1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and C.jurisdiction =#{jurisdiction}-->
- <!-- </if>-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and C.dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- </select>-->
<!--查询本年所有月份的总人数-->
@@ -1248,55 +1060,8 @@
AND H.departmentid = #{deptid}
</if>
</select>
- <!-- <select id="selectExtype" resultType="java.util.HashMap">-->
- <!-- SELECT COUNT-->
- <!-- (*) as num,-->
- <!-- d.dept_name,-->
- <!-- u.real_name,-->
- <!-- j.dept_name AS jurname-->
- <!-- FROM blade_user u-->
- <!-- LEFT JOIN blade_dept d ON d.id = u.dept_id-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction-->
- <!-- WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and u.jurisdiction in (${jurisdiction})-->
- <!-- </if>-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and u.dept_id =#{deptid}-->
- <!-- </if>-->
- <!-- <if test="type!=null and type=='1'.toString()">-->
- <!-- and to_days(u.update_time) = to_days(now())-->
- <!-- </if>-->
- <!-- <if test="type!=null and type=='2'.toString()">-->
- <!-- and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
- <!-- </if>-->
- <!-- GROUP BY d.dept_name,u.real_name,-->
- <!-- j.dept_name-->
- <!-- </select>-->
- <!--表现差的数量-->
- <!-- <select id="selectBx" resultType="java.util.HashMap">-->
- <!-- SELECT IFNULL(COUNT( * ),0) AS num,-->
- <!-- d.dept_name,-->
- <!-- j.dept_name AS jurname-->
- <!-- FROM sys_performance u-->
- <!-- LEFT JOIN blade_dept d ON d.id = u.departmentid-->
- <!-- LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction-->
- <!-- WHERE score = 3-->
- <!-- <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
- <!-- and u.jurisdiction in(${jurisdiction})-->
- <!-- </if>-->
- <!-- <if test="deptid!=null and deptid!=''">-->
- <!-- and u.departmentid =#{deptid}-->
- <!-- </if>-->
- <!-- <if test="type!=null and type=='1'.toString()">-->
- <!-- and to_days(u.time) = to_days(now())-->
- <!-- </if>-->
- <!-- <if test="type!=null and type=='2'.toString()">-->
- <!-- and DATE_FORMAT(u.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
- <!-- </if>-->
- <!-- GROUP BY d.dept_name,-->
- <!-- j.dept_name-->
- <!-- </select>-->
+
+ <!--表现差-->
<select id="selectBx" resultType="java.util.HashMap">
SELECT
IFNULL( J.num, 0 ) AS num
@@ -1416,7 +1181,7 @@
<select id="selectLi" resultType="java.util.HashMap">
SELECT
- IFNULL( J.num, 0 ) AS num,
+ IFNULL( V.num, 0 ) AS num,
IFNULL( B.cznum, 0 ) AS cznum,
IFNULL( D.wpaiqnum, 0 ) AS wpaiqnum,
IFNULL( E.sbnum, 0 ) AS sbnum,
@@ -1429,20 +1194,47 @@
A.stats,
j.dept_name AS jurname
FROM
- ( SELECT jurisdiction, departmentid,enterpriseName,stats,create_time FROM sys_information ) A
+ ( SELECT jurisdiction, departmentid,enterpriseName,stats,create_time FROM sys_information where state !=1) A
LEFT JOIN (
SELECT
- COUNT( * ) AS num,
- dept_id
+ J.znum+J.fznum as num,
+ J.dept_id
FROM
- blade_user
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
WHERE
- role_id = '1412226235153731586'
- AND STATUS = 1
- AND is_deleted = 0
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
GROUP BY
- dept_id
- ) J ON J.dept_id = A.departmentid
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J
+ ) V ON V.dept_id = A.departmentid
LEFT JOIN (
SELECT
COUNT( * ) AS cznum,
@@ -1542,9 +1334,11 @@
GROUP BY
dept_id
) G ON G.dept_id = A.departmentid
- LEFT JOIN sys_jurisdiction j ON j.id = A.jurisdiction WHERE 1=1
+ LEFT JOIN blade_dept d ON A.departmentid = d.id
+ LEFT JOIN sys_jurisdiction j ON j.id = A.jurisdiction
+ WHERE 1 =1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and A.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and A.enterpriseName like concat(concat('%', #{deptid}),'%')
@@ -1572,7 +1366,9 @@
GROUP BY stats
</select>
<select id="seCountUm" resultType="java.lang.String">
- SELECT COUNT(*) as mnum FROM `blade_user` WHERE status=1 AND sex=1
+ SELECT COUNT(*) as mnum FROM `blade_user` WHERE status=1 and
+ role_id = '1412226235153731586'
+ and is_deleted = 0 AND sex='1'
<if test="deptid!=null and deptid!=''">
and dept_id=#{deptid}
</if>
@@ -1581,7 +1377,8 @@
</if>
</select>
<select id="seCountUg" resultType="java.lang.String">
- SELECT COUNT(*) as gnum FROM `blade_user` WHERE status=1 AND sex=2
+ SELECT COUNT(*) as gnum FROM `blade_user` WHERE status=1 and role_id = '1412226235153731586' and is_deleted = 0
+ AND sex='2'
<if test="deptid!=null and deptid!=''">
and dept_id=#{deptid}
</if>
@@ -1770,7 +1567,7 @@
A.departmentid,
A.stats,
A.jurisdiction,
- A.dept_name as jurname,
+ j.dept_name as jurname,
IFNULL( B.num, 0 ) AS fwnum,
IFNULL( C.znum, 0 ) AS znum,
IFNULL( D.dqnum, 0 ) AS dqnum,
@@ -1778,19 +1575,8 @@
IFNULL( F.pqnum, 0 ) AS pqnum
FROM
(
- SELECT
- i.enterpriseName,
- i.departmentid,
- i.stats,
- i.jurisdiction,
- j.dept_name,
- i.create_time
- FROM
- sys_information i
- LEFT JOIN sys_jurisdiction j ON i.jurisdiction = j.id
- WHERE
- i.enterpriseName IS NOT NULL
- ) A
+ SELECT enterpriseName,jurisdiction, departmentid,stats FROM sys_information WHERE stats!=1 GROUP BY
+ enterpriseName,jurisdiction,departmentid,stats) A
LEFT JOIN
(
SELECT COUNT( * ) AS num, dept_id FROM sys_dispatcher_unit
@@ -1801,10 +1587,44 @@
ON A.departmentid = B.dept_id
LEFT JOIN
(
- SELECT COUNT( * ) AS znum, dept_id FROM blade_user WHERE role_id = '1412226235153731586'
- and status=1
- and is_deleted = 0
- GROUP BY dept_id
+ SELECT
+ J.znum+J.fznum as znum,
+ J.dept_id
+ FROM
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J
) C
ON A.departmentid = C.dept_id
LEFT JOIN
@@ -1824,18 +1644,20 @@
ON A.departmentid = E.dept_id
LEFT JOIN
(
- SELECT COUNT( * ) AS pqnum, dept_id FROM blade_user
- where
- dispatch = 0
- and role_id = '1412226235153731586'
- and status= 1
- and is_deleted = 0
- GROUP BY dept_id
+ SELECT
+ SUM(num) AS pqnum,
+ dept_id
+ FROM
+ sys_dispatcher
+ GROUP BY
+ dept_id
) F
ON A.departmentid = F.dept_id
- where 1=1
- <if test="jurisdiction!=null and jurisdiction!=''and jurisdiction!='1372091709474910209'">
- AND A.jurisdiction in(${jurisdiction})
+ LEFT JOIN blade_dept d ON A.departmentid = d.id
+ LEFT JOIN sys_jurisdiction j ON j.id = A.jurisdiction
+ WHERE 1 =1
+ <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and A.enterpriseName like concat('%', #{deptid},'%')
@@ -1958,7 +1780,7 @@
u.jurisdiction,
j.dept_name AS jurname
FROM sys_information u
- LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction WHERE u.stats!=0
+ LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction WHERE u.stats!=1
) A
LEFT JOIN (
SELECT COUNT(*) AS cznum,
@@ -1978,11 +1800,44 @@
AND is_deleted = 0
GROUP BY dept_id
) C ON C.dept_id = A.departmentid
- LEFT JOIN (SELECT COUNT(*) AS znum, dept_id
- FROM blade_user
- WHERE role_id = '1412226235153731586' AND `status`=1
- AND is_deleted = 0
- GROUP BY dept_id) D ON D.dept_id = A.departmentid where 1=1
+ LEFT JOIN (SELECT
+ J.znum+J.fznum as znum,
+ J.dept_id
+ FROM
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J )D ON D.dept_id = A.departmentid where 1=1
<if test="jurisdiction!=null and jurisdiction != '' and jurisdiction != '1372091709474910209'">
and A.jurisdiction in(${jurisdiction})
</if>
@@ -2042,7 +1897,7 @@
AND is_deleted = 0
GROUP BY
dept_id
- ) E ON E.dept_id = i.departmentid where 1=1 AND i.stats!=0
+ ) E ON E.dept_id = i.departmentid where 1=1 AND i.stats!=1
<if test="jurisdiction!=null and jurisdiction != '' and jurisdiction != '1372091709474910209'">
and i.jurisdiction in(${jurisdiction})
</if>
@@ -2101,7 +1956,7 @@
dept_id
) D ON D.dept_id = i.departmentid
LEFT JOIN ( SELECT COUNT( * ) fwnum, dept_id FROM sys_dispatcher_unit GROUP BY dept_id ) E ON i.departmentid =
- E.dept_id WHERE 1 =1 AND i.stats!=0
+ E.dept_id WHERE 1 =1 AND i.stats!=1
<if test="jurisdiction!=null and jurisdiction != '' and jurisdiction != '1372091709474910209'">
and i.jurisdiction in(${jurisdiction})
</if>
@@ -3118,28 +2973,61 @@
<select id="seleP" resultType="java.util.HashMap">
SELECT
IFNULL(G.pnum, 0) AS pnum,
- IFNULL(J.wpnum, 0) AS wpnum
+ IFNULL(K.wpnum, 0) AS wpnum
FROM (SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction) H
LEFT JOIN (
SELECT COUNT(*) AS pnum,
dept_id
- FROM blade_user
- WHERE dispatch = 0
- AND STATUS = 1
- AND is_deleted = 0
+ FROM sys_dispatcher
+ WHERE STATUS = 0
GROUP BY dept_id
) G ON G.dept_id = H.departmentid
LEFT JOIN (
- SELECT COUNT(*) AS wpnum,
- dept_id
- FROM blade_user
- WHERE dispatch = 1
- AND STATUS = 1
- AND is_deleted = 0
- GROUP BY dept_id
- ) J ON J.dept_id = H.departmentid where 1=1
+ SELECT
+ J.znum+J.fznum as wpnum,
+ J.dept_id
+ FROM
+ (
+ SELECT
+ A.znum,
+ IFNULL( B.znum, 0 ) AS fznum,
+ A.dept_id
+ FROM
+ (
+ SELECT
+ COUNT( * ) AS znum,
+ bu.dept_id
+ FROM
+ blade_user bu
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.dispatch = 1
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bu.dept_id
+ ) A
+ LEFT JOIN (
+ SELECT
+ IFNULL( COUNT( * ), 0 ) AS znum,
+ bd.parent_id
+ FROM
+ blade_user bu
+ LEFT JOIN blade_dept bd ON bu.dept_id = bd.id
+ WHERE
+ bu.`status` = 1
+ AND bu.is_deleted = 0
+ AND bu.dispatch = 1
+ AND bu.role_id = '1412226235153731586'
+ GROUP BY
+ bd.parent_id
+ ) B ON B.parent_id = A.dept_id
+ ) J
+ ) K ON K.dept_id = H.departmentid
+ LEFT JOIN blade_dept d ON H.departmentid = d.id
+ LEFT JOIN sys_jurisdiction j ON j.id = H.jurisdiction where 1=1
<if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
- and H.jurisdiction =#{jurisdiction}
+ and (j.id = #{jurisdiction} or j.parent_id = #{jurisdiction})
</if>
<if test="deptid!=null and deptid!=''">
and H.departmentid =#{deptid}
diff --git a/src/main/java/org/springblade/modules/system/controller/UserController.java b/src/main/java/org/springblade/modules/system/controller/UserController.java
index 455691d..2fe0c1c 100644
--- a/src/main/java/org/springblade/modules/system/controller/UserController.java
+++ b/src/main/java/org/springblade/modules/system/controller/UserController.java
@@ -140,7 +140,7 @@
@ApiImplicitParam(name = "account", value = "账号名", paramType = "query", dataType = "string"),
@ApiImplicitParam(name = "realName", value = "姓名", paramType = "query", dataType = "string")
})
- public R<IPage<UserVO>> pages(@ApiIgnore User user, Query query) {
+ public R<IPage<UserVO>> pages(@ApiIgnore UserVO user, Query query) {
IPage<User> pages = userService.selectUserPages(Condition.getPage(query), user);
return R.data(UserWrapper.build().pageVO(pages));
}
diff --git a/src/main/java/org/springblade/modules/system/entity/User.java b/src/main/java/org/springblade/modules/system/entity/User.java
index e050e1f..cce3c34 100644
--- a/src/main/java/org/springblade/modules/system/entity/User.java
+++ b/src/main/java/org/springblade/modules/system/entity/User.java
@@ -211,6 +211,7 @@
* 是否缴纳保险 0:是 1:否
*/
private Integer insurance;
+ private Integer guncode;
/**
* 审查时间
diff --git a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
index 2874a31..8e53366 100644
--- a/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -372,17 +372,17 @@
SELECT IFNULL(B.cz, 0) as cz,
IFNULL(C.wcz, 0) as wcz
FROM (SELECT departmentid,jurisdiction FROM sys_information) A
- LEFT JOIN (SELECT COUNT(hold) as cz, dept_id
+ LEFT JOIN (SELECT COUNT(*) as cz, dept_id
FROM blade_user
WHERE hold = 1
AND role_id = '1412226235153731586'
- and status = 1
+ and status = 1 AND is_deleted = 0
GROUP BY dept_id) B ON A.departmentid = B.dept_id
- LEFT JOIN (SELECT COUNT(hold) as wcz, dept_id
+ LEFT JOIN (SELECT COUNT(*) as wcz, dept_id
FROM blade_user
WHERE hold = 2
AND role_id = '1412226235153731586'
- and status = 1
+ and status = 1 AND is_deleted = 0
GROUP BY dept_id) C ON A.departmentid = C.dept_id
WHERE A.jurisdiction in (${deptid})
GROUP BY cz, wcz
diff --git a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
index fbf2038..8a180f4 100644
--- a/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
+++ b/src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -148,15 +148,19 @@
<select id="selectUserPages" resultMap="userResultMaps">
select
bu.*,
- ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( cardid,7,4),0) age
+ ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( bu.cardid,7,4),0) age,
+ p.score
from
blade_user bu
left join
sys_information si
on
si.departmentid = bu.dept_id
- where is_deleted = 0
- and status = 1
+ LEFT JOIN sys_performance p ON p.departmentid = bu.dept_id
+ LEFT JOIN blade_dept d ON bu.dept_id = d.id
+ LEFT JOIN sys_jurisdiction j ON j.id = si.jurisdiction
+ where bu.is_deleted = 0
+ and bu.status = 1
<if test="user.realName!=null and user.realName != ''">
and bu.real_name like concat(concat('%', #{user.realName}),'%')
</if>
@@ -178,11 +182,14 @@
<if test="user.hold!=null and user.hold != ''">
and bu.hold = #{user.hold}
</if>
- <if test="user.jurisdiction!=null and user.jurisdiction != '' and user.jurisdiction != '1372091709474910209'">
- and si.jurisdiction = #{user.jurisdiction}
+ <if test="user.jurisdiction!=null and user.jurisdiction!='' and user.jurisdiction!='1372091709474910209'">
+ and (j.id = #{user.jurisdiction} or j.parent_id = #{user.jurisdiction})
</if>
<if test="user.securitynumber!=null and user.securitynumber != ''">
and bu.securitynumber = #{user.securitynumber}
+ </if>
+ <if test="user.score!=null and user.score != ''">
+ and p.score = 3
</if>
ORDER BY bu.id
</select>
@@ -316,16 +323,14 @@
<!--根据保安员编码查询保安信息-->
<select id="getUserInfoBySecurityNumber" resultType="org.springblade.modules.system.vo.UserVO">
- select
- bu.*,
- ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING( cardid,7,4),0) age,
- bd.dept_name deptName
- from
- blade_user bu
- left join
- blade_dept bd
- on
- bu.dept_id = bd.id
+ select bu.*,
+ ifnull(DATE_FORMAT(NOW(), '%Y') - SUBSTRING(cardid, 7, 4), 0) age,
+ bd.dept_name deptName
+ from blade_user bu
+ left join
+ blade_dept bd
+ on
+ bu.dept_id = bd.id
where securitynumber = #{securityNumber}
</select>
diff --git a/src/main/java/org/springblade/modules/system/vo/UserVO.java b/src/main/java/org/springblade/modules/system/vo/UserVO.java
index 47a0c67..aaba07f 100644
--- a/src/main/java/org/springblade/modules/system/vo/UserVO.java
+++ b/src/main/java/org/springblade/modules/system/vo/UserVO.java
@@ -104,4 +104,5 @@
* 结束时间
*/
private String endTime;
+ private String score;
}
--
Gitblit v1.9.3