互动讨论、考试

main
@t2652009480 3 months ago
parent c07fbd5b12
commit 6d4f3e5da7

@ -31,9 +31,9 @@ public class StuInteractionController {
@ApiOperation("讨论展示(最新一条)") @ApiOperation("讨论展示(最新一条)")
@PostMapping("/getDiscuss") @PostMapping("/getDiscuss")
@AnonymousAccess @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") @PostMapping("/getDiscuss")
@AnonymousAccess @AnonymousAccess
public ResultEntity getDiscuss(@ApiParam("用户ID") String userId, 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 java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
/** /**
* ---- * ----
* *
@ -13,30 +10,31 @@ import org.springframework.format.annotation.DateTimeFormat;
* tch_discuss_manage * tch_discuss_manage
*/ */
public class TchDiscussManage { public class TchDiscussManage {
@ApiModelProperty("id") @ApiModelProperty(notes = "id")
private String id; private String id;
@ApiModelProperty("讨论ID") @ApiModelProperty(notes = "讨论ID")
private String discussId; private String discussId;
@ApiModelProperty("发布时间") @ApiModelProperty(notes = "发布时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime; private Date createTime;
@ApiModelProperty("讨论班级(多个班级逗号隔开)") @ApiModelProperty(notes = "讨论班级(多个班级逗号隔开)")
private String visibleClass; private String visibleClass;
@ApiModelProperty("讨论数") @ApiModelProperty(notes = "讨论数")
private Integer discussionQuantity; private Integer discussionQuantity;
@ApiModelProperty("用户ID") @ApiModelProperty(notes = "用户ID")
private String userId; private String userId;
@ApiModelProperty("发布者名字") @ApiModelProperty(notes = "发布者名字")
private String name; private String name;
@ApiModelProperty("讨论内容") @ApiModelProperty(notes = "学校ID")
private String schoolId;
@ApiModelProperty(notes = "讨论内容")
private String chatContent; private String chatContent;
public String getId() { public String getId() {
@ -95,6 +93,14 @@ public class TchDiscussManage {
this.name = name == null ? null : name.trim(); 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() { public String getChatContent() {
return chatContent; return chatContent;
} }

@ -574,6 +574,76 @@ public class TchDiscussManageExample {
addCriterion("name not between", value1, value2, "name"); addCriterion("name not between", value1, value2, "name");
return (Criteria) this; 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 { public static class Criteria extends GeneratedCriteria {

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

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

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

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

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

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

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