通过参数获得学生列表

163 阅读2分钟
 /**
     * 通过参数获得学生列表
     * 通过参数获得学生列表
     *getStStudentData
     */
    @AutoLog(value = "通过参数获得学生列表")
    @ApiOperation(value="通过参数获得学生列表", notes="通过参数获得学生列表")
    @GetMapping(value = "/getStStudentData")
//    @RequiresPermissions("stStudent:getStStudent")
    public Result<?> getStStudentData(String classId,
                               String departId,
                               String professionId,
                               String nationality,
                               String status,
                               String province,
                               String city,
                               String area,
                               String fieldTwo,
                               String face,
                               String difficult,
                               String psychological,
                               String graduation,
                               String single,
                               String academicWarning,
                               String delayedGraduation,
                               @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                               @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                               HttpServletRequest req) {
        if((StringUtils.isBlank(classId) )&&
                StringUtils.isBlank(departId) &&
                StringUtils.isBlank(professionId) &&
                StringUtils.isBlank(nationality) &&
                StringUtils.isBlank(province) &&
                StringUtils.isBlank(city) &&
                StringUtils.isBlank(area) &&
                StringUtils.isBlank(status)&&
                StringUtils.isBlank(fieldTwo)&&
                StringUtils.isBlank(face)&&
                StringUtils.isBlank(difficult)&&
                StringUtils.isBlank(psychological)&&
                StringUtils.isBlank(graduation)&&
                StringUtils.isBlank(single)&&
                StringUtils.isBlank(academicWarning)&&
                StringUtils.isBlank(delayedGraduation)
                ){
            return Result.error("您的参数不正确,请确认后再进行访问!");
        }
        List<StudentListVo> studentVos= stStudentService.getLists(classId,departId,professionId,nationality, status,province,city,area,fieldTwo,face,difficult,psychological,graduation,single,academicWarning,delayedGraduation,pageNo,pageSize);
        Result result=new Result();
        result.setResult(studentVos);
        return result;
    }
 List<StudentListVo> getLists(String classId, String departId, String professionId, String nationality, String status,  String province,
                                 String city,
                                 String area,String fieldTwo,String face,String difficult, String psychological,String graduation,String single,String academicWarning,String delayedGraduation,Integer pageNo, Integer pageSize);

    @Override
    public List<StudentListVo> getLists(String classId, String departId, String professionId, String nationality,String status, String province,
                                        String city,
                                        String area,String fieldTwo,String face, String difficult, String psychological,String graduation,String single,String academicWarning,String delayedGraduation,Integer pageNo, Integer pageSize){
        List<StudentListVo> studentListVos= stStudentMapper.getListByFront(classId,departId,professionId,nationality,status,province,city,area,fieldTwo,face,difficult,psychological,graduation,single,academicWarning,delayedGraduation,(pageNo-1)*pageSize,pageSize);
        return studentListVos;
    }
  List<StudentListVo> getListByFront(@Param("classId") String classId, @Param("departId") String departId,@Param("professionId")   String professionId,@Param("nationality")   String nationality,@Param("status") String status,
                                       @Param("province") String province,
                                       @Param("city") String city,
                                       @Param("area") String area,
                                       @Param("fieldTwo") String fieldTwo,
                                       @Param("face") String face,
                                       @Param("difficult") String difficult,@Param("psychological") String psychological,
                                       @Param("graduation") String graduation,@Param("single") String single,
                                       @Param("academicWarning") String academicWarning,@Param("delayedGraduation") String delayedGraduation,
                                       @Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize);

 <select id="getListByFront" resultType="org.jeecg.modules.demo.st.vo.StudentListVo">
        select * from st_student where field_one='0' and deleted='0'
        <if test="status !=null and status != ''">
            and st_student.status = #{status}
        </if>
        <if test="classId !=null and classId != ''">
            and st_student.st_class = #{classId}
        </if>
        <if test="departId !=null and departId != ''">
            and st_student.college = #{departId}
        </if>
        <if test="professionId !=null and professionId != ''">
            and st_student.profession = #{professionId}
        </if>
        <if test="nationality !=null and nationality != ''">
            and st_student.nationality = #{nationality}
        </if>
        <if test="province !=null and province != ''">
            and st_student.province = #{province}
        </if>
        <if test="fieldTwo !=null and fieldTwo != ''">
            and st_student.field_two = #{fieldTwo}
        </if>
        <if test="face !=null and face != ''">
            and st_student.face = #{face}
        </if>
        <if test="difficult !=null and difficult != ''">
            and st_student.difficult = #{difficult}
        </if>
        <if test="psychological !=null and psychological != ''">
            and st_student.psychological = #{psychological}
        </if>
        <if test="graduation !=null and graduation != ''">
            and st_student.graduation = #{graduation}
        </if>
        <if test="single !=null and single != ''">
            and st_student.single = #{single}
        </if>
        <if test="academicWarning !=null and academicWarning != ''">
            and st_student.academic_warning = #{academicWarning}
        </if>
        <if test="delayedGraduation !=null and delayedGraduation != ''">
            and st_student.delayed_graduation = #{delayedGraduation}
        </if>
        <if test="city !=null and city != ''">
            and st_student.city = #{city}
        </if>
        <if test="area !=null and area != ''">
            and st_student.area = #{area}
        </if>
        limit #{pageNo},#{pageSize}
    </select>