优化删除日志功能
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,6 +55,19 @@ public class PersonService {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Person> getPersonListByIds(String ids)throws Exception {
|
||||
List<Long> idList = StringUtil.strToLongList(ids);
|
||||
List<Person> list = new ArrayList<>();
|
||||
try{
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andIdIn(idList);
|
||||
list = personMapper.selectByExample(example);
|
||||
}catch(Exception e){
|
||||
JshException.readFail(logger, e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<Person> getPerson()throws Exception {
|
||||
PersonExample example = new PersonExample();
|
||||
example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||
@@ -190,8 +204,13 @@ public class PersonService {
|
||||
|
||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||
public int batchDeletePersonByIds(String ids)throws Exception {
|
||||
logService.insertLog("经手人",
|
||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(BusinessConstants.LOG_OPERATION_TYPE_DELETE);
|
||||
List<Person> list = getPersonListByIds(ids);
|
||||
for(Person person: list){
|
||||
sb.append("[").append(person.getName()).append("]");
|
||||
}
|
||||
logService.insertLog("经手人", sb.toString(),
|
||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||
User userInfo=userService.getCurrentUser();
|
||||
String [] idArray=ids.split(",");
|
||||
|
||||
Reference in New Issue
Block a user