LogServiceImpl.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package com.bowintek.practice.services.impl.system;
  2. import com.bowintek.practice.mapper.SysLogMapper;
  3. import com.bowintek.practice.mapper.cquery.SysLogCQuery;
  4. import com.bowintek.practice.model.SysLog;
  5. import com.bowintek.practice.services.service.system.LogService;
  6. import com.bowintek.practice.vo.system.LogModel;
  7. import com.github.pagehelper.PageHelper;
  8. import com.github.pagehelper.PageInfo;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.stereotype.Service;
  11. import java.util.Date;
  12. import java.util.List;
  13. import java.util.UUID;
  14. @Service("logService")
  15. public class LogServiceImpl implements LogService {
  16. @Autowired
  17. private SysLogMapper sysLogMapper;
  18. @Autowired
  19. private SysLogCQuery sysLogCQuery;
  20. @Override
  21. public PageInfo<LogModel> getList(Integer page, Integer rows, String loginID, String userName, Date startDate, Date endDate,List<String> idList){
  22. PageHelper.startPage(page, rows);
  23. List<LogModel> dataList = sysLogCQuery.selectLogList(loginID, userName, startDate,endDate,idList);
  24. PageInfo<LogModel> result = new PageInfo(dataList);
  25. return result;
  26. }
  27. public Integer save(String pageName, String pageUrl, String actionName, String userID) {
  28. try{
  29. SysLog sysLog = new SysLog();
  30. sysLog.setLogID(UUID.randomUUID().toString());
  31. sysLog.setPageName(pageName);
  32. sysLog.setPageUrl(pageUrl);
  33. sysLog.setActionName(actionName);
  34. sysLog.setUserID(userID);
  35. sysLog.setLogTime(new Date());
  36. sysLogMapper.insert(sysLog);
  37. }
  38. catch (Exception ex){
  39. }
  40. return 1;
  41. }
  42. }