| | |
| | | package com.yeshi.fanli.service.impl.homemodule;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SpecialCardMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SuperSpecialCardMapper;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.Special;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SpecialCard;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SuperSpecialCard;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialCardService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SpecialService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | |
|
| | | @Service
|
| | |
| | | @Resource
|
| | | private SpecialCardMapper specialCardMapper;
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | |
| | | @Resource
|
| | | private SpecialService specialService;
|
| | | |
| | | @Resource
|
| | | private SuperSpecialCardMapper superSpecialCardMapper;
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | |
| | | return specialCardMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) throws Exception{
|
| | | |
| | | specialService.deleteBatchByCardID(list);
|
| | | superSpecialCardMapper.deleteBatchByCardId(list);
|
| | | |
| | | return specialCardMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<SpecialCard> listQuery(long start, int count, String key, Integer sort) {
|
| | | |
| | | List<SpecialCard> listObj = specialCardMapper.listQuery(start, count, key, sort);
|
| | | if (listObj == null || listObj.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | |
| | | List<System> systemList = systemService.getSystems();
|
| | | |
| | | List<Long> listCardId = new ArrayList<Long>();
|
| | | for (SpecialCard specialCard: listObj) {
|
| | | listCardId.add(specialCard.getId());
|
| | | }
|
| | | |
| | | List<SuperSpecialCard> listSuper = superSpecialCardMapper.listByCardIDs(listCardId);
|
| | | |
| | | if (listSuper == null || listSuper.size() == 0) {
|
| | | |
| | | for (SpecialCard specialCard: listObj) {
|
| | | specialCard.setSystemList(systemList);
|
| | | }
|
| | | |
| | | } else {
|
| | | for (SpecialCard specialCard: listObj) {
|
| | | |
| | | Long id = specialCard.getId();
|
| | | |
| | | List<System> newList = new ArrayList<System>();
|
| | | // 是否有关联系统选项
|
| | | for (System dsystem : systemList) {
|
| | | |
| | | System newsystem = new System();
|
| | | |
| | | try {
|
| | | PropertyUtils.copyProperties(newsystem, dsystem);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | |
| | | |
| | | if (listSuper != null && listSuper.size() > 0) {
|
| | | |
| | | Long systemId = newsystem.getId();
|
| | | |
| | | for (SuperSpecialCard superSpecialCard : listSuper) {
|
| | | SpecialCard special = superSpecialCard.getSpecialCard();
|
| | | System system = superSpecialCard.getSystem();
|
| | | |
| | | // 当前专题 、当前系统
|
| | | if (special != null && system != null && id == special.getId() |
| | | && systemId == system.getId()) {
|
| | | newsystem.setCheck(1);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | if (newsystem.getCheck() != 1) {
|
| | | newsystem.setCheck(0);
|
| | | }
|
| | | |
| | | newList.add(newsystem);
|
| | | }
|
| | | |
| | | specialCard.setSystemList(newList);
|
| | | }
|
| | | }
|
| | | |
| | | return listObj;
|
| | | }
|
| | | |
| | | @Override
|
| | | public long countlistQuery(String key) {
|
| | | return specialCardMapper.countlistQuery(key);
|
| | | }
|
| | |
|
| | | }
|