夏文涛 1 год назад
Родитель
Сommit
a7749a758c

+ 5 - 1
src/main/java/com/template/api/WelcomeStudentControllerAPI.java

@@ -20,7 +20,7 @@ public interface WelcomeStudentControllerAPI {
 
     @GetMapping(value = "/queryPageStudents")
     @ApiOperation(value = "学生信息分页数据", notes = "学生信息分页数据", httpMethod = "GET")
-    CommonResult queryPageStudents(@RequestParam int currentPage, @RequestParam int pageCount, String college, String major, String classstr, String trafficMethod, String name);
+    CommonResult queryPageStudents(@RequestParam int currentPage, @RequestParam int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name);
 
     @GetMapping(value = "/queryStudentDetail")
     @ApiOperation(value = "学生信息明细数据", notes = "学生信息明细数据", httpMethod = "GET")
@@ -29,4 +29,8 @@ public interface WelcomeStudentControllerAPI {
     @PostMapping(value = "/infoCollection")
     @ApiOperation(value = "学生信息采集", notes = "学生信息采集", httpMethod = "POST")
     CommonResult infoCollection(@Validated @RequestBody InfoCollectionRequest icr, BindingResult bindingResult) throws Exception;
+
+    @GetMapping(value = "/deleteStudentInfo")
+    @ApiOperation(value = "删除学生信息", notes = "删除学生信息", httpMethod = "GET")
+    CommonResult deleteStudentInfo(@RequestParam int id) throws Exception;
 }

+ 2 - 2
src/main/java/com/template/controller/WelcomeOrgController.java

@@ -44,7 +44,7 @@ public class WelcomeOrgController implements WelcomeOrgControllerAPI {
     }
 
     @Override
-    public CommonResult getMajors(Integer collegeId) {
+    public CommonResult getMajors(int collegeId) {
         List<WelcomeOrg> majors = welcomeOrgService.queryMajors(collegeId);
 
         List<ListVo> result = new ArrayList<>();
@@ -58,7 +58,7 @@ public class WelcomeOrgController implements WelcomeOrgControllerAPI {
     }
 
     @Override
-    public CommonResult getClasss(Integer majorId) {
+    public CommonResult getClasss(int majorId) {
         List<WelcomeOrg> classs = welcomeOrgService.queryClasss(majorId);
 
         List<ListVo> result = new ArrayList<>();

+ 33 - 3
src/main/java/com/template/controller/WelcomeStudentController.java

@@ -184,8 +184,8 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
     }
 
     @Override
-    public CommonResult queryPageStudents(int currentPage, int pageCount, String college, String major, String classstr, String trafficMethod, String name) {
-        PageUtils<StudentPageVo> result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, college, major, classstr, trafficMethod, name);
+    public CommonResult queryPageStudents(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
+        PageUtils<StudentPageVo> result = welcomeStudentService.queryStudentPageList(currentPage, pageCount, collegeId, majorId, classstrId, trafficMethod, name);
         return CommonResult.ok(result);
     }
 
@@ -347,7 +347,7 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
         ws.setArrive(icr.getArrive());
         ws.setArrvieDate(icr.getArrvieDate());
         ws.setArriveTimeId(icr.getArriveTimeId());
-
+        ws.setFillStatus("已填报");
         //家庭成员
         List<WelcomeFamily> wfs = new ArrayList<>();
         if(icr.getFvs() != null && icr.getFvs().size() > 0){
@@ -397,5 +397,35 @@ public class WelcomeStudentController implements WelcomeStudentControllerAPI {
 
         return CommonResult.ok("采集完成!");
     }
+
+    @Override
+    @Transactional(rollbackFor = {Exception.class})
+    public CommonResult deleteStudentInfo( int id) throws Exception {
+
+        WelcomeStudent ws = welcomeStudentService.getManageById(id);
+        if(ws == null){
+            return CommonResult.fail("学生信息已失效,无法进行删除操作!");
+        }
+        try {
+            //删除学生数据
+            int deleteStudent = welcomeStudentService.deleteWelcomeStudentById(id);
+            if(deleteStudent <= 0){
+                logger.error("删除学生信息失败,id参数:" + JSON.toJSON(id));
+                throw new Exception("删除学生信息失败!");
+            }
+            //删除宿舍数据
+            int deleteSd = welcomeStudentDormitoryService.deleteWelcomeStudentDormitoryByCard(ws.getCardId());
+            //删除同行人员
+            int deleteWa = welcomeAccompanyService.deleteWelcomeAccompanyByCard(ws.getCardId());
+            //删除家庭成员
+            int deletef = welcomeFamilyService.deleteWelcomeFamilyByCard(ws.getCardId());
+
+        }catch (Exception e){
+            logger.error(e.getMessage());
+            throw new Exception("删除失败!");
+        }
+
+        return CommonResult.ok("删除成功");
+    }
 }
 

+ 1 - 1
src/main/java/com/template/mapper/WelcomeStudentMapper.java

@@ -17,5 +17,5 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface WelcomeStudentMapper extends BaseMapper<WelcomeStudent> {
-    IPage<StudentPageVo> queryStudentPageList(IPage<StudentPageVo> page, @Param("college") String college,@Param("major") String major,@Param("classstr") String classstr,@Param("trafficMethod") String trafficMethod ,@Param("name") String name);
+    IPage<StudentPageVo> queryStudentPageList(IPage<StudentPageVo> page, @Param("collegeId") Integer collegeId,@Param("majorId") Integer majorId,@Param("classstrId") Integer classstrId,@Param("trafficMethod") String trafficMethod ,@Param("name") String name);
 }

+ 2 - 0
src/main/java/com/template/services/WelcomeAccompanyService.java

@@ -27,4 +27,6 @@ public interface WelcomeAccompanyService extends IService<WelcomeAccompany> {
 
     List<WelcomeAccompany> getManageByCardId(String cardId);
 
+    int deleteWelcomeAccompanyByCard(String cardId);
+
 }

+ 2 - 0
src/main/java/com/template/services/WelcomeFamilyService.java

@@ -27,4 +27,6 @@ public interface WelcomeFamilyService extends IService<WelcomeFamily> {
     WelcomeFamily getManageById(String id);
 
     List<WelcomeFamily> getManageByCardId(String cardId);
+
+    int deleteWelcomeFamilyByCard(String cardId);
 }

+ 2 - 0
src/main/java/com/template/services/WelcomeStudentDormitoryService.java

@@ -25,4 +25,6 @@ public interface WelcomeStudentDormitoryService extends IService<WelcomeStudentD
     WelcomeStudentDormitory getManageById(String id);
 
     WelcomeStudentDormitory getManageByCardId(String cardId);
+
+    int deleteWelcomeStudentDormitoryByCard(String cardId);
 }

+ 2 - 2
src/main/java/com/template/services/WelcomeStudentService.java

@@ -21,7 +21,7 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
 
     int updateWelcomeStudent(WelcomeStudent rns);
 
-    int deleteWelcomeStudentById(String id);
+    int deleteWelcomeStudentById(Integer id);
 
     WelcomeStudent getManageById(Integer id);
 
@@ -29,6 +29,6 @@ public interface WelcomeStudentService extends IService<WelcomeStudent> {
 
     WelcomeStudent getDataByIdcard(String cardId);
 
-    PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, String college, String major, String classstr, String trafficMethod ,String name);
+    PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod ,String name);
 
 }

+ 9 - 0
src/main/java/com/template/services/impl/WelcomeAccompanyServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.template.model.pojo.WelcomeAccompany;
 import com.template.mapper.WelcomeAccompanyMapper;
+import com.template.model.pojo.WelcomeFamily;
 import com.template.model.result.PageUtils;
 import com.template.model.vo.RoleDetailsVO;
 import com.template.services.WelcomeAccompanyService;
@@ -70,4 +71,12 @@ public class WelcomeAccompanyServiceImpl extends ServiceImpl<WelcomeAccompanyMap
         return result;
     }
 
+    @Override
+    public int deleteWelcomeAccompanyByCard(String cardId) {
+        QueryWrapper<WelcomeAccompany> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(cardId), "student_card", cardId);
+        int result = welcomeAccompanyMapper.delete(queryWrapper);
+        return result;
+    }
+
 }

+ 9 - 0
src/main/java/com/template/services/impl/WelcomeFamilyServiceImpl.java

@@ -7,6 +7,7 @@ import com.template.mapper.WelcomeFamilyMapper;
 import com.template.model.pojo.WelcomeFamily;
 import com.template.model.pojo.WelcomeFamily;
 import com.template.mapper.WelcomeFamilyMapper;
+import com.template.model.pojo.WelcomeStudentDormitory;
 import com.template.model.result.PageUtils;
 import com.template.services.WelcomeFamilyService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -70,4 +71,12 @@ public class WelcomeFamilyServiceImpl extends ServiceImpl<WelcomeFamilyMapper, W
         List<WelcomeFamily> result = welcomeFamilyMapper.selectList(queryWrapper);
         return result;
     }
+
+    @Override
+    public int deleteWelcomeFamilyByCard(String cardId) {
+        QueryWrapper<WelcomeFamily> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(cardId), "student_card", cardId);
+        int result = welcomeFamilyMapper.delete(queryWrapper);
+        return result;
+    }
 }

+ 8 - 0
src/main/java/com/template/services/impl/WelcomeStudentDormitoryServiceImpl.java

@@ -68,4 +68,12 @@ public class WelcomeStudentDormitoryServiceImpl extends ServiceImpl<WelcomeStude
         WelcomeStudentDormitory result = welcomeStudentDormitoryMapper.selectOne(queryWrapper);
         return result;
     }
+
+    @Override
+    public int deleteWelcomeStudentDormitoryByCard(String cardId) {
+        QueryWrapper<WelcomeStudentDormitory> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq(StringUtils.hasText(cardId), "student_card", cardId);
+        int result = welcomeStudentDormitoryMapper.delete(queryWrapper);
+        return result;
+    }
 }

+ 3 - 3
src/main/java/com/template/services/impl/WelcomeStudentServiceImpl.java

@@ -43,7 +43,7 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
     }
 
     @Override
-    public int deleteWelcomeStudentById(String id) {
+    public int deleteWelcomeStudentById(Integer id) {
         int result = welcomeStudentMapper.deleteById(id);
         return result;
     }
@@ -73,11 +73,11 @@ public class WelcomeStudentServiceImpl extends ServiceImpl<WelcomeStudentMapper,
     }
 
     @Override
-    public PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, String college, String major, String classstr, String trafficMethod, String name) {
+    public PageUtils<StudentPageVo> queryStudentPageList(int currentPage, int pageCount, Integer collegeId, Integer majorId, Integer classstrId, String trafficMethod, String name) {
         Page<StudentPageVo> page = new Page<>();
         page.setCurrent(currentPage);
         page.setSize(pageCount);
-        IPage<StudentPageVo> result = welcomeStudentMapper.queryStudentPageList(page, college, major, classstr, trafficMethod, name);
+        IPage<StudentPageVo> result = welcomeStudentMapper.queryStudentPageList(page, collegeId, majorId, classstrId, trafficMethod, name);
         return new PageUtils(result);
     }
 }

+ 6 - 6
src/main/resources/mapper/template/WelcomeStudentMapper.xml

@@ -25,14 +25,14 @@
         left join welcome_student_dormitory wsd on wsd.deleted =0 and wsd.student_card = ws.card_id
         from welcome_student ws
         where ws.deleted = 0
-        <if test="college != null and college != ''">
-            ws.college = #{college}
+        <if test="collegeId != null and collegeId != ''">
+            ws.college_id = #{collegeId}
         </if>
-        <if test="major != null and major != ''">
-            ws.major = #{major}
+        <if test="majorId != null and majorId != ''">
+            ws.major_id = #{majorId}
         </if>
-        <if test="classstr != null and classstr != ''">
-            ws.classstr = #{classstr}
+        <if test="classstrId != null and classstrId != ''">
+            ws.classstr_id = #{classstrId}
         </if>
         <if test="trafficMethod != null and trafficMethod != ''">
             ws.trafficMethod = #{trafficMethod}