New file |
| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.social.SocialProjectVO; |
| | | import com.panzhihua.service_community.dao.ComActDAO; |
| | | import com.panzhihua.service_community.entity.ComActSocialProject; |
| | | import com.panzhihua.service_community.dao.ComActSocialProjectDao; |
| | | import com.panzhihua.service_community.entity.ProjectRelationVO; |
| | | import com.panzhihua.service_community.model.dos.ComActDO; |
| | | import com.panzhihua.service_community.service.ComActSocialProjectService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 三社联动项目表(ComActSocialProject)表服务实现类 |
| | | * |
| | | * @author makejava |
| | | * @since 2021-12-22 14:02:48 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ComActSocialProjectServiceImpl extends ServiceImpl<ComActSocialProjectDao, ComActSocialProject> implements ComActSocialProjectService { |
| | | |
| | | @Resource |
| | | private ComActSocialProjectDao comActSocialProjectDao; |
| | | @Resource |
| | | private ComActDAO comActDAO; |
| | | @Override |
| | | public R pageList(CommonPage commonPage) { |
| | | if(commonPage.getParamId2()!=null){ |
| | | ComActDO comActDO=comActDAO.selectById(commonPage.getCommunityId()); |
| | | if(comActDO!=null){ |
| | | commonPage.setStreetId(comActDO.getStreetId()); |
| | | } |
| | | } |
| | | return R.ok(comActSocialProjectDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage)); |
| | | } |
| | | |
| | | @Override |
| | | public R getByApplet(Long id) { |
| | | ComActSocialProject comActSocialProject=this.comActSocialProjectDao.selectById(id); |
| | | comActSocialProject.setViews(comActSocialProject.getViews()+1); |
| | | comActSocialProjectDao.updateById(comActSocialProject); |
| | | return R.ok(comActSocialProjectDao.getByApplet(id)); |
| | | } |
| | | |
| | | @Override |
| | | public R getByBackstage(Long id) { |
| | | return R.ok(comActSocialProjectDao.getByApplet(id)); |
| | | } |
| | | |
| | | @Override |
| | | public R getProject(CommonPage commonPage) { |
| | | if(commonPage.getParamId()==null){ |
| | | return R.fail("数据异常"); |
| | | } |
| | | ProjectRelationVO projectRelationVO=new ProjectRelationVO(); |
| | | SocialProjectVO comActSocialProject=this.comActSocialProjectDao.selectByLevel(commonPage.getParamId()); |
| | | if(comActSocialProject.getLevel()==2){ |
| | | SocialProjectVO comActSocialProject1=this.comActSocialProjectDao.selectByLevel(comActSocialProject.getParentId()); |
| | | if(comActSocialProject1!=null){ |
| | | projectRelationVO.setFatherProjectLevelOne(comActSocialProject1); |
| | | } |
| | | } |
| | | if(comActSocialProject.getLevel()==3){ |
| | | SocialProjectVO comActSocialProject1=this.comActSocialProjectDao.selectByLevel(comActSocialProject.getParentId()); |
| | | if(comActSocialProject1!=null){ |
| | | projectRelationVO.setFatherProjectLevelTwo(comActSocialProject1); |
| | | SocialProjectVO comActSocialProject2=this.comActSocialProjectDao.selectByLevel(comActSocialProject1.getParentId()); |
| | | if(comActSocialProject2!=null){ |
| | | projectRelationVO.setFatherProjectLevelOne(comActSocialProject2); |
| | | } |
| | | } |
| | | } |
| | | IPage<SocialProjectVO> socialProjectVOIPage=this.comActSocialProjectDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage); |
| | | projectRelationVO.setSocialProjectVOIPage(socialProjectVOIPage); |
| | | return R.ok(projectRelationVO); |
| | | } |
| | | } |