package com.cheng.blzb.ui.fragment.home.zzdb

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.cheng.blzb.R
import com.cheng.blzb.bean.ZZDBInfoEntity

class ZZDBAdapter: BaseQuickAdapter<ZZDBInfoEntity, BaseViewHolder>(R.layout.listitem_zzdb_info) {
    override fun convert(holder: BaseViewHolder, item: ZZDBInfoEntity) {
        holder.setText(R.id.tv_name, item.name)
        holder.setGone(R.id.tv_level1, true)
        holder.setGone(R.id.tv_level2, true)
        holder.setGone(R.id.tv_level3, true)
        item.children.forEach {
            when (it.level) {
                "1" -> {
                    holder.setVisible(R.id.tv_level1, true)
                }
                "2" -> {
                    holder.setVisible(R.id.tv_level2, true)
                }
                "3" -> {
                    holder.setVisible(R.id.tv_level3, true)
                }
            }
        }
    }
}