新增加题目快照
parent
32da505cd1
commit
9d58da3c81
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,25 @@
|
|||||||
|
package com.ibeetl.jlw.dao;
|
||||||
|
|
||||||
|
import com.ibeetl.jlw.entity.ResourcesQuestionSnapshot;
|
||||||
|
import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery;
|
||||||
|
import org.beetl.sql.core.engine.PageQuery;
|
||||||
|
import org.beetl.sql.mapper.BaseMapper;
|
||||||
|
import org.beetl.sql.mapper.annotation.SqlResource;
|
||||||
|
import org.beetl.sql.mapper.annotation.Update;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目快照 Dao
|
||||||
|
*/
|
||||||
|
@SqlResource("jlw.resourcesQuestionSnapshot")
|
||||||
|
public interface ResourcesQuestionSnapshotDao extends BaseMapper<ResourcesQuestionSnapshot>{
|
||||||
|
PageQuery<ResourcesQuestionSnapshot> queryByCondition(PageQuery query);
|
||||||
|
PageQuery<ResourcesQuestionSnapshot> queryByConditionQuery(PageQuery query);
|
||||||
|
@Update
|
||||||
|
void deleteResourcesQuestionSnapshotByIds(String ids);
|
||||||
|
@Update
|
||||||
|
int updateGivenByIds(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery);
|
||||||
|
List<ResourcesQuestionSnapshot> getByIds(String ids);
|
||||||
|
List<ResourcesQuestionSnapshot> getValuesByQuery(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery);
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
package com.ibeetl.jlw.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author mlx
|
||||||
|
* @date 2022/9/23
|
||||||
|
* @modified
|
||||||
|
*/
|
||||||
|
public enum FromTypeEnum {
|
||||||
|
|
||||||
|
HOMEWORK("家庭作业");
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
private String text;
|
||||||
|
FromTypeEnum(String text) {
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,147 @@
|
|||||||
|
package com.ibeetl.jlw.service;
|
||||||
|
|
||||||
|
import cn.jlw.util.ToolUtils;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
||||||
|
import com.ibeetl.admin.core.util.PlatformException;
|
||||||
|
import com.ibeetl.admin.core.web.JsonResult;
|
||||||
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
||||||
|
import com.ibeetl.jlw.dao.ResourcesQuestionSnapshotDao;
|
||||||
|
import com.ibeetl.jlw.entity.ResourcesQuestionSnapshot;
|
||||||
|
import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.beetl.sql.core.SqlId;
|
||||||
|
import org.beetl.sql.core.engine.PageQuery;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目快照 Service
|
||||||
|
* 当分布式ID开启后请勿使用insert(*,true)
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Transactional
|
||||||
|
public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQuestionSnapshot>{
|
||||||
|
|
||||||
|
@Resource private ResourcesQuestionSnapshotDao resourcesQuestionSnapshotDao;
|
||||||
|
|
||||||
|
public PageQuery<ResourcesQuestionSnapshot>queryByCondition(PageQuery query){
|
||||||
|
PageQuery ret = resourcesQuestionSnapshotDao.queryByCondition(query);
|
||||||
|
queryListAfter(ret.getList());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PageQuery<ResourcesQuestionSnapshot>queryByConditionQuery(PageQuery query){
|
||||||
|
PageQuery ret = resourcesQuestionSnapshotDao.queryByConditionQuery(query);
|
||||||
|
queryListAfter(ret.getList());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteByList(List list){
|
||||||
|
String ids = "";
|
||||||
|
ToolUtils.deleteNullList(list);
|
||||||
|
for(int i=0;null != list && i<list.size();i++){
|
||||||
|
ids += list.get(i).toString()+(i==list.size()-1?"":",");
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(ids)){
|
||||||
|
resourcesQuestionSnapshotDao.deleteResourcesQuestionSnapshotByIds(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteResourcesQuestionSnapshot(String ids){
|
||||||
|
try {
|
||||||
|
resourcesQuestionSnapshotDao.deleteResourcesQuestionSnapshotByIds(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new PlatformException("批量删除题目快照失败", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String addAll(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
String msg = "";
|
||||||
|
List<ResourcesQuestionSnapshot> resourcesQuestionSnapshotList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
resourcesQuestionSnapshotList = JSON.parseArray(resourcesQuestionSnapshotQuery.getResourcesQuestionSnapshotJsonStr(), ResourcesQuestionSnapshot.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
try {
|
||||||
|
resourcesQuestionSnapshotList.add(JSONObject.parseObject(resourcesQuestionSnapshotQuery.getResourcesQuestionSnapshotJsonStr(), ResourcesQuestionSnapshot.class));
|
||||||
|
} catch (Exception e1) {}
|
||||||
|
}
|
||||||
|
ToolUtils.deleteNullList(resourcesQuestionSnapshotList);
|
||||||
|
if(null != resourcesQuestionSnapshotList && resourcesQuestionSnapshotList.size()>0){
|
||||||
|
for(int i=0;i<resourcesQuestionSnapshotList.size();i++){
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotList.get(i);
|
||||||
|
resourcesQuestionSnapshot.setUserId(resourcesQuestionSnapshotQuery.getUserId());
|
||||||
|
resourcesQuestionSnapshot.setOrgId(resourcesQuestionSnapshotQuery.getOrgId());
|
||||||
|
}
|
||||||
|
insertBatch(resourcesQuestionSnapshotList);
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public JsonResult add(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
String msg = "";
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotQuery.pojo();
|
||||||
|
resourcesQuestionSnapshotDao.insert(resourcesQuestionSnapshot);
|
||||||
|
resourcesQuestionSnapshotQuery.setFromId(resourcesQuestionSnapshot.getFromId());
|
||||||
|
JsonResult jsonResult = new JsonResult();
|
||||||
|
jsonResult.setData(resourcesQuestionSnapshot.getFromId());//自增的ID丢进去
|
||||||
|
jsonResult.setCode(JsonReturnCode.SUCCESS.getCode());
|
||||||
|
jsonResult.setMsg(msg);
|
||||||
|
return jsonResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String edit(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
String msg = "";
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotQuery.pojo();
|
||||||
|
resourcesQuestionSnapshotDao.updateTemplateById(resourcesQuestionSnapshot);
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String updateGivenByIds(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
String msg = "";
|
||||||
|
if(StringUtils.isNotBlank(resourcesQuestionSnapshotQuery.get_given())){
|
||||||
|
boolean flag = resourcesQuestionSnapshotDao.updateGivenByIds(resourcesQuestionSnapshotQuery) > 0;
|
||||||
|
if(!flag){
|
||||||
|
msg = "更新指定参数失败";
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
msg = "指定参数为空";
|
||||||
|
}
|
||||||
|
return msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ResourcesQuestionSnapshot> getValues (Object paras){
|
||||||
|
return sqlManager.select(SqlId.of("jlw.resourcesQuestionSnapshot.getResourcesQuestionSnapshotValues"), ResourcesQuestionSnapshot.class, paras);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ResourcesQuestionSnapshot> getValuesByQuery (ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
return resourcesQuestionSnapshotDao.getValuesByQuery(resourcesQuestionSnapshotQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourcesQuestionSnapshot getInfo (Long fromId){
|
||||||
|
ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery = new ResourcesQuestionSnapshotQuery();
|
||||||
|
resourcesQuestionSnapshotQuery.setFromId(fromId);
|
||||||
|
List<ResourcesQuestionSnapshot> list = resourcesQuestionSnapshotDao.getValuesByQuery(resourcesQuestionSnapshotQuery);
|
||||||
|
if(null != list && list.size()>0){
|
||||||
|
return list.get(0);
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResourcesQuestionSnapshot getInfo (ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery){
|
||||||
|
List<ResourcesQuestionSnapshot> list = resourcesQuestionSnapshotDao.getValuesByQuery(resourcesQuestionSnapshotQuery);
|
||||||
|
if(null != list && list.size()>0){
|
||||||
|
return list.get(0);
|
||||||
|
}else{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,193 @@
|
|||||||
|
package com.ibeetl.jlw.web;
|
||||||
|
|
||||||
|
import cn.jlw.Interceptor.SCoreUser;
|
||||||
|
import cn.jlw.validate.ValidateConfig;
|
||||||
|
import com.ibeetl.admin.core.annotation.Function;
|
||||||
|
import com.ibeetl.admin.core.entity.CoreUser;
|
||||||
|
import com.ibeetl.admin.core.file.FileService;
|
||||||
|
import com.ibeetl.admin.core.web.JsonResult;
|
||||||
|
import com.ibeetl.jlw.entity.ResourcesQuestionSnapshot;
|
||||||
|
import com.ibeetl.jlw.service.ResourcesQuestionSnapshotService;
|
||||||
|
import com.ibeetl.jlw.web.query.ResourcesQuestionSnapshotQuery;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.beetl.sql.core.engine.PageQuery;
|
||||||
|
import org.springframework.validation.BindingResult;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 题目快照 资源管理 - 题库管理-快照-关联来源 接口
|
||||||
|
* 切记不要对非线程安全的静态变量进行写操作
|
||||||
|
*/
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class ResourcesQuestionSnapshotController{
|
||||||
|
|
||||||
|
private final Log log = LogFactory.getLog(this.getClass());
|
||||||
|
private static final String MODEL = "/jlw/resourcesQuestionSnapshot";
|
||||||
|
private static final String API = "/api/resourcesQuestionSnapshot";
|
||||||
|
|
||||||
|
|
||||||
|
@Resource private ResourcesQuestionSnapshotService resourcesQuestionSnapshotService;
|
||||||
|
|
||||||
|
@Resource FileService fileService;
|
||||||
|
|
||||||
|
/* 前端接口 */
|
||||||
|
|
||||||
|
@PostMapping(API + "/getPageList.do")
|
||||||
|
public JsonResult<PageQuery> getPageList(ResourcesQuestionSnapshotQuery condition,@SCoreUser CoreUser coreUser){
|
||||||
|
if(null == coreUser){
|
||||||
|
return JsonResult.failMessage("请登录后再操作");
|
||||||
|
}else{
|
||||||
|
PageQuery page = condition.getPageQuery();
|
||||||
|
resourcesQuestionSnapshotService.queryByConditionQuery(page);
|
||||||
|
return JsonResult.success(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(API + "/getInfo.do")
|
||||||
|
public JsonResult<ResourcesQuestionSnapshot>getInfo(ResourcesQuestionSnapshotQuery param,@SCoreUser CoreUser coreUser) {
|
||||||
|
if(null == coreUser){
|
||||||
|
return JsonResult.failMessage("请登录后再操作");
|
||||||
|
}else{
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotService.getInfo(param);
|
||||||
|
return JsonResult.success(resourcesQuestionSnapshot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(API + "/getList.do")
|
||||||
|
public JsonResult<List<ResourcesQuestionSnapshot>>getList(ResourcesQuestionSnapshotQuery param,@SCoreUser CoreUser coreUser) {
|
||||||
|
if(null == coreUser){
|
||||||
|
return JsonResult.failMessage("请登录后再操作");
|
||||||
|
}else{
|
||||||
|
List<ResourcesQuestionSnapshot>list = resourcesQuestionSnapshotService.getValuesByQuery(param);
|
||||||
|
return JsonResult.success(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* 后台页面 */
|
||||||
|
|
||||||
|
@GetMapping(MODEL + "/index.do")
|
||||||
|
@Function("resourcesQuestionSnapshot.query")
|
||||||
|
public ModelAndView index() {
|
||||||
|
ModelAndView view = new ModelAndView("/jlw/resourcesQuestionSnapshot/index.html") ;
|
||||||
|
view.addObject("search", ResourcesQuestionSnapshotQuery.class.getName());
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(MODEL + "/edit.do")
|
||||||
|
@Function("resourcesQuestionSnapshot.edit")
|
||||||
|
public ModelAndView edit(Long fromId) {
|
||||||
|
ModelAndView view = new ModelAndView("/jlw/resourcesQuestionSnapshot/edit.html");
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotService.queryById(fromId);
|
||||||
|
view.addObject("resourcesQuestionSnapshot", resourcesQuestionSnapshot);
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(MODEL + "/add.do")
|
||||||
|
@Function("resourcesQuestionSnapshot.add")
|
||||||
|
public ModelAndView add(Long fromId) {
|
||||||
|
ModelAndView view = new ModelAndView("/jlw/resourcesQuestionSnapshot/add.html");
|
||||||
|
if(null != fromId){
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotService.queryById(fromId);
|
||||||
|
view.addObject("resourcesQuestionSnapshot", resourcesQuestionSnapshot);
|
||||||
|
}else {
|
||||||
|
view.addObject("resourcesQuestionSnapshot", new ResourcesQuestionSnapshot());
|
||||||
|
}
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 后台接口 */
|
||||||
|
|
||||||
|
@PostMapping(MODEL + "/list.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.query")
|
||||||
|
public JsonResult<PageQuery> list(ResourcesQuestionSnapshotQuery condition){
|
||||||
|
PageQuery page = condition.getPageQuery();
|
||||||
|
resourcesQuestionSnapshotService.queryByCondition(page);
|
||||||
|
return JsonResult.success(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(MODEL + "/addAll.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.add")
|
||||||
|
public JsonResult addAll(ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery,@SCoreUser CoreUser coreUser){
|
||||||
|
if(null == coreUser){
|
||||||
|
return JsonResult.failMessage("请登录后再操作");
|
||||||
|
}else{
|
||||||
|
resourcesQuestionSnapshotQuery.setUserId(coreUser.getId());
|
||||||
|
resourcesQuestionSnapshotQuery.setOrgId(coreUser.getOrgId());
|
||||||
|
String msg = resourcesQuestionSnapshotService.addAll(resourcesQuestionSnapshotQuery);
|
||||||
|
if (StringUtils.isBlank(msg)) {
|
||||||
|
return JsonResult.success();
|
||||||
|
} else {
|
||||||
|
return JsonResult.failMessage("新增失败,"+msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(MODEL + "/add.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.add")
|
||||||
|
public JsonResult add(@Validated(ValidateConfig.ADD.class) ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery, BindingResult result,@SCoreUser CoreUser coreUser){
|
||||||
|
if(result.hasErrors()){
|
||||||
|
return JsonResult.failMessage(result);
|
||||||
|
}else{
|
||||||
|
resourcesQuestionSnapshotQuery.setUserId(coreUser.getId());
|
||||||
|
resourcesQuestionSnapshotQuery.setOrgId(coreUser.getOrgId());
|
||||||
|
return resourcesQuestionSnapshotService.add(resourcesQuestionSnapshotQuery);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(MODEL + "/edit.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.edit")
|
||||||
|
public JsonResult<String> update(@Validated(ValidateConfig.UPDATE.class) ResourcesQuestionSnapshotQuery resourcesQuestionSnapshotQuery, BindingResult result) {
|
||||||
|
if(result.hasErrors()){
|
||||||
|
return JsonResult.failMessage(result);
|
||||||
|
}else {
|
||||||
|
resourcesQuestionSnapshotQuery.setUserId(null);
|
||||||
|
resourcesQuestionSnapshotQuery.setOrgId(null);
|
||||||
|
String msg = resourcesQuestionSnapshotService.edit(resourcesQuestionSnapshotQuery);
|
||||||
|
if (StringUtils.isBlank(msg)) {
|
||||||
|
return JsonResult.success();
|
||||||
|
} else {
|
||||||
|
return JsonResult.failMessage("更新失败,"+msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping(MODEL + "/view.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.query")
|
||||||
|
public JsonResult<ResourcesQuestionSnapshot>queryInfo(Long fromId) {
|
||||||
|
ResourcesQuestionSnapshot resourcesQuestionSnapshot = resourcesQuestionSnapshotService.queryById( fromId);
|
||||||
|
return JsonResult.success(resourcesQuestionSnapshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping(MODEL + "/getValues.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.query")
|
||||||
|
public JsonResult<List<ResourcesQuestionSnapshot>>getValues(ResourcesQuestionSnapshotQuery param) {
|
||||||
|
List<ResourcesQuestionSnapshot>list = resourcesQuestionSnapshotService.getValuesByQuery(param);
|
||||||
|
return JsonResult.success(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping(MODEL + "/delete.json")
|
||||||
|
@Function("resourcesQuestionSnapshot.delete")
|
||||||
|
@ResponseBody
|
||||||
|
public JsonResult delete(String ids) {
|
||||||
|
resourcesQuestionSnapshotService.deleteResourcesQuestionSnapshot(ids);
|
||||||
|
return JsonResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
layui.define([ 'form', 'laydate', 'table','resourcesQuestionSnapshotApi'], function(exports) {
|
||||||
|
var form = layui.form;
|
||||||
|
var resourcesQuestionSnapshotApi = layui.resourcesQuestionSnapshotApi;
|
||||||
|
var index = layui.index;
|
||||||
|
var view = {
|
||||||
|
init:function(){
|
||||||
|
Lib.initGenrealForm($("#addForm"),form);
|
||||||
|
this.initSubmit();
|
||||||
|
},
|
||||||
|
initSubmit:function(){
|
||||||
|
$("#addButton").click(function(){
|
||||||
|
form.on('submit(form)', function(){
|
||||||
|
var fromId = $("#addForm input[name='fromId']").val();
|
||||||
|
if(!$.isEmpty(fromId)){
|
||||||
|
resourcesQuestionSnapshotApi.updateResourcesQuestionSnapshot($('#addForm'),function(){
|
||||||
|
parent.window.dataReload();
|
||||||
|
Common.info("更新成功");
|
||||||
|
Lib.closeFrame();
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
resourcesQuestionSnapshotApi.addResourcesQuestionSnapshot($('#addForm'),function(){
|
||||||
|
parent.window.dataReload();
|
||||||
|
Common.info("添加成功");
|
||||||
|
Lib.closeFrame();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#addButton-cancel").click(function(){
|
||||||
|
Lib.closeFrame();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
exports('add',view);
|
||||||
|
});
|
@ -0,0 +1,23 @@
|
|||||||
|
layui.define(['table', 'resourcesQuestionSnapshotApi'], function(exports) {
|
||||||
|
var resourcesQuestionSnapshotApi = layui.resourcesQuestionSnapshotApi;
|
||||||
|
var table=layui.table;
|
||||||
|
var view = {
|
||||||
|
init:function(){
|
||||||
|
},
|
||||||
|
delBatch:function(){
|
||||||
|
var data = Common.getMoreDataFromTable(table,"resourcesQuestionSnapshotTable");
|
||||||
|
if(data==null){
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
Common.openConfirm("确认要删除这些题目快照?",function(){
|
||||||
|
var ids =Common.concatBatchId(data,"fromId");
|
||||||
|
resourcesQuestionSnapshotApi.del(ids,function(){
|
||||||
|
Common.info("删除成功");
|
||||||
|
dataReload();
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports('del',view);
|
||||||
|
|
||||||
|
});
|
@ -0,0 +1,28 @@
|
|||||||
|
layui.define([ 'form', 'laydate', 'table','resourcesQuestionSnapshotApi'], function(exports) {
|
||||||
|
var form = layui.form;
|
||||||
|
var resourcesQuestionSnapshotApi = layui.resourcesQuestionSnapshotApi;
|
||||||
|
var index = layui.index;
|
||||||
|
var view = {
|
||||||
|
init:function(){
|
||||||
|
Lib.initGenrealForm($("#updateForm"),form);
|
||||||
|
this.initSubmit();
|
||||||
|
},
|
||||||
|
initSubmit:function(){
|
||||||
|
$("#updateButton").click(function(){
|
||||||
|
form.on('submit(form)', function(){
|
||||||
|
resourcesQuestionSnapshotApi.updateResourcesQuestionSnapshot($('#updateForm'),function(){
|
||||||
|
parent.window.dataReload();
|
||||||
|
Common.info("更新成功");
|
||||||
|
Lib.closeFrame();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$("#updateButton-cancel").click(function(){
|
||||||
|
Lib.closeFrame();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
exports('edit',view);
|
||||||
|
|
||||||
|
});
|
@ -0,0 +1,18 @@
|
|||||||
|
/*访问后台的代码*/
|
||||||
|
layui.define([], function(exports) {
|
||||||
|
var api={
|
||||||
|
updateResourcesQuestionSnapshot:function(form,callback){
|
||||||
|
Lib.submitForm("/jlw/resourcesQuestionSnapshot/edit.json",form,{},callback)
|
||||||
|
},
|
||||||
|
addResourcesQuestionSnapshot:function(form,callback){
|
||||||
|
Lib.submitForm("/jlw/resourcesQuestionSnapshot/add.json",form,{},callback)
|
||||||
|
},
|
||||||
|
del:function(ids,callback){
|
||||||
|
Common.post("/jlw/resourcesQuestionSnapshot/delete.json",{"ids":ids},function(){
|
||||||
|
callback();
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
exports('resourcesQuestionSnapshotApi',api);
|
||||||
|
});
|
@ -0,0 +1,29 @@
|
|||||||
|
<!--#layout("/common/layout.html",{"jsBase":"/js/jlw/resourcesQuestionSnapshot/"}){ -->
|
||||||
|
<layui:searchForm formId="searchForm" searchList="" condition="${search}">
|
||||||
|
</layui:searchForm>
|
||||||
|
<table id="resourcesQuestionSnapshotTable" lay-filter="resourcesQuestionSnapshotTable"></table>
|
||||||
|
<!--#} -->
|
||||||
|
|
||||||
|
<script type="text/html" id="toolbar_resourcesQuestionSnapshot">
|
||||||
|
<div class="layui-btn-container">
|
||||||
|
<div class="layui-btn-group" >
|
||||||
|
<!--# if(core.searchIsShow(search)) {-->
|
||||||
|
<layui:accessButton function="resourcesQuestionSnapshot.query" id="searchFormSearch" action="search"><i class="layui-icon"></i>搜索</layui:accessButton>
|
||||||
|
<!--# }-->
|
||||||
|
<layui:accessButton function="resourcesQuestionSnapshot.add" action="add">添加</layui:accessButton>
|
||||||
|
<layui:accessButton function="resourcesQuestionSnapshot.edit" action="edit">修改</layui:accessButton>
|
||||||
|
<layui:accessButton function="resourcesQuestionSnapshot.del" action="del">删除</layui:accessButton>
|
||||||
|
<!--# if(!isEmpty(search)) {-->
|
||||||
|
<layui:accessButton function="resourcesQuestionSnapshot.query" action="refresh"><i class="layui-icon"></i>刷新</layui:accessButton>
|
||||||
|
<!--# }-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
|
||||||
|
layui.use(['index'], function(){
|
||||||
|
var index = layui.index;
|
||||||
|
index.init();
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
Loading…
Reference in New Issue