/**
 */

package com.sifang.modules.sunshine.SystemSetting.dao;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.sifang.modules.sunshine.SystemSetting.entity.TraderProject;
import com.sifang.modules.sys.common.persistence.BaseDao;
import com.sifang.modules.sys.util.SqlBuilder;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * 代理商授权信息DAO接口
 * @author lzp
 * @version 
 */
@Repository
public class TraderProjectDao extends BaseDao<TraderProject> {

    public List<Record> findTraderProject(String traderId) {
        SqlBuilder sql = new SqlBuilder();
        sql.line("SELECT b.id,b.code,b.name,b.status,");
        sql.line("b.filing_type AS filingType,c.name AS productLineName");
        sql.line("FROM crm_trader_project a");
        sql.line("INNER JOIN crm_project_setting b ON b.id = a.project_id");
        sql.line("INNER JOIN crm_product_line_set c ON c.id = b.product_line_id");
        sql.line("WHERE a.trader_id = ?", traderId);
        return Db.find(sql.build(), sql.params());
    }
}
