package com.jzdsh.auto.biz;

import com.jfinal.plugin.activerecord.Page;
import com.jzdsh.auto.model.Owner;
import lombok.extern.log4j.Log4j2;

import java.util.List;

/**
 * @ProjectName: auto
 * @Package: com.jzdsh.auto.biz
 * @ClassName: OwnerService
 * @Author: Jzdsh
 * @Description: 车主服务
 * @Date: 2020/3/21 16:19
 * @Version: 1.0
 */
@Log4j2
public class OwnerService {

    /**
     * 查询推荐的车主服务信息
     *
     * @return
     */
    public List< Owner > getByIsRecommend( ) {
        try {
            return Owner.dao.find("select * from owner where isRecommend = 1 ");
        } catch (Exception e) {
            log.info(e);
        }
        return null;
    }

    public Page< Owner > findAll(int pageNum, int pageSize) {
        try {
            return Owner.dao.paginate(pageNum, pageSize, "select a.*,b.title typeName ", "from owner a,bs_type b where a.typeId = b.id order by sort desc,releaseTime desc");
        } catch (Exception e) {
            log.info("", e);
        }
        return null;
    }
}
