|
@@ -1,105 +0,0 @@
|
|
|
-package com.nosum.deliver.auth.service.impl;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.nosum.common.base.domain.Result;
|
|
|
-import com.nosum.common.enums.ErrorEnum;
|
|
|
-import com.nosum.common.util.ExceptionUtil;
|
|
|
-import com.nosum.common.util.PageUtil;
|
|
|
-import com.nosum.deliver.auth.dao.AuthUserSocialDao;
|
|
|
-import com.nosum.deliver.auth.domain.po.AuthUserSocial;
|
|
|
-import com.nosum.deliver.auth.domain.vo.AuthUserSocialVO;
|
|
|
-import com.nosum.deliver.auth.service.AuthUserSocialService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.StringUtils;
|
|
|
-
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Optional;
|
|
|
-
|
|
|
-@Service
|
|
|
-public class AuthUserSocialServiceImpl extends ServiceImpl<AuthUserSocialDao,AuthUserSocial> implements AuthUserSocialService{
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AuthUserSocialDao authUserSocialDao;
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result saveAuthUserSocial(AuthUserSocialVO authUserSocialVO) {
|
|
|
- AuthUserSocial authUserSocial=new AuthUserSocial()
|
|
|
- .setCode(authUserSocialVO.getCode())
|
|
|
- .setShowType(authUserSocialVO.getShowType())
|
|
|
- .setContent(authUserSocialVO.getContent())
|
|
|
- .setRemark(authUserSocialVO.getRemark())
|
|
|
- .setIcon(authUserSocialVO.getIcon())
|
|
|
- .setIsEnabled(authUserSocialVO.getIsEnabled())
|
|
|
- .setIsHome(authUserSocialVO.getIsHome())
|
|
|
- .setCreateTime(LocalDateTime.now())
|
|
|
- .setUpdateTime(LocalDateTime.now());
|
|
|
- authUserSocialDao.insert(authUserSocial);
|
|
|
- return Result.createWithSuccessMessage();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result editAuthUserSocial(AuthUserSocialVO authUserSocialVO) {
|
|
|
- AuthUserSocial authUserSocial=new AuthUserSocial()
|
|
|
- .setId(authUserSocialVO.getId())
|
|
|
- .setCode(authUserSocialVO.getCode())
|
|
|
- .setShowType(authUserSocialVO.getShowType())
|
|
|
- .setContent(authUserSocialVO.getContent())
|
|
|
- .setRemark(authUserSocialVO.getRemark())
|
|
|
- .setIcon(authUserSocialVO.getIcon())
|
|
|
- .setIsEnabled(authUserSocialVO.getIsEnabled())
|
|
|
- .setIsHome(authUserSocialVO.getIsHome())
|
|
|
- .setUpdateTime(LocalDateTime.now());
|
|
|
- authUserSocialDao.updateById(authUserSocial);
|
|
|
- return Result.createWithSuccessMessage();
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result getSocial(Long id) {
|
|
|
- AuthUserSocial authUserSocial=this.authUserSocialDao.selectById(id);
|
|
|
- if (authUserSocial==null){
|
|
|
- ExceptionUtil.rollback(ErrorEnum.PARAM_ERROR);
|
|
|
- }
|
|
|
- return Result.createWithModel(authUserSocial);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result getSocialList(AuthUserSocialVO authUserSocialVO) {
|
|
|
- authUserSocialVO= Optional.ofNullable(authUserSocialVO).orElse(new AuthUserSocialVO());
|
|
|
- Page page=Optional.of(PageUtil.checkAndInitPage(authUserSocialVO)).orElse(PageUtil.initPage());
|
|
|
- if (!StringUtils.isEmpty(authUserSocialVO.getKeywords())){
|
|
|
- authUserSocialVO.setKeywords("%"+authUserSocialVO.getKeywords()+"%");
|
|
|
- }
|
|
|
- List<AuthUserSocialVO> authUserSocialList=this.authUserSocialDao.selectSocialList(page,authUserSocialVO);
|
|
|
- return Result.createWithPaging(authUserSocialList,PageUtil.initPageInfo(page));
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result getSocialInfo() {
|
|
|
- List<AuthUserSocial> authUserSocialList=this.authUserSocialDao.selectList(new LambdaQueryWrapper<AuthUserSocial>().eq(AuthUserSocial::getIsHome,1).eq(AuthUserSocial::getIsEnabled,1));
|
|
|
- List<AuthUserSocialVO> authUserSocialVOList=new ArrayList<>();
|
|
|
- authUserSocialList.forEach(authUserSocial->{
|
|
|
- authUserSocialVOList.add(new AuthUserSocialVO()
|
|
|
- .setIcon(authUserSocial.getIcon())
|
|
|
- .setCode(authUserSocial.getCode())
|
|
|
- .setShowType(authUserSocial.getShowType())
|
|
|
- .setContent(authUserSocial.getContent())
|
|
|
- .setRemark(authUserSocial.getRemark())
|
|
|
- .setIsEnabled(authUserSocial.getIsEnabled())
|
|
|
- .setIsHome(authUserSocial.getIsHome())
|
|
|
- .setUpdateTime(LocalDateTime.now()));
|
|
|
- });
|
|
|
- return Result.createWithModels(authUserSocialVOList);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Result deleteSocial(Long id) {
|
|
|
- ExceptionUtil.isRollback(id==null,ErrorEnum.PARAM_ERROR);
|
|
|
- authUserSocialDao.deleteById(id);
|
|
|
- return Result.createWithSuccessMessage();
|
|
|
- }
|
|
|
-}
|