package com.zteits.park.dao.impl; import org.apache.commons.collections4.CollectionUtils; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.zteits.clouds.api.apibase.constants.DataStatusEnum; import com.zteits.clouds.api.dto.park.param.ParkingLotExtendQueryRequest; import com.zteits.clouds.api.dto.park.param.ParkingLotExtendRequest; import com.zteits.park.dao.ParkingLotExtendDao; import com.zteits.park.domain.ParkingLotExtend; import com.zteits.park.domain.ParkingLotExtendExample; import com.zteits.park.mapper.ParkingLotExtendMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.Date; import java.util.List; @Component public class ParkingLotExtendDaoImpl implements ParkingLotExtendDao { @Autowired private ParkingLotExtendMapper parkingLotExtendMapper; @Override public int deleteParkingLotExtendByPrimaryKey(Long id, String opId, String opName) { ParkingLotExtend record = new ParkingLotExtend(); record.setId(id); record.setDataStatus(DataStatusEnum.DATA_STATUS_NO_VALID.value()); record.setModifyOp(opId); record.setModifyTime(new Date()); return parkingLotExtendMapper.updateByPrimaryKeySelective(record); } @Override public int saveParkingLotExtend(ParkingLotExtend parkingLotExtend) { if(parkingLotExtend.getCreateTime()==null){ parkingLotExtend.setCreateTime(new Date()); } return parkingLotExtendMapper.insertSelective(parkingLotExtend); } @Override public int updateByExampleSelective(ParkingLotExtend record, ParkingLotExtendExample example) { return parkingLotExtendMapper.updateByExampleSelective(record,example); } @Override public int updateByPrimaryKeySelective(ParkingLotExtend record) { return parkingLotExtendMapper.updateByPrimaryKeySelective(record); } @Override public List selectByExample(ParkingLotExtendExample example) { return parkingLotExtendMapper.selectByExample(example); } @Override public ParkingLotExtend queryByPrimaryKey(Long id) { return parkingLotExtendMapper.selectByPrimaryKey(id); } @Override public List queryParkingLotExtend(ParkingLotExtendQueryRequest request) { ParkingLotExtendExample example = new ParkingLotExtendExample(); example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value()) .andPlNoIn(request.getPlNos()); List list = parkingLotExtendMapper.selectByExample(example); return list; } @Override public int batchDeleteParkingLotExtendByPrimaryKey(List ids, String opId, String opName) { ParkingLotExtend record = new ParkingLotExtend(); //where条件 ParkingLotExtendExample example = new ParkingLotExtendExample(); example.createCriteria().andIdIn(ids); return parkingLotExtendMapper.updateByExampleSelective(record,example); } @Override public PageInfo queryParkingLotExtendForPage(ParkingLotExtendQueryRequest request) { PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize()); ParkingLotExtendExample example = new ParkingLotExtendExample(); example.createCriteria().andDataStatusEqualTo(DataStatusEnum.DATA_STATUS_VALID.value()) .andPlNoIn(request.getPlNos()); List list = parkingLotExtendMapper.selectByExample(example); if (CollectionUtils.isNotEmpty(list)) { return new PageInfo(list); } return new PageInfo(new ArrayList()); } }