src/com/cms/service/impl/ScoreServiceImpl.java
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
package com.cms.service.impl;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.cms.dao.CourseDao;
import com.cms.dao.ScoreDao;
import com.cms.dto.ExcelBean;
import com.cms.dto.ScoreVo;
import com.cms.entity.Course;
import com.cms.entity.Score;
import com.cms.service.ScoreService;
import com.cms.utils.ExcelUtil;
import com.cms.utils.page.Pagination;
@Service
@Transactional
public class ScoreServiceImpl implements ScoreService {
@Autowired
ScoreDao scoreDao;
@Autowired
CourseDao courseDao;
@Override
public int choiceCourse(Score score) {
// 选课过程为一个事务
Course c = courseDao.selectByPrimaryKey(score.getcId());
if (c.getStudentNum() == c.getChoiceNum()) {
// 此课程学生人数已满,选课失败
return 0;
}
System.out.println(c.toString());
// 对所选课程中,choiceNum(已选人数+1)
c.setChoiceNum(c.getChoiceNum() + 1);
courseDao.updateByPrimaryKeySelective(c);
return scoreDao.insertSelective(score);
}
@Override
public int deleteScore(Score score) {
Course c = courseDao.selectByPrimaryKey(score.getcId());
c.setChoiceNum(c.getChoiceNum() - 1);
courseDao.updateByPrimaryKeySelective(c);
return scoreDao.delete(score);
}
@Override
public int updateScore(Score score) {
return scoreDao.updateByPrimaryKeySelective(score);
后面还有 52 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。