13 changed files with 976 additions and 0 deletions
@ -0,0 +1,104 @@ |
|||||
|
package com.zdxt.knowledge.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.zdxt.common.ZDResponse; |
||||
|
import com.zdxt.common.controller.BaseController; |
||||
|
import com.zdxt.common.util.TableDataInfo; |
||||
|
import com.zdxt.knowledge.domain.QuestionAnswer; |
||||
|
import com.zdxt.knowledge.service.IQuestionAnswerService; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 选择Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/small/questionAnswer") |
||||
|
public class QuestionAnswerController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "system/answer"; |
||||
|
|
||||
|
@Autowired |
||||
|
private IQuestionAnswerService questionAnswerService; |
||||
|
|
||||
|
@RequiresPermissions("system:answer:view") |
||||
|
@GetMapping() |
||||
|
public String answer() |
||||
|
{ |
||||
|
return prefix + "/answer"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询选择列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("system:answer:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<QuestionAnswer> list = questionAnswerService.selectQuestionAnswerList(questionAnswer); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增选择 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存选择 |
||||
|
*/ |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public ZDResponse addSave(@RequestBody QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
int resNum = questionAnswerService.insertQuestionAnswer(questionAnswer); |
||||
|
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改选择 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{guid}") |
||||
|
public String edit(@PathVariable("guid") String guid, ModelMap mmap) |
||||
|
{ |
||||
|
QuestionAnswer questionAnswer = questionAnswerService.selectQuestionAnswerById(guid); |
||||
|
mmap.put("questionAnswer", questionAnswer); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存选择 |
||||
|
*/ |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public ZDResponse editSave(QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
int resNum = questionAnswerService.updateQuestionAnswer(questionAnswer); |
||||
|
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除选择 |
||||
|
*/ |
||||
|
@RequiresPermissions("system:answer:remove") |
||||
|
@PostMapping( "/remove") |
||||
|
@ResponseBody |
||||
|
public ZDResponse remove(String ids) |
||||
|
{ |
||||
|
int resNum = questionAnswerService.deleteQuestionAnswerByIds(ids); |
||||
|
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,106 @@ |
|||||
|
package com.zdxt.knowledge.controller; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.zdxt.common.ZDResponse; |
||||
|
import com.zdxt.common.controller.BaseController; |
||||
|
import com.zdxt.common.util.StringUtils; |
||||
|
import com.zdxt.common.util.TableDataInfo; |
||||
|
import com.zdxt.knowledge.domain.QuestionFre; |
||||
|
import com.zdxt.knowledge.service.IQuestionFreService; |
||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.ui.ModelMap; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
/** |
||||
|
* 题次Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/small/questionFre") |
||||
|
public class QuestionFreController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "system/fre"; |
||||
|
|
||||
|
@Autowired |
||||
|
private IQuestionFreService questionFreService; |
||||
|
|
||||
|
@RequiresPermissions("system:fre:view") |
||||
|
@GetMapping() |
||||
|
public String fre() |
||||
|
{ |
||||
|
return prefix + "/fre"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询题次列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("system:fre:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(QuestionFre questionFre) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<QuestionFre> list = questionFreService.selectQuestionFreList(questionFre); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增题次 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存题次 |
||||
|
*/ |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public ZDResponse addSave(@RequestBody QuestionFre questionFre) |
||||
|
{ |
||||
|
String guid = questionFreService.insertQuestionFre(questionFre); |
||||
|
return StringUtils.isNotEmpty(guid)?ZDResponse.success("操作成功", guid):ZDResponse.error("操作失败", guid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改题次 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{guid}") |
||||
|
public String edit(@PathVariable("guid") String guid, ModelMap mmap) |
||||
|
{ |
||||
|
QuestionFre questionFre = questionFreService.selectQuestionFreById(guid); |
||||
|
mmap.put("questionFre", questionFre); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存题次 |
||||
|
*/ |
||||
|
@RequiresPermissions("system:fre:edit") |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public ZDResponse editSave(QuestionFre questionFre) |
||||
|
{ |
||||
|
int resNum = questionFreService.updateQuestionFre(questionFre); |
||||
|
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除题次 |
||||
|
*/ |
||||
|
@RequiresPermissions("system:fre:remove") |
||||
|
@PostMapping( "/remove") |
||||
|
@ResponseBody |
||||
|
public ZDResponse remove(String ids) |
||||
|
{ |
||||
|
int resNum = questionFreService.deleteQuestionFreByIds(ids); |
||||
|
return resNum>0?ZDResponse.success("操作成功", resNum):ZDResponse.error("操作失败", resNum); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
package com.zdxt.knowledge.domain; |
||||
|
|
||||
|
import com.zdxt.common.BaseDomain; |
||||
|
|
||||
|
/** |
||||
|
* 选择对象 question_answer |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public class QuestionAnswer extends BaseDomain |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private String guid; |
||||
|
|
||||
|
/** 题次id */ |
||||
|
private String questionFreId; |
||||
|
|
||||
|
/** 问题id */ |
||||
|
private String questionId; |
||||
|
|
||||
|
/** 所选答案 */ |
||||
|
private String answer; |
||||
|
|
||||
|
/** 正确答案 */ |
||||
|
private String correctAnswer; |
||||
|
|
||||
|
/** 是否正确(0:错误; 1:正确;) */ |
||||
|
private Integer correct; |
||||
|
|
||||
|
public void setGuid(String guid) |
||||
|
{ |
||||
|
this.guid = guid; |
||||
|
} |
||||
|
|
||||
|
public String getGuid() |
||||
|
{ |
||||
|
return guid; |
||||
|
} |
||||
|
public void setQuestionFreId(String questionFreId) |
||||
|
{ |
||||
|
this.questionFreId = questionFreId; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionFreId() |
||||
|
{ |
||||
|
return questionFreId; |
||||
|
} |
||||
|
public void setQuestionId(String questionId) |
||||
|
{ |
||||
|
this.questionId = questionId; |
||||
|
} |
||||
|
|
||||
|
public String getQuestionId() |
||||
|
{ |
||||
|
return questionId; |
||||
|
} |
||||
|
public void setAnswer(String answer) |
||||
|
{ |
||||
|
this.answer = answer; |
||||
|
} |
||||
|
|
||||
|
public String getAnswer() |
||||
|
{ |
||||
|
return answer; |
||||
|
} |
||||
|
public void setCorrectAnswer(String correctAnswer) |
||||
|
{ |
||||
|
this.correctAnswer = correctAnswer; |
||||
|
} |
||||
|
|
||||
|
public String getCorrectAnswer() |
||||
|
{ |
||||
|
return correctAnswer; |
||||
|
} |
||||
|
public void setCorrect(Integer correct) |
||||
|
{ |
||||
|
this.correct = correct; |
||||
|
} |
||||
|
|
||||
|
public Integer getCorrect() |
||||
|
{ |
||||
|
return correct; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.zdxt.knowledge.domain; |
||||
|
|
||||
|
import com.zdxt.common.BaseDomain; |
||||
|
|
||||
|
/** |
||||
|
* 题次对象 question_fre |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public class QuestionFre extends BaseDomain |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private String guid; |
||||
|
|
||||
|
/** 角色id */ |
||||
|
private String roleId; |
||||
|
|
||||
|
public void setGuid(String guid) |
||||
|
{ |
||||
|
this.guid = guid; |
||||
|
} |
||||
|
|
||||
|
public String getGuid() |
||||
|
{ |
||||
|
return guid; |
||||
|
} |
||||
|
public void setRoleId(String roleId) |
||||
|
{ |
||||
|
this.roleId = roleId; |
||||
|
} |
||||
|
|
||||
|
public String getRoleId() |
||||
|
{ |
||||
|
return roleId; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.mapper; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.QuestionAnswer; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 选择Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public interface QuestionAnswerMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询选择 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 选择 |
||||
|
*/ |
||||
|
public QuestionAnswer selectQuestionAnswerById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询选择列表 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 选择集合 |
||||
|
*/ |
||||
|
public List<QuestionAnswer> selectQuestionAnswerList(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 新增选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertQuestionAnswer(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 修改选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateQuestionAnswer(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 删除选择 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionAnswerById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除选择 |
||||
|
* |
||||
|
* @param guids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionAnswerByIds(String[] guids); |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.mapper; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.QuestionFre; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 题次Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public interface QuestionFreMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询题次 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 题次 |
||||
|
*/ |
||||
|
public QuestionFre selectQuestionFreById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询题次列表 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 题次集合 |
||||
|
*/ |
||||
|
public List<QuestionFre> selectQuestionFreList(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 新增题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertQuestionFre(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 修改题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateQuestionFre(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 删除题次 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionFreById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除题次 |
||||
|
* |
||||
|
* @param guids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionFreByIds(String[] guids); |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.service; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.QuestionAnswer; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 选择Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public interface IQuestionAnswerService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询选择 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 选择 |
||||
|
*/ |
||||
|
public QuestionAnswer selectQuestionAnswerById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询选择列表 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 选择集合 |
||||
|
*/ |
||||
|
public List<QuestionAnswer> selectQuestionAnswerList(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 新增选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertQuestionAnswer(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 修改选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateQuestionAnswer(QuestionAnswer questionAnswer); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除选择 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionAnswerByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除选择信息 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionAnswerById(String guid); |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.service; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.QuestionFre; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 题次Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
public interface IQuestionFreService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询题次 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 题次 |
||||
|
*/ |
||||
|
public QuestionFre selectQuestionFreById(String guid); |
||||
|
|
||||
|
/** |
||||
|
* 查询题次列表 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 题次集合 |
||||
|
*/ |
||||
|
public List<QuestionFre> selectQuestionFreList(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 新增题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public String insertQuestionFre(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 修改题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateQuestionFre(QuestionFre questionFre); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除题次 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionFreByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除题次信息 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteQuestionFreById(String guid); |
||||
|
} |
||||
@ -0,0 +1,100 @@ |
|||||
|
package com.zdxt.knowledge.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.zdxt.common.util.Convert; |
||||
|
import com.zdxt.common.util.StringUtils; |
||||
|
import com.zdxt.knowledge.domain.QuestionAnswer; |
||||
|
import com.zdxt.knowledge.mapper.QuestionAnswerMapper; |
||||
|
import com.zdxt.knowledge.service.IQuestionAnswerService; |
||||
|
import com.zdxt.knowledge.service.IQuestionFreService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 选择Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class QuestionAnswerServiceImpl implements IQuestionAnswerService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private QuestionAnswerMapper questionAnswerMapper; |
||||
|
@Autowired private IQuestionFreService iQuestionFreService; |
||||
|
|
||||
|
/** |
||||
|
* 查询选择 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 选择 |
||||
|
*/ |
||||
|
@Override |
||||
|
public QuestionAnswer selectQuestionAnswerById(String guid) |
||||
|
{ |
||||
|
return questionAnswerMapper.selectQuestionAnswerById(guid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询选择列表 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 选择 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<QuestionAnswer> selectQuestionAnswerList(QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
return questionAnswerMapper.selectQuestionAnswerList(questionAnswer); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertQuestionAnswer(QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
questionAnswer.setGuid(StringUtils.getUUID()); |
||||
|
|
||||
|
return questionAnswerMapper.insertQuestionAnswer(questionAnswer); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改选择 |
||||
|
* |
||||
|
* @param questionAnswer 选择 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateQuestionAnswer(QuestionAnswer questionAnswer) |
||||
|
{ |
||||
|
return questionAnswerMapper.updateQuestionAnswer(questionAnswer); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除选择对象 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteQuestionAnswerByIds(String ids) |
||||
|
{ |
||||
|
return questionAnswerMapper.deleteQuestionAnswerByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除选择信息 |
||||
|
* |
||||
|
* @param guid 选择ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteQuestionAnswerById(String guid) |
||||
|
{ |
||||
|
return questionAnswerMapper.deleteQuestionAnswerById(guid); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,101 @@ |
|||||
|
package com.zdxt.knowledge.service.impl; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
import com.zdxt.common.util.Convert; |
||||
|
import com.zdxt.common.util.StringUtils; |
||||
|
import com.zdxt.knowledge.domain.QuestionFre; |
||||
|
import com.zdxt.knowledge.mapper.QuestionFreMapper; |
||||
|
import com.zdxt.knowledge.service.IQuestionFreService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* 题次Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2024-02-04 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class QuestionFreServiceImpl implements IQuestionFreService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private QuestionFreMapper questionFreMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询题次 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 题次 |
||||
|
*/ |
||||
|
@Override |
||||
|
public QuestionFre selectQuestionFreById(String guid) |
||||
|
{ |
||||
|
return questionFreMapper.selectQuestionFreById(guid); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询题次列表 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 题次 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<QuestionFre> selectQuestionFreList(QuestionFre questionFre) |
||||
|
{ |
||||
|
return questionFreMapper.selectQuestionFreList(questionFre); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public String insertQuestionFre(QuestionFre questionFre) |
||||
|
{ |
||||
|
questionFre.setGuid(StringUtils.getUUID()); |
||||
|
int resNum = questionFreMapper.insertQuestionFre(questionFre); |
||||
|
if (resNum > 0) { |
||||
|
return questionFre.getGuid(); |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改题次 |
||||
|
* |
||||
|
* @param questionFre 题次 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateQuestionFre(QuestionFre questionFre) |
||||
|
{ |
||||
|
return questionFreMapper.updateQuestionFre(questionFre); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除题次对象 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteQuestionFreByIds(String ids) |
||||
|
{ |
||||
|
return questionFreMapper.deleteQuestionFreByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除题次信息 |
||||
|
* |
||||
|
* @param guid 题次ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteQuestionFreById(String guid) |
||||
|
{ |
||||
|
return questionFreMapper.deleteQuestionFreById(guid); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,97 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.zdxt.knowledge.mapper.QuestionAnswerMapper"> |
||||
|
|
||||
|
<resultMap type="com.zdxt.knowledge.domain.QuestionAnswer" id="QuestionAnswerResult"> |
||||
|
<result property="guid" column="guid" /> |
||||
|
<result property="questionFreId" column="question_fre_id" /> |
||||
|
<result property="questionId" column="question_id" /> |
||||
|
<result property="answer" column="answer" /> |
||||
|
<result property="correctAnswer" column="correct_answer" /> |
||||
|
<result property="correct" column="correct" /> |
||||
|
<result property="creator" column="creator" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="updator" column="updator" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectQuestionAnswerVo"> |
||||
|
select guid, question_fre_id, question_id, answer, correct_answer, correct, creator, create_time, updator, update_time from question_answer |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectQuestionAnswerList" parameterType="QuestionAnswer" resultMap="QuestionAnswerResult"> |
||||
|
<include refid="selectQuestionAnswerVo"/> |
||||
|
<where> |
||||
|
<if test="questionFreId != null and questionFreId != ''"> and question_fre_id = #{questionFreId}</if> |
||||
|
<if test="questionId != null and questionId != ''"> and question_id = #{questionId}</if> |
||||
|
<if test="answer != null and answer != ''"> and answer = #{answer}</if> |
||||
|
<if test="correctAnswer != null and correctAnswer != ''"> and correct_answer = #{correctAnswer}</if> |
||||
|
<if test="correct != null "> and correct = #{correct}</if> |
||||
|
<if test="creator != null and creator != ''"> and creator = #{creator}</if> |
||||
|
<if test="updator != null and updator != ''"> and updator = #{updator}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectQuestionAnswerById" parameterType="String" resultMap="QuestionAnswerResult"> |
||||
|
<include refid="selectQuestionAnswerVo"/> |
||||
|
where guid = #{guid} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertQuestionAnswer" parameterType="QuestionAnswer"> |
||||
|
insert into question_answer |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null and guid != ''">guid,</if> |
||||
|
<if test="questionFreId != null and questionFreId != ''">question_fre_id,</if> |
||||
|
<if test="questionId != null and questionId != ''">question_id,</if> |
||||
|
<if test="answer != null and answer != ''">answer,</if> |
||||
|
<if test="correctAnswer != null and correctAnswer != ''">correct_answer,</if> |
||||
|
<if test="correct != null ">correct,</if> |
||||
|
<if test="creator != null and creator != ''">creator,</if> |
||||
|
<if test="createTime != null ">create_time,</if> |
||||
|
<if test="updator != null and updator != ''">updator,</if> |
||||
|
<if test="updateTime != null ">update_time,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null and guid != ''">#{guid},</if> |
||||
|
<if test="questionFreId != null and questionFreId != ''">#{questionFreId},</if> |
||||
|
<if test="questionId != null and questionId != ''">#{questionId},</if> |
||||
|
<if test="answer != null and answer != ''">#{answer},</if> |
||||
|
<if test="correctAnswer != null and correctAnswer != ''">#{correctAnswer},</if> |
||||
|
<if test="correct != null ">#{correct},</if> |
||||
|
<if test="creator != null and creator != ''">#{creator},</if> |
||||
|
<if test="createTime != null ">#{createTime},</if> |
||||
|
<if test="updator != null and updator != ''">#{updator},</if> |
||||
|
<if test="updateTime != null ">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateQuestionAnswer" parameterType="QuestionAnswer"> |
||||
|
update question_answer |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="questionFreId != null and questionFreId != ''">question_fre_id = #{questionFreId},</if> |
||||
|
<if test="questionId != null and questionId != ''">question_id = #{questionId},</if> |
||||
|
<if test="answer != null and answer != ''">answer = #{answer},</if> |
||||
|
<if test="correctAnswer != null and correctAnswer != ''">correct_answer = #{correctAnswer},</if> |
||||
|
<if test="correct != null ">correct = #{correct},</if> |
||||
|
<if test="creator != null and creator != ''">creator = #{creator},</if> |
||||
|
<if test="createTime != null ">create_time = #{createTime},</if> |
||||
|
<if test="updator != null and updator != ''">updator = #{updator},</if> |
||||
|
<if test="updateTime != null ">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where guid = #{guid} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteQuestionAnswerById" parameterType="String"> |
||||
|
delete from question_answer where guid = #{guid} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteQuestionAnswerByIds" parameterType="String"> |
||||
|
delete from question_answer where guid in |
||||
|
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
||||
|
#{guid} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,82 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<!DOCTYPE mapper |
||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.zdxt.knowledge.mapper.QuestionFreMapper"> |
||||
|
|
||||
|
<resultMap type="com.zdxt.knowledge.domain.QuestionFre" id="QuestionFreResult"> |
||||
|
<result property="guid" column="guid" /> |
||||
|
<result property="userId" column="user_id" /> |
||||
|
<result property="roleId" column="role_id" /> |
||||
|
<result property="creator" column="creator" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="updator" column="updator" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectQuestionFreVo"> |
||||
|
select guid, user_id, role_id, creator, create_time, updator, update_time from question_fre |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectQuestionFreList" parameterType="QuestionFre" resultMap="QuestionFreResult"> |
||||
|
<include refid="selectQuestionFreVo"/> |
||||
|
<where> |
||||
|
<if test="userId != null and userId != ''"> and user_id = #{userId}</if> |
||||
|
<if test="roleId != null and roleId != ''"> and role_id = #{roleId}</if> |
||||
|
<if test="creator != null and creator != ''"> and creator = #{creator}</if> |
||||
|
<if test="updator != null and updator != ''"> and updator = #{updator}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectQuestionFreById" parameterType="String" resultMap="QuestionFreResult"> |
||||
|
<include refid="selectQuestionFreVo"/> |
||||
|
where guid = #{guid} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertQuestionFre" parameterType="QuestionFre"> |
||||
|
insert into question_fre |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null and guid != ''">guid,</if> |
||||
|
<if test="userId != null and userId != ''">user_id,</if> |
||||
|
<if test="roleId != null and roleId != ''">role_id,</if> |
||||
|
<if test="creator != null and creator != ''">creator,</if> |
||||
|
<if test="createTime != null ">create_time,</if> |
||||
|
<if test="updator != null and updator != ''">updator,</if> |
||||
|
<if test="updateTime != null ">update_time,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="guid != null and guid != ''">#{guid},</if> |
||||
|
<if test="userId != null and userId != ''">#{userId},</if> |
||||
|
<if test="roleId != null and roleId != ''">#{roleId},</if> |
||||
|
<if test="creator != null and creator != ''">#{creator},</if> |
||||
|
<if test="createTime != null ">#{createTime},</if> |
||||
|
<if test="updator != null and updator != ''">#{updator},</if> |
||||
|
<if test="updateTime != null ">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateQuestionFre" parameterType="QuestionFre"> |
||||
|
update question_fre |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="userId != null and userId != ''">user_id = #{userId},</if> |
||||
|
<if test="roleId != null and roleId != ''">role_id = #{roleId},</if> |
||||
|
<if test="creator != null and creator != ''">creator = #{creator},</if> |
||||
|
<if test="createTime != null ">create_time = #{createTime},</if> |
||||
|
<if test="updator != null and updator != ''">updator = #{updator},</if> |
||||
|
<if test="updateTime != null ">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where guid = #{guid} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteQuestionFreById" parameterType="String"> |
||||
|
delete from question_fre where guid = #{guid} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteQuestionFreByIds" parameterType="String"> |
||||
|
delete from question_fre where guid in |
||||
|
<foreach item="guid" collection="array" open="(" separator="," close=")"> |
||||
|
#{guid} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue