package com.bonait.bnframework.common.db.util;

import android.database.sqlite.SQLiteDatabase;

import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;

/**
 * @author: liup
 * @description:
 * @date: 2024/6/12 10:27.
 */
public class GoodsUtil {
    /**
     * 删除分类下的商品
     *
     * @param goodtype
     * @return 是否成功
     */
    public static boolean deleteGoodsByTypeId(String goodtype) {
        boolean result = true;
        SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
        long delete = db.delete(BPA_GOODS.class.getSimpleName(), "goodtype=?",
                new String[]{goodtype});
        if(delete <= 0){
            result = false;
        }
        db.close();
        LogUtils.d("deleteGoodsByTypeId 删除分类下的商品 result=" + result);
        return result;
    }
}
