Commit 33805a63 authored by liwei's avatar liwei

修改了互换微信

parent e3ca0dd7
...@@ -824,7 +824,7 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -824,7 +824,7 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
//校验对方是不是已经填了微信号 //校验对方是不是已经填了微信号
Integer targetId = memUserTaskDTO.getTargetId(); Integer targetId = memUserTaskDTO.getTargetId();
MemInfo targetInfo = memInfoRepository.getUserInfo(String.valueOf(targetId)); MemInfo targetInfo = memInfoRepository.getUserInfo(String.valueOf(targetId));
MemInfo memInfo = memInfoRepository.selectByOpenId(memUserTaskDTO.getWxOpenid()); MemInfo memInfo = memInfoRepository.selectByUserId(CyUserUtil.getAuthenBusinessId());
if (StringUtils.isEmpty(memInfo.getMemWxCode())){ if (StringUtils.isEmpty(memInfo.getMemWxCode())){
throw new CyServiceException(1006,"还未完善个人微信号,不能交换!"); throw new CyServiceException(1006,"还未完善个人微信号,不能交换!");
} }
...@@ -832,15 +832,13 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -832,15 +832,13 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
throw new CyServiceException(1005,"对方还未填写微信号,不能交换!"); throw new CyServiceException(1005,"对方还未填写微信号,不能交换!");
} }
Integer createBy = Integer.valueOf(CyUserUtil.getAuthenBusinessId()); Integer createBy = Integer.valueOf(CyUserUtil.getAuthenBusinessId());
memUserTaskDTO.setCreateBy(createBy);
memUserTaskDTO.setCreateDate(new Date());
//获取数据字典中的消耗金币数 //获取数据字典中的消耗金币数
List<DictData> userLikeConfig = dictionaryService.selectByTypes("user_config"); List<DictData> userLikeConfig = dictionaryService.selectByTypes("user_config");
DictData dictData1 = userLikeConfig.stream().filter(item -> item.getDictLabel().equals("request_exchange_wechat")).findFirst().orElse(null); DictData dictData1 = userLikeConfig.stream().filter(item -> item.getDictLabel().equals("request_exchange_wechat")).findFirst().orElse(null);
DictData dictData2 = userLikeConfig.stream().filter(item -> item.getDictLabel().equals("accept_exchange_wechat")).findFirst().orElse(null); DictData dictData2 = userLikeConfig.stream().filter(item -> item.getDictLabel().equals("accept_exchange_wechat")).findFirst().orElse(null);
Integer requestGoldCoinCount = Integer.valueOf(dictData1.getDictValue());//发起请求需消耗的金币数 Integer requestGoldCoinCount = Integer.valueOf(dictData1.getDictValue());//发起请求需消耗的金币数
Integer acceptGoldCoinCount = Integer.valueOf(dictData2.getDictValue());//接收需消耗的金币数 Integer acceptGoldCoinCount = Integer.valueOf(dictData2.getDictValue());//接收需消耗的金币数
if (memUserTaskDTO.getType().equals("1") && memUserTaskDTO.getAgainRequest().equals("0")){ if (memUserTaskDTO.getType().equals("1")){
//发起请求 //发起请求
//扣除该用户的金币数量 //扣除该用户的金币数量
int line = 0; int line = 0;
...@@ -854,12 +852,33 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -854,12 +852,33 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
if (memInfo.getGoldCoinsCount() - acceptGoldCoinCount < 0){ if (memInfo.getGoldCoinsCount() - acceptGoldCoinCount < 0){
throw new CyServiceException(1003,"金币不足,请先充值!"); throw new CyServiceException(1003,"金币不足,请先充值!");
} }
//添加索要微信任务 //查询互换微信任务是否已存在
memUserTaskDTO.setStatus("0"); memUserTaskDTO.setCreateBy(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
line = baseMapper.addWeChatTask(memUserTaskDTO); MemUserTaskDTO userTask = baseMapper.selectWeChatTask(memUserTaskDTO);
if (userTask != null){
if (userTask.getType().equals("1")){
//已存在 证明对方已经要了微信 但是是同时要的
throw new CyServiceException(1007,"对方已经要了微信,请重试!");
} else {
//已存在 证明互相要过 但是被拒绝了
userTask.setBusinessId(userTask.getBusinessId());
userTask.setCreateBy(createBy);
userTask.setCreateDate(new Date());
userTask.setType("1");
userTask.setStatus("0");
userTask.setTargetId(targetId);
line = baseMapper.updateWeChatTaskById(userTask);
}
} else {
//添加索要微信任务
memUserTaskDTO.setStatus("0");
memUserTaskDTO.setCreateBy(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
memUserTaskDTO.setCreateDate(new Date());
line = baseMapper.addWeChatTask(memUserTaskDTO);
}
//增加金币流水记录 //增加金币流水记录
MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow(); MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow();
memGoldCoinFlow.setUpdateBy(String.valueOf(createBy)); memGoldCoinFlow.setUpdateBy(CyUserUtil.getAuthenBusinessId());
memGoldCoinFlow.setCount(acceptGoldCoinCount); memGoldCoinFlow.setCount(acceptGoldCoinCount);
memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount() - acceptGoldCoinCount); memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount() - acceptGoldCoinCount);
memGoldCoinFlow.setType("2"); memGoldCoinFlow.setType("2");
...@@ -877,9 +896,9 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -877,9 +896,9 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
throw new CyServiceException(1004,"服务器繁忙,请稍后再试"); throw new CyServiceException(1004,"服务器繁忙,请稍后再试");
} }
return new CyPersistModel(line); return new CyPersistModel(line);
} else if (memUserTaskDTO.getType().equals("2") && memUserTaskDTO.getAgainRequest().equals("0")){ } else {
memUserTaskDTO.setCreateBy(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
MemUserTaskDTO memUserTaskDTO1 = baseMapper.selectWeChatTask(memUserTaskDTO); MemUserTaskDTO memUserTaskDTO1 = baseMapper.selectWeChatTask(memUserTaskDTO);
memUserTaskDTO.setBusinessId(memUserTaskDTO1.getBusinessId());
//接收请求 //接收请求
//判断是同意还是拒绝 //判断是同意还是拒绝
int line = 0; int line = 0;
...@@ -897,12 +916,12 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -897,12 +916,12 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
throw new CyServiceException(1003,"金币不足,请先充值!"); throw new CyServiceException(1003,"金币不足,请先充值!");
} }
//修改微信任务 //修改微信任务
memUserTaskDTO.setCreateBy(targetId); memUserTaskDTO1.setType("2");
memUserTaskDTO.setTargetId(Integer.valueOf(CyUserUtil.getAuthenBusinessId())); memUserTaskDTO1.setStatus("1");
line = baseMapper.updateWeChatTaskById(memUserTaskDTO); line = baseMapper.updateWeChatTaskById(memUserTaskDTO1);
//添加金币流水记录 //添加金币流水记录
MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow(); MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow();
memGoldCoinFlow.setUpdateBy(String.valueOf(createBy)); memGoldCoinFlow.setUpdateBy(CyUserUtil.getAuthenBusinessId());
memGoldCoinFlow.setCount(requestGoldCoinCount); memGoldCoinFlow.setCount(requestGoldCoinCount);
memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount() - requestGoldCoinCount); memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount() - requestGoldCoinCount);
memGoldCoinFlow.setType("2"); memGoldCoinFlow.setType("2");
...@@ -923,46 +942,9 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo> ...@@ -923,46 +942,9 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
} else { } else {
//拒绝 //拒绝
//修改微信任务 //修改微信任务
memUserTaskDTO.setCreateBy(targetId); memUserTaskDTO1.setType("2");
memUserTaskDTO.setTargetId(Integer.valueOf(CyUserUtil.getAuthenBusinessId())); memUserTaskDTO1.setStatus("2");
line = baseMapper.updateWeChatTaskById(memUserTaskDTO); line = baseMapper.updateWeChatTaskById(memUserTaskDTO1);
}
return new CyPersistModel(line);
} else {
//被拒绝后 再次发送请求
//扣除该用户的金币数量 修改原始的微信任务状态为1 0
int line = 0;
boolean isGetLock = false;
RLock lock = redissonClient.getLock(MemberInfoRedisBean.USER_WECHAT_TASK_LOCK + memUserTaskDTO.getCreateBy());
try {
isGetLock = lock.tryLock(Long.parseLong(MemberInfoRedisBean.USER_WECHAT_TASK_LOCK_WAIT_TIME),
Long.parseLong(MemberInfoRedisBean.USER_WECHAT_LOCK_LEASE_TIME), TimeUnit.SECONDS);
if (isGetLock) {
//查询用户信息
if (memInfo.getGoldCoinsCount() - acceptGoldCoinCount < 0){
throw new CyServiceException(1003,"金币不足,请先充值!");
}
memUserTaskDTO.setType("1");
memUserTaskDTO.setStatus("0");
line = baseMapper.updateWeChatTask(memUserTaskDTO);
//增加金币流水记录
MemGoldCoinFlow memGoldCoinFlow = new MemGoldCoinFlow();
memGoldCoinFlow.setUpdateBy(String.valueOf(createBy));
memGoldCoinFlow.setCount(acceptGoldCoinCount);
memGoldCoinFlow.setEndCount(memInfo.getGoldCoinsCount() - acceptGoldCoinCount);
memGoldCoinFlow.setType("2");
memGoldCoinFlow.setActionType("23");
memGoldCoinFlowRepository.insert(memGoldCoinFlow);
//修改用户金币数量
memInfo.setGoldCoinsCount(memInfo.getGoldCoinsCount() - acceptGoldCoinCount);
memInfoRepository.updateById(memInfo);
lock.unlock();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
lock.unlock();
isGetLock = false;
throw new CyServiceException(1004,"服务器繁忙,请稍后再试");
} }
return new CyPersistModel(line); return new CyPersistModel(line);
} }
......
...@@ -29,12 +29,15 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> { ...@@ -29,12 +29,15 @@ public interface OpmArticleRepository extends CyBaseMapper<OpmArticle> {
*/ */
IPage<OpmArticle> queryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle opmArticle); IPage<OpmArticle> queryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle opmArticle);
/** //app-最近-分页查询 OpmArticle
* app-分页查询 OpmArticle
*
*/
IPage<OpmArticle> appQueryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle opmArticle); IPage<OpmArticle> appQueryOpmArticlePaged(CyPageInfo cyPageInfo, @Param("entity") OpmArticle opmArticle);
//app-话题-分页查询 OpmArticle
IPage<OpmArticle> appQueryTopicOpmArticlePaged(CyPageInfo<OpmArticle> paginationUtility,@Param("entity") OpmArticle opmArticle);
//app-关注-分页查询 OpmArticle
IPage<OpmArticle> appQueryFollowOpmArticlePaged(CyPageInfo<OpmArticle> paginationUtility,@Param("entity") OpmArticle opmArticle);
OpmArticle selectArticleDetail(@Param("articleId") Integer articleId, @Param("loginUserId") String loginUserId); OpmArticle selectArticleDetail(@Param("articleId") Integer articleId, @Param("loginUserId") String loginUserId);
//web查询评论 //web查询评论
......
...@@ -46,7 +46,7 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> { ...@@ -46,7 +46,7 @@ public class OpmArticle extends CyIdIncreEntity<OpmArticle> {
/** /**
* @desc 是否动态 * @desc 是否动态
* @column is_article * @column is_article 1:普通动态 0:话题动态
* @default * @default
*/ */
private String isArticle; private String isArticle;
......
...@@ -192,7 +192,13 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -192,7 +192,13 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
opmArticle.setRemarks(msg.toString()); opmArticle.setRemarks(msg.toString());
} }
} }
//判断是否是普通动态
if (opmArticle.getTopicId() == null){
//普通动态
opmArticle.setIsArticle("1");
} else {
opmArticle.setIsArticle("0");
}
int line = baseMapper.insert(opmArticle); int line = baseMapper.insert(opmArticle);
log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+ log.debug(CyUserUtil.getAuthenUsername()+"新增了ID为"+
opmArticle.getBusinessId()+"的opmArticle管理信息"); opmArticle.getBusinessId()+"的opmArticle管理信息");
...@@ -252,6 +258,10 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -252,6 +258,10 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
String loginUserId = CyUserUtil.getAuthenBusinessId(); String loginUserId = CyUserUtil.getAuthenBusinessId();
//根据动态id 查询动态详情 //根据动态id 查询动态详情
OpmArticle opmArticle = baseMapper.selectArticleDetail(articleId,loginUserId); OpmArticle opmArticle = baseMapper.selectArticleDetail(articleId,loginUserId);
if (opmArticle == null){
//该动态 对方已删除
throw new CyServiceException(1001,"该动态已被对方删除!");
}
//查询该动态的评论 //查询该动态的评论
List<ArticleCommentVO> list = baseMapper.appSelectArticleComment(opmArticle.getBusinessId(),loginUserId); List<ArticleCommentVO> list = baseMapper.appSelectArticleComment(opmArticle.getBusinessId(),loginUserId);
list.forEach(item -> { list.forEach(item -> {
...@@ -300,15 +310,22 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm ...@@ -300,15 +310,22 @@ public class OpmArticleServiceImpl extends ServiceImpl<OpmArticleRepository, Opm
//设置当前登录人id 用来查询该用户对文章是否已点赞 //设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId()); opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId());
} }
result = baseMapper.appQueryOpmArticlePaged(paginationUtility,opmArticle); result = baseMapper.appQueryFollowOpmArticlePaged(paginationUtility,opmArticle);
} }
} else { } else if(opmArticle.getArticleType() != null && opmArticle.getArticleType().equals("1")){
//话题 最近 //最近
if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){ if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){
//设置当前登录人id 用来查询该用户对文章是否已点赞 //设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId()); opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId());
} }
result = baseMapper.appQueryOpmArticlePaged(paginationUtility,opmArticle); result = baseMapper.appQueryOpmArticlePaged(paginationUtility,opmArticle);
} else {
//话题
if (StringUtils.isNotEmpty(CyUserUtil.getAuthenBusinessId())){
//设置当前登录人id 用来查询该用户对文章是否已点赞
opmArticle.setLoginUserId(CyUserUtil.getAuthenBusinessId());
}
result = baseMapper.appQueryTopicOpmArticlePaged(paginationUtility,opmArticle);
} }
} else { } else {
//管理端 //管理端
......
...@@ -222,6 +222,7 @@ ...@@ -222,6 +222,7 @@
and opa.del_flag = '0' and opa.del_flag = '0'
and opa.flag = '1' and opa.flag = '1'
and opa.exam_status = '1' and opa.exam_status = '1'
and opa.is_article = '1'
and opa.create_by not in ( and opa.create_by not in (
select obl.target_id select obl.target_id
from opm_black_list obl from opm_black_list obl
...@@ -232,9 +233,6 @@ ...@@ -232,9 +233,6 @@
from opm_black_list obl from opm_black_list obl
where obl.target_id = #{entity.loginUserId} where obl.target_id = #{entity.loginUserId}
) )
<if test="entity.topicId !=null and entity.topicId != 0 ">
and opa.topic_id = #{entity.topicId}
</if>
<if test="entity.followList != null and entity.followList.size > 0"> <if test="entity.followList != null and entity.followList.size > 0">
and opa.create_by IN and opa.create_by IN
<foreach item="item" index="index" collection="entity.followList" <foreach item="item" index="index" collection="entity.followList"
...@@ -279,10 +277,170 @@ ...@@ -279,10 +277,170 @@
and opa.del_flag = '0' and opa.del_flag = '0'
and opa.flag = '1' and opa.flag = '1'
and opa.exam_status = '0' and opa.exam_status = '0'
and opa.is_article = '1'
and opa.create_by = #{entity.loginUserId} and opa.create_by = #{entity.loginUserId}
) )
ORDER BY create_date DESC ORDER BY create_date DESC
</select> </select>
<select id="appQueryFollowOpmArticlePaged" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT
opa.business_id,
opa.flag,
opa.del_flag,
opa.comment_count,
opa.like_count,
opa.exam_status,
opa.is_article,
opa.create_date,
opa.content,
opa.create_by AS userId,
opa.picture_id,
opt.topic_name AS topic,
mi.mem_code,
mi.mem_nick_name,
mi.mem_sex,
mi.mem_birthday,
mi.mem_residence_province,
mi.mem_residence_city,
mi.mem_max_education,
mi.mem_career,
mi.mem_wx_code,
mi.business_id AS memberId,
mi.avatar AS avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike
FROM
opm_article opa
LEFT JOIN opm_topic opt ON opa.topic_id = opt.business_id
LEFT JOIN mem_info mi ON opa.create_by = mi.user_id
LEFT JOIN opm_article_like oal on oal.article_id = opa.business_id and oal.user_id = #{entity.loginUserId}
WHERE 1=1
and opa.del_flag = '0'
and opa.flag = '1'
and opa.exam_status = '1'
and opa.create_by not in (
select obl.target_id
from opm_black_list obl
where obl.user_id = #{entity.loginUserId}
)
and opa.create_by not in (
select obl.user_id
from opm_black_list obl
where obl.target_id = #{entity.loginUserId}
)
<if test="entity.followList != null and entity.followList.size > 0">
and opa.create_by IN
<foreach item="item" index="index" collection="entity.followList"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
ORDER BY create_date DESC
</select>
<select id="appQueryTopicOpmArticlePaged" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT
opa.business_id,
opa.flag,
opa.del_flag,
opa.comment_count,
opa.like_count,
opa.exam_status,
opa.is_article,
opa.create_date,
opa.content,
opa.create_by AS userId,
opa.picture_id,
opt.topic_name AS topic,
mi.mem_code,
mi.mem_nick_name,
mi.mem_sex,
mi.mem_birthday,
mi.mem_residence_province,
mi.mem_residence_city,
mi.mem_max_education,
mi.mem_career,
mi.mem_wx_code,
mi.business_id AS memberId,
mi.avatar AS avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike
FROM
opm_article opa
LEFT JOIN opm_topic opt ON opa.topic_id = opt.business_id
LEFT JOIN mem_info mi ON opa.create_by = mi.user_id
LEFT JOIN opm_article_like oal on oal.article_id = opa.business_id and oal.user_id = #{entity.loginUserId}
WHERE 1=1
and opa.del_flag = '0'
and opa.flag = '1'
and opa.exam_status = '1'
and opa.is_article = '0'
and opa.create_by not in (
select obl.target_id
from opm_black_list obl
where obl.user_id = #{entity.loginUserId}
)
and opa.create_by not in (
select obl.user_id
from opm_black_list obl
where obl.target_id = #{entity.loginUserId}
)
<if test="entity.topicId !=null and entity.topicId != 0 ">
and opa.topic_id = #{entity.topicId}
</if>
<if test="entity.followList != null and entity.followList.size > 0">
and opa.create_by IN
<foreach item="item" index="index" collection="entity.followList"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL(
SELECT
opa.business_id,
opa.flag,
opa.del_flag,
opa.comment_count,
opa.like_count,
opa.exam_status,
opa.is_article,
opa.create_date,
opa.content,
opa.create_by AS userId,
opa.picture_id,
opt.topic_name AS topic,
mi.mem_code,
mi.mem_nick_name,
mi.mem_sex,
mi.mem_birthday,
mi.mem_residence_province,
mi.mem_residence_city,
mi.mem_max_education,
mi.mem_career,
mi.mem_wx_code,
mi.business_id AS memberId,
mi.avatar AS avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike
FROM
opm_article opa
LEFT JOIN opm_topic opt ON opa.topic_id = opt.business_id
LEFT JOIN mem_info mi ON opa.create_by = mi.user_id
LEFT JOIN opm_article_like oal on oal.article_id = opa.business_id and oal.user_id = #{entity.loginUserId}
WHERE 1=1
and opa.del_flag = '0'
and opa.flag = '1'
and opa.exam_status = '0'
and opa.is_article = '0'
and opa.create_by = #{entity.loginUserId}
<if test="entity.topicId !=null and entity.topicId != 0 ">
and opa.topic_id = #{entity.topicId}
</if>
)
ORDER BY create_date DESC
</select>
<select id="queryUserArticlePaged" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle"> <select id="queryUserArticlePaged" resultType="org.rcisoft.business.opmArticle.entity.OpmArticle">
SELECT SELECT
opa.business_id, opa.business_id,
...@@ -447,7 +605,36 @@ ...@@ -447,7 +605,36 @@
SELECT 1 FROM opm_black_list obl SELECT 1 FROM opm_black_list obl
WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id) WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id)
OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId}) OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId})
) )
UNION ALL(
SELECT
opc.business_id,
opc.content,
opc.parent_id,
opc.create_date,
opc.like_count,
opc.comment_count,
opc.create_by AS userId,
opc.user_id AS commentedUserId,
mi.mem_code AS memCode,
mi.mem_nick_name AS memNickName,
mi.avatar AS avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN
1 ELSE 0
END AS isLike
FROM
opm_article_comment opc
LEFT JOIN mem_info mi ON mi.user_id = opc.create_by
LEFT JOIN opm_article_like oal ON oal.comment_id = opc.business_id AND oal.user_id = #{loginUserId}
WHERE
1 = 1
AND opc.del_flag = '0'
AND opc.parent_id IS NULL
AND opc.article_id = #{articleId}
AND opc.exam_status = '0'
AND opc.create_by = #{loginUserId}
)
</select> </select>
<select id="selectArticleChildrenComment" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentVO"> <select id="selectArticleChildrenComment" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentVO">
SELECT SELECT
...@@ -480,6 +667,35 @@ ...@@ -480,6 +667,35 @@
WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id) WHERE (obl.user_id = #{loginUserId} AND obl.target_id = opc.user_id)
OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId}) OR (obl.user_id = opc.user_id AND obl.target_id = #{loginUserId})
) )
UNION ALL(
SELECT
opc.business_id,
opc.content,
opc.parent_id,
opc.create_date,
opc.like_count,
opc.comment_count,
opc.create_by AS userId,
opc.user_id AS commentedUserId,
mi.mem_code as memCode,
mi.mem_nick_name as memNickName,
mi2.mem_code as commentedMemCode,
mi2.mem_nick_name as commentedMemNickName,
mi.avatar as avatarId,
CASE
WHEN oal.business_id IS NOT NULL THEN 1 ELSE 0
END AS isLike
FROM opm_article_comment opc
LEFT JOIN mem_info mi ON mi.user_id = opc.create_by
LEFT JOIN mem_info mi2 ON mi2.user_id = opc.user_id
LEFT JOIN opm_article_like oal on oal.comment_id = opc.business_id and oal.user_id = #{loginUserId}
WHERE 1 = 1
AND opc.del_flag = '0'
AND opc.article_id = #{articleId}
and opc.parent_id = #{parentId}
and opc.exam_status = '0'
and opc.create_by = #{loginUserId}
)
</select> </select>
<select id="findCommentById" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentDTO"> <select id="findCommentById" resultType="org.rcisoft.business.opmArticle.entity.ArticleCommentDTO">
select * select *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment