Commit 007a8317 authored by liu_cheng_jiu's avatar liu_cheng_jiu

init

parent a77d30b9
......@@ -45,10 +45,10 @@ public class ClassService {
* @param className
* @return
*/
public Object addClassInfo(String className) {
public String addClassInfo(String className) {
List<ClassInfo> classInfoList = selectClass(className);
if (classInfoList != null && classInfoList.size() != 0) {
return "当前已存在该班级";
return "fail 当前已存在该班级";
}
ClassInfo classInfo = new ClassInfo();
LocalDateTime now = LocalDateTime.now();
......@@ -57,7 +57,7 @@ public class ClassService {
classInfo.setDeleted(false);
classInfo.setClassName(className);
classInfoMapper.insertSelective(classInfo);
return "添加班级成功";
return "OK 添加班级成功";
}
public void updateClassInfo(ClassInfo classInfo) {
......
......@@ -2,6 +2,7 @@ package cn.exploring.engine.server.db.service;
import cn.exploring.engine.server.db.dao.StudentPointInfoMapper;
import cn.exploring.engine.server.db.domain.StudentPointInfo;
import cn.exploring.engine.server.db.domain.StudentPointInfoExample;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -14,12 +15,25 @@ public class StudentPointService {
@Resource
StudentPointInfoMapper studentPointInfoMapper;
// public List<StudentPointInfo> selectPointInfo() {
//
// }
/**
* id 检索
* @param idList
* @return
*/
public List<StudentPointInfo> selectPointInfo(List<Integer> idList) {
StudentPointInfoExample example = new StudentPointInfoExample();
StudentPointInfoExample.Criteria criteria = example.createCriteria();
criteria.andDeletedEqualTo(false);
if (idList != null && idList.size() > 0) {
criteria.andIdIn(idList);
}
return studentPointInfoMapper.selectByExample(example);
}
public Object addPoint(StudentPointInfo studentPoint) {
LocalDateTime now = LocalDateTime.now();
studentPoint.setRecordTime(now);
studentPoint.setUpdateTime(now);
studentPoint.setAddTime(now);
studentPoint.setDeleted(false);
......@@ -34,4 +48,13 @@ public class StudentPointService {
return "update OK";
}
public Object batchDeleted(List<Integer> idList) {
List<StudentPointInfo> studentPointInfoList = selectPointInfo(idList);
studentPointInfoList.forEach(x -> {
x.setDeleted(null);
updatePoint(x);
});
return "batch deleted OK";
}
}
package cn.exploring.engine.server.wx.web;
import cn.exploring.engine.server.core.util.ResponseUtil;
import cn.exploring.engine.server.db.domain.ClassInfo;
import cn.exploring.engine.server.db.service.ClassService;
import cn.exploring.engine.server.db.service.StudentPointService;
import cn.exploring.engine.server.wx.annotation.LoginUser;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@RequestMapping("/wx/class")
@Validated
public class ClassController {
@Resource
ClassService classService;
@GetMapping("addClass")
public Object commitUserLessonRecord(@RequestParam String className) {
String status = classService.addClassInfo(className);
return status.contains("OK") ? ResponseUtil.ok(status) : ResponseUtil.fail(502, status);
}
}
package cn.exploring.engine.server.wx.web;
import cn.exploring.engine.server.core.util.ResponseUtil;
import cn.exploring.engine.server.db.service.ClassService;
import cn.exploring.engine.server.db.service.StudentPointService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/wx/point")
@Validated
public class PointController {
@Resource
StudentPointService pointService;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment