admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/SuperGoodsClassServiceImpl.java
@@ -1,82 +1,82 @@
package com.yeshi.fanli.service.impl.goods;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
@Service
public class SuperGoodsClassServiceImpl implements SuperGoodsClassService {
   @Resource
   private SuperGoodsClassMapper superGoodsClassMapper;
   @Resource
   private BusinessSystemService businessSystemService;
   @Override
   @Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id")
   public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) {
      return superGoodsClassMapper.listBySystemId(id);
   }
   @Override
   public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) {
      if (gcIdList == null || gcIdList.size() == 0) {
         return new ArrayList<SuperGoodsClass>();
      }
      return superGoodsClassMapper.listByGoodsclassIds(gcIdList);
   }
   @Override
   public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start,   int count, String key) {
      return superGoodsClassMapper.listBySystemIdAmdClassName(start, count, key, id);
   }
   @Override
   public Integer deleteSuperGoodsClass(final long gcid, final String platform, final String packageName) {
      BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName,null);
      if (system == null) {
         return 0;
      }
      return superGoodsClassMapper.deleteBySystemIdAndClassId(gcid, system.getId());
   }
   @Override
   public void addSuperGoodsClass(long gcid, String platform, String packageName) {
      BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName,null);
      GoodsClass goodsClass = new GoodsClass();
      goodsClass.setId(gcid);
      SuperGoodsClass superGoodsClass = new SuperGoodsClass();
      superGoodsClass.setGoodsClass(goodsClass);;
      superGoodsClass.setSystem(system);
      superGoodsClassMapper.insert(superGoodsClass);
   }
   @Override
   public void deleteSuperGoodsClass(long gcid) {
      superGoodsClassMapper.deleteByClassId(gcid);
   }
   @Override
   public void insertSelective(SuperGoodsClass record){
      superGoodsClassMapper.insertSelective(record);
   }
}
package com.yeshi.fanli.service.impl.goods;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper;
import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.service.inter.config.BusinessSystemService;
import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
@Service
public class SuperGoodsClassServiceImpl implements SuperGoodsClassService {
   @Resource
   private SuperGoodsClassMapper superGoodsClassMapper;
   @Resource
   private BusinessSystemService businessSystemService;
   @Override
   @Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id")
   public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) {
      return superGoodsClassMapper.listBySystemId(id);
   }
   @Override
   public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) {
      if (gcIdList == null || gcIdList.size() == 0) {
         return new ArrayList<SuperGoodsClass>();
      }
      return superGoodsClassMapper.listByGoodsclassIds(gcIdList);
   }
   @Override
   public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start,   int count, String key) {
      return superGoodsClassMapper.listBySystemIdAmdClassName(start, count, key, id);
   }
   @Override
   public Integer deleteSuperGoodsClass(final long gcid, final String platform, final String packageName) {
      BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName,null);
      if (system == null) {
         return 0;
      }
      return superGoodsClassMapper.deleteBySystemIdAndClassId(gcid, system.getId());
   }
   @Override
   public void addSuperGoodsClass(long gcid, String platform, String packageName) {
      BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName,null);
      GoodsClass goodsClass = new GoodsClass();
      goodsClass.setId(gcid);
      SuperGoodsClass superGoodsClass = new SuperGoodsClass();
      superGoodsClass.setGoodsClass(goodsClass);;
      superGoodsClass.setSystem(system);
      superGoodsClassMapper.insert(superGoodsClass);
   }
   @Override
   public void deleteSuperGoodsClass(long gcid) {
      superGoodsClassMapper.deleteByClassId(gcid);
   }
   @Override
   public void insertSelective(SuperGoodsClass record){
      superGoodsClassMapper.insertSelective(record);
   }
}