Sfoglia il codice sorgente

Merge branch 'master' of https://e.coding.net/chuanghaikeji/smarCampus/backend_dormitory

夏文涛 1 anno fa
parent
commit
fe1d88c3cb

+ 4 - 0
doc/update_0619.sql

@@ -0,0 +1,4 @@
+-- 访客表新增司机名称字段
+alter table welcome_visitor
+    add driver_name varchar(32) not null comment '司机名称' after name;
+

+ 9 - 0
src/main/java/com/template/api/WelcomeStudentControllerAPI.java

@@ -57,4 +57,13 @@ public interface WelcomeStudentControllerAPI {
     void welcomeStudentExport(HttpServletResponse response, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
 
 
+    @GetMapping(value = "/dataOverview")
+    @ApiOperation(value = "数据总览", notes = "数据总览", httpMethod = "GET")
+    CommonResult dataOverview();
+
+    @GetMapping(value = "/studentRegister")
+    @ApiOperation(value = "新生报到情况", notes = "数据总览", httpMethod = "GET")
+    CommonResult studentRegister();
+
+
 }

+ 4 - 4
src/main/java/com/template/api/WelcomeVisitorControllerAPI.java

@@ -12,9 +12,9 @@ import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestAttribute;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -29,15 +29,15 @@ public interface WelcomeVisitorControllerAPI {
 
     @PostMapping
     @ApiOperation(value = "新增访客记录")
-    CommonResult addVisitor(@RequestParam String studentCard, @Validated @RequestBody WelcomeVisitorRequest visitorRequest);
+    CommonResult addVisitor(@RequestAttribute String studentCard, @Validated @RequestBody WelcomeVisitorRequest visitorRequest);
 
     @GetMapping
     @ApiOperation(value = "获取当前用户访客记录")
-    CommonResult<WelcomeVisitorVO> getByCurUser(@RequestParam String studentCard);
+    CommonResult<WelcomeVisitorVO> getByCurUser(@RequestAttribute String studentCard);
 
     @DeleteMapping
     @ApiOperation(value = "删除当前用户的访客记录")
-    CommonResult deleteByCurUser(@RequestParam String studentCard);
+    CommonResult deleteByCurUser(@RequestAttribute String studentCard);
 
     @GetMapping("admin/page")
     @ApiOperation(value = "访客记录分页")

+ 2 - 1
src/main/java/com/template/controller/WelcomeDormitoryController.java

@@ -11,6 +11,7 @@ import com.template.model.enumModel.eFileType;
 import com.template.model.pojo.*;
 import com.template.model.result.CommonResult;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.WelcomeDormitoryVo;
 import com.template.services.*;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -116,7 +117,7 @@ public class WelcomeDormitoryController implements WelcomeDormitoryControllerAPI
     @Override
     public CommonResult listDormitory(int currentPage, int pageCount, Integer schoolId,Integer buildId,Integer dormitoryId,String sex,Integer status,Integer majorId,Integer collegeId) {
 
-        PageUtils<WelcomeDormitory> pageUtils = welcomeDormitoryService.listDormitory(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, status, majorId, collegeId);
+        PageUtils<WelcomeDormitoryVo> pageUtils = welcomeDormitoryService.listDormitory(currentPage, pageCount, schoolId, buildId, dormitoryId, sex, status, majorId, collegeId);
 
         return CommonResult.ok(pageUtils);
     }

+ 16 - 0
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -2,6 +2,7 @@ package com.template.controller;
 
 
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.template.api.WelcomeStudentControllerAPI;
 import com.template.common.utils.ExcelUtils;
 import com.template.common.utils.paramUtils;
@@ -1298,5 +1299,20 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         // 将工作簿写入文件
         ExcelUtils.excelDownload(workbook, "学生信息.xlsx", response);
     }
+
+    @Override
+    public CommonResult dataOverview() {
+        return null;
+    }
+
+    @Override
+    public CommonResult studentRegister() {
+
+//        获取总数
+        int count = welcomeStudentService.count(new QueryWrapper<>());
+
+
+        return null;
+    }
 }
 

+ 4 - 3
src/main/java/com/template/mapper/WelcomeDormitoryMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.template.model.pojo.WelcomeDormitory;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.template.model.vo.WelcomeDormitoryVo;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
@@ -25,9 +26,9 @@ public interface WelcomeDormitoryMapper extends BaseMapper<WelcomeDormitory> {
 
     List<String> groupDormitory(@Param("sex") String sex,@Param("college") String college,@Param("gradestr") String gradestr,@Param("school")String school, @Param("buildName") String buildName);
 
-    IPage<WelcomeDormitory> listDormitory(Page<WelcomeDormitory> page,@Param("schoolId") Integer schoolId,@Param("buildId") Integer buildId,
-                                          @Param("dormitoryId") Integer dormitoryId, @Param("sex") String sex,@Param("status") Integer status,
-                                          @Param("majorId") Integer majorId,@Param("collegeId") Integer collegeId);
+    IPage<WelcomeDormitoryVo> listDormitory(Page<WelcomeDormitoryVo> page, @Param("schoolId") Integer schoolId, @Param("buildId") Integer buildId,
+                                            @Param("dormitoryId") Integer dormitoryId, @Param("sex") String sex, @Param("status") Integer status,
+                                            @Param("majorId") Integer majorId, @Param("collegeId") Integer collegeId);
 
 
 }

+ 5 - 2
src/main/java/com/template/model/pojo/WelcomeVisitor.java

@@ -1,15 +1,15 @@
 package com.template.model.pojo;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
 import com.baomidou.mybatisplus.annotation.TableId;
-import java.io.Serializable;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 
+import java.io.Serializable;
+
 /**
  * <p>
  *
@@ -36,6 +36,9 @@ public class WelcomeVisitor implements Serializable {
     @ApiModelProperty(value = "访客姓名")
     private String name;
 
+    @ApiModelProperty(value = "司机姓名")
+    private String driverName;
+
     @ApiModelProperty(value = "访客手机号")
     private String phone;
 

+ 4 - 0
src/main/java/com/template/model/request/WelcomeVisitorRequest.java

@@ -29,6 +29,10 @@ public class WelcomeVisitorRequest implements Serializable {
     @NotBlank(message = "访客姓名不能为空")
     private String name;
 
+    @ApiModelProperty(value = "司机姓名")
+    @NotBlank(message = "司机姓名不能为空")
+    private String driverName;
+
     @ApiModelProperty(value = "访客手机号")
     @NotBlank(message = "访客手机号不能为空")
     @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")

+ 51 - 0
src/main/java/com/template/model/vo/WelcomeDormitoryVo.java

@@ -0,0 +1,51 @@
+package com.template.model.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class WelcomeDormitoryVo {
+    private Integer id;
+
+    @ApiModelProperty(value = "校区id")
+    private Integer schoolId;
+
+    @ApiModelProperty(value = "校区名称")
+    private String school;
+
+    @ApiModelProperty(value = "楼栋ID")
+    private Integer buildId;
+
+    @ApiModelProperty(value = "楼栋名称")
+    private String build;
+
+    @ApiModelProperty(value = "寝室号")
+    private String dormitory;
+
+    @ApiModelProperty(value = "寝室性别")
+    private String sex;
+
+    @ApiModelProperty(value = "所属学院")
+    private String college;
+
+    @ApiModelProperty(value = "所属专业")
+    private String major;
+
+    @ApiModelProperty(value = "所属学院ID")
+    private Integer collegeId;
+
+    @ApiModelProperty(value = "所属专业ID")
+    private Integer majorId;
+
+    @ApiModelProperty(value = "床位数")
+    private Integer bedNumber;
+
+    @ApiModelProperty(value = "备注")
+    private String remark;
+
+    @ApiModelProperty(value = "入住状态 1:满员,2.全空,3.缺额")
+    private Integer status;
+
+    @ApiModelProperty(value = "空闲床位数")
+    private Integer freeBedNumber;
+}

+ 4 - 0
src/main/java/com/template/model/vo/WelcomeVisitorVO.java

@@ -25,6 +25,10 @@ public class WelcomeVisitorVO implements Serializable {
     @ExcelProperty("访客姓名")
     private String name;
 
+    @ApiModelProperty(value = "司机姓名")
+    @ExcelProperty("司机姓名")
+    private String driverName;
+
     @ApiModelProperty(value = "访客手机号")
     @ExcelProperty("访客手机号")
     private String phone;

+ 2 - 1
src/main/java/com/template/services/WelcomeDormitoryService.java

@@ -4,6 +4,7 @@ import com.template.model.pojo.WelcomeDormitory;
 import com.template.model.pojo.WelcomeDormitory;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.WelcomeDormitoryVo;
 
 import java.util.List;
 
@@ -30,7 +31,7 @@ public interface WelcomeDormitoryService extends IService<WelcomeDormitory> {
 
     List<String> groupDormitory(String sex,String college,String gradestr,String school,String buildName);
 
-    PageUtils<WelcomeDormitory> listDormitory(int currentPage, int pageCount,  Integer schoolId,Integer buildId,Integer dormitoryId,String sex,Integer status,Integer majorId,Integer collegeId);
+    PageUtils<WelcomeDormitoryVo> listDormitory(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer status, Integer majorId, Integer collegeId);
 
     List<WelcomeDormitory> listDormitory( String schoolName, String buildName, String dormitory, String sex, Integer status, String major, String college);
 

+ 5 - 4
src/main/java/com/template/services/impl/WelcomeDormitoryServiceImpl.java

@@ -10,6 +10,7 @@ import com.template.model.pojo.WelcomeDormitory;
 import com.template.model.pojo.WelcomeDormitory;
 import com.template.mapper.WelcomeDormitoryMapper;
 import com.template.model.result.PageUtils;
+import com.template.model.vo.WelcomeDormitoryVo;
 import com.template.services.WelcomeDormitoryService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,9 +78,9 @@ public class WelcomeDormitoryServiceImpl extends ServiceImpl<WelcomeDormitoryMap
     }
 
     @Override
-    public PageUtils<WelcomeDormitory> listDormitory(int currentPage, int pageCount,  Integer schoolId,Integer buildId,Integer dormitoryId,String sex,Integer status,Integer majorId,Integer collegeId) {
-        Page<WelcomeDormitory> page = new Page<>(currentPage, pageCount);
-        IPage<WelcomeDormitory> result = welcomeDormitoryMapper.listDormitory(page,schoolId,buildId,dormitoryId,sex,status,majorId,collegeId);
+    public PageUtils<WelcomeDormitoryVo> listDormitory(int currentPage, int pageCount, Integer schoolId, Integer buildId, Integer dormitoryId, String sex, Integer status, Integer majorId, Integer collegeId) {
+        Page<WelcomeDormitoryVo> page = new Page<>(currentPage, pageCount);
+        IPage<WelcomeDormitoryVo> result = welcomeDormitoryMapper.listDormitory(page,schoolId,buildId,dormitoryId,sex,status,majorId,collegeId);
         return new PageUtils<>(result);
     }
 
@@ -103,7 +104,7 @@ public class WelcomeDormitoryServiceImpl extends ServiceImpl<WelcomeDormitoryMap
     public List<WelcomeDormitory> dormitoryGroup(Integer schoolId, Integer buildId) {
         LambdaQueryWrapper<WelcomeDormitory> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(ObjectUtils.isNotEmpty(schoolId), WelcomeDormitory::getSchoolId, schoolId)
-                .eq(ObjectUtils.isNotEmpty(buildId), WelcomeDormitory::getBuild, buildId);
+                .eq(ObjectUtils.isNotEmpty(buildId), WelcomeDormitory::getBuildId, buildId);
         List<WelcomeDormitory> welcomeDormitories = welcomeDormitoryMapper.selectList(wrapper);
         return welcomeDormitories;
     }

+ 0 - 1
src/main/java/com/template/services/impl/WelcomeVisitorServiceImpl.java

@@ -24,7 +24,6 @@ import com.template.model.vo.WelcomeVisitorVO;
 import com.template.services.WelcomeVisitorService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;

+ 32 - 32
src/main/resources/mapper/template/WelcomeDormitoryMapper.xml

@@ -6,10 +6,10 @@
         SELECT build
         FROM `welcome_dormitory`
         WHERE deleted = 0
-        AND sex= #{sex}
-        AND college= #{college}
-        AND gradestr= #{gradestr}
-        AND school= #{school}
+          AND sex = #{sex}
+          AND college = #{college}
+          AND gradestr = #{gradestr}
+          AND school = #{school}
         GROUP BY build
     </select>
 
@@ -17,38 +17,38 @@
         SELECT dormitory
         FROM `welcome_dormitory`
         WHERE deleted = 0
-          AND sex= #{sex}
-          AND college= #{college}
-          AND gradestr= #{gradestr}
-          AND school= #{school}
+          AND sex = #{sex}
+          AND college = #{college}
+          AND gradestr = #{gradestr}
+          AND school = #{school}
           AND build = #{buildName}
         GROUP BY dormitory
     </select>
-    <select id="listDormitory" resultType="com.template.model.pojo.WelcomeDormitory">
+    <select id="listDormitory" resultType="com.template.model.vo.WelcomeDormitoryVo">
         SELECT
-            wd.id,
-            wd.school_id as schoolId,
-            ws.school,
-            wd.build_id as buildId,
-            wb.build,
-            wd.dormitory,
-            wd.sex,
-            wd.college_id as collegeId,
-            wo.name as college,
-            wd.major_id as majorId,
-            wo2.name as major,
-            wd.bed_number as bedNumber,
-            wd.remark,
-            wd.status,
-            wd.free_bed_number as freeBedNumber
+        wd.id,
+        wd.school_id as schoolId,
+        ws.school,
+        wd.build_id as buildId,
+        wb.build,
+        wd.dormitory,
+        wd.sex,
+        wd.college_id as collegeId,
+        wo.name as college,
+        wd.major_id as majorId,
+        wo2.name as major,
+        wd.bed_number as bedNumber,
+        wd.remark,
+        wd.status,
+        wd.free_bed_number as freeBedNumber
         FROM
-            `welcome_dormitory` wd
-                LEFT JOIN welcome_school ws ON wd.school_id = ws.id and ws.deleted = 0
-                LEFT JOIN welcome_build wb ON wd.build_id = wb.id and wb.deleted = 0
-                LEFT JOIN welcome_org wo ON wd.college_id = wo.id and wo.deleted = 0
-                LEFT JOIN welcome_org wo2 ON wd.major_id = wo2.id and wo2.deleted = 0
+        `welcome_dormitory` wd
+        LEFT JOIN welcome_school ws ON wd.school_id = ws.id and ws.deleted = 0
+        LEFT JOIN welcome_build wb ON wd.build_id = wb.id and wb.deleted = 0
+        LEFT JOIN welcome_org wo ON wd.college_id = wo.id and wo.deleted = 0
+        LEFT JOIN welcome_org wo2 ON wd.major_id = wo2.id and wo2.deleted = 0
         WHERE
-            wd.deleted =0
+        wd.deleted =0
         <if test="schoolId != null and schoolId != ''">
             and wd.school_id = #{schoolId}
         </if>
@@ -65,10 +65,10 @@
             and wd.status = #{status}
         </if>
         <if test="majorId != null and majorId != ''">
-            and wd.major_id = #{status}
+            and wd.major_id = #{majorId}
         </if>
         <if test="collegeId != null and collegeId != ''">
-            and wd.college_id  = #{collegeId}
+            and wd.college_id = #{collegeId}
         </if>
     </select>
 </mapper>