package com.org.hktshop.Dao.Impl;

import com.org.hktshop.Dao.Intface.IGoodsAttrItemDao;
import com.org.hktshop.base.BaseDaoJdbc;
import com.org.hktshop.entity.product.HktGoodsAttrItem;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class HktGoodsAttrItemImpl extends BaseDaoJdbc<HktGoodsAttrItem> implements IGoodsAttrItemDao {
    @Override
    public List<HktGoodsAttrItem> queryLists(String k3id) {

        String sql = "select attr.id as id,attr.language_id as languageId,attr.attr_value as attrValue, hgca.sort as sort," +
                " case attr.language_id when 1 then hgca.name_ch when 2 then hgca.name_en else hgca.name_en end attrId " +
                " from hkt_goods_attr attr left join hkt_goods_category_attr hgca on attr.category_id = hgca.category_id and attr.attr_id = hgca.id" +
                " where  attr.goods_id = '" + k3id + "'";
        List<HktGoodsAttrItem> list = this.queryList(sql, new HktGoodsAttrItem());
        return list;
    }
}
