package com.njcn.process.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.process.mapper.RGeneralSurveyPlanDetailMapper;
import com.njcn.process.pojo.param.RGeneralSurveyPlandetailQueryParm;
import com.njcn.process.pojo.po.RGeneralSurveyPlanDetail;
import com.njcn.process.pojo.vo.RGeneralSurveyPlanVO;
import com.njcn.process.service.RGeneralSurveyPlanDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 
 * Description:
 * 接口文档访问地址：http://serverIP:port/swagger-ui.html
 * Date: 2022/11/11  11:28【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Service
public class RGeneralSurveyPlanDetailServiceImpl extends MppServiceImpl<RGeneralSurveyPlanDetailMapper, RGeneralSurveyPlanDetail> implements RGeneralSurveyPlanDetailService{


    private @Autowired
    RGeneralSurveyPlanDetailMapper rGeneralSurveyPlanDetailMapper;
    /**
     * @param rGeneralSurveyPlandetailQueryParm
     * @Description: 根据planNO查询普测计划详情
     * @Param: [rGeneralSurveyPlandetailQueryParm]
     * @return: com.baomidou.mybatisplus.core.metadata.IPage<com.njcn.process.pojo.vo.RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO>
     * @Author: clam
     * @Date: 2022/11/15
     */
    @Override
    public IPage<RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO> queryPlandetail(RGeneralSurveyPlandetailQueryParm rGeneralSurveyPlandetailQueryParm) {

        IPage<RGeneralSurveyPlanDetail> page = new Page<> (rGeneralSurveyPlandetailQueryParm.getCurrentPage(), rGeneralSurveyPlandetailQueryParm.getPageSize());

        LambdaQueryWrapper<RGeneralSurveyPlanDetail> lambdaQueryWrapper = new LambdaQueryWrapper<> ();
        lambdaQueryWrapper.eq (RGeneralSurveyPlanDetail::getPlanNo, rGeneralSurveyPlandetailQueryParm.getPlanNo ());
        IPage<RGeneralSurveyPlanDetail> rGeneralSurveyPlanDetailIPage = rGeneralSurveyPlanDetailMapper.selectPage (page, lambdaQueryWrapper);

        return rGeneralSurveyPlanDetailIPage.convert (temp-> BeanUtil.copyProperties (temp, RGeneralSurveyPlanVO.RGeneralSurveyPlanDetailVO.class));

    }
}
