change vor 3 Jahren
Ursprung
Commit
394525d06a

+ 112 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/TeacherController.java

@@ -0,0 +1,112 @@
+package com.zhongzheng.controller.course;
+
+import java.util.List;
+import java.util.Arrays;
+
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.zhongzheng.common.annotation.Log;
+import com.zhongzheng.common.core.controller.BaseController;
+import com.zhongzheng.common.core.domain.AjaxResult;
+import com.zhongzheng.common.enums.BusinessType;
+import com.zhongzheng.modules.course.vo.TeacherVo;
+import com.zhongzheng.modules.course.bo.TeacherQueryBo;
+import com.zhongzheng.modules.course.bo.TeacherAddBo;
+import com.zhongzheng.modules.course.bo.TeacherEditBo;
+import com.zhongzheng.modules.course.service.ITeacherService;
+import com.zhongzheng.common.utils.poi.ExcelUtil;
+import com.zhongzheng.common.core.page.TableDataInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 名师Controller
+ * 
+ * @author ruoyi
+ * @date 2021-11-29
+ */
+@Api(value = "名师控制器", tags = {"名师管理"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RestController
+@RequestMapping("/system/teacher")
+public class TeacherController extends BaseController {
+
+    private final ITeacherService iTeacherService;
+
+    /**
+     * 查询名师列表
+     */
+    @ApiOperation("查询名师列表")
+    @PreAuthorize("@ss.hasPermi('system:teacher:list')")
+    @GetMapping("/list")
+    public TableDataInfo<TeacherVo> list(TeacherQueryBo bo) {
+        startPage();
+        List<TeacherVo> list = iTeacherService.queryList(bo);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出名师列表
+     */
+    @ApiOperation("导出名师列表")
+    @PreAuthorize("@ss.hasPermi('system:teacher:export')")
+    @Log(title = "名师", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult<TeacherVo> export(TeacherQueryBo bo) {
+        List<TeacherVo> list = iTeacherService.queryList(bo);
+        ExcelUtil<TeacherVo> util = new ExcelUtil<TeacherVo>(TeacherVo.class);
+        return util.exportExcel(list, "名师");
+    }
+
+    /**
+     * 获取名师详细信息
+     */
+    @ApiOperation("获取名师详细信息")
+    @PreAuthorize("@ss.hasPermi('system:teacher:query')")
+    @GetMapping("/{teacherId}")
+    public AjaxResult<TeacherVo> getInfo(@PathVariable("teacherId" ) Long teacherId) {
+        return AjaxResult.success(iTeacherService.queryById(teacherId));
+    }
+
+    /**
+     * 新增名师
+     */
+    @ApiOperation("新增名师")
+    @PreAuthorize("@ss.hasPermi('system:teacher:add')")
+    @Log(title = "名师", businessType = BusinessType.INSERT)
+    @PostMapping()
+    public AjaxResult<Void> add(@RequestBody TeacherAddBo bo) {
+        return toAjax(iTeacherService.insertByAddBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 修改名师
+     */
+    @ApiOperation("修改名师")
+    @PreAuthorize("@ss.hasPermi('system:teacher:edit')")
+    @Log(title = "名师", businessType = BusinessType.UPDATE)
+    @PutMapping()
+    public AjaxResult<Void> edit(@RequestBody TeacherEditBo bo) {
+        return toAjax(iTeacherService.updateByEditBo(bo) ? 1 : 0);
+    }
+
+    /**
+     * 删除名师
+     */
+    @ApiOperation("删除名师")
+    @PreAuthorize("@ss.hasPermi('system:teacher:remove')")
+    @Log(title = "名师" , businessType = BusinessType.DELETE)
+    @DeleteMapping("/{teacherIds}")
+    public AjaxResult<Void> remove(@PathVariable Long[] teacherIds) {
+        return toAjax(iTeacherService.deleteWithValidByIds(Arrays.asList(teacherIds), true) ? 1 : 0);
+    }
+}

+ 1 - 7
zhongzheng-system/src/main/resources/mapper/modules/inform/InformMapper.xml

@@ -66,19 +66,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
     <select id="listInform" parameterType="com.zhongzheng.modules.inform.bo.InformQueryBo"  resultMap="InformVo">
         SELECT
-        i.inform_name,
-        i.inform_id,
-        i.inform_way,
-        i.create_by,
-        i.inform_type,
+        i.*,
         (SELECT COUNT(iu.id) FROM inform_user iu where i.inform_id=iu.inform_id) as user_num,
         (SELECT ic.classify_name FROM inform_classify ic where i.classify_id=ic.classify_id) as classify_name,
         (SELECT iu.send_time FROM inform_user iu where i.inform_id=iu.inform_id ORDER BY iu.send_time ASC limit 1) as send_time,
-        i.`status`,
         IF((SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id and iu.send_status=1)=0,2,
         IF((SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id and iu.send_status=1)=(SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id),1,
         IF((SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id and iu.send_status=1)&lt;(SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id),3,4))) as user_status,
-        i.receipt_status,
         (SELECT COUNT(iu.inform_id) FROM inform_user iu where i.inform_id=iu.inform_id and iu.send_status=1) as receipt_num
         FROM
         inform i where 1=1