main
parent
53104891f8
commit
4b87cc7b73
|
|
@ -27,6 +27,9 @@ public class AppContentGift implements Serializable {
|
|||
@ApiModelProperty(value = "送礼用户")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "送礼入口1动态2聊天3圈子内容")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "礼物图片")
|
||||
private String imgUrl;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.mdd.common.mapper;
|
||||
|
||||
import com.mdd.common.core.basics.IBaseMapper;
|
||||
import com.mdd.common.entity.AppCircle;
|
||||
import com.mdd.common.entity.AppCircleContent;
|
||||
import com.mdd.common.vo.CircleContentListedVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 圈子内容信息Mapper
|
||||
* @author LikeAdmin
|
||||
|
|
@ -12,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface AppCircleContentMapper extends IBaseMapper<AppCircleContent> {
|
||||
void updateByPlateId(Integer plateId);
|
||||
|
||||
List<CircleContentListedVo> listCircleContent(AppCircleContent appCircleContent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,86 @@
|
|||
package com.mdd.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("圈子内容信息列表Vo")
|
||||
public class CircleContentListedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "圈子id")
|
||||
private Integer circleId;
|
||||
|
||||
@ApiModelProperty(value = "创建用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "图片,多张用逗号分隔")
|
||||
private String imgUrl;
|
||||
|
||||
@ApiModelProperty(value = "视频地址")
|
||||
private String videoUrl;
|
||||
|
||||
@ApiModelProperty(value = "引用类型1动态2圈子内容3心愿单")
|
||||
private Integer citeType;
|
||||
|
||||
@ApiModelProperty(value = "引用类型=1为动态id;=2为圈子内容id;=3为心愿单内容id")
|
||||
private Integer citeId;
|
||||
|
||||
@ApiModelProperty(value = "是否置顶1是2否")
|
||||
private Integer isTop;
|
||||
|
||||
@ApiModelProperty(value = "是否屏蔽1是2否")
|
||||
private Integer isShield;
|
||||
|
||||
@ApiModelProperty(value = "是否开启sos1是2否")
|
||||
private Integer isSos;
|
||||
|
||||
@ApiModelProperty(value = "是否推荐1是2否")
|
||||
private Integer isTj;
|
||||
|
||||
@ApiModelProperty(value = "板块id")
|
||||
private Integer plateId;
|
||||
|
||||
@ApiModelProperty(value = "是否圈主1是2否")
|
||||
private Integer isOwner;
|
||||
|
||||
@ApiModelProperty(value = "是否是管理员1是2否")
|
||||
private Integer isAdmin;
|
||||
|
||||
@ApiModelProperty(value = "位置")
|
||||
private String address;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "用户账号")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "用户性别: [1=男, 2=女]")
|
||||
private Integer sex;
|
||||
|
||||
@ApiModelProperty(value = "点赞数")
|
||||
private Integer countLike;
|
||||
|
||||
@ApiModelProperty(value = "分享数")
|
||||
private Integer countShare;
|
||||
|
||||
@ApiModelProperty(value = "评论数")
|
||||
private Integer countComment;
|
||||
|
||||
@ApiModelProperty(value = "礼物数")
|
||||
private Integer countGift;
|
||||
}
|
||||
|
|
@ -3,10 +3,57 @@
|
|||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mdd.common.mapper.AppCircleContentMapper">
|
||||
<sql id="contentColumn">
|
||||
a.id as "id",
|
||||
a.circle_id as "circleId",
|
||||
a.user_id as "userId",
|
||||
a.img_url as "imgUrl",
|
||||
a.video_url as "videoUrl",
|
||||
a.cite_type as "citeType",
|
||||
a.cite_id as "citeId",
|
||||
a.is_top as "isTop",
|
||||
a.is_shield as "isShield",
|
||||
a.is_sos as "isSos",
|
||||
a.is_tj as "isTj",
|
||||
a.plate_id as "plateId",
|
||||
a.is_owner as "isOwner",
|
||||
a.is_admin as "isAdmin",
|
||||
a.address as "address",
|
||||
a.create_time as "createTime"
|
||||
</sql>
|
||||
|
||||
<update id="updateByPlateId">
|
||||
update la_app_circle_content
|
||||
set plate_id = null
|
||||
where plate_id = #{plateId}
|
||||
</update>
|
||||
|
||||
<select id="listCircleContent" resultType="com.mdd.common.vo.CircleContentListedVo">
|
||||
select
|
||||
<include refid="contentColumn"/>
|
||||
u.avatar as "avatar",
|
||||
u.username as "username",
|
||||
u.sex as "sex",
|
||||
count(l.id) as "countLike",
|
||||
count(c.id) as "countComment",
|
||||
sum(g.num) as "countGift"
|
||||
from la_app_circle_content a
|
||||
left join la_app_user u on u.id = a.user_id and u.is_delete = 0
|
||||
left join la_app_content_like l on l.content_id = a.id
|
||||
left join la_app_content_comment c on c.content_id = a.id
|
||||
left join la_app_content_gift g on g.content_id = a.id and a.type = 3
|
||||
where a.is_delete = 0
|
||||
<if test="id != null">
|
||||
and a.id = #{id}
|
||||
</if>
|
||||
<if test="circleId != null">
|
||||
and a.circle_id = #{circleId}
|
||||
</if>
|
||||
<if test="plateId != null">
|
||||
and a.plate_id = #{plateId}
|
||||
</if>
|
||||
group by a.id
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.mdd.front.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mdd.common.vo.CircleContentListedVo;
|
||||
import com.mdd.front.aop.Log;
|
||||
import com.mdd.front.service.IAppCircleContentService;
|
||||
import com.mdd.front.validate.common.IdValidate;
|
||||
|
|
@ -35,6 +37,14 @@ public class AppCircleContentController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/pageList")
|
||||
@ApiOperation(value="圈子列表-请用这个")
|
||||
public AjaxResult<PageInfo<CircleContentListedVo>> pageList(@Validated PageValidate pageValidate,
|
||||
@Validated AppCircleContentSearchValidate searchValidate) {
|
||||
PageInfo<CircleContentListedVo> list = iAppCircleContentService.pageList(pageValidate, searchValidate);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value="圈子内容信息详情")
|
||||
public AjaxResult<AppCircleContentDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.mdd.front.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mdd.common.vo.CircleContentListedVo;
|
||||
import com.mdd.front.validate.common.PageValidate;
|
||||
import com.mdd.front.validate.AppCircleContentCreateValidate;
|
||||
import com.mdd.front.validate.AppCircleContentUpdateValidate;
|
||||
|
|
@ -23,6 +25,7 @@ public interface IAppCircleContentService {
|
|||
* @return PageResult<AppCircleContentListedVo>
|
||||
*/
|
||||
PageResult<AppCircleContentListedVo> list(PageValidate pageValidate, AppCircleContentSearchValidate searchValidate);
|
||||
PageInfo<CircleContentListedVo> pageList(PageValidate pageValidate, AppCircleContentSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 圈子内容信息详情
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.mdd.front.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.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.mdd.common.core.PageResult;
|
||||
import com.mdd.common.entity.AppCircle;
|
||||
import com.mdd.common.entity.AppCircleContent;
|
||||
|
|
@ -14,6 +16,8 @@ import com.mdd.common.mapper.AppCirclePlateMapper;
|
|||
import com.mdd.common.mapper.AppCircleUserMapper;
|
||||
import com.mdd.common.util.RedisUtils;
|
||||
import com.mdd.common.util.TimeUtils;
|
||||
import com.mdd.common.vo.AppCircleVo;
|
||||
import com.mdd.common.vo.CircleContentListedVo;
|
||||
import com.mdd.front.service.IAppCircleContentService;
|
||||
import com.mdd.front.validate.AppCircleContentCreateValidate;
|
||||
import com.mdd.front.validate.AppCircleContentSearchValidate;
|
||||
|
|
@ -102,6 +106,23 @@ public class AppCircleContentServiceImpl implements IAppCircleContentService {
|
|||
return PageResult.iPageHandle(iPage.getTotal(), iPage.getCurrent(), iPage.getSize(), list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<CircleContentListedVo> pageList(PageValidate pageValidate, AppCircleContentSearchValidate searchValidate) {
|
||||
AppCircleContent appCircleContent = new AppCircleContent();
|
||||
BeanUtils.copyProperties(searchValidate,appCircleContent);
|
||||
Integer pageNo = pageValidate.getPageNo();
|
||||
Integer pageSize = pageValidate.getPageSize();
|
||||
PageHelper.startPage(pageNo, pageSize);
|
||||
PageInfo<CircleContentListedVo> page = new PageInfo(appCircleContentMapper.listCircleContent(appCircleContent));
|
||||
List<CircleContentListedVo> list = page.getList();
|
||||
for (CircleContentListedVo circleContentListedVo : list) {
|
||||
Object share = RedisUtils.get(shareRedisKey + circleContentListedVo.getId());
|
||||
circleContentListedVo.setCountShare(share == null ? 0 : Integer.valueOf(share.toString()));
|
||||
}
|
||||
page.setList(list);
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* 圈子内容信息详情
|
||||
*
|
||||
|
|
|
|||
|
|
@ -118,6 +118,18 @@ public class AppCircleUserServiceImpl implements IAppCircleUserService {
|
|||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
Assert.notNull(appCircle, "圈子数据不存在");
|
||||
List<String> adminIds = Arrays.asList(appCircle.getAdminIds().split(","));
|
||||
if (adminIds.size() >= 4) {
|
||||
Assert.notNull(null, "管理员位数已达到最高限制!");
|
||||
}
|
||||
if (adminIds.contains(createValidate.getUserId())) {
|
||||
Assert.notNull(null, "该用户已经是管理员不能重复设置!");
|
||||
}
|
||||
AppCircle entity = new AppCircle();
|
||||
entity.setId(appCircle.getId());
|
||||
entity.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
entity.setAdminIds(appCircle.getAdminIds() + createValidate.getUserId() + ",");
|
||||
appCircleMapper.updateById(entity);
|
||||
|
||||
AppCircleUser model = new AppCircleUser();
|
||||
model.setCircleId(createValidate.getCircleId());
|
||||
|
|
|
|||
Loading…
Reference in New Issue