13 changed files with 1053 additions and 123 deletions
@ -0,0 +1,46 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('新增场景题目')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-question-add"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">题目名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="name" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">角色:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="roleId" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">状态:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="status"> |
||||
|
<option value="0">有效</option> |
||||
|
<option value="1">无效</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script type="text/javascript"> |
||||
|
var prefix = ctx + "project/question" |
||||
|
$("#form-question-add").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/add", $('#form-question-add').serialize()); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,38 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('场景题目绑定')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-question-detail" th:object="${sceneQuestion}"> |
||||
|
<h2 th:value="*{name}"></h2> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="name" class="form-control" type="text" placeholder="A:..."> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="groupId" class="form-control" type="text" placeholder="B:..."> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="roleId" class="form-control" type="text" placeholder="C:..."> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="roleId" class="form-control" type="text" placeholder="D:..."> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,44 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('场景题目详情')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-question-detail" th:object="${sceneQuestion}"> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">题目名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="name" th:field="*{name}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">角色:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="roleId" th:field="*{roleId}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">状态:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="status"> |
||||
|
<option value="0">有效</option> |
||||
|
<option value="1">无效</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">创建人:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="creator" th:field="*{creator}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script type="text/javascript"> |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,53 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" > |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('修改场景题目')" /> |
||||
|
</head> |
||||
|
<body class="white-bg"> |
||||
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-question-edit" th:object="${sceneQuestion}"> |
||||
|
<input name="id" th:field="*{id}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">题目名称:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="name" th:field="*{name}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">角色:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="roleId" th:field="*{roleId}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">状态:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<select name="status"> |
||||
|
<option value="0">有效</option> |
||||
|
<option value="1">无效</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-3 control-label">创建人:</label> |
||||
|
<div class="col-sm-8"> |
||||
|
<input name="creator" th:field="*{creator}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<script type="text/javascript"> |
||||
|
var prefix = ctx + "project/question"; |
||||
|
$("#form-question-edit").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
$.operate.save(prefix + "/edit", $('#form-question-edit').serialize()); |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,115 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> |
||||
|
<head> |
||||
|
<th:block th:include="include :: header('场景题目列表')"/> |
||||
|
</head> |
||||
|
<body class="gray-bg"> |
||||
|
<div class="container-div"> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 search-collapse"> |
||||
|
<form id="formId"> |
||||
|
<div class="select-list"> |
||||
|
<ul> |
||||
|
<li> |
||||
|
<p>题目名称:</p> |
||||
|
<input type="text" name="name"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<p>创建时间:</p> |
||||
|
<input type="text" class="time-input" id="createTime" placeholder="年-月-日" |
||||
|
name="createTime" style="width: 200px;"/> |
||||
|
</li> |
||||
|
<li> |
||||
|
<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.search()"><i |
||||
|
class="fa fa-search"></i> 搜索</a> |
||||
|
<a class="btn btn-reset btn-rounded btn-sm" onclick="$.form.reset()"><i |
||||
|
class="fa fa-refresh"></i> 重置</a> |
||||
|
</li> |
||||
|
</ul> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
|
||||
|
<div class="btn-group-sm" id="toolbar" role="group"> |
||||
|
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:question:add"> |
||||
|
<i class="fa fa-plus"></i> 新增题目 |
||||
|
</a> |
||||
|
</div> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer"/> |
||||
|
<script th:inline="javascript"> |
||||
|
var editFlag = [[${@permission.hasPermi('project:question:edit')}]]; |
||||
|
var removeFlag = [[${@permission.hasPermi('project:question:remove')}]]; |
||||
|
var detailFlag = [[${@permission.hasPermi('project:question:detail')}]]; |
||||
|
var bindFlag = [[${@permission.hasPermi('project:question:bind')}]]; |
||||
|
var prefix = ctx + "project/question"; |
||||
|
|
||||
|
$(function () { |
||||
|
var options = { |
||||
|
url: prefix + "/list", |
||||
|
createUrl: prefix + "/add", |
||||
|
updateUrl: prefix + "/edit/{id}", |
||||
|
removeUrl: prefix + "/remove", |
||||
|
exportUrl: prefix + "/export", |
||||
|
detailUrl: prefix + "/detail/{id}", |
||||
|
modalName: "场景题目", |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
field: 'id', |
||||
|
title: '题目序号' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'name', |
||||
|
title: '题目名称' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'roleId', |
||||
|
title: '角色' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'creator', |
||||
|
title: '创建人' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'createTime', |
||||
|
title: '创建时间' |
||||
|
}, |
||||
|
{ |
||||
|
field: 'status', |
||||
|
title: '状态', |
||||
|
formatter: function (value, index) { |
||||
|
return value === 0 ? "有效" : "无效"; |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function (value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); |
||||
|
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); |
||||
|
actions.push('<a class="btn btn-primary btn-xs ' + detailFlag + '" href="javascript:void(0)" onclick="detail(\'' + row.id + '\',800,450)"><i class="fa fa-eye"></i>查看</a> '); |
||||
|
actions.push('<a class="btn btn-danger btn-xs ' + bindFlag + '" href="javascript:void(0)" onclick="bind(\'' + row.id + '\',800,450)"><i class="fa fa-eject"></i>绑定</a>'); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
|
||||
|
function detail(id, width, height) { |
||||
|
$.modal.open("查看场景题目", ctx + "project/question/detail/" + id, width, height); |
||||
|
} |
||||
|
|
||||
|
function bind(id, width, height) { |
||||
|
$.modal.open("", ctx + "project/question/bind/" + id, width, height); |
||||
|
} |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,135 @@ |
|||||
|
package com.zdxt.knowledge.controller; |
||||
|
|
||||
|
import com.zdxt.common.ZDResponse; |
||||
|
import com.zdxt.common.controller.BaseController; |
||||
|
import com.zdxt.common.util.TableDataInfo; |
||||
|
import com.zdxt.knowledge.domain.SceneQuestion; |
||||
|
import com.zdxt.knowledge.service.ISceneQuestionService; |
||||
|
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.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 场景题目Controller |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
@Controller |
||||
|
@RequestMapping("/project/question") |
||||
|
public class SceneQuestionController extends BaseController |
||||
|
{ |
||||
|
private String prefix = "project/question"; |
||||
|
|
||||
|
@Autowired |
||||
|
private ISceneQuestionService sceneQuestionService; |
||||
|
|
||||
|
@RequiresPermissions("project:question:view") |
||||
|
@GetMapping() |
||||
|
public String question() |
||||
|
{ |
||||
|
return prefix + "/view"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询场景题目列表 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:question:list") |
||||
|
@PostMapping("/list") |
||||
|
@ResponseBody |
||||
|
public TableDataInfo list(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(sceneQuestion); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
@RequiresPermissions("project:question:detail") |
||||
|
@GetMapping("/detail/{id}") |
||||
|
public String detail(@PathVariable("id") Long id, ModelMap mmap) { |
||||
|
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); |
||||
|
mmap.put("sceneQuestion", sceneQuestion); |
||||
|
return prefix + "/detail"; |
||||
|
} |
||||
|
|
||||
|
@RequiresPermissions("project:question:bind") |
||||
|
@GetMapping("/bind/{id}") |
||||
|
public String bind(@PathVariable("id") Long id, ModelMap mmap) { |
||||
|
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); |
||||
|
mmap.put("sceneQuestion", sceneQuestion); |
||||
|
return prefix + "/bind"; |
||||
|
} |
||||
|
|
||||
|
// /**
|
||||
|
// * 导出场景题目列表
|
||||
|
// */
|
||||
|
// @RequiresPermissions("project:question:export")
|
||||
|
// @PostMapping("/export")
|
||||
|
// @ResponseBody
|
||||
|
// public AjaxResult export(SceneQuestion sceneQuestion)
|
||||
|
// {
|
||||
|
// List<SceneQuestion> list = sceneQuestionService.selectSceneQuestionList(sceneQuestion);
|
||||
|
// ExcelUtil<SceneQuestion> util = new ExcelUtil<SceneQuestion>(SceneQuestion.class);
|
||||
|
// return util.exportExcel(list, "question");
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* 新增场景题目 |
||||
|
*/ |
||||
|
@GetMapping("/add") |
||||
|
public String add() |
||||
|
{ |
||||
|
return prefix + "/add"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增保存场景题目 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:question:add") |
||||
|
@PostMapping("/add") |
||||
|
@ResponseBody |
||||
|
public ZDResponse addSave(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
return sceneQuestionService.insertSceneQuestion(sceneQuestion) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("新增失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改场景题目 |
||||
|
*/ |
||||
|
@GetMapping("/edit/{id}") |
||||
|
public String edit(@PathVariable("id") Long id, ModelMap mmap) |
||||
|
{ |
||||
|
SceneQuestion sceneQuestion = sceneQuestionService.selectSceneQuestionById(id); |
||||
|
mmap.put("sceneQuestion", sceneQuestion); |
||||
|
return prefix + "/edit"; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改保存场景题目 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:question:edit") |
||||
|
@PostMapping("/edit") |
||||
|
@ResponseBody |
||||
|
public ZDResponse editSave(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
return sceneQuestionService.updateSceneQuestion(sceneQuestion) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("修改失败"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除场景题目 |
||||
|
*/ |
||||
|
@RequiresPermissions("project:question:remove") |
||||
|
@PostMapping( "/remove") |
||||
|
@ResponseBody |
||||
|
public ZDResponse remove(String ids) |
||||
|
{ |
||||
|
return sceneQuestionService.deleteSceneQuestionByIds(ids) > 0 |
||||
|
? ZDResponse.success() : ZDResponse.error("删除失败"); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,146 @@ |
|||||
|
package com.zdxt.knowledge.domain; |
||||
|
|
||||
|
import com.zdxt.common.annotation.Excel; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.Date; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 场景题目对象 scene_question |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
public class SceneQuestion implements Serializable |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 题目名称 */ |
||||
|
@Excel(name = "题目名称") |
||||
|
private String name; |
||||
|
|
||||
|
/** 分组 */ |
||||
|
@Excel(name = "场景id") |
||||
|
private String parentId; |
||||
|
|
||||
|
/** 角色 */ |
||||
|
@Excel(name = "角色") |
||||
|
private String roleId; |
||||
|
|
||||
|
/** 状态0有效1无效 */ |
||||
|
@Excel(name = "状态0有效1无效") |
||||
|
private Integer status; |
||||
|
|
||||
|
/** 创建人 */ |
||||
|
@Excel(name = "创建人") |
||||
|
private String creator; |
||||
|
|
||||
|
/** 创建时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date createTime; |
||||
|
|
||||
|
/** 更新时间 */ |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private Date updateTime; |
||||
|
|
||||
|
/** 请求参数 */ |
||||
|
private Map<String, Object> params; |
||||
|
|
||||
|
public void setId(Long id) |
||||
|
{ |
||||
|
this.id = id; |
||||
|
} |
||||
|
|
||||
|
public Long getId() |
||||
|
{ |
||||
|
return id; |
||||
|
} |
||||
|
public void setName(String name) |
||||
|
{ |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getName() |
||||
|
{ |
||||
|
return name; |
||||
|
} |
||||
|
public void setRoleId(String roleId) |
||||
|
{ |
||||
|
this.roleId = roleId; |
||||
|
} |
||||
|
|
||||
|
public String getRoleId() |
||||
|
{ |
||||
|
return roleId; |
||||
|
} |
||||
|
public void setStatus(Integer status) |
||||
|
{ |
||||
|
this.status = status; |
||||
|
} |
||||
|
|
||||
|
public Integer getStatus() |
||||
|
{ |
||||
|
return status; |
||||
|
} |
||||
|
public void setCreator(String creator) |
||||
|
{ |
||||
|
this.creator = creator; |
||||
|
} |
||||
|
|
||||
|
public String getCreator() |
||||
|
{ |
||||
|
return creator; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String toString() { |
||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
||||
|
.append("id", getId()) |
||||
|
.append("name", getName()) |
||||
|
.append("roleId", getRoleId()) |
||||
|
.append("status", getStatus()) |
||||
|
.append("creator", getCreator()) |
||||
|
.append("createTime", getCreateTime()) |
||||
|
.append("updateTime", getUpdateTime()) |
||||
|
.toString(); |
||||
|
} |
||||
|
|
||||
|
public String getParentId() { |
||||
|
return parentId; |
||||
|
} |
||||
|
|
||||
|
public void setParentId(String parentId) { |
||||
|
this.parentId = parentId; |
||||
|
} |
||||
|
|
||||
|
public Date getCreateTime() { |
||||
|
return createTime; |
||||
|
} |
||||
|
|
||||
|
public void setCreateTime(Date createTime) { |
||||
|
this.createTime = createTime; |
||||
|
} |
||||
|
|
||||
|
public Date getUpdateTime() { |
||||
|
return updateTime; |
||||
|
} |
||||
|
|
||||
|
public void setUpdateTime(Date updateTime) { |
||||
|
this.updateTime = updateTime; |
||||
|
} |
||||
|
|
||||
|
public Map<String, Object> getParams() { |
||||
|
return params; |
||||
|
} |
||||
|
|
||||
|
public void setParams(Map<String, Object> params) { |
||||
|
this.params = params; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.mapper; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.SceneQuestion; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 场景题目Mapper接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
public interface SceneQuestionMapper |
||||
|
{ |
||||
|
/** |
||||
|
* 查询场景题目 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 场景题目 |
||||
|
*/ |
||||
|
public SceneQuestion selectSceneQuestionById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询场景题目列表 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 场景题目集合 |
||||
|
*/ |
||||
|
public List<SceneQuestion> selectSceneQuestionList(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 新增场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSceneQuestion(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 修改场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSceneQuestion(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 删除场景题目 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneQuestionById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除场景题目 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneQuestionByIds(String[] ids); |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
package com.zdxt.knowledge.service; |
||||
|
|
||||
|
import com.zdxt.knowledge.domain.SceneQuestion; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 场景题目Service接口 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
public interface ISceneQuestionService |
||||
|
{ |
||||
|
/** |
||||
|
* 查询场景题目 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 场景题目 |
||||
|
*/ |
||||
|
public SceneQuestion selectSceneQuestionById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询场景题目列表 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 场景题目集合 |
||||
|
*/ |
||||
|
public List<SceneQuestion> selectSceneQuestionList(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 新增场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertSceneQuestion(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 修改场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateSceneQuestion(SceneQuestion sceneQuestion); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除场景题目 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneQuestionByIds(String ids); |
||||
|
|
||||
|
/** |
||||
|
* 删除场景题目信息 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteSceneQuestionById(Long id); |
||||
|
} |
||||
@ -0,0 +1,98 @@ |
|||||
|
package com.zdxt.knowledge.service.impl; |
||||
|
|
||||
|
import com.zdxt.common.util.Convert; |
||||
|
import com.zdxt.common.util.DateUtils; |
||||
|
import com.zdxt.knowledge.domain.SceneQuestion; |
||||
|
import com.zdxt.knowledge.mapper.SceneQuestionMapper; |
||||
|
import com.zdxt.knowledge.service.ISceneQuestionService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 场景题目Service业务层处理 |
||||
|
* |
||||
|
* @author ruoyi |
||||
|
* @date 2023-12-26 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class SceneQuestionServiceImpl implements ISceneQuestionService |
||||
|
{ |
||||
|
@Autowired |
||||
|
private SceneQuestionMapper sceneQuestionMapper; |
||||
|
|
||||
|
/** |
||||
|
* 查询场景题目 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 场景题目 |
||||
|
*/ |
||||
|
@Override |
||||
|
public SceneQuestion selectSceneQuestionById(Long id) |
||||
|
{ |
||||
|
return sceneQuestionMapper.selectSceneQuestionById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询场景题目列表 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 场景题目 |
||||
|
*/ |
||||
|
@Override |
||||
|
public List<SceneQuestion> selectSceneQuestionList(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
return sceneQuestionMapper.selectSceneQuestionList(sceneQuestion); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int insertSceneQuestion(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
sceneQuestion.setCreateTime(DateUtils.getNowDate()); |
||||
|
return sceneQuestionMapper.insertSceneQuestion(sceneQuestion); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改场景题目 |
||||
|
* |
||||
|
* @param sceneQuestion 场景题目 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int updateSceneQuestion(SceneQuestion sceneQuestion) |
||||
|
{ |
||||
|
sceneQuestion.setUpdateTime(DateUtils.getNowDate()); |
||||
|
return sceneQuestionMapper.updateSceneQuestion(sceneQuestion); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除场景题目对象 |
||||
|
* |
||||
|
* @param ids 需要删除的数据ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSceneQuestionByIds(String ids) |
||||
|
{ |
||||
|
return sceneQuestionMapper.deleteSceneQuestionByIds(Convert.toStrArray(ids)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除场景题目信息 |
||||
|
* |
||||
|
* @param id 场景题目ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Override |
||||
|
public int deleteSceneQuestionById(Long id) |
||||
|
{ |
||||
|
return sceneQuestionMapper.deleteSceneQuestionById(id); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,87 @@ |
|||||
|
<?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.SceneQuestionMapper"> |
||||
|
|
||||
|
<resultMap type="com.zdxt.knowledge.domain.SceneQuestion" id="SceneQuestionResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="name" column="name" /> |
||||
|
<result property="parentId" column="parent_id" /> |
||||
|
<result property="roleId" column="role_id" /> |
||||
|
<result property="status" column="status" /> |
||||
|
<result property="creator" column="creator" /> |
||||
|
<result property="createTime" column="create_time" /> |
||||
|
<result property="updateTime" column="update_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectSceneQuestionVo"> |
||||
|
select id, name, parent_id, role_id, status, creator, create_time, update_time from scene_question |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectSceneQuestionList" parameterType="SceneQuestion" resultMap="SceneQuestionResult"> |
||||
|
<include refid="selectSceneQuestionVo"/> |
||||
|
<where> |
||||
|
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> |
||||
|
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if> |
||||
|
<if test="roleId != null and roleId != ''"> and role_id = #{roleId}</if> |
||||
|
<if test="status != null "> and status = #{status}</if> |
||||
|
<if test="creator != null and creator != ''"> and creator = #{creator}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectSceneQuestionById" parameterType="Long" resultMap="SceneQuestionResult"> |
||||
|
<include refid="selectSceneQuestionVo"/> |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertSceneQuestion" parameterType="SceneQuestion"> |
||||
|
insert into scene_question |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null ">id,</if> |
||||
|
<if test="name != null and name != ''">name,</if> |
||||
|
<if test="parentId != null and parentId != ''">parent_id,</if> |
||||
|
<if test="roleId != null and roleId != ''">role_id,</if> |
||||
|
<if test="status != null ">status,</if> |
||||
|
<if test="creator != null and creator != ''">creator,</if> |
||||
|
<if test="createTime != null ">create_time,</if> |
||||
|
<if test="updateTime != null ">update_time,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="id != null ">#{id},</if> |
||||
|
<if test="name != null and name != ''">#{name},</if> |
||||
|
<if test="parentId != null and parentId != ''">#{parentId},</if> |
||||
|
<if test="roleId != null and roleId != ''">#{roleId},</if> |
||||
|
<if test="status != null ">#{status},</if> |
||||
|
<if test="creator != null and creator != ''">#{creator},</if> |
||||
|
<if test="createTime != null ">#{createTime},</if> |
||||
|
<if test="updateTime != null ">#{updateTime},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateSceneQuestion" parameterType="SceneQuestion"> |
||||
|
update scene_question |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="name != null and name != ''">name = #{name},</if> |
||||
|
<if test="parentId != null and parentId != ''">parent_id = #{parentId},</if> |
||||
|
<if test="roleId != null and roleId != ''">role_id = #{roleId},</if> |
||||
|
<if test="status != null ">status = #{status},</if> |
||||
|
<if test="creator != null and creator != ''">creator = #{creator},</if> |
||||
|
<if test="createTime != null ">create_time = #{createTime},</if> |
||||
|
<if test="updateTime != null ">update_time = #{updateTime},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteSceneQuestionById" parameterType="Long"> |
||||
|
delete from scene_question where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteSceneQuestionByIds" parameterType="String"> |
||||
|
delete from scene_question where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue