浏览代码

公开类相关接口

Signed-off-by: guoWenHao <2532478980@qq.com>
guoWenHao 9 月之前
父节点
当前提交
d19aff7591

+ 2 - 0
teacher-pojo/src/main/java/com/example/dto/PageQueryDTO.java

@@ -16,4 +16,6 @@ public class PageQueryDTO implements Serializable {
     //每页显示记录数
     //每页显示记录数
     private int pageSize;
     private int pageSize;
 
 
+    private Long teacherId;
+
 }
 }

+ 22 - 0
teacher-pojo/src/main/java/com/example/entity/Home.java

@@ -0,0 +1,22 @@
+package com.example.entity;
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@Data
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class Home implements Serializable {
+
+    private Long id;
+
+    private String name;
+
+    private String image;
+
+}

+ 7 - 5
teacher-serve/src/main/java/com/example/controller/admin/AdminController.java

@@ -32,19 +32,21 @@ public class AdminController {
         PageResult pageResult = adminService.page(pageQueryDTO);
         PageResult pageResult = adminService.page(pageQueryDTO);
         return Result.success(pageResult);
         return Result.success(pageResult);
     }
     }
-//启用禁用老师账号
+
+    //启用禁用老师账号
     @PostMapping("/status/{status}")
     @PostMapping("/status/{status}")
     @ApiOperation("启用禁用老师账号")
     @ApiOperation("启用禁用老师账号")
     public Result starOrStop(@PathVariable Integer status, Long id) {
     public Result starOrStop(@PathVariable Integer status, Long id) {
-        log.info("启用禁用老师账号:{},{}",id,status);
-        adminService.starOrStop(id,status);
+        log.info("启用禁用老师账号:{},{}", id, status);
+        adminService.starOrStop(id, status);
         return Result.success();
         return Result.success();
     }
     }
+
     //删除老师账号
     //删除老师账号
     @DeleteMapping("/{id}")
     @DeleteMapping("/{id}")
     @ApiOperation(value = "删除老师账号")
     @ApiOperation(value = "删除老师账号")
-    public Result deleteById(@PathVariable Long id){
-        log.info("删除老师账号:{}",id);
+    public Result deleteById(@PathVariable Long id) {
+        log.info("删除老师账号:{}", id);
         adminService.deleteById(id);
         adminService.deleteById(id);
         return Result.success();
         return Result.success();
     }
     }

+ 7 - 7
teacher-serve/src/main/java/com/example/controller/teacher/ThesisController.java

@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 @RestController
 @RestController
 @Slf4j
 @Slf4j
-@Api(tags = "老师获奖相关接口")
+@Api(tags = "老师论文相关接口")
 @RequestMapping("/teacher/thesis")
 @RequestMapping("/teacher/thesis")
 public class ThesisController {
 public class ThesisController {
 
 
@@ -29,23 +29,23 @@ public class ThesisController {
         return Result.success();
         return Result.success();
     }
     }
     @PutMapping("/{id}")
     @PutMapping("/{id}")
-    @ApiOperation(value = "修改指定奖项")
+    @ApiOperation(value = "修改指定论文")
     public Result updateAwards(@RequestBody ThesisDTO thesisDTO, @PathVariable Long id) {
     public Result updateAwards(@RequestBody ThesisDTO thesisDTO, @PathVariable Long id) {
-        log.info("修改指定奖项:{}", id);
+        log.info("修改指定论文:{}", id);
         thesisService.updateThesis(thesisDTO, id);
         thesisService.updateThesis(thesisDTO, id);
         return Result.success();
         return Result.success();
     }
     }
     @GetMapping("/{id}")
     @GetMapping("/{id}")
-    @ApiOperation(value = "获取指定奖项详细信息")
+    @ApiOperation(value = "获取指定论文详细信息")
     public Result<ThesisVO> getById(@PathVariable Long id) {
     public Result<ThesisVO> getById(@PathVariable Long id) {
-        log.info("获取指定奖项详细信息:{}", id);
+        log.info("获取指定论文详细信息:{}", id);
         ThesisVO thesisVO = thesisService.getById(id);
         ThesisVO thesisVO = thesisService.getById(id);
         return Result.success(thesisVO);
         return Result.success(thesisVO);
     }
     }
     @DeleteMapping("/{id}")
     @DeleteMapping("/{id}")
-    @ApiOperation(value = "删除指定奖项")
+    @ApiOperation(value = "删除指定论文")
     public Result deleteById(@PathVariable Long id){
     public Result deleteById(@PathVariable Long id){
-        log.info("删除指定奖项:{}",id);
+        log.info("删除指定论文:{}",id);
         thesisService.deleteById(id);
         thesisService.deleteById(id);
         return Result.success();
         return Result.success();
     }
     }

+ 55 - 0
teacher-serve/src/main/java/com/example/controller/user/OpenController.java

@@ -0,0 +1,55 @@
+package com.example.controller.user;
+
+import com.example.dto.PageQueryDTO;
+import com.example.result.PageResult;
+import com.example.result.Result;
+import com.example.service.OpenService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@Slf4j
+@Api(tags = "公开类相关接口")
+@RequestMapping("/open")
+public class OpenController {
+
+    @Autowired
+    private OpenService openService;
+
+    @GetMapping("/page")
+    @ApiOperation(value = "首页分页查询")
+    public Result<PageResult> page(PageQueryDTO pageQueryDTO) {
+        log.info("首页分页查询,查询参数:{}", pageQueryDTO);
+        PageResult pageResult = openService.page(pageQueryDTO);
+        return Result.success(pageResult);
+    }
+
+    @GetMapping("/awards/page")
+    @ApiOperation(value = "获奖分页查询")
+    public Result<PageResult> AwardsPage(PageQueryDTO pageQueryDTO) {
+        log.info("获奖分页查询,查询参数:{}", pageQueryDTO);
+        PageResult pageResult = openService.AwardsPage(pageQueryDTO);
+        return Result.success(pageResult);
+    }
+
+    @GetMapping("/work/page")
+    @ApiOperation(value = "著作分页查询")
+    public Result<PageResult> WorkPage(PageQueryDTO pageQueryDTO) {
+        log.info("著作分页查询,查询参数:{}", pageQueryDTO);
+        PageResult pageResult = openService.WorkPage(pageQueryDTO);
+        return Result.success(pageResult);
+    }
+
+    @GetMapping("/thesis/page")
+    @ApiOperation(value = "论文分页查询")
+    public Result<PageResult> ThesisPage(PageQueryDTO pageQueryDTO) {
+        log.info("论文分页查询,查询参数:{}", pageQueryDTO);
+        PageResult pageResult = openService.ThesisPage(pageQueryDTO);
+        return Result.success(pageResult);
+    }
+}

+ 38 - 0
teacher-serve/src/main/java/com/example/mapper/OpenMapper.java

@@ -0,0 +1,38 @@
+package com.example.mapper;
+
+import com.example.dto.PageQueryDTO;
+import com.example.entity.Awards;
+import com.example.entity.Home;
+import com.example.entity.Thesis;
+import com.example.entity.Work;
+import com.github.pagehelper.Page;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface OpenMapper {
+    /**
+     * 首页分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    Page<Home> page(PageQueryDTO pageQueryDTO);
+
+    /**
+     * 获奖分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    Page<Awards> AwardsPage(PageQueryDTO pageQueryDTO);
+    /**
+     * 著作分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    Page<Work> WorkPage(PageQueryDTO pageQueryDTO);
+    /**
+     * 论文分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    Page<Thesis> ThesisPage(PageQueryDTO pageQueryDTO);
+}

+ 34 - 0
teacher-serve/src/main/java/com/example/service/OpenService.java

@@ -0,0 +1,34 @@
+package com.example.service;
+
+import com.example.dto.PageQueryDTO;
+import com.example.result.PageResult;
+
+public interface OpenService {
+    /**
+     * 首页分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    PageResult page(PageQueryDTO pageQueryDTO);
+
+    /**
+     * 获奖分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    PageResult AwardsPage(PageQueryDTO pageQueryDTO);
+
+    /**
+     * 著作分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    PageResult WorkPage(PageQueryDTO pageQueryDTO);
+
+    /**
+     * 论文分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    PageResult ThesisPage(PageQueryDTO pageQueryDTO);
+}

+ 73 - 0
teacher-serve/src/main/java/com/example/service/impl/OpenServiceImpl.java

@@ -0,0 +1,73 @@
+package com.example.service.impl;
+
+import com.example.dto.PageQueryDTO;
+import com.example.entity.*;
+import com.example.mapper.OpenMapper;
+import com.example.result.PageResult;
+import com.example.service.OpenService;
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class OpenServiceImpl implements OpenService {
+
+    @Autowired
+    private OpenMapper openMapper;
+    /**
+     * 首页分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    @Override
+    public PageResult page(PageQueryDTO pageQueryDTO) {
+        PageHelper.startPage(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
+        Page<Home> page = openMapper.page(pageQueryDTO);
+        long total = page.getTotal();
+        List<Home> result = page.getResult();
+        return new PageResult(total, result);
+    }
+
+    /**
+     * 获奖分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    @Override
+    public PageResult AwardsPage(PageQueryDTO pageQueryDTO) {
+        PageHelper.startPage(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
+        Page<Awards> page=openMapper.AwardsPage(pageQueryDTO);
+        long total = page.getTotal();
+        List<Awards> result = page.getResult();
+        return new PageResult(total,result);
+    }
+    /**
+     * 著作分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    @Override
+    public PageResult WorkPage(PageQueryDTO pageQueryDTO) {
+        PageHelper.startPage(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
+        Page<Work> page=openMapper.WorkPage(pageQueryDTO);
+        long total = page.getTotal();
+        List<Work> result = page.getResult();
+        return new PageResult(total,result);
+    }
+    /**
+     * 论文分页查询
+     * @param pageQueryDTO
+     * @return
+     */
+    @Override
+    public PageResult ThesisPage(PageQueryDTO pageQueryDTO) {
+        PageHelper.startPage(pageQueryDTO.getPage(), pageQueryDTO.getPageSize());
+        Page<Thesis> page=openMapper.ThesisPage(pageQueryDTO);
+        long total = page.getTotal();
+        List<Thesis> result = page.getResult();
+        return new PageResult(total,result);
+    }
+}

+ 47 - 0
teacher-serve/src/main/resources/mapper/OpenMapper.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.example.mapper.OpenMapper">
+
+    <select id="page" resultType="com.example.entity.Home">
+        select * from teacherteam_system.teacher
+        <where>
+            <if test="name != null and name != ''">
+                name like concat('%',#{name},'%')
+            </if>
+        </where>
+    </select>
+    <select id="AwardsPage" resultType="com.example.entity.Awards">
+        select * from teacherteam_system.awards
+        <where>
+            <if test="name != null and name != ''">
+                name like concat('%',#{name},'%')
+            </if>
+            <if test="teacherId != null">
+                and teacher_id=#{teacherId}
+            </if>
+        </where>
+    </select>
+    <select id="WorkPage" resultType="com.example.entity.Work">
+        select * from teacherteam_system.work
+        <where>
+        <if test="name != null and name != ''">
+            name like concat('%',#{name},'%')
+        </if>
+        <if test="teacherId != null">
+            and teacher_id=#{teacherId}
+        </if>
+        </where>
+    </select>
+    <select id="ThesisPage" resultType="com.example.entity.Thesis">
+        select * from teacherteam_system.thesis
+        <where>
+            <if test="name != null and name != ''">
+                name like concat('%',#{name},'%')
+            </if>
+            <if test="teacherId != null">
+                and teacher_id=#{teacherId}
+            </if>
+        </where>
+    </select>
+</mapper>