commit
36b479dd25
@ -7,6 +7,7 @@ import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.sign.AesUtils;
|
||||
import com.stdiet.custom.domain.SysOrderPause;
|
||||
import com.stdiet.custom.domain.SysVideoComment;
|
||||
import com.stdiet.custom.domain.SysWxAdLog;
|
||||
import com.stdiet.custom.service.*;
|
||||
import com.stdiet.custom.utils.CookieUtils;
|
||||
@ -45,6 +46,9 @@ public class SysWapController extends BaseController {
|
||||
@Autowired
|
||||
ISysSmsConfirmServie iSysSmsConfirmServie;
|
||||
|
||||
@Autowired
|
||||
ISysNutritionalVideoService iSysNutritionalVideoService;
|
||||
|
||||
|
||||
/**
|
||||
* 客户食谱详情
|
||||
@ -159,6 +163,12 @@ public class SysWapController extends BaseController {
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/checkCookie")
|
||||
public AjaxResult checkCookie(HttpServletRequest request) {
|
||||
JSONObject resultObj = CookieUtils.checkCookieValida(request, "token");
|
||||
@ -169,6 +179,12 @@ public class SysWapController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码校验
|
||||
*
|
||||
* @param phone
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getCode")
|
||||
public AjaxResult getCode(@RequestParam String phone) {
|
||||
|
||||
@ -200,8 +216,6 @@ public class SysWapController extends BaseController {
|
||||
String tokenStr = phone + "_" + new Date().getTime() + "_" + RandomStringUtils.randomAlphanumeric(8);
|
||||
Cookie cookie = new Cookie("token", AesUtils.encrypt(tokenStr));
|
||||
cookie.setMaxAge(24 * 60 * 60);
|
||||
// cookie.setSecure(true);
|
||||
// cookie.setHttpOnly(true);
|
||||
cookie.setPath("/");
|
||||
response.addCookie(cookie);
|
||||
return new AjaxResult(20000, "登录成功");
|
||||
@ -214,4 +228,53 @@ public class SysWapController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping(value = "/video/comment")
|
||||
public AjaxResult getVideoComment(SysVideoComment videoComment, HttpServletRequest request) {
|
||||
JSONObject result = CookieUtils.checkCookieValida(request, "token");
|
||||
|
||||
String phone = result.getString("phone");
|
||||
List<SysVideoComment> comments = iSysNutritionalVideoService.selectVideoCommentByTopicId(videoComment, phone == null ? "" : phone);
|
||||
|
||||
return AjaxResult.success(comments);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/video/post/comment")
|
||||
public AjaxResult insertVideoComment(@RequestBody SysVideoComment videoComment, HttpServletRequest request) {
|
||||
JSONObject result = CookieUtils.checkCookieValida(request, "token");
|
||||
if (result.getInteger("code") != 200) {
|
||||
return AjaxResult.error(result.getInteger("code"), result.getString("msg"));
|
||||
}
|
||||
|
||||
videoComment.setFromUid(result.getString("phone"));
|
||||
videoComment.setFromRole("phone");
|
||||
|
||||
SysVideoComment comment = iSysNutritionalVideoService.insertVideoComment(videoComment);
|
||||
|
||||
if (StringUtils.isNull(comment)) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
return AjaxResult.success(comment);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/video/post/reply")
|
||||
public AjaxResult insertVideoCommentReply(@RequestBody SysVideoComment videoComment, HttpServletRequest request) {
|
||||
JSONObject result = CookieUtils.checkCookieValida(request, "token");
|
||||
if (result.getInteger("code") != 200) {
|
||||
return AjaxResult.error(result.getInteger("code"), result.getString("msg"));
|
||||
}
|
||||
|
||||
videoComment.setFromUid(result.getString("phone"));
|
||||
videoComment.setFromRole("phone");
|
||||
|
||||
SysVideoComment reply = iSysNutritionalVideoService.insertVideoCommentReply(videoComment);
|
||||
|
||||
if (StringUtils.isNull(reply)) {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
return AjaxResult.success(reply);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -47,11 +47,6 @@ public class VideoWebInterfaceController extends BaseController {
|
||||
|
||||
JSONObject result = CookieUtils.checkCookieValida(request, "token");
|
||||
if (result.getInteger("code") != 200) {
|
||||
// TableDataInfo errInfo = new TableDataInfo();
|
||||
// errInfo.setCode(result.getInteger("code"));
|
||||
// errInfo.setMsg(result.getString("msg"));
|
||||
// return errInfo;
|
||||
|
||||
Cookie cookie = new Cookie("token", "");
|
||||
cookie.setMaxAge(24 * 60 * 60);
|
||||
cookie.setPath("/");
|
||||
|
@ -0,0 +1,101 @@
|
||||
package com.stdiet.custom.domain;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class SysVideoComment {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
String id;
|
||||
|
||||
/**
|
||||
* 问题id
|
||||
*/
|
||||
String topicId;
|
||||
|
||||
/**
|
||||
* 问题类型
|
||||
*/
|
||||
Integer topicType;
|
||||
|
||||
String commentId;
|
||||
|
||||
String replyId;
|
||||
|
||||
Integer replyType;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
String uid;
|
||||
|
||||
String fromUid;
|
||||
|
||||
String toUid;
|
||||
|
||||
/**
|
||||
* 问题内容
|
||||
*/
|
||||
String content;
|
||||
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
JSONArray img;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date createTime;
|
||||
|
||||
/**
|
||||
* 0-未读 1-已读
|
||||
*/
|
||||
Integer read;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
Date updateTime;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
String role;
|
||||
|
||||
String fromRole;
|
||||
|
||||
String toRole;
|
||||
|
||||
// 非持久化字段
|
||||
/**
|
||||
* 角色名字
|
||||
*/
|
||||
String fromName;
|
||||
String toName;
|
||||
String name;
|
||||
|
||||
String avatar;
|
||||
String fromAvatar;
|
||||
String toAvatar;
|
||||
|
||||
|
||||
List<SysVideoComment> comments;
|
||||
|
||||
List<SysVideoComment> replys;
|
||||
|
||||
Integer count;
|
||||
|
||||
Boolean owner;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.stdiet.custom.mapper;
|
||||
|
||||
import com.stdiet.custom.domain.SysVideoComment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysVideoCommentMapper {
|
||||
List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment);
|
||||
|
||||
int insertVideoComment(SysVideoComment videoComment);
|
||||
|
||||
int insertVideoCommentReply(SysVideoComment videoComment);
|
||||
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
import com.stdiet.custom.domain.SysVideoClassify;
|
||||
import com.stdiet.custom.domain.SysVideoComment;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
@ -89,4 +90,25 @@ public interface ISysNutritionalVideoService
|
||||
* @return
|
||||
*/
|
||||
public int updateVideoPlayNum(String videoId);
|
||||
|
||||
/**
|
||||
* 获取评论
|
||||
* @param videoComment
|
||||
* @return
|
||||
*/
|
||||
public List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment, String phone);
|
||||
|
||||
/**
|
||||
* 添加评论
|
||||
* @param videoComment
|
||||
* @return
|
||||
*/
|
||||
public SysVideoComment insertVideoComment(SysVideoComment videoComment);
|
||||
|
||||
/**
|
||||
* 添加回复
|
||||
* @param videoComment
|
||||
* @return
|
||||
*/
|
||||
public SysVideoComment insertVideoCommentReply(SysVideoComment videoComment);
|
||||
}
|
@ -1,22 +1,24 @@
|
||||
package com.stdiet.custom.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponse;
|
||||
import com.aliyun.vod20170321.models.SearchMediaResponseBody;
|
||||
import com.stdiet.common.utils.AliyunVideoUtils;
|
||||
import com.stdiet.common.utils.DateUtils;
|
||||
import com.stdiet.common.utils.StringUtils;
|
||||
import com.stdiet.common.utils.oss.AliyunOSSUtils;
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
import com.stdiet.custom.domain.SysVideoComment;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
import com.stdiet.custom.mapper.SysVideoCommentMapper;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.stdiet.custom.mapper.SysNutritionalVideoMapper;
|
||||
import com.stdiet.custom.domain.SysNutritionalVideo;
|
||||
import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 营养视频Service业务层处理
|
||||
@ -25,11 +27,13 @@ import com.stdiet.custom.service.ISysNutritionalVideoService;
|
||||
* @date 2021-04-29
|
||||
*/
|
||||
@Service
|
||||
public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService
|
||||
{
|
||||
public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoService {
|
||||
@Autowired
|
||||
private SysNutritionalVideoMapper sysNutritionalVideoMapper;
|
||||
|
||||
@Autowired
|
||||
private SysVideoCommentMapper sysVideoCommentMapper;
|
||||
|
||||
/**
|
||||
* 查询营养视频
|
||||
*
|
||||
@ -37,8 +41,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 营养视频
|
||||
*/
|
||||
@Override
|
||||
public SysNutritionalVideo selectSysNutritionalVideoById(Long id)
|
||||
{
|
||||
public SysNutritionalVideo selectSysNutritionalVideoById(Long id) {
|
||||
return sysNutritionalVideoMapper.selectSysNutritionalVideoById(id);
|
||||
}
|
||||
|
||||
@ -49,8 +52,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 营养视频
|
||||
*/
|
||||
@Override
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag)
|
||||
{
|
||||
public List<SysNutritionalVideo> selectSysNutritionalVideoList(SysNutritionalVideo sysNutritionalVideo, boolean flag) {
|
||||
List<SysNutritionalVideo> list = sysNutritionalVideoMapper.selectSysNutritionalVideoList(sysNutritionalVideo);
|
||||
if (flag && list != null && list.size() > 0) {
|
||||
List<String> fileUrl = new ArrayList<>();
|
||||
@ -103,8 +105,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
public int insertSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
|
||||
sysNutritionalVideo.setCreateTime(DateUtils.getNowDate());
|
||||
//判断封面是上传的还是阿里云视频截图封面
|
||||
if (isSnapshot(sysNutritionalVideo.getCoverUrl())) {
|
||||
@ -127,8 +128,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo)
|
||||
{
|
||||
public int updateSysNutritionalVideo(SysNutritionalVideo sysNutritionalVideo) {
|
||||
sysNutritionalVideo.setUpdateTime(DateUtils.getNowDate());
|
||||
sysNutritionalVideo.setCoverUrl(sysNutritionalVideo.getCoverUrl() == null ? "" : sysNutritionalVideo.getCoverUrl());
|
||||
String coverUrl = sysNutritionalVideo.getCoverUrl();
|
||||
@ -160,8 +160,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysNutritionalVideoByIds(Long[] ids)
|
||||
{
|
||||
public int deleteSysNutritionalVideoByIds(Long[] ids) {
|
||||
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoByIds(ids);
|
||||
if (row > 0) {
|
||||
updateAliyunVideoCateId(ids);
|
||||
@ -176,8 +175,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSysNutritionalVideoById(Long id)
|
||||
{
|
||||
public int deleteSysNutritionalVideoById(Long id) {
|
||||
int row = sysNutritionalVideoMapper.deleteSysNutritionalVideoById(id);
|
||||
if (row > 0) {
|
||||
Long[] ids = {id};
|
||||
@ -188,6 +186,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
|
||||
/**
|
||||
* 获取视频
|
||||
*
|
||||
* @param videoId
|
||||
* @return
|
||||
*/
|
||||
@ -197,6 +196,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
|
||||
/**
|
||||
* 阿里云视频查询检索
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> searchVideo(String key, Integer showFlag, Integer pageNo, Integer pageSize, String scrollToken) {
|
||||
@ -251,6 +251,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
|
||||
/**
|
||||
* 更新微信展示状态
|
||||
*
|
||||
* @param wxShow
|
||||
* @param ids
|
||||
* @return
|
||||
@ -261,6 +262,7 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
|
||||
/**
|
||||
* 将删除的阿里云视频放入回收站
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
@Async
|
||||
@ -279,14 +281,73 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
|
||||
/**
|
||||
* 更新视频播放量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int updateVideoPlayNum(String videoId) {
|
||||
return sysNutritionalVideoMapper.updateVideoPlayNum(videoId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysVideoComment> selectVideoCommentByTopicId(SysVideoComment videoComment, String uid) {
|
||||
List<SysVideoComment> comments = sysVideoCommentMapper.selectVideoCommentByTopicId(videoComment);
|
||||
for (SysVideoComment comment : comments) {
|
||||
if(comment.getFromUid().equals(uid)){
|
||||
comment.setOwner(true);
|
||||
} else {
|
||||
comment.setOwner(false);
|
||||
}
|
||||
if (comment.getFromRole().equals("phone")) {
|
||||
comment.setFromUid(StringUtils.hiddenPhoneNumber(comment.getFromUid()));
|
||||
}
|
||||
if (comment.getToRole().equals("phone")) {
|
||||
comment.setToUid(StringUtils.hiddenPhoneNumber(comment.getToUid()));
|
||||
}
|
||||
List<SysVideoComment> replys = comment.getReplys();
|
||||
for (SysVideoComment reply : replys) {
|
||||
if(reply.getFromUid().equals(uid)){
|
||||
reply.setOwner(true);
|
||||
} else {
|
||||
reply.setOwner(false);
|
||||
}
|
||||
if (reply.getFromRole().equals("phone")) {
|
||||
reply.setFromUid(StringUtils.hiddenPhoneNumber(reply.getFromUid()));
|
||||
}
|
||||
if (reply.getToRole().equals("phone")) {
|
||||
reply.setToUid(StringUtils.hiddenPhoneNumber(reply.getToUid()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysVideoComment insertVideoComment(SysVideoComment videoComment) {
|
||||
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
videoComment.setId(uuid);
|
||||
int rows = sysVideoCommentMapper.insertVideoComment(videoComment);
|
||||
if (rows > 0) {
|
||||
return videoComment;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysVideoComment insertVideoCommentReply(SysVideoComment videoComment) {
|
||||
String id = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
videoComment.setId(id);
|
||||
String uuid = java.util.UUID.randomUUID().toString().replace("-", "");
|
||||
videoComment.setReplyId(uuid);
|
||||
int rows = sysVideoCommentMapper.insertVideoCommentReply(videoComment);
|
||||
if (rows > 0) {
|
||||
return videoComment;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为阿里点播的截图
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
@ -295,5 +356,4 @@ public class SysNutritionalVideoServiceImpl implements ISysNutritionalVideoServi
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.stdiet.custom.mapper.SysVideoCommentMapper">
|
||||
|
||||
<resultMap id="SysVideoCommentResult" type="SysVideoComment">
|
||||
<result column="id" property="id"/>
|
||||
<result column="topic_id" property="topicId"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="from_uid" property="fromUid"/>
|
||||
<result column="from_role" property="fromRole"/>
|
||||
<result column="to_uid" property="toUid"/>
|
||||
<result column="to_role" property="toRole"/>
|
||||
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
|
||||
<result column="create_time" property="createTime"/>
|
||||
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
|
||||
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
|
||||
<association property="replys" column="id"
|
||||
select="selectVideoCommentReplyByCommentId"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="SysVideoCommentReplyResult" type="SysVideoComment">
|
||||
<result column="id" property="id"/>
|
||||
<result column="topic_id" property="topicId"/>
|
||||
<result column="comment_id" property="commentId"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="from_uid" property="fromUid"/>
|
||||
<result column="from_role" property="fromRole"/>
|
||||
<result column="to_uid" property="toUid"/>
|
||||
<result column="to_role" property="toRole"/>
|
||||
<result column="reply_id" property="replyId"/>
|
||||
<!-- <result column="img" property="img" typeHandler="com.stdiet.custom.typehandler.ArrayJsonHandler"/>-->
|
||||
<result column="create_time" property="createTime"/>
|
||||
<!-- <association property="fromName" column="{uid=from_uid,role=from_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="fromAvatar" column="{uid=from_uid,role=from_role}" select="selectUserAvatar"/>-->
|
||||
<!-- <association property="toName" column="{uid=to_uid,role=to_role}" select="selectUserInfo"/>-->
|
||||
<!-- <association property="toAvatar" column="{uid=to_uid,role=to_role}" select="selectUserAvatar"/>-->
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVideoCommentByTopicId" resultMap="SysVideoCommentResult">
|
||||
select * from sys_nutritional_video_comment where topic_id = #{topicId} and del_flag = 0
|
||||
order by create_time asc
|
||||
</select>
|
||||
|
||||
<select id="selectVideoCommentReplyByCommentId" resultMap="SysVideoCommentReplyResult">
|
||||
select * from sys_nutritional_video_reply where comment_id = #{id} and del_flag = 0
|
||||
order by create_time asc
|
||||
</select>
|
||||
|
||||
<!-- 查询人名-->
|
||||
<select id="selectUserInfo" parameterType="java.util.Map" resultType="String">
|
||||
<choose>
|
||||
<when test="_parameter.get('role') == 'customer'">
|
||||
select name from sys_customer where id = #{uid}
|
||||
</when>
|
||||
<otherwise>
|
||||
select nick_name from sys_user where user_id = #{uid}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 查询头像-->
|
||||
<select id="selectUserAvatar" parameterType="java.util.Map" resultType="String">
|
||||
<choose>
|
||||
<when test="_parameter.get('role') == 'customer'">
|
||||
select avatar_url from sys_wx_user_info where cus_id = #{uid}
|
||||
</when>
|
||||
<otherwise>
|
||||
select IF(avatar != '', CONCAT("https://api.stdiet.top/prod-api", avatar), '') as avatar from sys_user
|
||||
where user_id = #{uid}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 插入问题回复-->
|
||||
<insert id="insertVideoComment" parameterType="SysVideoComment">
|
||||
insert into sys_nutritional_video_comment
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="topicId != null">topic_id,</if>
|
||||
<if test="fromUid != null">from_uid,</if>
|
||||
<if test="fromRole != null">from_role,</if>
|
||||
<if test="toUid != null">to_uid,</if>
|
||||
<if test="toRole != null">to_role,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="img != null">img,</if>
|
||||
<if test="topicId != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="topicId != null">#{topicId},</if>
|
||||
<if test="fromUid != null">#{fromUid},</if>
|
||||
<if test="fromRole != null">#{fromRole},</if>
|
||||
<if test="toUid != null">#{toUid},</if>
|
||||
<if test="toRole != null">#{toRole},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="img != null">
|
||||
#{img, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
|
||||
</if>
|
||||
<if test="topicId != null">now(),</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 插入问题回复-->
|
||||
<insert id="insertVideoCommentReply" parameterType="SysVideoComment" useGeneratedKeys="true" keyColumn="id"
|
||||
keyProperty="id">
|
||||
insert into sys_nutritional_video_reply
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="commentId != null">comment_id,</if>
|
||||
<if test="replyId != null">reply_id,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="fromUid != null">from_uid,</if>
|
||||
<if test="toUid != null">to_uid,</if>
|
||||
<if test="img != null">img,</if>
|
||||
<if test="fromRole != null">from_role,</if>
|
||||
<if test="toRole != null">to_role,</if>
|
||||
<if test="content != null">create_time,</if>
|
||||
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="commentId != null">#{commentId},</if>
|
||||
<if test="replyId != null">#{replyId},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="fromUid != null">#{fromUid},</if>
|
||||
<if test="toUid != null">#{toUid},</if>
|
||||
<if test="img != null">
|
||||
#{img, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler},
|
||||
</if>
|
||||
<if test="fromRole != null">#{fromRole},</if>
|
||||
<if test="toRole != null">#{toRole},</if>
|
||||
<if test="content != null">now(),</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user