package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import com.xunmei.common.core.web.domain.AjaxResult;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import static com.xunmei.common.core.web.domain.AjaxResult.success;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**
 * <p>
 * ${table.comment!} 服务实现类
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
@Service
<#if kotlin>
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

}
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

    @Override
    public AjaxResult findListByPage(Page<${entity}> page,${entity} ${entity?uncap_first}){
    QueryWrapper<${entity}> where = new QueryWrapper<>(${entity?uncap_first});
        return success(baseMapper.selectPage(page,where));
    }

    @Override
    public AjaxResult add(${entity} ${entity?uncap_first}){
        return success(baseMapper.insert(${entity?uncap_first}));
    }

    @Override
    public AjaxResult delete(Long id){
        return success(baseMapper.deleteById(id));
    }

    @Override
    public AjaxResult updateData(${entity} ${entity?uncap_first}){
        return success(baseMapper.updateById(${entity?uncap_first}));
    }

    @Override
    public AjaxResult findById(Long id){
        return success(baseMapper.selectById(id));
    }
}
</#if>
