package ${package}.${moduleName}.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import ${package}.${moduleName}.model.entity.${className};
import ${package}.${moduleName}.model.vo.${className}VO;
import ${package}.${moduleName}.model.qo.${className}QO;
import ${package}.${moduleName}.mapper.${className}Mapper;
import ${package}.${moduleName}.service.${className}Service;
import org.springframework.stereotype.Service;

/**
 * ${comments}
 *
 * @author ${author}
 * @date ${datetime}
 */
@Service
public class ${className}ServiceImpl extends ServiceImpl<${className}Mapper, ${className}> implements ${className}Service {
    private final static String TABLE_ALIAS_PREFIX = "${tableAlias}.";

    /**
    *  根据QueryObeject查询分页数据
    * @param page 分页参数
    * @param qo 查询参数对象
    * @return  分页数据
    */
    @Override
    public IPage<${className}VO> selectPageVo(IPage<?> page, ${className}QO qo) {
        QueryWrapper<${className}> wrapper = Wrappers.<${className}>query()
                .eq(ObjectUtil.isNotNull(qo.get${pk.caseAttrName}()), TABLE_ALIAS_PREFIX + "${pk.caseAttrName}", qo.get${pk.caseAttrName}());
        return baseMapper.selectPageVo(page, wrapper);
    }

}
