| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.doumee.core.model.LoginUserInfo; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.admin.request.OptionsObject; |
| | | import com.doumee.dao.admin.response.ProblemDTO; |
| | | import com.doumee.dao.business.ProblemsMapper; |
| | | import com.doumee.dao.business.model.Problems; |
| | | import com.doumee.dao.web.response.ProblemsVO; |
| | | import com.doumee.service.business.ProblemsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | |
| | | insert.setIsdeleted(Constants.ZERO); |
| | | insert.setRemark(problems.getRemark()); |
| | | insert.setTitle(problems.getTitle()); |
| | | insert.setOptions(problems.getOptions()); |
| | | if(null != problems.getObjectList() && problems.getObjectList().size() > 0) { |
| | | insert.setOptions(JSON.toJSONString(problems.getObjectList())); |
| | | } |
| | | insert.setAnswer(problems.getAnswer()); |
| | | insert.setSortnu(problems.getSortnu()); |
| | | insert.setType(problems.getType()); |
| | |
| | | |
| | | @Override |
| | | public Problems findById(Integer id) { |
| | | return problemsMapper.selectById(id); |
| | | Problems problems = problemsMapper.selectById(id); |
| | | if(null != problems && StringUtils.isNotBlank(problems.getOptions())) { |
| | | problems.setObjectList(JSON.parseArray(problems.getOptions(), OptionsObject.class)); |
| | | } |
| | | return problems; |
| | | } |
| | | |
| | | @Override |
| | |
| | | return collect; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取题目信息 |
| | | * @param useType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ProblemsVO> getProblemsVO(Integer useType){ |
| | | List<Problems> problemsList = problemsMapper.selectList(new QueryWrapper<Problems>().lambda().eq(Problems::getUseType,useType) |
| | | .eq(Problems::getIsdeleted, Constants.ZERO).orderByAsc(Problems::getSortnu)); |
| | | List<ProblemsVO> problemsVOList = new ArrayList<>(); |
| | | for (Problems problems:problemsList) { |
| | | ProblemsVO problemsVO = new ProblemsVO(); |
| | | BeanUtils.copyProperties(problems,problemsVO); |
| | | problemsVOList.add(problemsVO); |
| | | } |
| | | return problemsVOList; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | } |