From bd8c08d2a0a92e79ebfea72b37e572efd1158f80 Mon Sep 17 00:00:00 2001 From: Mlxa0324 Date: Mon, 19 Sep 2022 01:03:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E8=AF=BE=E4=BA=92=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/core/service/CoreUserService.java | 39 ++++++ data_base_design/天泽数据大平台.pdb | 71 +++++----- data_base_design/天泽数据大平台.pdm | 71 +++++----- httpTest/TeacherOpenCourseChatLog.http | 11 ++ httpTest/http-client.private.env.json | 2 +- .../jlw/dao/TeacherOpenCourseChatLogDao.java | 2 + .../jlw/entity/TeacherOpenCourseChatLog.java | 80 +++++------ .../TeacherOpenCourseChatLogService.java | 5 +- .../TeacherOpenCourseChatLogController.java | 33 ++++- .../query/TeacherOpenCourseChatLogQuery.java | 72 +++++----- .../sql/jlw/teacherOpenCourseChatLog.md | 132 +++++++++++------- .../js/jlw/teacherOpenCourseChatLog/index.js | 39 +++--- .../jlw/teacherOpenCourseChatLog/add.html | 33 +++-- .../jlw/teacherOpenCourseChatLog/edit.html | 33 +++-- 14 files changed, 381 insertions(+), 242 deletions(-) create mode 100644 httpTest/TeacherOpenCourseChatLog.http diff --git a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java index 27086484..732e99ab 100644 --- a/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java +++ b/admin-core/src/main/java/com/ibeetl/admin/core/service/CoreUserService.java @@ -1,5 +1,6 @@ package com.ibeetl.admin.core.service; +import cn.hutool.core.util.ReflectUtil; import com.ibeetl.admin.core.conf.PasswordConfig.PasswordEncryptService; import com.ibeetl.admin.core.dao.CoreOrgDao; import com.ibeetl.admin.core.dao.CoreUserDao; @@ -14,7 +15,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.lang.reflect.Method; import java.util.List; +import java.util.function.Consumer; @Service @Transactional @@ -94,4 +97,40 @@ public class CoreUserService { public List getCoreUserList(CoreUser coreUser){ return userDao.template(coreUser); } + + /** + * 根据身份标识,尝试获取该身份对应的ID + * @param coreUser + * @return + */ + public Long tryToGetIdByIdentity(CoreUser coreUser, Consumer consumer) throws ClassNotFoundException { + Long id = null; + // 如果是超管 + if (coreUser.isAdmin()) { + id = coreUser.getId(); + + // 如果是教师 + } else if (coreUser.isTeacher()) { + Class mapperInterface = Class.forName("com.ibeetl.jlw.dao.TeacherDao"); + Class teacherClass = Class.forName("com.ibeetl.jlw.entity.Teacher"); + Method getByUserId = ReflectUtil.getMethodByName(mapperInterface, "getByUserId"); + Object invoke = ReflectUtil.invoke(sqlManager.getMapper(mapperInterface), getByUserId); + + // 获取ID + id = (Long)ReflectUtil.getFieldValue(invoke, ReflectUtil.getField(teacherClass, "teacherId")); + + // 如果是学生 + } else if (coreUser.isStudent()) { + Class mapperInterface = Class.forName("com.ibeetl.jlw.dao.StudentDao"); + Class studentClass = Class.forName("com.ibeetl.jlw.entity.Student"); + Method getByUserId = ReflectUtil.getMethodByName(mapperInterface, "getByUserId"); + Object invoke = ReflectUtil.invoke(sqlManager.getMapper(mapperInterface), getByUserId); + + // 获取ID + id = (Long)ReflectUtil.getFieldValue(invoke, ReflectUtil.getField(studentClass, "studentId")); + } + + consumer.accept(id); + return id; + } } diff --git a/data_base_design/天泽数据大平台.pdb b/data_base_design/天泽数据大平台.pdb index 629ca682..b08b32e7 100644 --- a/data_base_design/天泽数据大平台.pdb +++ b/data_base_design/天泽数据大平台.pdb @@ -1,5 +1,5 @@ - + @@ -4553,9 +4553,9 @@ Shadow=0 1662020600 -1663078111 -((307940,-926), (325909,24981)) -((325909,-926),(325909,11662),(308240,11662),(308240,24981)) +1663511274 +((307940,-926), (328444,24981)) +((328444,-926),(328444,11662),(308240,11662),(308240,24981)) 1 8 16744576 @@ -4739,9 +4739,9 @@ Shadow=0 1662865795 -1663078108 -((287323,12394), (337544,23674)) -((337544,12394),(319070,12394),(319070,23374),(287323,23374)) +1663518151 +((287323,12044), (337544,23674)) +((337544,12044),(319070,12044),(319070,23374),(287323,23374)) 1 8 16744576 @@ -6246,9 +6246,9 @@ LABL 0 新宋体,8,N 1661963144 -1663078111 +1663511274 -1 -((316487,-8835), (335487,6555)) +((316487,-8835), (340599,6555)) 0 12615680 16570034 @@ -6543,9 +6543,9 @@ LABL 0 新宋体,8,N 1662865695 -1663078108 +1663518151 -1 -((329272,7420), (345816,17368)) +((329272,7070), (345816,17018)) 0 12615680 16570034 @@ -15561,7 +15561,7 @@ COLLATE = utf8_general_ci teacher_open_course_chat_log 1661850632 lx -1662048320 +1663511956 lx 课程开课-互动-评论日志 auto_increment = 1 @@ -15606,14 +15606,15 @@ COLLATE = utf8_general_ci D7BD01D2-4D7E-4228-B94F-711BB78D809D -school_class_id -school_class_id +school_class_ids +school_class_ids 1661963176 lx -1661963461 +1663515539 lx -班级ID -bigint +班级ID集合 +varchar(4000) +4000 18589108-4394-4335-8B90-7E3795F82B8A @@ -15621,7 +15622,7 @@ COLLATE = utf8_general_ci teacher_id 1661952562 lx -1661963144 +1663511267 lx 教师ID bigint @@ -15643,11 +15644,13 @@ COLLATE = utf8_general_ci chat_content 1661963176 lx -1662020042 -87966 +1663511779 +lx 讨论内容 -varchar(2000) -2000 +text +{F4F16ECD-F2F1-4006-AF6F-638D5C65F35E},MYSQL50,58={9480E6AA-83DD-4AA7-9C91-E48F709C29D9},CharSet,7=utf8mb4 + + D2108D51-47D4-4398-942C-4DA987E91A52 @@ -15696,6 +15699,17 @@ COLLATE = utf8_general_ci int +F4E24A74-7879-4FA7-A31A-1DF43C87CCA9 +teacher_open_course_chat_log_add_time +teacher_open_course_chat_log_add_time +1661957411 +lx +1663511956 +lx +创建时间 +datetime + + 915B6210-D43D-4773-A051-C208B1123038 org_id org_id @@ -15706,7 +15720,7 @@ COLLATE = utf8_general_ci 组织ID bigint - + 052B1726-9F05-49F3-9AE1-E73D36F22ED1 user_id user_id @@ -15717,17 +15731,6 @@ COLLATE = utf8_general_ci 用户ID bigint - -F4E24A74-7879-4FA7-A31A-1DF43C87CCA9 -create_time -create_time -1661957411 -lx -1661963144 -lx -创建时间 -datetime - diff --git a/data_base_design/天泽数据大平台.pdm b/data_base_design/天泽数据大平台.pdm index 629ca682..7da3a1e1 100644 --- a/data_base_design/天泽数据大平台.pdm +++ b/data_base_design/天泽数据大平台.pdm @@ -1,5 +1,5 @@ - + @@ -4553,9 +4553,9 @@ Shadow=0 1662020600 -1663078111 -((307940,-926), (325909,24981)) -((325909,-926),(325909,11662),(308240,11662),(308240,24981)) +1663511274 +((307940,-926), (328444,24981)) +((328444,-926),(328444,11662),(308240,11662),(308240,24981)) 1 8 16744576 @@ -4739,9 +4739,9 @@ Shadow=0 1662865795 -1663078108 -((287323,12394), (337544,23674)) -((337544,12394),(319070,12394),(319070,23374),(287323,23374)) +1663518168 +((287323,15194), (337794,23674)) +((337794,15194),(319320,15194),(319320,23374),(287323,23374)) 1 8 16744576 @@ -6246,9 +6246,9 @@ LABL 0 新宋体,8,N 1661963144 -1663078111 +1663511274 -1 -((316487,-8835), (335487,6555)) +((316487,-8835), (340599,6555)) 0 12615680 16570034 @@ -6543,9 +6543,9 @@ LABL 0 新宋体,8,N 1662865695 -1663078108 +1663518151 -1 -((329272,7420), (345816,17368)) +((329272,7070), (345816,17018)) 0 12615680 16570034 @@ -15561,7 +15561,7 @@ COLLATE = utf8_general_ci teacher_open_course_chat_log 1661850632 lx -1662048320 +1663511956 lx 课程开课-互动-评论日志 auto_increment = 1 @@ -15606,14 +15606,15 @@ COLLATE = utf8_general_ci D7BD01D2-4D7E-4228-B94F-711BB78D809D -school_class_id -school_class_id +school_class_ids +school_class_ids 1661963176 lx -1661963461 +1663515539 lx -班级ID -bigint +班级ID集合 +varchar(4000) +4000 18589108-4394-4335-8B90-7E3795F82B8A @@ -15621,7 +15622,7 @@ COLLATE = utf8_general_ci teacher_id 1661952562 lx -1661963144 +1663511267 lx 教师ID bigint @@ -15643,11 +15644,13 @@ COLLATE = utf8_general_ci chat_content 1661963176 lx -1662020042 -87966 +1663511779 +lx 讨论内容 -varchar(2000) -2000 +text +{F4F16ECD-F2F1-4006-AF6F-638D5C65F35E},MYSQL50,58={9480E6AA-83DD-4AA7-9C91-E48F709C29D9},CharSet,7=utf8mb4 + + D2108D51-47D4-4398-942C-4DA987E91A52 @@ -15696,6 +15699,17 @@ COLLATE = utf8_general_ci int +F4E24A74-7879-4FA7-A31A-1DF43C87CCA9 +teacher_open_course_chat_log_add_time +teacher_open_course_chat_log_add_time +1661957411 +lx +1663511956 +lx +创建时间 +datetime + + 915B6210-D43D-4773-A051-C208B1123038 org_id org_id @@ -15706,7 +15720,7 @@ COLLATE = utf8_general_ci 组织ID bigint - + 052B1726-9F05-49F3-9AE1-E73D36F22ED1 user_id user_id @@ -15717,17 +15731,6 @@ COLLATE = utf8_general_ci 用户ID bigint - -F4E24A74-7879-4FA7-A31A-1DF43C87CCA9 -create_time -create_time -1661957411 -lx -1661963144 -lx -创建时间 -datetime - diff --git a/httpTest/TeacherOpenCourseChatLog.http b/httpTest/TeacherOpenCourseChatLog.http new file mode 100644 index 00000000..675e253c --- /dev/null +++ b/httpTest/TeacherOpenCourseChatLog.http @@ -0,0 +1,11 @@ +### 教师发表评论 +POST {{baseURL}}/jlw/teacherOpenCourseChatLog/add.json +Content-Type: application/json +Cookie: JSESSIONID={{session}} + +{ + "chatContent": "我是讨论的内容_{{$timestamp}}", + "keywords": "讨论,内容", + "schoolClassIds": "1,2", + "teacherId": "2" +} \ No newline at end of file diff --git a/httpTest/http-client.private.env.json b/httpTest/http-client.private.env.json index a1509655..4b3e2964 100644 --- a/httpTest/http-client.private.env.json +++ b/httpTest/http-client.private.env.json @@ -1,6 +1,6 @@ { "dev": { "baseURL": "http://localhost:9090/server/", - "session": "497889C2B1819A5699DB4FB749932184" + "session": "DDA76B28B0EA912BEC98C6A156685858" } } \ No newline at end of file diff --git a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseChatLogDao.java b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseChatLogDao.java index d3b81b78..e2a3ac8c 100644 --- a/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseChatLogDao.java +++ b/web/src/main/java/com/ibeetl/jlw/dao/TeacherOpenCourseChatLogDao.java @@ -19,6 +19,8 @@ public interface TeacherOpenCourseChatLogDao extends BaseMapper getByIds(String ids); List getValuesByQuery(TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery); diff --git a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java index 7e1360b1..6a65061d 100644 --- a/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java +++ b/web/src/main/java/com/ibeetl/jlw/entity/TeacherOpenCourseChatLog.java @@ -1,10 +1,9 @@ package com.ibeetl.jlw.entity; +import com.ibeetl.admin.core.annotation.Dict; import com.ibeetl.admin.core.entity.BaseEntity; import com.ibeetl.admin.core.util.ValidateConfig; import org.beetl.sql.annotation.entity.AssignID; -import org.beetl.sql.annotation.entity.InsertIgnore; -import org.beetl.sql.annotation.entity.LogicDelete; import javax.validation.constraints.NotNull; import java.math.BigDecimal; @@ -28,18 +27,21 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ private Long teacherOpenCourseChatLogParentId ; //课程开课ID + @Dict(type="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") private Long teacherOpenCourseId ; - //班级ID + //班级ID集合 - private Long schoolClassId ; + private String schoolClassIds ; //教师ID + @Dict(type="teacher.teacher_name.teacher_status=1") private Long teacherId ; //学生ID + @Dict(type="student.student_name.student_status=1") private Long studentId ; @@ -59,12 +61,14 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ private String chatFiles ; - //删除状态 - /*逻辑删除标志*/ - @InsertIgnore - @LogicDelete(value = 1) + //状态 (1正常 2删除) + @Dict(type="global_status") - private Integer delFlag ; + private Integer teacherOpenCourseChatLogStatus ; + + //创建时间 + + private Date teacherOpenCourseChatLogAddTime ; //组织ID @@ -74,10 +78,6 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ private Long userId ; - //创建时间 - - private Date createTime ; - public TeacherOpenCourseChatLog(){ } @@ -120,17 +120,17 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ this.teacherOpenCourseId = teacherOpenCourseId; } - /**班级ID + /**班级ID集合 *@return */ - public Long getSchoolClassId(){ - return schoolClassId; + public String getSchoolClassIds(){ + return schoolClassIds; } - /**班级ID - *@param schoolClassId + /**班级ID集合 + *@param schoolClassIds */ - public void setSchoolClassId(Long schoolClassId){ - this.schoolClassId = schoolClassId; + public void setSchoolClassIds(String schoolClassIds){ + this.schoolClassIds = schoolClassIds; } /**教师ID @@ -211,17 +211,30 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ this.chatFiles = chatFiles; } - /**删除状态 + /**状态 (1正常 2删除) + *@return + */ + public Integer getTeacherOpenCourseChatLogStatus(){ + return teacherOpenCourseChatLogStatus; + } + /**状态 (1正常 2删除) + *@param teacherOpenCourseChatLogStatus + */ + public void setTeacherOpenCourseChatLogStatus(Integer teacherOpenCourseChatLogStatus){ + this.teacherOpenCourseChatLogStatus = teacherOpenCourseChatLogStatus; + } + + /**创建时间 *@return */ - public Integer getDelFlag(){ - return delFlag; + public Date getTeacherOpenCourseChatLogAddTime(){ + return teacherOpenCourseChatLogAddTime; } - /**删除状态 - *@param delFlag + /**创建时间 + *@param teacherOpenCourseChatLogAddTime */ - public void setDelFlag(Integer delFlag){ - this.delFlag = delFlag; + public void setTeacherOpenCourseChatLogAddTime(Date teacherOpenCourseChatLogAddTime){ + this.teacherOpenCourseChatLogAddTime = teacherOpenCourseChatLogAddTime; } /**组织ID @@ -250,18 +263,5 @@ public class TeacherOpenCourseChatLog extends BaseEntity{ this.userId = userId; } - /**创建时间 - *@return - */ - public Date getCreateTime(){ - return createTime; - } - /**创建时间 - *@param createTime - */ - public void setCreateTime(Date createTime){ - this.createTime = createTime; - } - } diff --git a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseChatLogService.java b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseChatLogService.java index 2282e28c..4c50d0f9 100644 --- a/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseChatLogService.java +++ b/web/src/main/java/com/ibeetl/jlw/service/TeacherOpenCourseChatLogService.java @@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; +import java.util.Date; import java.util.List; /** @@ -50,7 +51,7 @@ public class TeacherOpenCourseChatLogService extends CoreBaseService list = teacherOpenCourseChatLogDao.getValuesByQuery(teacherOpenCourseChatLogQuery); if(null != list && list.size()>0){ return list.get(0); diff --git a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseChatLogController.java b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseChatLogController.java index c5bf7e87..28ee46df 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseChatLogController.java +++ b/web/src/main/java/com/ibeetl/jlw/web/TeacherOpenCourseChatLogController.java @@ -1,10 +1,12 @@ package com.ibeetl.jlw.web; +import cn.hutool.core.lang.Assert; import cn.jlw.Interceptor.SCoreUser; import cn.jlw.validate.ValidateConfig; import com.ibeetl.admin.core.annotation.Function; import com.ibeetl.admin.core.entity.CoreUser; import com.ibeetl.admin.core.file.FileService; +import com.ibeetl.admin.core.service.CoreUserService; import com.ibeetl.admin.core.web.JsonResult; import com.ibeetl.jlw.entity.TeacherOpenCourseChatLog; import com.ibeetl.jlw.service.TeacherOpenCourseChatLogService; @@ -15,10 +17,7 @@ import org.apache.commons.logging.LogFactory; import org.beetl.sql.core.engine.PageQuery; import org.springframework.validation.BindingResult; import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.annotation.Resource; @@ -40,6 +39,8 @@ public class TeacherOpenCourseChatLogController{ @Resource private TeacherOpenCourseChatLogService teacherOpenCourseChatLogService; @Resource FileService fileService; + @Resource + private CoreUserService coreUserService; /* 前端接口 */ @@ -113,12 +114,27 @@ public class TeacherOpenCourseChatLogController{ @PostMapping(MODEL + "/list.json") @Function("teacherOpenCourseChatLog.query") - public JsonResult list(TeacherOpenCourseChatLogQuery condition){ + public JsonResult list(TeacherOpenCourseChatLogQuery condition, @SCoreUser CoreUser coreUser) { PageQuery page = condition.getPageQuery(); teacherOpenCourseChatLogService.queryByCondition(page); return JsonResult.success(page); } + /** + * 学生端-分页查看评论区详情 + * @param condition + * @param coreUser + * @return + */ + @PostMapping(MODEL + "/details.json") + @Function("teacherOpenCourseChatLog.query") + public JsonResult details(TeacherOpenCourseChatLogQuery condition, @SCoreUser CoreUser coreUser) { + PageQuery page = condition.getPageQuery(); + Assert.notNull(condition.getTeacherOpenCourseChatLogParentId(), "评论的上级ID不能为空!"); + teacherOpenCourseChatLogService.queryByCondition(page); + return JsonResult.success(page); + } + @PostMapping(MODEL + "/addAll.json") @Function("teacherOpenCourseChatLog.add") public JsonResult addAll(TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery,@SCoreUser CoreUser coreUser){ @@ -138,19 +154,22 @@ public class TeacherOpenCourseChatLogController{ @PostMapping(MODEL + "/add.json") @Function("teacherOpenCourseChatLog.add") - public JsonResult add(@Validated(ValidateConfig.ADD.class) TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result,@SCoreUser CoreUser coreUser){ + public JsonResult add(@Validated(ValidateConfig.ADD.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result,@SCoreUser CoreUser coreUser){ if(result.hasErrors()){ return JsonResult.failMessage(result); }else{ teacherOpenCourseChatLogQuery.setUserId(coreUser.getId()); teacherOpenCourseChatLogQuery.setOrgId(coreUser.getOrgId()); + if(null == teacherOpenCourseChatLogQuery.getTeacherOpenCourseChatLogStatus()){ + teacherOpenCourseChatLogQuery.setTeacherOpenCourseChatLogStatus(1); + } return teacherOpenCourseChatLogService.add(teacherOpenCourseChatLogQuery); } } @PostMapping(MODEL + "/edit.json") @Function("teacherOpenCourseChatLog.edit") - public JsonResult update(@Validated(ValidateConfig.UPDATE.class) TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result) { + public JsonResult update(@Validated(ValidateConfig.UPDATE.class) @RequestBody TeacherOpenCourseChatLogQuery teacherOpenCourseChatLogQuery, BindingResult result) { if(result.hasErrors()){ return JsonResult.failMessage(result); }else { diff --git a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java index a0bfe8e9..ecbf3d10 100644 --- a/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java +++ b/web/src/main/java/com/ibeetl/jlw/web/query/TeacherOpenCourseChatLogQuery.java @@ -13,19 +13,25 @@ import java.util.Date; *开课互动查询 */ public class TeacherOpenCourseChatLogQuery extends PageParam { + @NotNull(message = "ID不能为空", groups =ValidateConfig.UPDATE.class) @Query(name = "课程开课--讨论-日志ID", display = false) private Long teacherOpenCourseChatLogId; + @NotNull(message = "上级ID不能为空", groups =ValidateConfig.ADD.class) @Query(name = "上级ID", display = false) private Long teacherOpenCourseChatLogParentId; - @Query(name = "课程开课ID", display = false) + @NotNull(message = "课程开课ID不能为空", groups =ValidateConfig.ADD.class) + @Query(name = "课程开课ID", display = true,type=Query.TYPE_DICT,dict="teacher_open_course.teacher_open_course_title.teacher_open_course_status=1") private Long teacherOpenCourseId; - @Query(name = "班级ID", display = false) - private Long schoolClassId; - @Query(name = "教师ID", display = false) + @Query(name = "班级ID集合", display = false) + private String schoolClassIds; + @NotNull(message = "教师ID不能为空", groups =ValidateConfig.ADD.class) + @Query(name = "教师ID", display = true,type=Query.TYPE_DICT,dict="teacher.teacher_name.teacher_status=1") private Long teacherId; - @Query(name = "学生ID", display = false) + @NotNull(message = "学生ID不能为空", groups =ValidateConfig.ADD.class) + @Query(name = "学生ID", display = true,type=Query.TYPE_DICT,dict="student.student_name.student_status=1") private Long studentId; + @NotNull(message = "讨论内容不能为空", groups =ValidateConfig.ADD.class) @Query(name = "讨论内容", display = false) private String chatContent; @Query(name = "关键字(多个逗号隔开)", display = false) @@ -34,21 +40,21 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { private BigDecimal studentScore; @Query(name = "附件上传(仅支持图片,多个逗号隔开)", display = false) private String chatFiles; - @Query(name = "删除状态", display = false) - private Integer delFlag; + @Query(name = "状态 (1正常 2删除)", display = true,type=Query.TYPE_DICT,dict="global_status") + private Integer teacherOpenCourseChatLogStatus; + @Query(name = "创建时间", display = false) + private Date teacherOpenCourseChatLogAddTime; @Query(name = "组织ID", display = false) private Long orgId; @Query(name = "用户ID", display = false) private Long userId; - @Query(name = "创建时间", display = false) - private Date createTime; private String teacherOpenCourseChatLogIdPlural; private String teacherOpenCourseChatLogParentIdPlural; private String teacherOpenCourseIdPlural; - private String schoolClassIdPlural; private String teacherIdPlural; private String studentIdPlural; + private String teacherOpenCourseChatLogStatusPlural; private String orgIdPlural; private String userIdPlural; @@ -74,11 +80,11 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void setTeacherOpenCourseId(Long teacherOpenCourseId ){ this.teacherOpenCourseId = teacherOpenCourseId; } - public Long getSchoolClassId(){ - return schoolClassId; + public String getSchoolClassIds(){ + return schoolClassIds; } - public void setSchoolClassId(Long schoolClassId ){ - this.schoolClassId = schoolClassId; + public void setSchoolClassIds(String schoolClassIds ){ + this.schoolClassIds = schoolClassIds; } public Long getTeacherId(){ return teacherId; @@ -116,11 +122,17 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void setChatFiles(String chatFiles ){ this.chatFiles = chatFiles; } - public Integer getDelFlag(){ - return delFlag; + public Integer getTeacherOpenCourseChatLogStatus(){ + return teacherOpenCourseChatLogStatus; } - public void setDelFlag(Integer delFlag ){ - this.delFlag = delFlag; + public void setTeacherOpenCourseChatLogStatus(Integer teacherOpenCourseChatLogStatus ){ + this.teacherOpenCourseChatLogStatus = teacherOpenCourseChatLogStatus; + } + public Date getTeacherOpenCourseChatLogAddTime(){ + return teacherOpenCourseChatLogAddTime; + } + public void setTeacherOpenCourseChatLogAddTime(Date teacherOpenCourseChatLogAddTime ){ + this.teacherOpenCourseChatLogAddTime = teacherOpenCourseChatLogAddTime; } public Long getOrgId(){ return orgId; @@ -134,29 +146,23 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void setUserId(Long userId ){ this.userId = userId; } - public Date getCreateTime(){ - return createTime; - } - public void setCreateTime(Date createTime ){ - this.createTime = createTime; - } public TeacherOpenCourseChatLog pojo(){ TeacherOpenCourseChatLog pojo = new TeacherOpenCourseChatLog(); pojo.setTeacherOpenCourseChatLogId(this.getTeacherOpenCourseChatLogId()); pojo.setTeacherOpenCourseChatLogParentId(this.getTeacherOpenCourseChatLogParentId()); pojo.setTeacherOpenCourseId(this.getTeacherOpenCourseId()); - pojo.setSchoolClassId(this.getSchoolClassId()); + pojo.setSchoolClassIds(this.getSchoolClassIds()); pojo.setTeacherId(this.getTeacherId()); pojo.setStudentId(this.getStudentId()); pojo.setChatContent(this.getChatContent()); pojo.setKeywords(this.getKeywords()); pojo.setStudentScore(this.getStudentScore()); pojo.setChatFiles(this.getChatFiles()); - pojo.setDelFlag(this.getDelFlag()); + pojo.setTeacherOpenCourseChatLogStatus(this.getTeacherOpenCourseChatLogStatus()); + pojo.setTeacherOpenCourseChatLogAddTime(this.getTeacherOpenCourseChatLogAddTime()); pojo.setOrgId(this.getOrgId()); pojo.setUserId(this.getUserId()); - pojo.setCreateTime(this.getCreateTime()); return pojo; } @@ -178,12 +184,6 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void setTeacherOpenCourseIdPlural(String teacherOpenCourseIdPlural){ this.teacherOpenCourseIdPlural = teacherOpenCourseIdPlural; } - public String getSchoolClassIdPlural(){ - return schoolClassIdPlural; - } - public void setSchoolClassIdPlural(String schoolClassIdPlural){ - this.schoolClassIdPlural = schoolClassIdPlural; - } public String getTeacherIdPlural(){ return teacherIdPlural; } @@ -196,6 +196,12 @@ public class TeacherOpenCourseChatLogQuery extends PageParam { public void setStudentIdPlural(String studentIdPlural){ this.studentIdPlural = studentIdPlural; } + public String getTeacherOpenCourseChatLogStatusPlural(){ + return teacherOpenCourseChatLogStatusPlural; + } + public void setTeacherOpenCourseChatLogStatusPlural(String teacherOpenCourseChatLogStatusPlural){ + this.teacherOpenCourseChatLogStatusPlural = teacherOpenCourseChatLogStatusPlural; + } public String getOrgIdPlural(){ return orgIdPlural; } diff --git a/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md b/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md index 5565e06f..bf6420ce 100644 --- a/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md +++ b/web/src/main/resources/sql/jlw/teacherOpenCourseChatLog.md @@ -5,6 +5,12 @@ queryByCondition select @pageTag(){ t.* + @if(!isEmpty(teacherOpenCourseChatLogParentId)){ + ,(select count(1) from teacher_open_course_chat_log a + where a.teacher_open_course_chat_log_status = 1 + and teacher_open_course_chat_log_parent_id = #teacherOpenCourseChatLogParentId# + ) as comment_count + @} @} from teacher_open_course_chat_log t where 1=1 @@ -28,11 +34,8 @@ queryByCondition @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} - @if(!isEmpty(schoolClassId)){ - and t.school_class_id =#schoolClassId# - @} - @if(!isEmpty(schoolClassIdPlural)){ - and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @if(!isEmpty(schoolClassIds)){ + and t.school_class_ids =#schoolClassIds# @} @if(!isEmpty(teacherId)){ and t.teacher_id =#teacherId# @@ -58,8 +61,17 @@ queryByCondition @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} - @if(!isEmpty(delFlag)){ - and t.del_flag =#delFlag# + @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and t.teacher_open_course_chat_log_status != 2 + @}else{ + @if(!isEmpty(teacherOpenCourseChatLogStatus)){ + and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus# + @}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#) + @} + @} + @if(!isEmpty(teacherOpenCourseChatLogAddTime)){ + and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @@ -73,8 +85,8 @@ queryByCondition @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} - @if(!isEmpty(createTime)){ - and t.create_time =#createTime# + @if(!isEmpty(teacherOpenCourseChatLogParentId)){ + order by create_time desc @} @@ -106,11 +118,8 @@ queryByConditionQuery @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} - @if(!isEmpty(schoolClassId)){ - and t.school_class_id =#schoolClassId# - @} - @if(!isEmpty(schoolClassIdPlural)){ - and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @if(!isEmpty(schoolClassIds)){ + and t.school_class_ids =#schoolClassIds# @} @if(!isEmpty(teacherId)){ and t.teacher_id =#teacherId# @@ -136,8 +145,17 @@ queryByConditionQuery @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} - @if(!isEmpty(delFlag)){ - and t.del_flag =#delFlag# + @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and t.teacher_open_course_chat_log_status != 2 + @}else{ + @if(!isEmpty(teacherOpenCourseChatLogStatus)){ + and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus# + @}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#) + @} + @} + @if(!isEmpty(teacherOpenCourseChatLogAddTime)){ + and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @@ -151,9 +169,6 @@ queryByConditionQuery @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} - @if(!isEmpty(createTime)){ - and t.create_time =#createTime# - @} @@ -161,7 +176,15 @@ queryByConditionQuery deleteTeacherOpenCourseChatLogByIds === -* 批量删除 +* 批量删除(假删除) + + update teacher_open_course_chat_log set teacher_open_course_chat_log_status = 2 where find_in_set(teacher_open_course_chat_log_id,#ids#) + + +deleteByIds +=== + +* 批量删除(真删除) delete from teacher_open_course_chat_log where find_in_set(teacher_open_course_chat_log_id,#ids#) @@ -194,11 +217,11 @@ updateGivenByIds teacher_open_course_id = #teacherOpenCourseId# , @} @} - @if(contain("schoolClassId",_given)){ - @if(isEmpty(schoolClassId)){ - school_class_id = null , + @if(contain("schoolClassIds",_given)){ + @if(isEmpty(schoolClassIds)){ + school_class_ids = null , @}else{ - school_class_id = #schoolClassId# , + school_class_ids = #schoolClassIds# , @} @} @if(contain("teacherId",_given)){ @@ -243,11 +266,18 @@ updateGivenByIds chat_files = #chatFiles# , @} @} - @if(contain("delFlag",_given)){ - @if(isEmpty(delFlag)){ - del_flag = null , + @if(contain("teacherOpenCourseChatLogStatus",_given)){ + @if(isEmpty(teacherOpenCourseChatLogStatus)){ + teacher_open_course_chat_log_status = null , @}else{ - del_flag = #delFlag# , + teacher_open_course_chat_log_status = #teacherOpenCourseChatLogStatus# , + @} + @} + @if(contain("teacherOpenCourseChatLogAddTime",_given)){ + @if(isEmpty(teacherOpenCourseChatLogAddTime)){ + teacher_open_course_chat_log_add_time = null , + @}else{ + teacher_open_course_chat_log_add_time = #teacherOpenCourseChatLogAddTime# , @} @} @if(contain("orgId",_given)){ @@ -264,13 +294,6 @@ updateGivenByIds user_id = #userId# , @} @} - @if(contain("createTime",_given)){ - @if(isEmpty(createTime)){ - create_time = null , - @}else{ - create_time = #createTime# , - @} - @} teacher_open_course_chat_log_id = teacher_open_course_chat_log_id where find_in_set(teacher_open_course_chat_log_id,#teacherOpenCourseChatLogIdPlural#) @@ -293,8 +316,8 @@ getTeacherOpenCourseChatLogValues @if(!isEmpty(teacherOpenCourseId)){ and t.teacher_open_course_id =#teacherOpenCourseId# @} - @if(!isEmpty(schoolClassId)){ - and t.school_class_id =#schoolClassId# + @if(!isEmpty(schoolClassIds)){ + and t.school_class_ids =#schoolClassIds# @} @if(!isEmpty(teacherId)){ and t.teacher_id =#teacherId# @@ -314,8 +337,13 @@ getTeacherOpenCourseChatLogValues @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} - @if(!isEmpty(delFlag)){ - and t.del_flag =#delFlag# + @if(!isEmpty(teacherOpenCourseChatLogStatus)){ + and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus# + @}else{ + and t.teacher_open_course_chat_log_status != 2 + @} + @if(!isEmpty(teacherOpenCourseChatLogAddTime)){ + and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @@ -323,9 +351,6 @@ getTeacherOpenCourseChatLogValues @if(!isEmpty(userId)){ and t.user_id =#userId# @} - @if(!isEmpty(createTime)){ - and t.create_time =#createTime# - @} getValuesByQuery @@ -354,11 +379,8 @@ getValuesByQuery @if(!isEmpty(teacherOpenCourseIdPlural)){ and find_in_set(t.teacher_open_course_id,#teacherOpenCourseIdPlural#) @} - @if(!isEmpty(schoolClassId)){ - and t.school_class_id =#schoolClassId# - @} - @if(!isEmpty(schoolClassIdPlural)){ - and find_in_set(t.school_class_id,#schoolClassIdPlural#) + @if(!isEmpty(schoolClassIds)){ + and t.school_class_ids =#schoolClassIds# @} @if(!isEmpty(teacherId)){ and t.teacher_id =#teacherId# @@ -384,8 +406,17 @@ getValuesByQuery @if(!isEmpty(chatFiles)){ and t.chat_files =#chatFiles# @} - @if(!isEmpty(delFlag)){ - and t.del_flag =#delFlag# + @if(isEmpty(teacherOpenCourseChatLogStatus) && isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and t.teacher_open_course_chat_log_status != 2 + @}else{ + @if(!isEmpty(teacherOpenCourseChatLogStatus)){ + and t.teacher_open_course_chat_log_status =#teacherOpenCourseChatLogStatus# + @}else if(!isEmpty(teacherOpenCourseChatLogStatusPlural)){ + and find_in_set(t.teacher_open_course_chat_log_status,#teacherOpenCourseChatLogStatusPlural#) + @} + @} + @if(!isEmpty(teacherOpenCourseChatLogAddTime)){ + and t.teacher_open_course_chat_log_add_time =#teacherOpenCourseChatLogAddTime# @} @if(!isEmpty(orgId)){ and t.org_id =#orgId# @@ -399,9 +430,6 @@ getValuesByQuery @if(!isEmpty(userIdPlural)){ and find_in_set(t.user_id,#userIdPlural#) @} - @if(!isEmpty(createTime)){ - and t.create_time =#createTime# - @} diff --git a/web/src/main/resources/static/js/jlw/teacherOpenCourseChatLog/index.js b/web/src/main/resources/static/js/jlw/teacherOpenCourseChatLog/index.js index 3a563a4c..43974e88 100644 --- a/web/src/main/resources/static/js/jlw/teacherOpenCourseChatLog/index.js +++ b/web/src/main/resources/static/js/jlw/teacherOpenCourseChatLog/index.js @@ -49,32 +49,32 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { hide:$.isEmpty(sx_['teacherOpenCourseChatLogParentId'])?false:sx_['teacherOpenCourseChatLogParentId'], }, { - field : 'teacherOpenCourseId', + field : 'teacherOpenCourseIdText', //数据字典类型为 teacher_open_course.teacher_open_course_title.teacher_open_course_status=1 title : '课程开课ID', align:"center", hideField :false, - hide:$.isEmpty(sx_['teacherOpenCourseId'])?false:sx_['teacherOpenCourseId'], + hide:$.isEmpty(sx_['teacherOpenCourseIdText'])?false:sx_['teacherOpenCourseIdText'], }, { - field : 'schoolClassId', - title : '班级ID', + field : 'schoolClassIds', + title : '班级ID集合', align:"center", hideField :false, - hide:$.isEmpty(sx_['schoolClassId'])?false:sx_['schoolClassId'], + hide:$.isEmpty(sx_['schoolClassIds'])?false:sx_['schoolClassIds'], }, { - field : 'teacherId', + field : 'teacherIdText', //数据字典类型为 teacher.teacher_name.teacher_status=1 title : '教师ID', align:"center", hideField :false, - hide:$.isEmpty(sx_['teacherId'])?false:sx_['teacherId'], + hide:$.isEmpty(sx_['teacherIdText'])?false:sx_['teacherIdText'], }, { - field : 'studentId', + field : 'studentIdText', //数据字典类型为 student.student_name.student_status=1 title : '学生ID', align:"center", hideField :false, - hide:$.isEmpty(sx_['studentId'])?false:sx_['studentId'], + hide:$.isEmpty(sx_['studentIdText'])?false:sx_['studentIdText'], }, { field : 'chatContent', @@ -104,6 +104,20 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { hideField :false, hide:$.isEmpty(sx_['chatFiles'])?false:sx_['chatFiles'], }, + { + field : 'teacherOpenCourseChatLogStatusText', //数据字典类型为 global_status + title : '状态 (1正常 2删除)', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['teacherOpenCourseChatLogStatusText'])?false:sx_['teacherOpenCourseChatLogStatusText'], + }, + { + field : 'teacherOpenCourseChatLogAddTime', + title : '创建时间', + align:"center", + hideField :false, + hide:$.isEmpty(sx_['teacherOpenCourseChatLogAddTime'])?false:sx_['teacherOpenCourseChatLogAddTime'], + }, { field : 'orgId', title : '组织ID', @@ -117,13 +131,6 @@ layui.define([ 'form', 'laydate', 'table' ], function(exports) { align:"center", hideField :false, hide:$.isEmpty(sx_['userId'])?false:sx_['userId'], - }, - { - field : 'createTime', - title : '创建时间', - align:"center", - hideField :false, - hide:$.isEmpty(sx_['createTime'])?false:sx_['createTime'], } ,{ field : 'operation_',title : '操作',align:"center", templet: function (d) { diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/add.html b/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/add.html index e49153a2..53342162 100644 --- a/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/add.html +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/add.html @@ -12,7 +12,8 @@
- +
@@ -20,15 +21,16 @@
- +
- +
- +
@@ -38,7 +40,8 @@
- +
@@ -73,20 +76,27 @@
+
+ +
+ +
+
- +
- +
- +
- +
@@ -94,15 +104,14 @@
- +
- +
- diff --git a/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/edit.html b/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/edit.html index c766ea12..56629ae8 100644 --- a/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/edit.html +++ b/web/src/main/resources/templates/jlw/teacherOpenCourseChatLog/edit.html @@ -12,7 +12,8 @@
- +
@@ -20,15 +21,16 @@
- +
- +
- +
@@ -38,7 +40,8 @@
- +
@@ -73,20 +76,27 @@
+
+ +
+ +
+
- +
- +
- +
- +
@@ -94,15 +104,14 @@
- +
- +
-