package io.renren.modules.generator.service.impl;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.ApplicationsDao;
import io.renren.modules.generator.entity.ApplicationsEntity;
import io.renren.modules.generator.service.ApplicationsService;


@Service("applicationsService")
public class ApplicationsServiceImpl extends ServiceImpl<ApplicationsDao, ApplicationsEntity> implements ApplicationsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String applicationName=(String) params.get("applicationName");
        String applicationType= (String) params.get("applicationType");
        IPage<ApplicationsEntity> page = this.page(
                new Query<ApplicationsEntity>().getPage(params),
                new QueryWrapper<ApplicationsEntity>()
                .eq(StringUtils.isNotBlank(applicationName),"application_name",applicationName)
                .eq(StringUtils.isNotBlank(applicationType),"application_type",applicationType)
        );

        return new PageUtils(page);
    }

}