This commit is contained in:
linfeng 2022-04-30 15:57:10 +08:00
parent e5f4a6ad14
commit 60ae5403df
7 changed files with 33 additions and 29 deletions

View File

@ -41,6 +41,12 @@ public class Constant {
public static final Integer NOT_READ = 0; public static final Integer NOT_READ = 0;
public static final Integer HAS_READ = 1; public static final Integer HAS_READ = 1;
/**
* 用户是否禁用
*/
public static final Integer USER_NORMAL = 0;
public static final Integer USER_BANNER = 1;
/** /**
* 圈子是否禁用 * 圈子是否禁用
*/ */

View File

@ -43,7 +43,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void ban(Integer id) { public void ban(Integer id) {
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus(); Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
if(status==1){ if(status.equals(Constant.USER_BANNER)){
throw new LinfengException("该用户已被禁用"); throw new LinfengException("该用户已被禁用");
} }
this.lambdaUpdate() this.lambdaUpdate()
@ -55,7 +55,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void openBan(Integer id) { public void openBan(Integer id) {
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus(); Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
if(status==0){ if(status.equals(Constant.USER_NORMAL)){
throw new LinfengException("该用户已解除禁用"); throw new LinfengException("该用户已解除禁用");
} }
this.lambdaUpdate() this.lambdaUpdate()

View File

@ -23,7 +23,7 @@ public class LinkServiceImpl extends ServiceImpl<LinkDao, LinkEntity> implements
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<LinkEntity> page = this.page( IPage<LinkEntity> page = this.page(
new Query<LinkEntity>().getPage(params), new Query<LinkEntity>().getPage(params),
new QueryWrapper<LinkEntity>() new QueryWrapper<>()
); );
return new PageUtils(page); return new PageUtils(page);

View File

@ -90,15 +90,16 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
/** /**
* 选取圈子中热度最高的三条动态的首图作为展示 * 选取圈子中热度最高的三条动态的首图作为展示
*
* @param id * @param id
* @return * @return
*/ */
@Override @Override
public List<String> findThreeMedia(Integer id) { public List<String> findThreeMedia(Integer id) {
QueryWrapper<PostEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<PostEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("topic_id",id); queryWrapper.lambda().eq(PostEntity::getTopicId, id);
queryWrapper.eq("type",1); queryWrapper.lambda().eq(PostEntity::getType, 1);
queryWrapper.orderByDesc("read_count"); queryWrapper.lambda().orderByDesc(PostEntity::getReadCount);
queryWrapper.last("limit 10"); queryWrapper.last("limit 10");
List<PostEntity> postEntityList = baseMapper.selectList(queryWrapper); List<PostEntity> postEntityList = baseMapper.selectList(queryWrapper);
List<String> imageList = new ArrayList<>(); List<String> imageList = new ArrayList<>();

View File

@ -3,7 +3,9 @@ package io.linfeng.modules.admin.service.impl;
import io.linfeng.common.exception.LinfengException; import io.linfeng.common.exception.LinfengException;
import io.linfeng.common.utils.Constant; import io.linfeng.common.utils.Constant;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

View File

@ -1,7 +1,5 @@
package io.linfeng.modules.admin.service.impl; package io.linfeng.modules.admin.service.impl;
import io.linfeng.modules.admin.dao.AppUserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

View File

@ -18,7 +18,6 @@ import io.linfeng.modules.admin.entity.TopicEntity;
public class TopicServiceImpl extends ServiceImpl<TopicDao, TopicEntity> implements TopicService { public class TopicServiceImpl extends ServiceImpl<TopicDao, TopicEntity> implements TopicService {
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
IPage<TopicEntity> page = this.page( IPage<TopicEntity> page = this.page(
@ -30,7 +29,6 @@ public class TopicServiceImpl extends ServiceImpl<TopicDao, TopicEntity> impleme
} }
@Override @Override
public AppPageUtils queryByPage(Map<String, Object> params) { public AppPageUtils queryByPage(Map<String, Object> params) {
Integer classId = Integer.valueOf((String) params.get(Constant.CLASSID)); Integer classId = Integer.valueOf((String) params.get(Constant.CLASSID));
@ -45,5 +43,4 @@ public class TopicServiceImpl extends ServiceImpl<TopicDao, TopicEntity> impleme
} }
} }