package com.cy.guoyan.admin.module.ai.dal.mysql.chatapp;

import com.cy.guoyan.admin.framework.common.pojo.PageResult;
import com.cy.guoyan.admin.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.cy.guoyan.admin.framework.mybatis.core.mapper.BaseMapperX;
import com.cy.guoyan.admin.module.ai.controller.admin.chatapp.vo.ChatAppPageReqVO;
import com.cy.guoyan.admin.module.ai.dal.dataobject.chatapp.ChatAppDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * AI 应用 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface ChatAppMapper extends BaseMapperX<ChatAppDO> {

    default PageResult<ChatAppDO> selectPage(ChatAppPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ChatAppDO>()
                .betweenIfPresent(ChatAppDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(ChatAppDO::getAppName, reqVO.getAppName())
                .eqIfPresent(ChatAppDO::getAppKey, reqVO.getAppKey())
                .eqIfPresent(ChatAppDO::getAppType, reqVO.getAppType())
                .orderByDesc(ChatAppDO::getId));
    }

}