mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 10:56:50 +08:00
根据用户和课程id查评分
This commit is contained in:
@@ -2,6 +2,7 @@ package com.xboe.module.interaction.api;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -15,6 +16,8 @@ import com.xboe.module.interaction.service.ICourseGradeService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping(value = "/xboe/m/grade")
|
||||
@@ -50,5 +53,20 @@ public class CourseGradeApi extends ApiBaseController {
|
||||
return success(has);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前用户评分的课程 分数
|
||||
* */
|
||||
@PostMapping("/score")
|
||||
public JsonResponse<Map<String,Object>> score(String courseId,String aid){
|
||||
if(StringUtils.isBlank(courseId)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
if(StringUtils.isBlank(aid)){
|
||||
aid=this.getCurrent().getAccountId();
|
||||
}
|
||||
Map<String, Object> score = service.score(courseId, aid);
|
||||
return success(score);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.xboe.common.PageList;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.interaction.entity.CourseGrade;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ICourseGradeService {
|
||||
|
||||
|
||||
@@ -20,4 +22,9 @@ public interface ICourseGradeService {
|
||||
* 查询当前用户是否评分
|
||||
* */
|
||||
Boolean has(String courseId,String aid);
|
||||
|
||||
/**
|
||||
* 查询当前用户评分的课程
|
||||
* */
|
||||
Map<String,Object> score(String courseId,String aid);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.xboe.module.interaction.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -77,6 +80,13 @@ public class CourseGradeServiceImpl implements ICourseGradeService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> score(String courseId, String aid) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
Object field = courseGradeDao.findField("scores", FieldFilters.eq("courseId", courseId), FieldFilters.eq("sysCreateAid", aid));
|
||||
map.put(courseId,field);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user