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.TraderPartner;
import com.sifang.modules.sys.common.persistence.BaseDao;
import com.sifang.modules.sys.util.SqlBuilder;
import liquibase.sql.Sql;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TraderPartnerDao extends BaseDao<TraderPartner> {

    public List<Record> getListByTraderId(String id){
        SqlBuilder builder = new SqlBuilder();
        builder.line(" select t.partner_id as id ,p.`name` as name  from crm_trader_partner  t")
                .line(" inner join crm_partner p on p.id = t.partner_id ")
                .line(" where t.trader_id = ?",id);
        return Db.find(builder.build(),builder.params());
    }

}
