package ${package.ServiceImpl};

import com.foreverwin.modular.core.util.FrontPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * <p>
 * $!{table.comment} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {


    @Autowired
    private ${table.mapperName} ${table.entityPath}Mapper;

    @Override
    public IPage<${entity}> selectPage(FrontPage<${entity}> frontPage, ${entity} ${table.entityPath}) {
        QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(${table.entityPath});
        return super.page(frontPage.getPagePlus(), queryWrapper);
    }

    @Override
    public List<${entity}> selectList(${entity} ${table.entityPath}) {
        QueryWrapper<${entity}> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(${table.entityPath});
        return super.list(queryWrapper);
    }

#*    /**
     *  公共查询条件
     * @param entityWrapper
     * @return
     */
    public EntityWrapper<${entity}> getEntityWrapper(EntityWrapper<${entity}> entityWrapper, ${entity} ${table.entityPath}){
        //条件拼接
#foreach($field in ${table.fields})
#if(!${field.keyFlag})
        if (StringUtils.isNotBlank(${table.entityPath}.${getprefix}${field.capitalName}())){
            entityWrapper.like(${entity}.${field.name.toUpperCase()}, ${table.entityPath}.${getprefix}${field.capitalName}());
        }
#end
#end
        return entityWrapper;
    }*#
}