ParkingLotGroupDaoImpl.java 2.43 KB
package com.zteits.park.dao.impl;

import com.clouds.common.utils.SequenceUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaoleilu.hutool.util.BeanUtil;
import com.zteits.clouds.api.dto.park.param.parkgroup.ParkingLotGroupSaveReq;
import com.zteits.park.dao.ParkingLotGroupDao;
import com.zteits.park.domain.ParkingLotGroup;
import com.zteits.park.mapper.ParkingLotGroupMapper;
import com.zteits.park.mapper.smapper.ParkingLotGroupSmapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

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

/**
 * Copyright: Copyright (c) 2017  zteits
 *
 * @ClassName: ParkingLotGroupDaoImpl.java
 * @Description:
 * @version: v1.0.0
 * @author: wangfs
 * @date: 2021-04-19 10:57
 * Modification History:
 * Date             Author          Version            Description
 * ---------------------------------------------------------*
 * 2021-04-19     wangfs              v1.0.0               创建
 */
@Component
public class ParkingLotGroupDaoImpl implements ParkingLotGroupDao {


    @Autowired
    private ParkingLotGroupMapper parkingLotGroupMapper;

    @Autowired
    private ParkingLotGroupSmapper parkingLotGroupSmapper;

    @Override
    public Integer saveParkingLotGroup(ParkingLotGroupSaveReq req) {
        int flg =0;
        ParkingLotGroup record = new ParkingLotGroup();
        if(req != null){
            BeanUtil.copyProperties(req,record);
            record.setDataStatus(1);
            record.setParkNum(0);
            flg = parkingLotGroupMapper.insert(record);
        }
        return flg;
    }

    @Override
    public Integer updateParkingLotGroup(ParkingLotGroupSaveReq req) {

        ParkingLotGroup record = new ParkingLotGroup();
        record.setId(req.getId());
        record.setPlGroupName(req.getPlGroupName());
        record.setModfiyEmpid(req.getModfiyEmpid());
        record.setModfiyDate(new Date());
        return parkingLotGroupMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public PageInfo<ParkingLotGroup> queryParkGroupForPage(ParkingLotGroupSaveReq request) {
        //设置分页
        PageHelper.startPage(request.getBaseRequest().getPageNum(),request.getBaseRequest().getPageSize());
        //list
        List<ParkingLotGroup> list = parkingLotGroupSmapper.queryParkLontGroupForList(request);
        return new PageInfo<ParkingLotGroup>(list);
    }
}