Browse Source

信件分类统计大类型时间查询

master
laishajiang 2 years ago
parent
commit
9f275a9530
  1. 6
      mailbox-lan/src/main/java/com/biutag/lan/mapper/DataMapper.java
  2. 11
      mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java
  3. 12
      mailbox-lan/src/main/resources/mapper/DataMapper.xml

6
mailbox-lan/src/main/java/com/biutag/lan/mapper/DataMapper.java

@ -20,11 +20,11 @@ public interface DataMapper extends BaseMapper<Mail> {
List<Map<String, Object>> getThirdList(Page page,@Param("searchStartTime") String searchStartTime,@Param("searchEndTime") String searchEndTime,@Param("deptId") String deptId);
List<Map<String, Object>> selectMailCategoryWithCount(@Param("dept_level") String dept_level,@Param("deptId") String deptId,@Param("deptName") String deptName);
List<Map<String, Object>> selectMailCategoryWithCount(@Param("dept_level") String dept_level,@Param("deptId") String deptId,@Param("deptName") String deptName,@Param("searchStartTime") String searchStartTime,@Param("searchEndTime") String searchEndTime);
List<Map<String, Object>> selectMailFirstCategoryWithCount();
List<Map<String, Object>> selectMailFirstCategoryWithCount(@Param("searchStartTime") String searchStartTime,@Param("searchEndTime") String searchEndTime);
List<Map<String, Object>> selectMailThreeCategoryWithCount(@Param("dept_level") String dept_level,@Param("deptId") String deptId,@Param("deptName") String deptName);
List<Map<String, Object>> selectMailThreeCategoryWithCount(@Param("dept_level") String dept_level,@Param("deptId") String deptId,@Param("deptName") String deptName,@Param("searchStartTime") String searchStartTime,@Param("searchEndTime") String searchEndTime);
}

11
mailbox-lan/src/main/java/com/biutag/lan/service/DataService.java

@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biutag.entity.system.Dept;
import com.biutag.lan.domain.*;
import com.biutag.lan.mapper.*;
import com.biutag.lan.validate.system.DataSearchValidate;
import com.biutag.mapper.system.DeptMapper;
@ -84,7 +83,7 @@ public class DataService extends ServiceImpl<DataMapper, Mail> {
List<Dept> deptslist = null;
List<Map<String,Object>> list = new ArrayList<>();
if (searchValidate.getEasydept()==null||searchValidate.getEasydept().equals("1")){
List<Map<String,Object>> categorylist = baseMapper.selectMailFirstCategoryWithCount();
List<Map<String,Object>> categorylist = baseMapper.selectMailFirstCategoryWithCount(searchValidate.getSearchStartTime(),searchValidate.getSearchEndTime());
int keycount = 1;
Map<String,Object> map = new HashMap<>();
for (Map<String,Object> item :categorylist){
@ -100,7 +99,7 @@ public class DataService extends ServiceImpl<DataMapper, Mail> {
Wrapper wrapper2 = new QueryWrapper<>().eq("level",2);
deptslist = deptMapper.selectPage(page,wrapper2).getRecords();
for(Dept deptItem :deptslist){
List<Map<String,Object>> categorylistforsecond = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName());
List<Map<String,Object>> categorylistforsecond = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName(),searchValidate.getSearchStartTime(), searchValidate.getSearchEndTime());
int count = 1;
Map<String,Object> mapforsecond = new HashMap<>();
for (Map<String,Object> item :categorylistforsecond){
@ -120,7 +119,7 @@ public class DataService extends ServiceImpl<DataMapper, Mail> {
Wrapper wrapper2 = new QueryWrapper<>().eq("level",2);
deptslist = deptMapper.selectPage(page,wrapper2).getRecords();
for(Dept deptItem :deptslist){
List<Map<String,Object>> categorylist = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName());
List<Map<String,Object>> categorylist = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName(), searchValidate.getSearchStartTime(), searchValidate.getSearchEndTime());
int count = 1;
Map<String,Object> map = new HashMap<>();
for (Map<String,Object> item :categorylist){
@ -139,7 +138,7 @@ public class DataService extends ServiceImpl<DataMapper, Mail> {
Wrapper wrapper2 = new QueryWrapper<>().eq("level",2).eq("id",searchValidate.getSdept());
deptslist = deptMapper.selectPage(page,wrapper2).getRecords();
for(Dept deptItem :deptslist){
List<Map<String,Object>> categorylist = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName());
List<Map<String,Object>> categorylist = baseMapper.selectMailCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName(), searchValidate.getSearchStartTime(), searchValidate.getSearchEndTime());
int count = 1;
Map<String,Object> map = new HashMap<>();
for (Map<String,Object> item :categorylist){
@ -156,7 +155,7 @@ public class DataService extends ServiceImpl<DataMapper, Mail> {
Wrapper wrapper3 = new QueryWrapper<>().eq("level",3).eq("pid",searchValidate.getSdept());
deptslist = deptMapper.selectPage(page,wrapper3).getRecords();
for(Dept deptItem :deptslist){
List<Map<String,Object>> categorylist = baseMapper.selectMailThreeCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName());
List<Map<String,Object>> categorylist = baseMapper.selectMailThreeCategoryWithCount(searchValidate.getEasydept(),deptItem.getId().toString(),deptItem.getName(),searchValidate.getSearchStartTime(), searchValidate.getSearchEndTime());
int count = 1;
Map<String,Object> map = new HashMap<>();
for (Map<String,Object> item :categorylist){

12
mailbox-lan/src/main/resources/mapper/DataMapper.xml

@ -210,6 +210,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
1 = 1
and mail.second_dept_id = #{deptId}
<if test="searchStartTime != null and searchEndTime != null">
AND mail.create_time BETWEEN #{searchStartTime} AND #{searchEndTime}
</if>
GROUP BY
mail_first_category, mail.second_dept_name,mail.second_dept_id
) m ON mc.name = m.category
@ -223,7 +226,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
COALESCE(m.countRate, '0%') AS countRate
FROM mail_category mc LEFT JOIN ( SELECT mail_first_category AS category, COUNT(1) AS sumCount,
CONCAT(ROUND(COUNT(1) * 100.0 / (SELECT COUNT(1) FROM mail), 0), '%') AS countRate,(SELECT COUNT(1) FROM mail) as allcount
FROM mail WHERE 1 = 1 GROUP BY mail_first_category) m ON mc.name = m.category WHERE mc.level = 1;
FROM mail WHERE 1 = 1
<if test="searchStartTime != null and searchEndTime != null">
AND mail.create_time BETWEEN #{searchStartTime} AND #{searchEndTime}
</if>
GROUP BY mail_first_category) m ON mc.name = m.category WHERE mc.level = 1;
</select>
@ -246,6 +253,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE
1 = 1
and mail.three_dept_id = #{deptId}
<if test="searchStartTime != null and searchEndTime != null">
AND mail.create_time BETWEEN #{searchStartTime} AND #{searchEndTime}
</if>
GROUP BY
mail_first_category, mail.three_dept_name,mail.three_dept_id
) m ON mc.name = m.category

Loading…
Cancel
Save