Ver código fonte

我的消息

change 3 anos atrás
pai
commit
6f90244f16

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/mapper/UserNoteMapper.java

@@ -4,6 +4,7 @@ import com.zhongzheng.modules.user.bo.UserNoteQueryBo;
 import com.zhongzheng.modules.user.domain.UserNote;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.zhongzheng.modules.user.vo.UserDateNoteVo;
+import com.zhongzheng.modules.user.vo.UserNoteVo;
 
 import java.util.List;
 
@@ -16,4 +17,6 @@ import java.util.List;
 public interface UserNoteMapper extends BaseMapper<UserNote> {
 
     List<UserDateNoteVo> listDate(UserNoteQueryBo bo);
+
+    List<UserNoteVo> listDateSon(UserNoteQueryBo bo);
 }

+ 2 - 10
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserNoteServiceImpl.java

@@ -109,16 +109,8 @@ public class UserNoteServiceImpl extends ServiceImpl<UserNoteMapper, UserNote> i
     public List<UserDateNoteVo> listDate(UserNoteQueryBo bo) {
         List<UserDateNoteVo> userDateVos = baseMapper.listDate(bo);
         for (UserDateNoteVo userDateVo : userDateVos) {
-            LambdaQueryWrapper<UserNote> lqw = Wrappers.lambdaQuery();
-            lqw.eq(userDateVo.getDateNote() != null, UserNote::getNoteDate, userDateVo.getDateNote());
-            lqw.eq(bo.getCourseId() != null, UserNote::getCourseId, bo.getCourseId());
-            lqw.eq(bo.getSectionId() != null, UserNote::getSectionId, bo.getSectionId());
-            lqw.eq(bo.getGoodsId() != null, UserNote::getGoodsId, bo.getGoodsId());
-            lqw.eq(bo.getModuleId() != null, UserNote::getModuleId, bo.getModuleId());
-            lqw.eq(bo.getChapterId() != null, UserNote::getChapterId, bo.getChapterId());
-            lqw.eq(bo.getGradeId() != null, UserNote::getGradeId, bo.getGradeId());
-            lqw.in(bo.getStatus() != null, UserNote::getStatus, bo.getStatus());
-            List<UserNoteVo> userNoteVos = entity2Vo(this.list(lqw));
+            bo.setNoteDate(userDateVo.getDateNote());
+            List<UserNoteVo> userNoteVos = baseMapper.listDateSon(bo);
             userDateVo.setUserNotes(userNoteVos);
         }
         return userDateVos;

+ 5 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/vo/UserNoteVo.java

@@ -44,7 +44,7 @@ public class UserNoteVo {
 	/** 节ID */
 	@Excel(name = "节ID")
 	@ApiModelProperty("节ID")
-	private Long sectionName;
+	private String sectionName;
 	/** 商品Id */
 	@Excel(name = "商品Id")
 	@ApiModelProperty("商品Id")
@@ -71,5 +71,9 @@ public class UserNoteVo {
 	@ApiModelProperty("用户ID")
 	private Long userId;
 
+	/** 创建时间 */
+	@ApiModelProperty("创建时间")
+	private Long createTime;
+
 
 }

+ 46 - 0
zhongzheng-system/src/main/resources/mapper/modules/user/UserNoteMapper.xml

@@ -18,6 +18,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="gradeId" column="grade_id"/>
     </resultMap>
 
+    <resultMap type="com.zhongzheng.modules.user.vo.UserNoteVo" id="UserNoteVo">
+        <result property="noteId" column="note_id"/>
+        <result property="noteText" column="note_text"/>
+        <result property="noteDate" column="note_date"/>
+        <result property="courseId" column="course_id"/>
+        <result property="sectionId" column="section_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="moduleId" column="module_id"/>
+        <result property="chapterId" column="chapter_id"/>
+        <result property="gradeId" column="grade_id"/>
+        <result property="sectionName" column="section_name"/>
+    </resultMap>
+
     <resultMap type="com.zhongzheng.modules.user.vo.UserDateNoteVo" id="UserDateNoteVo">
         <result property="dateNote" column="date_note"/>
     </resultMap>
@@ -52,4 +66,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </if>
         order by un.note_date desc
     </select>
+
+    <select id="listDateSon" parameterType="com.zhongzheng.modules.user.bo.UserNoteQueryBo" resultMap="UserNoteVo">
+        SELECT
+            un.*,
+               (SELECT cs.`name` FROM course_section cs where cs.section_id = un.section_id) as section_name
+        FROM
+        user_note un
+        WHERE 1=1
+        AND un.status = 1
+        <if test="goodsId != null and goodsId !='' ">
+            AND un.goods_id=#{goodsId}
+        </if>
+        <if test="moduleId != null and moduleId !='' ">
+            AND un.module_id=#{moduleId}
+        </if>
+        <if test="courseId != null and courseId !='' ">
+            AND un.course_id =#{courseId}
+        </if>
+        <if test="sectionId != null and sectionId !='' ">
+            AND un.section_id =#{sectionId}
+        </if>
+        <if test="chapterId != null and chapterId !='' ">
+            AND un.chapter_id =#{chapterId}
+        </if>
+        <if test="gradeId != null and gradeId !='' ">
+            AND un.grade_id =#{gradeId}
+        </if>
+        <if test="userId != null and userId !='' ">
+            AND un.user_id =#{userId}
+        </if>
+        order by un.note_date desc
+    </select>
 </mapper>