admin
2021-07-24 e257a2834bf7b62af5c5c96f9b0b21fac92f2196
fanli/src/main/java/com/yeshi/fanli/service/impl/common/JumpDetailV2ServiceImpl.java
@@ -4,6 +4,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
@@ -49,17 +50,21 @@
   }
   @Override
   public List<JumpDetailV2> listByType(String type) {
      return jumpDetailV2Mapper.listByType(type);
    public List<JumpDetailV2> listByType(String type, SystemEnum system) {
        JumpDetailV2Mapper.DaoQuery daoQuery = new JumpDetailV2Mapper.DaoQuery();
        daoQuery.type = type;
        daoQuery.system = system;
        daoQuery.count = Integer.MAX_VALUE;
        return jumpDetailV2Mapper.list(daoQuery);
   }
   @Cacheable(value = "configCache", key = "'getByTypeCache-'+#type")
   @Override
   public JumpDetailV2 getByTypeCache(String type) {
    public JumpDetailV2 getByTypeCache(String type, SystemEnum system) {
      JumpDetailV2 jumpDetailV2 = null;
      List<JumpDetailV2> listByType = listByType(type);
        List<JumpDetailV2> listByType = listByType(type, system);
      if (listByType != null && listByType.size() > 0) {
         jumpDetailV2 = listByType.get(0);
@@ -72,17 +77,29 @@
   @Cacheable(value = "configCache", key = "'getByTypeCache-'+#type+'-'+#platform+'-'+#version")
   @Override
   public JumpDetailV2 getByTypeCache(String type, int platform, int version) {
    public JumpDetailV2 getByTypeCache(String type, int platform, int version, SystemEnum system) {
        JumpDetailV2Mapper.DaoQuery daoQuery = new JumpDetailV2Mapper.DaoQuery();
        daoQuery.type = type;
        daoQuery.system = system;
      if (platform == 1) {
         return jumpDetailV2Mapper.selectAndroidByTypeAndVersion(type, version);
            daoQuery.maxAndroidVersion = version;
      } else {
         return jumpDetailV2Mapper.selectIOSByTypeAndVersion(type, version);
            daoQuery.maxIOSVersion = version;
      }
        daoQuery.count = 1;
        List<JumpDetailV2> list = jumpDetailV2Mapper.list(daoQuery);
        if (list == null || list.size() == 0)
            return list.get(0);
        else
            return list.get(0);
   }
   @Override
   public List<JumpDetailV2> listJump() {
      return jumpDetailV2Mapper.listJump();
    public List<JumpDetailV2> listJump(SystemEnum system) {
        JumpDetailV2Mapper.DaoQuery daoQuery = new JumpDetailV2Mapper.DaoQuery();
        daoQuery.count = Integer.MAX_VALUE;
        daoQuery.system = system;
        return jumpDetailV2Mapper.list(daoQuery);
   }
   @Override
@@ -91,13 +108,21 @@
   }
   @Override
   public List<JumpDetailV2> listQuery(long start, int count, String key) {
      return jumpDetailV2Mapper.listQuery(start, count, key);
    public List<JumpDetailV2> listQuery(long start, int count, String key, SystemEnum system) {
        JumpDetailV2Mapper.DaoQuery daoQuery = new JumpDetailV2Mapper.DaoQuery();
        daoQuery.key = key;
        daoQuery.start = start;
        daoQuery.count = count;
        daoQuery.system = system;
        return jumpDetailV2Mapper.list(daoQuery);
   }
   @Override
   public long countListQuery(String key) {
      return jumpDetailV2Mapper.countListQuery(key);
    public long countListQuery(String key, SystemEnum system) {
        JumpDetailV2Mapper.DaoQuery daoQuery = new JumpDetailV2Mapper.DaoQuery();
        daoQuery.key = key;
        daoQuery.system = system;
        return jumpDetailV2Mapper.count(daoQuery);
   }
}