ShopService/src/main/java/com/java110/shop/dao/impl/ShopServiceDaoImpl.java
@@ -1,9 +1,9 @@
package com.java110.shop.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.common.constant.ResponseConstant;
import com.java110.common.exception.DAOException;
import com.java110.common.util.DateUtil;
import com.java110.utils.constant.ResponseConstant;
import com.java110.utils.exception.DAOException;
import com.java110.utils.util.DateUtil;
import com.java110.core.base.dao.BaseServiceDao;
import com.java110.shop.dao.IShopServiceDao;
import org.slf4j.Logger;
@@ -128,6 +128,23 @@
    }
    /**
     * 保存商品目录
     * @param businessShopCatalog 商品目录
     * @throws DAOException
     */
    @Override
    public void saveBusinessShopCatalog(Map businessShopCatalog) throws DAOException {
        businessShopCatalog.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品目录信息 入参 businessShopCatalog : {}",businessShopCatalog);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBusinessShopCatalog",businessShopCatalog);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录数据失败:"+ JSONObject.toJSONString(businessShopCatalog));
        }
    }
    /**
     * 查询商品信息
     * @param info bId 信息
     * @return 商品信息
@@ -236,6 +253,26 @@
        return businessShopDesces.get(0);
    }
    /**
     * 查询商品目录
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBusinessShopCatalog(Map info) throws DAOException {
        logger.debug("查询商品证件信息 入参 info : {}",info);
        List<Map> businessShopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBusinessShopCatalog",info);
        if(businessShopCatalogs == null){
            return null;
        }
        if(businessShopCatalogs.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:businessShopCatalogs,"+ JSONObject.toJSONString(info));
        }
        return businessShopCatalogs.get(0);
    }
    /**
     * 保存商品信息 到 instance
@@ -310,6 +347,52 @@
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品证件信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    @Override
    public void saveShopCatalogInstance(Map info) throws DAOException {
        logger.debug("保存商品目录信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveShopCatalogInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 保存购买记录
     * @param businessBuyShop
     * @throws DAOException
     */
    @Override
    public void saveBuyShopInstance(Map businessBuyShop) throws DAOException {
        businessBuyShop.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品购买记录信息 入参 businessBuyShop : {}",businessBuyShop);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBuyShopInstance",businessBuyShop);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品购买记录数据失败:"+ JSONObject.toJSONString(businessBuyShop));
        }
    }
    /**
     * 购买商品属性保存
     * @param businessBuyShopAttr
     * @throws DAOException
     */
    @Override
    public void saveBuyShopAttrInstance(Map businessBuyShopAttr) throws DAOException {
        businessBuyShopAttr.put("month", DateUtil.getCurrentMonth());
        logger.debug("保存商品购买记录属性信息 入参 businessBuyShopAttr : {}",businessBuyShopAttr);
        int saveFlag = sqlSessionTemplate.insert("shopServiceDaoImpl.saveBuyShopAttrInstance",businessBuyShopAttr);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存商品购买记录属性数据失败:"+ JSONObject.toJSONString(businessBuyShopAttr));
        }
    }
@@ -419,6 +502,60 @@
        return shopDesces.get(0);
    }
    /**
     * 商品目录查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getShopCatalog(Map info) throws DAOException {
        logger.debug("查询商品目录信息 入参 info : {}",info);
        List<Map> shopCatalogs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getShopCatalog",info);
        if(shopCatalogs == null || shopCatalogs.size() == 0){
            return null;
        }
        if(shopCatalogs.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
        }
        return shopCatalogs.get(0);
    }
    /**
     * 商品描述查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public Map getBuyShop(Map info) throws DAOException {
        logger.debug("查询商品购买信息 入参 info : {}",info);
        List<Map> getBuyShops = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBuyShop",info);
        if(getBuyShops == null || getBuyShops.size() == 0){
            return null;
        }
        if(getBuyShops.size() >1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"根据条件查询有多条数据,数据异常,请检查:getShopCatalog,"+ JSONObject.toJSONString(info));
        }
        return getBuyShops.get(0);
    }
    /**
     * 商品属性查询(instance)
     * @param info bId 信息
     * @return
     * @throws DAOException
     */
    @Override
    public List<Map> getBuyShopAttrs(Map info) throws DAOException {
        logger.debug("查询商品购买属性信息 入参 info : {}",info);
        List<Map> buyShopAttrs = sqlSessionTemplate.selectList("shopServiceDaoImpl.getBuyShopAttrs",info);
        return buyShopAttrs;
    }
    /**
     * 修改商品信息
@@ -515,4 +652,52 @@
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品描述信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品描述信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateShopCatalogInstance(Map info) throws DAOException {
        logger.debug("修改商品目录信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateShopCatalogInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品目录信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品购买信息
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateBuyShopInstance(Map info) throws DAOException {
        logger.debug("修改商品购买信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateBuyShopInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品购买信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
    /**
     * 修改商品购买属性信息(instance)
     * @param info 修改信息
     * @throws DAOException
     */
    @Override
    public void updateBuyShopAttrInstance(Map info) throws DAOException {
        logger.debug("修改商品购买属性信息Instance 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("shopServiceDaoImpl.updateBuyShopAttrInstance",info);
        if(saveFlag < 1){
            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改商品购买属性信息Instance数据失败:"+ JSONObject.toJSONString(info));
        }
    }
}