ParkBerthAppointmentParkRelDaoImpl.java 4.7 KB
package com.zteits.park.dao.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zteits.clouds.api.dto.park.dto.ParkBerthAppointmentParkRelDTO;
import com.zteits.clouds.api.dto.park.dto.ParkBerthAppointmentParkRelDTO;
import com.zteits.park.domain.ParkBerthAppointmentParkRel;
import com.zteits.park.domain.ParkBerthAppointmentParkRelExample;
import com.zteits.clouds.api.dto.park.param.ParkBerthAppointmentParkRelRequest;
import com.zteits.park.dao.ParkBerthAppointmentParkRelDao;
import com.zteits.park.mapper.ParkBerthAppointmentParkRelMapper;

import com.zteits.park.mapper.smapper.ParkBerthAppointmentParkRelSMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zteits.clouds.api.apibase.constants.DataStatusEnum;

import java.util.Date;
import java.util.List;

@Component
public class ParkBerthAppointmentParkRelDaoImpl implements  ParkBerthAppointmentParkRelDao {
    @Autowired
    private ParkBerthAppointmentParkRelMapper parkBerthAppointmentParkRelMapper;

    @Autowired
    private ParkBerthAppointmentParkRelSMapper parkBerthAppointmentParkRelSMapper;

    @Override
    public int saveParkBerthAppointmentParkRel(ParkBerthAppointmentParkRel parkBerthAppointmentParkRel) {
        if(parkBerthAppointmentParkRel.getCreateTime()==null){
            parkBerthAppointmentParkRel.setCreateTime(new Date());
        }
        return parkBerthAppointmentParkRelMapper.insertSelective(parkBerthAppointmentParkRel);
    }

    @Override
    public int updateByExampleSelective(ParkBerthAppointmentParkRel record, ParkBerthAppointmentParkRelExample example) {
        return parkBerthAppointmentParkRelMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByPrimaryKeySelective(ParkBerthAppointmentParkRel record) {
        return parkBerthAppointmentParkRelMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public List<ParkBerthAppointmentParkRel> selectByExample(ParkBerthAppointmentParkRelExample example) {
        return parkBerthAppointmentParkRelMapper.selectByExample(example);
    }

    @Override
    public ParkBerthAppointmentParkRel queryByPrimaryKey(Long id) {
        return parkBerthAppointmentParkRelMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<ParkBerthAppointmentParkRel> queryParkBerthAppointmentParkRel(ParkBerthAppointmentParkRelRequest request) {
        //TODO 编写smapper实现
        //return parkBerthAppointmentParkRelSMapper.queryParkBerthAppointmentParkRel(request);
        return null;
    }

    @Override
    public int batchDeleteParkBerthAppointmentParkRelByPrimaryKey(List<Long> ids) {
        ParkBerthAppointmentParkRelExample example = new ParkBerthAppointmentParkRelExample();
        example.createCriteria().andIdIn(ids);
        return parkBerthAppointmentParkRelMapper.deleteByExample(example);
    }

    /**
     * 根据appointmentConfigId删除记录
     * @param plNos
     * @return
     */
    @Override
    public int deleteAppointmentParkRelByAppointmentConfigId(List<String> plNos) {
        ParkBerthAppointmentParkRelExample example = new ParkBerthAppointmentParkRelExample();
        example.createCriteria().andPlNoIn(plNos);
        return parkBerthAppointmentParkRelMapper.deleteByExample(example);
    }

    @Override
    public PageInfo<ParkBerthAppointmentParkRelDTO> queryParkBerthAppointmentParkRelForPage(ParkBerthAppointmentParkRelRequest request) {
        PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
        List<ParkBerthAppointmentParkRelDTO> parkBerthAppointmentParkRelDTOS = parkBerthAppointmentParkRelMapper.queryParkBerthAppointmentParkRelForList(request);
        return new  PageInfo<ParkBerthAppointmentParkRelDTO>(parkBerthAppointmentParkRelDTOS);
    }

    @Override
    public List<ParkBerthAppointmentParkRelDTO> queryAppointmentBerthParkList(ParkBerthAppointmentParkRelRequest request) {
        return parkBerthAppointmentParkRelSMapper.queryAppointmentBerthParkList(request);

    }

    /*@Override
    public PageInfo<ParkBerthAppointmentParkRel> queryParkBerthAppointmentParkRelForPage(ParkBerthAppointmentParkRelRequest request) {
        PageHelper.startPage(request.getBaseRequest().getPageNum(), request.getBaseRequest().getPageSize());
        //TODO 编写smapper实现
        *//*List<ParkBerthAppointmentParkRel> list = parkBerthAppointmentParkRelSMapper.queryParkBerthAppointmentParkRel(request);
        if (CollectionUtils.isNotEmpty(list)) {
            return new PageInfo<ParkBerthAppointmentParkRel>(list);
        }*//*
        return new PageInfo<ParkBerthAppointmentParkRel>(new ArrayList<ParkBerthAppointmentParkRel>());
    }*/
}