Forráskód Böngészése

Merge remote-tracking branch 'origin/dev' into dev

dzx 3 hónapja
szülő
commit
6038a56b07

+ 38 - 0
src/main/java/com/xjrsoft/module/student/controller/StudentLeaveController.java

@@ -0,0 +1,38 @@
+package com.xjrsoft.module.student.controller;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.xjrsoft.common.model.result.R;
+import com.xjrsoft.common.page.ConventPage;
+import com.xjrsoft.common.page.PageOutput;
+import com.xjrsoft.module.student.dto.StudentLeavePageDto;
+import com.xjrsoft.module.student.service.IStudentLeaveService;
+import com.xjrsoft.module.student.vo.StudentLeavePageVo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.validation.Valid;
+
+@RestController
+@RequestMapping("/student" + "/leave")
+@Api(value = "/student" + "/leave", tags = "学生请假")
+@AllArgsConstructor
+public class StudentLeaveController {
+
+    private final IStudentLeaveService studentLeaveService;
+
+    @GetMapping(value = "/page")
+    @ApiOperation(value = "学生请假列表(分页)")
+    @SaCheckPermission("studentleave:detail")
+    public R page(@Valid StudentLeavePageDto dto) {
+        IPage<StudentLeavePageVo> page = studentLeaveService.getLeavePage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+
+        PageOutput<StudentLeavePageVo> pageOutput = ConventPage.getPageOutput(page, StudentLeavePageVo.class);
+        return R.ok(pageOutput);
+    }
+}

+ 28 - 0
src/main/java/com/xjrsoft/module/student/dto/StudentLeavePageDto.java

@@ -0,0 +1,28 @@
+package com.xjrsoft.module.student.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class StudentLeavePageDto  extends PageInput {
+    /**
+     * 账户
+     */
+    @ApiModelProperty("账户")
+    private Long userId;
+
+    /**
+     * 开始时间
+     */
+    @ApiModelProperty("开始时间")
+    private String startDate;
+
+    /**
+     * 结束时间
+     */
+    @ApiModelProperty("结束时间")
+    private String endDate;
+}

+ 5 - 0
src/main/java/com/xjrsoft/module/student/mapper/StudentLeaveMapper.java

@@ -1,9 +1,12 @@
 package com.xjrsoft.module.student.mapper;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
 import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
 import com.xjrsoft.module.outint.vo.IdCountVo;
+import com.xjrsoft.module.student.dto.StudentLeavePageDto;
 import com.xjrsoft.module.student.entity.StudentLeave;
+import com.xjrsoft.module.student.vo.StudentLeavePageVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,4 +28,6 @@ public interface StudentLeaveMapper extends MPJBaseMapper<StudentLeave> {
 
 
     List<StudentLeave> getLeaveList(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
+
+    Page<StudentLeavePageVo> getLeavePage(Page<StudentLeavePageVo> page, StudentLeavePageDto dto);
 }

+ 7 - 0
src/main/java/com/xjrsoft/module/student/service/IStudentLeaveService.java

@@ -1,8 +1,13 @@
 package com.xjrsoft.module.student.service;
 
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
 import com.xjrsoft.module.attendance.dto.AttendanceStatisticDto;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
+import com.xjrsoft.module.student.dto.StudentLeavePageDto;
 import com.xjrsoft.module.student.entity.StudentLeave;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.student.vo.StudentLeavePageVo;
 import org.apache.ibatis.annotations.Param;
 
 import java.time.LocalDateTime;
@@ -25,4 +30,6 @@ public interface IStudentLeaveService extends MPJBaseService<StudentLeave> {
 
 
     Map<Long, StudentLeave> getLeaveList(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime);
+
+    Page<StudentLeavePageVo> getLeavePage(Page<StudentLeavePageVo> page, StudentLeavePageDto dto);
 }

+ 10 - 0
src/main/java/com/xjrsoft/module/student/service/impl/StudentLeaveServiceImpl.java

@@ -1,6 +1,7 @@
 package com.xjrsoft.module.student.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
@@ -11,9 +12,13 @@ import com.xjrsoft.module.hikvision.entity.HikvisionData;
 import com.xjrsoft.module.hikvision.mapper.HikvisionDataMapper;
 import com.xjrsoft.module.hikvision.util.ApiUtil;
 import com.xjrsoft.module.outint.vo.IdCountVo;
+import com.xjrsoft.module.student.dto.BaseStudentUserPageDto;
+import com.xjrsoft.module.student.dto.StudentLeavePageDto;
 import com.xjrsoft.module.student.entity.StudentLeave;
 import com.xjrsoft.module.student.mapper.StudentLeaveMapper;
 import com.xjrsoft.module.student.service.IStudentLeaveService;
+import com.xjrsoft.module.student.vo.BaseStudentUserPageVo;
+import com.xjrsoft.module.student.vo.StudentLeavePageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
@@ -105,6 +110,11 @@ public class StudentLeaveServiceImpl extends MPJBaseServiceImpl<StudentLeaveMapp
         return result;
     }
 
+    @Override
+    public Page<StudentLeavePageVo> getLeavePage(Page<StudentLeavePageVo> page, StudentLeavePageDto dto) {
+        return baseMapper.getLeavePage(page, dto);
+    }
+
     JsonArray selectResource(ApiUtil apiUtil){
         String apiPath = "/api/irds/v2/resource/resourcesByParams";
         JsonObject jsonObject = new JsonObject();

+ 53 - 0
src/main/java/com/xjrsoft/module/student/vo/StudentLeavePageVo.java

@@ -0,0 +1,53 @@
+package com.xjrsoft.module.student.vo;
+
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDate;
+
+@Data
+public class StudentLeavePageVo {
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty("主键编号")
+    @TableId
+    private Long id;
+
+    @ApiModelProperty("学生id")
+    private Long studentUserId;
+
+    @ApiModelProperty("班级id")
+    private Long classId;
+
+    @ApiModelProperty("开始时间")
+    private LocalDate startDate;
+
+    @ApiModelProperty("开始时间")
+    private LocalDate endDate;
+
+    @ApiModelProperty("请假原因")
+    private String reason;
+
+    @ApiModelProperty("班主任")
+    private Long teacherId;
+
+    @ApiModelProperty("附件id")
+    private Long folderId;
+
+    /**
+     * 状态(1:结束 0:未结束)
+     */
+    @ApiModelProperty("状态(1:结束 0:未结束)")
+    private Integer status;
+
+    @ApiModelProperty("时长(天)")
+    private Double dayDuration;
+
+    @ApiModelProperty("请假类型")
+    private String leaveType;
+
+    @ApiModelProperty("海康接口返回信息")
+    private String hikvisionResult;
+}

+ 16 - 0
src/main/resources/mapper/student/StudentLeaveMapper.xml

@@ -43,4 +43,20 @@
                 OR (DATE_FORMAT(#{startTime}, '%Y-%m-%d') > start_date and end_date > DATE_FORMAT(#{endTime}, '%Y-%m-%d'))
         )
     </select>
+    <select id="getLeavePage" resultType="com.xjrsoft.module.student.vo.StudentLeavePageVo">
+        SELECT t1.* FROM student_leave t1
+                             INNER JOIN xjr_user t2 ON t1.student_user_id = t2.id
+        WHERE t1.status = 1 AND t2.delete_mark = 0
+        <if test="dto.userId != null">
+            and t1.student_user_id = #{dto.userId}
+        </if>
+        <if test="dto.startDate != null and dto.startDate != '' and dto.endDate != null and dto.endDate != ''">
+          AND (
+                (start_date BETWEEN DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d') and DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d'))
+                OR (end_date BETWEEN DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d') and DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d'))
+                OR (start_date > DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d') and DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d') > end_date)
+                OR (DATE_FORMAT(#{dto.startDate}, '%Y-%m-%d') > start_date and end_date > DATE_FORMAT(#{dto.endDate}, '%Y-%m-%d'))
+            )
+        </if>
+    </select>
 </mapper>