互动讨论、考试

main
@t2652009480 2 months ago
parent c07fbd5b12
commit 6d4f3e5da7

@ -31,9 +31,9 @@ public class StuInteractionController {
@ApiOperation("讨论展示(最新一条)")
@PostMapping("/getDiscuss")
@AnonymousAccess
public ResultEntity getDiscuss(String userId,String id) {
public ResultEntity getDiscuss(String userId,String id,Integer roleId) {
return new ResultEntity<>(HttpStatus.OK,"成功",tchInteractionService. getDiscuss(userId,id));
return new ResultEntity<>(HttpStatus.OK,"成功",tchInteractionService. getDiscuss(userId,id,roleId));
}

@ -34,9 +34,9 @@ public class TchInteractionController {
@PostMapping("/getDiscuss")
@AnonymousAccess
public ResultEntity getDiscuss(@ApiParam("用户ID") String userId,
@ApiParam("ID") String id) {
@ApiParam("ID") String id,Integer roleId) {
return new ResultEntity<>(HttpStatus.OK,"成功",interactionService.getDiscuss(userId,id));
return new ResultEntity<>(HttpStatus.OK,"成功",interactionService.getDiscuss(userId,id,roleId));
}

@ -2,10 +2,7 @@ package com.sztzjy.trade.entity;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
/**
* ----
*
@ -13,30 +10,31 @@ import org.springframework.format.annotation.DateTimeFormat;
* tch_discuss_manage
*/
public class TchDiscussManage {
@ApiModelProperty("id")
@ApiModelProperty(notes = "id")
private String id;
@ApiModelProperty("讨论ID")
@ApiModelProperty(notes = "讨论ID")
private String discussId;
@ApiModelProperty("发布时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@ApiModelProperty(notes = "发布时间")
private Date createTime;
@ApiModelProperty("讨论班级(多个班级逗号隔开)")
@ApiModelProperty(notes = "讨论班级(多个班级逗号隔开)")
private String visibleClass;
@ApiModelProperty("讨论数")
@ApiModelProperty(notes = "讨论数")
private Integer discussionQuantity;
@ApiModelProperty("用户ID")
@ApiModelProperty(notes = "用户ID")
private String userId;
@ApiModelProperty("发布者名字")
@ApiModelProperty(notes = "发布者名字")
private String name;
@ApiModelProperty("讨论内容")
@ApiModelProperty(notes = "学校ID")
private String schoolId;
@ApiModelProperty(notes = "讨论内容")
private String chatContent;
public String getId() {
@ -95,6 +93,14 @@ public class TchDiscussManage {
this.name = name == null ? null : name.trim();
}
public String getSchoolId() {
return schoolId;
}
public void setSchoolId(String schoolId) {
this.schoolId = schoolId == null ? null : schoolId.trim();
}
public String getChatContent() {
return chatContent;
}

@ -574,6 +574,76 @@ public class TchDiscussManageExample {
addCriterion("name not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andSchoolIdIsNull() {
addCriterion("school_id is null");
return (Criteria) this;
}
public Criteria andSchoolIdIsNotNull() {
addCriterion("school_id is not null");
return (Criteria) this;
}
public Criteria andSchoolIdEqualTo(String value) {
addCriterion("school_id =", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdNotEqualTo(String value) {
addCriterion("school_id <>", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdGreaterThan(String value) {
addCriterion("school_id >", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdGreaterThanOrEqualTo(String value) {
addCriterion("school_id >=", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdLessThan(String value) {
addCriterion("school_id <", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdLessThanOrEqualTo(String value) {
addCriterion("school_id <=", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdLike(String value) {
addCriterion("school_id like", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdNotLike(String value) {
addCriterion("school_id not like", value, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdIn(List<String> values) {
addCriterion("school_id in", values, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdNotIn(List<String> values) {
addCriterion("school_id not in", values, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdBetween(String value1, String value2) {
addCriterion("school_id between", value1, value2, "schoolId");
return (Criteria) this;
}
public Criteria andSchoolIdNotBetween(String value1, String value2) {
addCriterion("school_id not between", value1, value2, "schoolId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -10,31 +10,31 @@ import io.swagger.annotations.ApiModelProperty;
* tch_problem_info
*/
public class TchProblemInfo {
@ApiModelProperty("教师提问ID")
@ApiModelProperty(notes = "教师提问ID")
private String id;
@ApiModelProperty("提问时间")
@ApiModelProperty(notes = "提问时间")
private Date questionTime;
@ApiModelProperty("提问的学生")
@ApiModelProperty(notes = "提问的学生")
private String questionStudent;
@ApiModelProperty("提问的方式")
@ApiModelProperty(notes = "提问的方式")
private String questionFormat;
@ApiModelProperty("所属班级")
@ApiModelProperty(notes = "所属班级")
private String classAffiliation;
@ApiModelProperty("用户ID")
@ApiModelProperty(notes = "用户ID")
private String userId;
@ApiModelProperty("提问学生的ID")
@ApiModelProperty(notes = "提问学生的ID")
private String questionUserId;
@ApiModelProperty("提问的内容")
@ApiModelProperty(notes = "提问的内容")
private String content;
@ApiModelProperty("回答")
@ApiModelProperty(notes = "回答")
private String answer;
public String getId() {

@ -3,10 +3,8 @@ package com.sztzjy.trade.mapper;
import com.sztzjy.trade.entity.TchDiscussManage;
import com.sztzjy.trade.entity.TchDiscussManageExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TchDiscussManageMapper {
long countByExample(TchDiscussManageExample example);

@ -3,10 +3,8 @@ package com.sztzjy.trade.mapper;
import com.sztzjy.trade.entity.TchProblemInfo;
import com.sztzjy.trade.entity.TchProblemInfoExample;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TchProblemInfoMapper {
long countByExample(TchProblemInfoExample example);

@ -16,7 +16,7 @@ import java.util.List;
* @date 2024/8/15 11:05
*/
public interface TchInteractionService {
TchDiscussInfoDTO getDiscuss(String userId,String id);
TchDiscussInfoDTO getDiscuss(String userId,String id,Integer roleId);
Integer publish(TchReleaseDTO releaseDTO);

@ -44,6 +44,7 @@ public class StuInteractionServiceImpl implements StuInteractionService {
tchDiscussManage.setChatContent(releaseDTO.getChatContent());
tchDiscussManage.setUserId(releaseDTO.getUserId());
tchDiscussManage.setName(name);
tchDiscussManage.setSchoolId(stuUser.getSchoolId());

@ -40,16 +40,23 @@ public class TchInteractionImpl implements TchInteractionService {
TchProblemInfoMapper tchProblemInfoMapper;
@Override
public TchDiscussInfoDTO getDiscuss(String userId,String priId) {
public TchDiscussInfoDTO getDiscuss(String userId,String priId,Integer roleId) {
List<TchDiscussManage> tchDiscussManages=new ArrayList<>();
if(priId==null){ //默认为最新的一条
if(priId==null || priId.isEmpty()){ //默认为最新的一条
// TODO: 2024/8/15 1、查询已发布的讨论信息取到最新一条2、获取讨论ID查询所有学生回复的讨论信息3、根据学生回复的讨论ID查询老师的回复
StuUser stuUser = stuUserMapper.selectByPrimaryKey(userId);
//1、查询已发布的讨论信息取到最新一条
TchDiscussManageExample discussManageExample=new TchDiscussManageExample();
discussManageExample.createCriteria().andUserIdEqualTo(userId);
if (roleId==4){
discussManageExample.createCriteria().andSchoolIdEqualTo(stuUser.getSchoolId());
}else {
discussManageExample.createCriteria().andUserIdEqualTo(userId);
}
discussManageExample.setOrderByClause("create_time DESC");
tchDiscussManages = discussManageMapper.selectByExampleWithBLOBs(discussManageExample);
}else { //根据id查询讨论信息

@ -9,6 +9,7 @@
<result column="discussion_quantity" jdbcType="INTEGER" property="discussionQuantity" />
<result column="user_id" jdbcType="VARCHAR" property="userId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="school_id" jdbcType="VARCHAR" property="schoolId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.sztzjy.trade.entity.TchDiscussManage">
<result column="chat_content" jdbcType="LONGVARCHAR" property="chatContent" />
@ -72,7 +73,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, discuss_id, create_time, visible_class, discussion_quantity, user_id, name
id, discuss_id, create_time, visible_class, discussion_quantity, user_id, name, school_id
</sql>
<sql id="Blob_Column_List">
chat_content
@ -128,10 +129,12 @@
<insert id="insert" parameterType="com.sztzjy.trade.entity.TchDiscussManage">
insert into tch_discuss_manage (id, discuss_id, create_time,
visible_class, discussion_quantity, user_id,
name, chat_content)
name, school_id, chat_content
)
values (#{id,jdbcType=VARCHAR}, #{discussId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{visibleClass,jdbcType=VARCHAR}, #{discussionQuantity,jdbcType=INTEGER}, #{userId,jdbcType=VARCHAR},
#{name,jdbcType=VARCHAR}, #{chatContent,jdbcType=LONGVARCHAR})
#{name,jdbcType=VARCHAR}, #{schoolId,jdbcType=VARCHAR}, #{chatContent,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.trade.entity.TchDiscussManage">
insert into tch_discuss_manage
@ -157,6 +160,9 @@
<if test="name != null">
name,
</if>
<if test="schoolId != null">
school_id,
</if>
<if test="chatContent != null">
chat_content,
</if>
@ -183,6 +189,9 @@
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
#{schoolId,jdbcType=VARCHAR},
</if>
<if test="chatContent != null">
#{chatContent,jdbcType=LONGVARCHAR},
</if>
@ -218,6 +227,9 @@
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.schoolId != null">
school_id = #{record.schoolId,jdbcType=VARCHAR},
</if>
<if test="record.chatContent != null">
chat_content = #{record.chatContent,jdbcType=LONGVARCHAR},
</if>
@ -235,6 +247,7 @@
discussion_quantity = #{record.discussionQuantity,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR},
chat_content = #{record.chatContent,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -248,7 +261,8 @@
visible_class = #{record.visibleClass,jdbcType=VARCHAR},
discussion_quantity = #{record.discussionQuantity,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR}
name = #{record.name,jdbcType=VARCHAR},
school_id = #{record.schoolId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -274,6 +288,9 @@
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="schoolId != null">
school_id = #{schoolId,jdbcType=VARCHAR},
</if>
<if test="chatContent != null">
chat_content = #{chatContent,jdbcType=LONGVARCHAR},
</if>
@ -288,6 +305,7 @@
discussion_quantity = #{discussionQuantity,jdbcType=INTEGER},
user_id = #{userId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR},
chat_content = #{chatContent,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -298,7 +316,8 @@
visible_class = #{visibleClass,jdbcType=VARCHAR},
discussion_quantity = #{discussionQuantity,jdbcType=INTEGER},
user_id = #{userId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR}
name = #{name,jdbcType=VARCHAR},
school_id = #{schoolId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
Loading…
Cancel
Save