| | |
| | | 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 com.yeshi.fanli.dao.mybatis.homemodule.HomeNavbarMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SuperHomeNavbarMapper;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SuperHomeNavbar;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
|
| | |
|
| | |
|
| | |
| | | public class HomeNavbarServiceImpl implements HomeNavbarService {
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | @Resource
|
| | | private HomeNavbarMapper homeNavbarMapper;
|
| | | @Resource
|
| | | private SuperHomeNavbarMapper superHomeNavbarMapper;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | return homeNavbarMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | superHomeNavbarMapper.deleteBatchByNavbarIds(list);
|
| | | return homeNavbarMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMaxOrder() {
|
| | | return homeNavbarMapper.getMaxOrder();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HomeNavbar> getChangeOrder(Long id, Integer type, Integer order) {
|
| | | return homeNavbarMapper.getChangeOrder(id, type, order);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HomeNavbar> listQuery(long start, int count, String key) {
|
| | | |
| | | List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key);
|
| | | if (listObj == null || listObj.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | |
| | | List<System> systemList = systemService.getSystems();
|
| | | |
| | | List<Long> listId = new ArrayList<Long>();
|
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | listId.add(homeNavbar.getId());
|
| | | }
|
| | | List<SuperHomeNavbar> listSuper = superHomeNavbarMapper.listByNavbarIds(listId);
|
| | | |
| | | if (listSuper == null || listSuper.size() == 0) {
|
| | | |
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | homeNavbar.setSystemList(systemList);
|
| | | }
|
| | | |
| | | } else {
|
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | |
| | | Long id = homeNavbar.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 (SuperHomeNavbar superHomeNavbar : listSuper) {
|
| | | HomeNavbar navbar = superHomeNavbar.getHomeNavbar();
|
| | | System system = superHomeNavbar.getSystem();
|
| | | |
| | | // 当前专题 、当前系统
|
| | | if (navbar != null && system != null && id == navbar.getId() |
| | | && systemId == system.getId()) {
|
| | | newsystem.setCheck(1);
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | if (newsystem.getCheck() != 1) {
|
| | | newsystem.setCheck(0);
|
| | | }
|
| | | |
| | | newList.add(newsystem);
|
| | | }
|
| | | |
| | | homeNavbar.setSystemList(newList);
|
| | | }
|
| | | }
|
| | | |
| | | return listObj;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countlistQuery(String key) {
|
| | | return homeNavbarMapper.countListQuery(key);
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | |
| | |
|
| | | }
|