| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.dto.HomeCtlGroupDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.LockCtlLogMapper; |
| | | import com.whyc.mapper.LockInfMapper; |
| | | import com.whyc.pojo.db_area.AreaUser; |
| | | import com.whyc.pojo.db_area.LockInf; |
| | | import com.whyc.pojo.db_lock_ram.LockCtlLog; |
| | | import com.whyc.pojo.db_user.UserInf; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class LockCtlLogService { |
| | | @Autowired(required = false) |
| | | private LockCtlLogMapper mapper; |
| | | |
| | | @Autowired(required = false) |
| | | private LockInfMapper linfmapper; |
| | | |
| | | //查询开锁日志 |
| | | public Response getLockLog(LockCtlLog log, int pageNum, int pageSize) { |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | QueryWrapper wrapper=new QueryWrapper(); |
| | | if(log.getLockId()!=null){ |
| | | wrapper.eq("lock_id",log.getLockId()); |
| | | } |
| | | if(log.getCtlResult()!=null){ |
| | | wrapper.eq("ctl_result",log.getCtlResult()); |
| | | } |
| | | if(log.getCtlType()!=null){ |
| | | wrapper.eq("ctl_type",log.getCtlType()); |
| | | } |
| | | if(log.getCtlUname()!=null){ |
| | | wrapper.eq("ctl_uname",log.getCtlUname()); |
| | | } |
| | | if(log.getStartTime()!=null){ |
| | | wrapper.gt("ctl_time",log.getStartTime()); |
| | | } |
| | | if(log.getEndTime()!=null){ |
| | | wrapper.lt("ctl_time",log.getEndTime()); |
| | | } |
| | | wrapper.orderByDesc("ctl_time"); |
| | | List<LockCtlLog> list=mapper.selectList(wrapper); |
| | | for (LockCtlLog l:list) { |
| | | QueryWrapper wrapper1=new QueryWrapper(); |
| | | wrapper1.eq("lock_id",l.getLockId()); |
| | | wrapper1.last("limit 1"); |
| | | LockInf linf=linfmapper.selectOne(wrapper1); |
| | | l.setLockName(linf.getLockName()); |
| | | } |
| | | PageInfo pageInfo=new PageInfo(list); |
| | | return new Response().setII(1,list!=null,pageInfo,"查询最近的开锁日志"); |
| | | } |
| | | //获取开锁错误的日志 |
| | | public List getAllErrorLog(List lockIds) { |
| | | List<LockCtlLog> list=mapper.getAllErrorLog(lockIds); |