admin
2020-07-14 eec7e789a87863c25d92c10ad5dfc22ad80c448d
fanli/src/main/java/com/yeshi/fanli/service/impl/homemodule/SpecialCardServiceImpl.java
@@ -8,6 +8,7 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -30,9 +31,6 @@
   
   @Resource
   private SpecialCardMapper specialCardMapper;
   @Resource
   private BusinessSystemService businessSystemService;
   
   @Resource
   private SpecialService specialService;
@@ -156,7 +154,6 @@
   /**
    * 删除图片-不更新数据库
    * @param record
    * @throws Exception
    */
   public void removePicture(String picture) throws Exception {
@@ -174,9 +171,9 @@
   }
   
   @Override
   public List<SpecialCard> listQuery(long start, int count, String key, Integer sort) {
   public List<SpecialCard> listQuery(long start, int count, String key, Integer sort, List<Long> listPid, SystemEnum system) {
      
      List<SpecialCard> listObj = specialCardMapper.listQuery(start, count, key);
      List<SpecialCard> listObj = specialCardMapper.listQuery(start, count, key, listPid,system);
      if (listObj == null || listObj.size() == 0) {
         return null;
      }
@@ -184,6 +181,14 @@
      for (SpecialCard specialCard: listObj) {
         long totalSpecial= specialService.countlistQueryByCard(specialCard.getId(), null, null);
         specialCard.setTotalSpecial(totalSpecial);
         // 将状态变化
         if (specialCard.getState() != null && specialCard.getState() == 0) {
            specialCard.setState(1);
         } else {
            specialCard.setState(0);
         }
         
         Date startTime = specialCard.getStartTime();
         Date endTime = specialCard.getEndTime();
@@ -217,16 +222,39 @@
   }
   
   @Override
   public long countlistQuery(String key) {
      return specialCardMapper.countlistQuery(key);
   public long countlistQuery(String key, List<Long> listPid, SystemEnum system) {
      return specialCardMapper.countlistQuery(key, listPid,system);
   }
   
   @Override
   public String getbottomPicture(String placeKey) {
      return specialCardMapper.getbottomPicture(placeKey);
   public String getbottomPicture(String placeKey, SystemEnum system) {
      return specialCardMapper.getbottomPicture(placeKey,system);
   }
   
   
   @Override
   public void switchState(Long id) throws SpecialCardException {
      if (id == null) {
         throw new SpecialCardException(1, "请传递正确参数");
      }
      SpecialCard resultObj = specialCardMapper.selectByPrimaryKey(id);
      if (resultObj == null) {
         throw new SpecialCardException(1, "此内容已不存在");
      }
      Integer state = resultObj.getState();
      if (state == null || state == 0) {
         state = 1;
      } else {
         state = 0;
      }
      SpecialCard updateObj = new SpecialCard();
      updateObj.setId(id);
      updateObj.setState(state);
      specialCardMapper.updateByPrimaryKeySelective(updateObj);
   }
   
}