案件统计需求修改。
新增本年处理案件
This commit is contained in:
parent
256a073e8a
commit
b96e254bcb
@ -33,6 +33,7 @@ import com.cm.systemcity.service.reportcase.IReportCaseService;
|
|||||||
import com.cm.systemcity.service.userlocation.IUserLocationService;
|
import com.cm.systemcity.service.userlocation.IUserLocationService;
|
||||||
import com.cm.systemcity.service.userpoints.IUserPointsService;
|
import com.cm.systemcity.service.userpoints.IUserPointsService;
|
||||||
import com.cm.systemcity.utils.BigDataResult;
|
import com.cm.systemcity.utils.BigDataResult;
|
||||||
|
import com.cm.systemcity.utils.BigDataResult2;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
@ -45,6 +46,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 网格治理对外提供数据接口类
|
* 网格治理对外提供数据接口类
|
||||||
@ -67,6 +69,8 @@ public class DataReleaseController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IReportCaseService reportCaseService;
|
private IReportCaseService reportCaseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
private IReportCaseDao reportCaseDao;
|
||||||
|
@Autowired
|
||||||
private IUserLocationService userLocationService;
|
private IUserLocationService userLocationService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUserPointsService userPointsService;
|
private IUserPointsService userPointsService;
|
||||||
@ -1205,4 +1209,73 @@ public class DataReleaseController extends AbstractController {
|
|||||||
return userPointsService.listUserAndPointsByUserIdsByGridService(params);
|
return userPointsService.listUserAndPointsByUserIdsByGridService(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "本年案件处理情况", notes = "本年案件处理情况")
|
||||||
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
|
@GetMapping("get-case-handle-year")
|
||||||
|
public BigDataResult2 getCaseHandleYear() {
|
||||||
|
Map<String, Object> reqParams = requestParams();
|
||||||
|
// 查询所有网格员
|
||||||
|
List<CommunityBossDTO> communityBossDTOS = communityBossService.listCommunityBoss(reqParams);
|
||||||
|
List<String> bossList = communityBossDTOS.stream()
|
||||||
|
.map(CommunityBossDTO::getCommunityBossUserId).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 获取当前年份
|
||||||
|
Calendar calendar = Calendar.getInstance();
|
||||||
|
int year = calendar.get(Calendar.YEAR);
|
||||||
|
|
||||||
|
// 查询所有的专管员(ID: bc405346-8714-4ded-89ac-9cc4d755f66a)
|
||||||
|
reqParams.put("roleId", "bc405346-8714-4ded-89ac-9cc4d755f66a");
|
||||||
|
List<Map<String, Object>> roleUserMap = communityBossService.getRoleUser(reqParams);
|
||||||
|
List<String> roleList = roleUserMap.stream()
|
||||||
|
.map(map -> map.get("userId").toString()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
BigDataResult2 bdr = new BigDataResult2();
|
||||||
|
List<BigDataResult2.CountClass> countClassList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 获取所有网格员处理数
|
||||||
|
final int batchSize = 5000;
|
||||||
|
for (int i = 1; i <= 12; i++) {
|
||||||
|
int start = 0;
|
||||||
|
int totalHandleCount1 = 0;
|
||||||
|
int totalHandleCount2 = 0;
|
||||||
|
String time = year + "-" + i;
|
||||||
|
if (i < 10) {
|
||||||
|
time = year + "-0" + i;
|
||||||
|
}
|
||||||
|
|
||||||
|
reqParams.put("time", time);
|
||||||
|
|
||||||
|
while (start < bossList.size()) {
|
||||||
|
int end = Math.min(start + batchSize, bossList.size());
|
||||||
|
List<String> batchBossIds = bossList.subList(start, end);
|
||||||
|
|
||||||
|
reqParams.put("bossIds", batchBossIds);
|
||||||
|
Integer count = reportCaseDao.handleCountData(reqParams);
|
||||||
|
|
||||||
|
totalHandleCount1 += count;
|
||||||
|
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
start = 0;
|
||||||
|
|
||||||
|
while (start < roleList.size()) {
|
||||||
|
int end = Math.min(start + batchSize, roleList.size());
|
||||||
|
List<String> batchUserIds = roleList.subList(start, end);
|
||||||
|
|
||||||
|
reqParams.put("bossIds", batchUserIds);
|
||||||
|
Integer count = reportCaseDao.handleCountData(reqParams);
|
||||||
|
|
||||||
|
totalHandleCount2 += count;
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDataResult2.CountClass class1 = new BigDataResult2.CountClass(time, totalHandleCount1, totalHandleCount2);
|
||||||
|
countClassList.add(class1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bdr.setCountClass(countClassList);
|
||||||
|
return bdr;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -232,4 +232,6 @@ public interface ICommunityBossDao {
|
|||||||
List<Map<String, Object>> listGridUser(Map<String, Object> query);
|
List<Map<String, Object>> listGridUser(Map<String, Object> query);
|
||||||
|
|
||||||
void deleteCommunityAndGridUserBind(Map<String, Object> query);
|
void deleteCommunityAndGridUserBind(Map<String, Object> query);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getRoleUser(Map<String, Object> reqParams);
|
||||||
}
|
}
|
||||||
|
@ -390,4 +390,12 @@ public interface IReportCaseDao {
|
|||||||
List<Map<String, Object>> allCountData(Map<String, Object> params);
|
List<Map<String, Object>> allCountData(Map<String, Object> params);
|
||||||
|
|
||||||
Integer handleCountData(Map<String, Object> params);
|
Integer handleCountData(Map<String, Object> params);
|
||||||
|
|
||||||
|
Integer queryCountWithTempTable(Map<String, Object> params);
|
||||||
|
|
||||||
|
void createTempTable(Map<String, Object> params);
|
||||||
|
|
||||||
|
void insertIntoTempTable(Map<String, Object> params);
|
||||||
|
|
||||||
|
void cleanUpTempTable();
|
||||||
}
|
}
|
||||||
|
@ -230,4 +230,6 @@ public interface ICommunityBossService {
|
|||||||
List<CommunityBossDTO> listGridUser(Map<String, Object> params);
|
List<CommunityBossDTO> listGridUser(Map<String, Object> params);
|
||||||
|
|
||||||
List<CommunityBossDTO> listCommunityBossByLevel(int level);
|
List<CommunityBossDTO> listCommunityBossByLevel(int level);
|
||||||
|
|
||||||
|
List<Map<String, Object>> getRoleUser(Map<String, Object> reqParams);
|
||||||
}
|
}
|
||||||
|
@ -721,4 +721,9 @@ public class CommunityBossServiceImpl extends AbstractService implements ICommun
|
|||||||
List<Map<String, Object>> nPeopleList = communityBossDao.listNPeopleByRoleId(roleId);
|
List<Map<String, Object>> nPeopleList = communityBossDao.listNPeopleByRoleId(roleId);
|
||||||
return nPeopleList;
|
return nPeopleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getRoleUser(Map<String, Object> reqParams) {
|
||||||
|
return communityBossDao.getRoleUser(reqParams);
|
||||||
|
}
|
||||||
}
|
}
|
@ -2202,8 +2202,30 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
}
|
}
|
||||||
|
|
||||||
params.put("caseIds", caseIdList);
|
params.put("caseIds", caseIdList);
|
||||||
Integer i = reportCaseDao.handleCountData(params);
|
/*Integer i = reportCaseDao.handleCountData(params);
|
||||||
caseCountDTOList.get(0).setHandleCount(i.toString());
|
caseCountDTOList.get(0).setHandleCount(i.toString());*/
|
||||||
|
|
||||||
|
final int batchSize = 5000;
|
||||||
|
int start = 0;
|
||||||
|
int totalHandleCount = 0;
|
||||||
|
while (start < caseIdList.size()) {
|
||||||
|
int end = Math.min(start + batchSize, caseIdList.size());
|
||||||
|
List<String> batchCaseIds = caseIdList.subList(start, end);
|
||||||
|
|
||||||
|
params.put("caseIds", batchCaseIds);
|
||||||
|
/* reportCaseDao.createTempTable(params);
|
||||||
|
reportCaseDao.insertIntoTempTable(params);
|
||||||
|
Integer i1 = reportCaseDao.queryCountWithTempTable(params);
|
||||||
|
reportCaseDao.cleanUpTempTable();*/
|
||||||
|
Integer i1 = reportCaseDao.handleCountData(params);
|
||||||
|
totalHandleCount += i1;
|
||||||
|
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新DTO
|
||||||
|
caseCountDTOList.get(0).setHandleCount(String.valueOf(totalHandleCount));
|
||||||
|
|
||||||
return caseCountDTOList;
|
return caseCountDTOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2251,7 +2273,7 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String key : caseIdMap.keySet()) {
|
/*for (String key : caseIdMap.keySet()) {
|
||||||
params.put("caseIds", caseIdMap.get(key));
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
Integer i = reportCaseDao.handleCountData(params);
|
Integer i = reportCaseDao.handleCountData(params);
|
||||||
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
@ -2259,6 +2281,32 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseCountDTO.setHandleCount(i.toString());
|
caseCountDTO.setHandleCount(i.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (String key : caseIdMap.keySet()) {
|
||||||
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
|
final int batchSize = 5000;
|
||||||
|
int start = 0;
|
||||||
|
int totalHandleCount = 0;
|
||||||
|
while (start < caseIdMap.get(key).size()) {
|
||||||
|
int end = Math.min(start + batchSize, caseIdMap.get(key).size());
|
||||||
|
List<String> batchCaseIds = caseIdMap.get(key).subList(start, end);
|
||||||
|
|
||||||
|
params.put("caseIds", batchCaseIds);
|
||||||
|
/* reportCaseDao.createTempTable(params);
|
||||||
|
reportCaseDao.insertIntoTempTable(params);
|
||||||
|
Integer i1 = reportCaseDao.queryCountWithTempTable(params);
|
||||||
|
reportCaseDao.cleanUpTempTable();*/
|
||||||
|
Integer i1 = reportCaseDao.handleCountData(params);
|
||||||
|
totalHandleCount += i1;
|
||||||
|
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
|
if (key.equals(caseCountDTO.getDataId())) {
|
||||||
|
caseCountDTO.setHandleCount(String.valueOf(totalHandleCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caseCountDTOList;
|
return caseCountDTOList;
|
||||||
@ -2310,7 +2358,7 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String key : caseIdMap.keySet()) {
|
/*for (String key : caseIdMap.keySet()) {
|
||||||
params.put("caseIds", caseIdMap.get(key));
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
Integer i = reportCaseDao.handleCountData(params);
|
Integer i = reportCaseDao.handleCountData(params);
|
||||||
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
@ -2318,6 +2366,32 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseCountDTO.setHandleCount(i.toString());
|
caseCountDTO.setHandleCount(i.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (String key : caseIdMap.keySet()) {
|
||||||
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
|
final int batchSize = 5000;
|
||||||
|
int start = 0;
|
||||||
|
int totalHandleCount = 0;
|
||||||
|
while (start < caseIdMap.get(key).size()) {
|
||||||
|
int end = Math.min(start + batchSize, caseIdMap.get(key).size());
|
||||||
|
List<String> batchCaseIds = caseIdMap.get(key).subList(start, end);
|
||||||
|
|
||||||
|
params.put("caseIds", batchCaseIds);
|
||||||
|
/* reportCaseDao.createTempTable(params);
|
||||||
|
reportCaseDao.insertIntoTempTable(params);
|
||||||
|
Integer i1 = reportCaseDao.queryCountWithTempTable(params);
|
||||||
|
reportCaseDao.cleanUpTempTable();*/
|
||||||
|
Integer i1 = reportCaseDao.handleCountData(params);
|
||||||
|
totalHandleCount += i1;
|
||||||
|
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
|
if (key.equals(caseCountDTO.getDataId())) {
|
||||||
|
caseCountDTO.setHandleCount(String.valueOf(totalHandleCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caseCountDTOList;
|
return caseCountDTOList;
|
||||||
@ -2365,7 +2439,7 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
caseIdMap.put(caseCountDTO.getDataId(), caseIdList);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String key : caseIdMap.keySet()) {
|
/*for (String key : caseIdMap.keySet()) {
|
||||||
params.put("caseIds", caseIdMap.get(key));
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
Integer i = reportCaseDao.handleCountData(params);
|
Integer i = reportCaseDao.handleCountData(params);
|
||||||
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
@ -2373,6 +2447,32 @@ public class ReportCaseServiceImpl extends BaseService implements IReportCaseSer
|
|||||||
caseCountDTO.setHandleCount(i.toString());
|
caseCountDTO.setHandleCount(i.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
for (String key : caseIdMap.keySet()) {
|
||||||
|
params.put("caseIds", caseIdMap.get(key));
|
||||||
|
final int batchSize = 5000;
|
||||||
|
int start = 0;
|
||||||
|
int totalHandleCount = 0;
|
||||||
|
while (start < caseIdMap.get(key).size()) {
|
||||||
|
int end = Math.min(start + batchSize, caseIdMap.get(key).size());
|
||||||
|
List<String> batchCaseIds = caseIdMap.get(key).subList(start, end);
|
||||||
|
|
||||||
|
params.put("caseIds", batchCaseIds);
|
||||||
|
/* reportCaseDao.createTempTable(params);
|
||||||
|
reportCaseDao.insertIntoTempTable(params);
|
||||||
|
Integer i1 = reportCaseDao.queryCountWithTempTable(params);
|
||||||
|
reportCaseDao.cleanUpTempTable();*/
|
||||||
|
Integer i1 = reportCaseDao.handleCountData(params);
|
||||||
|
totalHandleCount += i1;
|
||||||
|
|
||||||
|
start += batchSize;
|
||||||
|
}
|
||||||
|
for (CaseCountDTO caseCountDTO : caseCountDTOList) {
|
||||||
|
if (key.equals(caseCountDTO.getDataId())) {
|
||||||
|
caseCountDTO.setHandleCount(String.valueOf(totalHandleCount));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return caseCountDTOList;
|
return caseCountDTOList;
|
||||||
|
101
src/main/java/com/cm/systemcity/utils/BigDataResult2.java
Normal file
101
src/main/java/com/cm/systemcity/utils/BigDataResult2.java
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
package com.cm.systemcity.utils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class BigDataResult2 {
|
||||||
|
|
||||||
|
private List<CountClass> countClass;
|
||||||
|
|
||||||
|
private String msg = "加载成功";
|
||||||
|
|
||||||
|
private String state = "200";
|
||||||
|
|
||||||
|
public List<CountClass> getCountClass() {
|
||||||
|
if(null == countClass) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
return countClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountClass(List<CountClass> countClass) {
|
||||||
|
this.countClass = countClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BigDataResult2 getInstance() {
|
||||||
|
return new BigDataResult2();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMsg() {
|
||||||
|
return msg == null ? "" : msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMsg(String msg) {
|
||||||
|
this.msg = msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getState() {
|
||||||
|
return state == null ? "" : state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setState(String state) {
|
||||||
|
this.state = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRatio(Double val1, Double val2, int decimal){
|
||||||
|
if(val2 == 0d || val1 == 0d){
|
||||||
|
return new BigDecimal(0);
|
||||||
|
}
|
||||||
|
BigDecimal ratioDecimal = new BigDecimal(( val1 / val2 ) * 100);
|
||||||
|
ratioDecimal.setScale(decimal,BigDecimal.ROUND_HALF_UP);
|
||||||
|
return ratioDecimal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String lastMonth() {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
today = today.minusMonths(1);
|
||||||
|
DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM");
|
||||||
|
return formatters.format(today);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class CountClass {
|
||||||
|
private String dateTime;
|
||||||
|
private Integer bossCount;
|
||||||
|
private Integer zgyCount;
|
||||||
|
|
||||||
|
public CountClass(String dateTime, Integer bossCount, Integer zgyCount) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
this.bossCount = bossCount;
|
||||||
|
this.zgyCount = zgyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDateTime() {
|
||||||
|
return dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDateTime(String dateTime) {
|
||||||
|
this.dateTime = dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getBossCount() {
|
||||||
|
return bossCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBossCount(Integer bossCount) {
|
||||||
|
this.bossCount = bossCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getZgyCount() {
|
||||||
|
return zgyCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZgyCount(Integer zgyCount) {
|
||||||
|
this.zgyCount = zgyCount;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -71,6 +71,10 @@
|
|||||||
<result column="community_boss_id" property="communityBossId"/>
|
<result column="community_boss_id" property="communityBossId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="userMap" type="java.util.Map">
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
<!-- 新增网格长 -->
|
<!-- 新增网格长 -->
|
||||||
<insert id="saveCommunityBoss" parameterType="map" flushCache="true">
|
<insert id="saveCommunityBoss" parameterType="map" flushCache="true">
|
||||||
INSERT INTO city_community_boss(
|
INSERT INTO city_community_boss(
|
||||||
@ -703,4 +707,8 @@
|
|||||||
DELETE FROM city_community_boss_community where community_boss_id = #{communityBossId}
|
DELETE FROM city_community_boss_community where community_boss_id = #{communityBossId}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getRoleUser" parameterType="map" resultMap="userMap">
|
||||||
|
SELECT user_id FROM sys_role_user WHERE role_id = #{roleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -2301,12 +2301,40 @@
|
|||||||
WHERE
|
WHERE
|
||||||
creator <![CDATA[ <> ]]> '1'
|
creator <![CDATA[ <> ]]> '1'
|
||||||
AND is_delete = 0
|
AND is_delete = 0
|
||||||
|
<if test="time != null and time != ''">
|
||||||
|
AND LEFT(gmt_create, 7) = #{time}
|
||||||
|
</if>
|
||||||
<if test="caseIds != null and caseIds.size > 0">
|
<if test="caseIds != null and caseIds.size > 0">
|
||||||
AND case_id IN
|
AND case_id IN
|
||||||
<foreach collection="caseIds" index="index" open="(" separator="," close=")">
|
<foreach collection="caseIds" index="index" open="(" separator="," close=")">
|
||||||
#{caseIds[${index}]}
|
#{caseIds[${index}]}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="bossIds != null and bossIds.size > 0">
|
||||||
|
AND creator IN
|
||||||
|
<foreach collection="bossIds" index="index" open="(" separator="," close=")">
|
||||||
|
#{bossIds[${index}]}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!-- 创建临时表 -->
|
||||||
|
<insert id="createTempTable" parameterType="map">
|
||||||
|
CREATE TEMPORARY TABLE temp_table (case_id VARCHAR(36));
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="insertIntoTempTable" parameterType="map">
|
||||||
|
INSERT INTO temp_table (case_id) VALUES
|
||||||
|
<foreach item="caseId" index="index" collection="caseIds" separator=",">
|
||||||
|
(#{caseId})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="queryCountWithTempTable" parameterType="map" resultType="java.lang.Integer">
|
||||||
|
SELECT COUNT(*)
|
||||||
|
FROM city_report_case_handle t1 JOIN temp_table ON t1.case_id = temp_table.case_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<delete id="cleanUpTempTable">DROP TEMPORARY TABLE temp_table</delete>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
Loading…
Reference in New Issue
Block a user