You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.5 KiB
Java
48 lines
1.5 KiB
Java
package com.example.duplicate.service.impl;
|
|
|
|
import com.example.duplicate.controller.vo.MessageLogVo;
|
|
import com.example.duplicate.infrastructure.configOneDao.MessageLogMapper;
|
|
import com.example.duplicate.service.MessageLogService;
|
|
import com.example.utils.ListUtilsNew;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
* @ClassName MessageLogServiceImpl
|
|
* @Description 湛江医院接口
|
|
* @Author linjj
|
|
* @Date 2023/10/13 15:19
|
|
* @Version 1.0
|
|
*/
|
|
@Service
|
|
public class MessageLogServiceImpl implements MessageLogService {
|
|
@Autowired
|
|
MessageLogMapper messageLogMapper;
|
|
@Value("${ZJ_DATE_TIME_LOG}")
|
|
private String dateTime;
|
|
@Override
|
|
public int delMessageLog() {
|
|
//查询需要删除数据条数
|
|
int messageLogNum = messageLogMapper.getMessageLogNum(dateTime);
|
|
//需要次数
|
|
double num = ((double) messageLogNum) / 100;
|
|
int circulateNum= (int) Math.ceil(num);
|
|
for (int i=0;i<circulateNum;i++){
|
|
//查询需要删除数据的id每次查100条
|
|
List<MessageLogVo> list = messageLogMapper.getAllByIds(dateTime);
|
|
//id集合
|
|
List<String> idList = ListUtilsNew.distinctSelect(list, MessageLogVo::getId);
|
|
//转成逗号拼接
|
|
String ids = String.join(",", idList);
|
|
messageLogMapper.del(ids);
|
|
}
|
|
return 1;
|
|
}
|
|
|
|
|
|
}
|