对外开放接口调整

beetlsql3-dev
陈沅 1 year ago
parent 071480c640
commit 080f7ddc7b

@ -37,4 +37,5 @@ public interface SchoolClassDao extends BaseMapper<SchoolClass> {
List<Map<String,Object>> getClassListByMajorId(String majorId);
}

@ -117,4 +117,8 @@ public interface StudentDao extends BaseMapper<Student>{
List<Map<String,Object>>getStudentInfoByClassId(String classIds);
List<Map<String,Object>>getStudentInfoByKeyword(String keyword,Long schoolId);
PageQuery<Map<String,Object>> pagedListStudentInfoByClassId(PageQuery query);
}

@ -11,6 +11,7 @@ import com.ibeetl.jlw.web.query.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import javafx.beans.binding.DoubleExpression;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -19,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.sql.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -796,4 +798,28 @@ public class AccountController {
public JsonResult<List<Map<String,Object>>> getClassListByMajorId(String majorId){
return JsonResult.success(schoolClassService.getClassListByMajorId(majorId));
}
@ApiOperation("根据关键字查询学生信息")
@GetMapping("getStudentByKeyword.json")
public JsonResult<List<Map<String, Object>>> getStudentByKeyword(String keyword,Integer schoolId){
return JsonResult.success(studentService.getStudentInfoByKeyword(keyword,Long.valueOf(schoolId)));
}
@ApiOperation("根据班级id分页展示学生数据")
@GetMapping("pagedListStudentByClassId.json")
public Map<String, Object> pagedListStudentByClassId(String classList,Integer page,Integer size){
if(page==null||page<1){
page=1;
}
if(size==null){
size=10;
}
PageQuery<Map<String, Object>> mapPageQuery = studentService.pagedListStudentInfoByClassId(classList,page,size);
Map<String,Object> map = new HashMap<>();
map.put("code",0);
map.put("msg","成功");
map.put("count",mapPageQuery.getTotalRow());
map.put("content",mapPageQuery);
return map;
}
}

@ -2162,4 +2162,41 @@ getStudentInfoByClassId
JOIN school_class ON student.class_id = school_class.class_id
JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id
WHERE
student.class_id IN (#classIds#)
student.class_id IN (#classIds#)
getStudentInfoByKeyword
===
SELECT
student.user_id AS userid,
student_id as studentid,
student_name AS NAME,
student.class_id AS classId,
school_class.class_name AS className,
student_sn AS studentNo,
universities_colleges_name as schoolName
FROM
student
JOIN school_class ON student.class_id = school_class.class_id
JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id
WHERE student.student_name like #keyword+'%'# and universities_colleges.universities_colleges_id=#schoolId#
pagedListStudentInfoByClassId
===
SELECT
@pageTag(){
student.user_id AS userid,
student_id as studentid,
student_name AS NAME,
student.class_id AS classId,
school_class.class_name AS className,
student_sn AS studentNo,
universities_colleges_name as schoolName @}
FROM
student
JOIN school_class ON student.class_id = school_class.class_id
JOIN universities_colleges on school_class.universities_colleges_id = universities_colleges.universities_colleges_id
WHERE 1=1 @if(!isEmpty(classIds)){
and find_in_set(student.class_id ,#classIds#)
@}
Loading…
Cancel
Save