package com.njcn.rdms.module.system.dal.mysql.feedback;

import com.njcn.rdms.framework.common.pojo.PageResult;
import com.njcn.rdms.framework.mybatis.core.mapper.BaseMapperX;
import com.njcn.rdms.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.njcn.rdms.module.system.controller.admin.feedback.vo.FeedbackPageReqVO;
import com.njcn.rdms.module.system.dal.dataobject.feedback.FeedbackDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface FeedbackMapper extends BaseMapperX<FeedbackDO> {

    default PageResult<FeedbackDO> selectPage(FeedbackPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FeedbackDO>()
                .eqIfPresent(FeedbackDO::getType, reqVO.getType())
                .eqIfPresent(FeedbackDO::getStatus, reqVO.getStatus())
                .eqIfPresent(FeedbackDO::getCreator, reqVO.getCreator())
                .likeIfPresent(FeedbackDO::getTitle, reqVO.getTitle())
                .orderByDesc(FeedbackDO::getId));
    }

}
