修改考核管理查看成绩页面

master
pd 4 years ago
parent 44c35d8a31
commit 074f769cbb
  1. 48
      src/main/java/com/yipin/liuwanr/controller/AssesmentController.java
  2. 10
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  3. 3
      src/main/java/com/yipin/liuwanr/mapper/CourseMapper.java
  4. 34
      src/main/java/com/yipin/liuwanr/service/AssesmentService.java

@ -5,13 +5,7 @@ import java.util.List;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yipin.liuwanr.entity.Assesment; import com.yipin.liuwanr.entity.Assesment;
import com.yipin.liuwanr.entity.Response; import com.yipin.liuwanr.entity.Response;
@ -491,5 +485,45 @@ public class AssesmentController {
} }
return resp; return resp;
} }
@DeleteMapping("/deleteAssesment")
Response deleteAssesment(@RequestParam Integer assesmentId){
Response resp = new Response();
if(StringUtils.isEmpty(assesmentId)){
resp.setStatus(300);
resp.setErrmessage("考核信息为空");
}else{
HashMap<String, Object> ret = service.deleteAssesment(assesmentId);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@GetMapping("/isNameExistis")
Response isNameExistis(@RequestParam String assesmentName){
Response resp = new Response();
if(StringUtils.isEmpty(assesmentName)){
resp.setStatus(300);
resp.setErrmessage("考核信息为空");
}else{
HashMap<String, Object> ret = service.isNameExistis(assesmentName);
int status = (int) ret.get("retcode");
if (200 == status) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
} }

@ -88,6 +88,10 @@ public interface AssesmentMapper {
void insertAssesment(Assesment assesment); void insertAssesment(Assesment assesment);
@Delete("delete from assessment where id=#{id}")
boolean deleteAssesment(Integer assesmentId);
/** /**
* 修改考核 * 修改考核
* *
@ -151,10 +155,12 @@ public interface AssesmentMapper {
* @param assesmentId * @param assesmentId
* @param students * @param students
*/ */
@Delete({"<script>", "delete from record where assesmentId=#{assesmentId} and studentId in", @Delete({"<script>", "delete from record where assesmentId=#{assesmentId} ",
"<foreach collection='students' item='stu' open='(' separator=',' close=')'>" + "<if test='students!=null'>",
"<foreach collection='students' item='stu' open='and studentId in(' separator=',' close=')'>" +
"#{stu.studentId} " "#{stu.studentId} "
+ "</foreach> ", + "</foreach> ",
"</if>",
"</script>"}) "</script>"})
void deleteRecord(@Param("assesmentId") Integer assesmentId, @Param("students") List<Student> students); void deleteRecord(@Param("assesmentId") Integer assesmentId, @Param("students") List<Student> students);

@ -215,7 +215,8 @@ public interface CourseMapper {
* @param schoolId * @param schoolId
* @return * @return
*/ */
@Select("select c.courseId,courseName from course c left join hr_course_permissions cp on (c.courseId=cp.courseId) left join orders o on (cp.orderId=o.orderId) left join customer cu on(o.customerId=cu.customerId) where c.isdel=0 and c.isShelves=0 and cu.schoolId=#{schoolId} GROUP BY c.courseId") @Select("select c.courseId,courseName from course c left join hr_course_permissions cp on (c.courseId=cp.courseId) left join orders o " +
" on (cp.orderId=o.orderId) left join customer cu on(o.customerId=cu.customerId) where c.isdel=0 and c.isShelves=0 and cu.schoolId=#{schoolId} GROUP BY c.courseId")
List<Course> getBySchool(Integer schoolId); List<Course> getBySchool(Integer schoolId);

@ -627,4 +627,38 @@ public class AssesmentService {
} }
public HashMap<String, Object> deleteAssesment(Integer assesmentId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
boolean relus=mapper.deleteAssesment(assesmentId);
if(relus){
mapper.deleteRecord(assesmentId,null);
}
resp.put("retcode", 200);
}catch (RuntimeException e){
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "DELETE Failed");
return resp;
}
return resp;
}
public HashMap<String, Object> isNameExistis(String assesmentName) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer count=mapper.getByAssesmentName(assesmentName);
if(count!=null && count>1){
resp.put("retvalue", "考核名称已存在");
resp.put("retcode", 300);
}
resp.put("retcode", 200);
}catch (RuntimeException e){
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "DELETE Failed");
return resp;
}
return resp;
}
} }

Loading…
Cancel
Save