添加游戏数学学习
This commit is contained in:
		| @@ -2,52 +2,60 @@ import request from '@/utils/request' | ||||
|  | ||||
| // 查询游戏数学列表 | ||||
| export function listMath(query) { | ||||
|   return request({ | ||||
|     url: '/benyi/math/list', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math/list', | ||||
|         method: 'get', | ||||
|         params: query | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 查询游戏数学下拉树结构 | ||||
| export function treeselect() { | ||||
|     return request({ | ||||
|         url: '/benyi/math/treeselect', | ||||
|         method: 'get' | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 查询游戏数学详细 | ||||
| export function getMath(id) { | ||||
|   return request({ | ||||
|     url: '/benyi/math/' + id, | ||||
|     method: 'get' | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math/' + id, | ||||
|         method: 'get' | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 新增游戏数学 | ||||
| export function addMath(data) { | ||||
|   return request({ | ||||
|     url: '/benyi/math', | ||||
|     method: 'post', | ||||
|     data: data | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math', | ||||
|         method: 'post', | ||||
|         data: data | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 修改游戏数学 | ||||
| export function updateMath(data) { | ||||
|   return request({ | ||||
|     url: '/benyi/math', | ||||
|     method: 'put', | ||||
|     data: data | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math', | ||||
|         method: 'put', | ||||
|         data: data | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 删除游戏数学 | ||||
| export function delMath(id) { | ||||
|   return request({ | ||||
|     url: '/benyi/math/' + id, | ||||
|     method: 'delete' | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math/' + id, | ||||
|         method: 'delete' | ||||
|     }) | ||||
| } | ||||
|  | ||||
| // 导出游戏数学 | ||||
| export function exportMath(query) { | ||||
|   return request({ | ||||
|     url: '/benyi/math/export', | ||||
|     method: 'get', | ||||
|     params: query | ||||
|   }) | ||||
|     return request({ | ||||
|         url: '/benyi/math/export', | ||||
|         method: 'get', | ||||
|         params: query | ||||
|     }) | ||||
| } | ||||
| @@ -70,16 +70,13 @@ | ||||
|     <el-table v-loading="loading" :data="mathList" @selection-change="handleSelectionChange"> | ||||
|       <el-table-column type="selection" width="55" align="center" /> | ||||
|       <el-table-column label="编号" align="center" prop="id" /> | ||||
|       <el-table-column label="名称" align="center" prop="name" > | ||||
|       <el-table-column label="名称" align="center" prop="name"> | ||||
|         <template slot-scope="scope"> | ||||
|           <router-link | ||||
|             :to="'/benyi_course/math/plan/' + scope.row.id" | ||||
|             class="link-dayflow" | ||||
|           > | ||||
|           <router-link :to="'/benyi_course/math/plan/' + scope.row.id" class="link-dayflow"> | ||||
|             <span>{{ scope.row.name }}</span> | ||||
|           </router-link> | ||||
|         </template> | ||||
|       </el-table-column>   | ||||
|       </el-table-column> | ||||
|       <el-table-column | ||||
|         label="适用班级" | ||||
|         align="center" | ||||
| @@ -131,14 +128,14 @@ | ||||
|           <Editor v-model="form.suggest" placeholder="请输入教学建议" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="适用班级" prop="classtypeId"> | ||||
|             <el-select v-model="form.classtypeId" placeholder="请选择适用班级"> | ||||
|                 <el-option | ||||
|                 v-for="dict in classtypeIdOptions" | ||||
|                 :key="dict.dictValue" | ||||
|                 :label="dict.dictLabel" | ||||
|                 :value="dict.dictValue" | ||||
|                 /> | ||||
|             </el-select> | ||||
|           <el-select v-model="form.classtypeId" placeholder="请选择适用班级"> | ||||
|             <el-option | ||||
|               v-for="dict in classtypeIdOptions" | ||||
|               :key="dict.dictValue" | ||||
|               :label="dict.dictLabel" | ||||
|               :value="dict.dictValue" | ||||
|             /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="序号" prop="sort"> | ||||
|           <el-input-number v-model="form.sort" controls-position="right" :min="0" /> | ||||
| @@ -180,8 +177,6 @@ export default { | ||||
|       multiple: true, | ||||
|       // 总条数 | ||||
|       total: 0, | ||||
|       //班级类型 字典 | ||||
|       bjtypeOptions: [], | ||||
|       // 游戏数学表格数据 | ||||
|       mathList: [], | ||||
|       // 弹出层标题 | ||||
| @@ -204,7 +199,14 @@ export default { | ||||
|       // 表单参数 | ||||
|       form: {}, | ||||
|       // 表单校验 | ||||
|       rules: {} | ||||
|       rules: { | ||||
|         name: [{ required: true, message: "名称不能为空", trigger: "blur" }], | ||||
|         target: [{ required: true, message: "学习目标不能为空", trigger: "blur" }], | ||||
|         feature: [{ required: true, message: "年龄段表现特征不能为空", trigger: "blur" }], | ||||
|         suggest: [{ required: true, message: "教学建议不能为空", trigger: "blur" }], | ||||
|         classtypeId: [{ required: true, message: "适用班级不能为空", trigger: "blur" }], | ||||
|         sort: [{ required: true, message: "序号不能为空", trigger: "blur" }] | ||||
|       } | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
| @@ -274,6 +276,7 @@ export default { | ||||
|       const id = row.id || this.ids; | ||||
|       getMath(id).then(response => { | ||||
|         this.form = response.data; | ||||
|         console.log(this.form); | ||||
|         this.open = true; | ||||
|         this.title = "修改游戏数学"; | ||||
|       }); | ||||
|   | ||||
| @@ -148,9 +148,9 @@ | ||||
|       <el-table-column label="游戏名称" align="center" prop="name" /> | ||||
|       <el-table-column label="排序" align="center" prop="sort" /> | ||||
|       <el-table-column label="游戏形式" align="center" :formatter="typeFormat" prop="type" /> | ||||
|       <el-table-column label="游戏目标" align="center" prop="target" /> | ||||
|       <el-table-column label="游戏准备" align="center" prop="prepare" /> | ||||
|       <el-table-column label="游戏过程" align="center" prop="process" /> | ||||
|       <el-table-column label="游戏目标" align="center" prop="target"  :show-overflow-tooltip="true"/> | ||||
|       <el-table-column label="游戏准备" align="center" prop="prepare" :show-overflow-tooltip="true" /> | ||||
|       <el-table-column label="游戏过程" align="center" prop="process"  :show-overflow-tooltip="true"/> | ||||
|       <!-- <el-table-column label="本周其它目标" align="center" prop="otherTarget" /> | ||||
|       <el-table-column label="建议" align="center" prop="suggest" /> | ||||
|       <el-table-column label="创建时间" align="center" prop="createtime" width="180"> | ||||
| @@ -298,7 +298,16 @@ export default { | ||||
|       // 表单参数 | ||||
|       form: {}, | ||||
|       // 表单校验 | ||||
|       rules: {} | ||||
|       rules: { | ||||
|         name: [{ required: true, message: "游戏名称不能为空", trigger: "blur" }], | ||||
|         sort: [{ required: true, message: "序号不能为空", trigger: "blur" }], | ||||
|         type: [{ required: true, message: "游戏形式不能为空", trigger: "blur" }], | ||||
|         target: [{ required: true, message: "游戏目标不能为空", trigger: "blur" }], | ||||
|         prepare: [{ required: true, message: "游戏准备不能为空", trigger: "blur" }], | ||||
|         process: [{ required: true, message: "游戏过程不能为空", trigger: "blur" }], | ||||
|         otherTarget: [{ required: true, message: "本周其它目标不能为空", trigger: "blur" }], | ||||
|         suggest: [{ required: true, message: "建议不能为空", trigger: "blur" }] | ||||
|       } | ||||
|     }; | ||||
|   }, | ||||
|   created() { | ||||
|   | ||||
| @@ -383,6 +383,7 @@ export default { | ||||
|       const id = row.id || this.ids; | ||||
|       getActivity(id).then(response => { | ||||
|         this.form = response.data; | ||||
|         console.log(this.form); | ||||
|  | ||||
|         this.typeOptions = response.types; | ||||
|         this.form.type = response.typeIds; | ||||
|   | ||||
| @@ -262,6 +262,7 @@ export default { | ||||
|       const id = row.id || this.ids; | ||||
|       getTheme(id).then(response => { | ||||
|         this.form = response.data; | ||||
|         console.log(this.form); | ||||
|         this.open = true; | ||||
|         this.title = "修改主题整合"; | ||||
|       }); | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import java.util.List; | ||||
| import java.util.stream.Collectors; | ||||
| import com.fasterxml.jackson.annotation.JsonInclude; | ||||
| import com.ruoyi.project.benyi.domain.ByDayFlowDetail; | ||||
| import com.ruoyi.project.benyi.domain.ByMath; | ||||
| import com.ruoyi.project.benyi.domain.ByTheme; | ||||
| import com.ruoyi.project.system.domain.SysDept; | ||||
| import com.ruoyi.project.system.domain.SysMenu; | ||||
| @@ -59,6 +60,14 @@ public class TreeSelect implements Serializable | ||||
|         this.children = bytheme.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); | ||||
|     } | ||||
|  | ||||
|     //下拉树构造器 | ||||
|     public TreeSelect(ByMath bymath) { | ||||
|  | ||||
|         this.id = bymath.getId(); | ||||
|         this.label = bymath.getName(); | ||||
|         this.children = bymath.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); | ||||
|     } | ||||
|  | ||||
|     public Long getId() | ||||
|     { | ||||
|         return id; | ||||
|   | ||||
| @@ -61,13 +61,22 @@ public class ByMathController extends BaseController | ||||
|     /** | ||||
|      * 获取游戏数学详细信息 | ||||
|      */ | ||||
|     @PreAuthorize("@ss.hasPermi('benyi:math:query')") | ||||
|     @PreAuthorize("@ss.hasPermi('benyi:math:query')" + "||@ss.hasPermi('benyi:theme:list')") | ||||
|     @GetMapping(value = "/{id}") | ||||
|     public AjaxResult getInfo(@PathVariable("id") Long id) | ||||
|     { | ||||
|         return AjaxResult.success(byMathService.selectByMathById(id)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 获取部门下拉树列表 | ||||
|      */ | ||||
|     @GetMapping("/treeselect") | ||||
|     public AjaxResult treeselect(ByMath byMath) { | ||||
|         List<ByMath> byMathDetails = byMathService.selectByMathListTree(byMath); | ||||
|         return AjaxResult.success(byMathService.buildMathTreeSelect(byMathDetails)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增游戏数学 | ||||
|      */ | ||||
|   | ||||
| @@ -6,7 +6,9 @@ import org.apache.commons.lang3.builder.ToStringStyle; | ||||
| import com.ruoyi.framework.aspectj.lang.annotation.Excel; | ||||
| import com.ruoyi.framework.web.domain.BaseEntity; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 游戏数学对象 by_math | ||||
| @@ -58,6 +60,12 @@ public class ByMath extends BaseEntity { | ||||
|     @Excel(name = "序号") | ||||
|     private Long sort; | ||||
|  | ||||
|     /** 树状父类ID */ | ||||
|     private Long parentId; | ||||
|  | ||||
|     /** 树状子类 */ | ||||
|     private List<ByMath> children = new ArrayList<ByMath>(); | ||||
|  | ||||
|     /** | ||||
|      * 创建时间 | ||||
|      */ | ||||
| @@ -120,6 +128,30 @@ public class ByMath extends BaseEntity { | ||||
|         return sort; | ||||
|     } | ||||
|  | ||||
|     public Date getCreatetime() { | ||||
|         return createtime; | ||||
|     } | ||||
|  | ||||
|     public void setCreatetime(Date createtime) { | ||||
|         this.createtime = createtime; | ||||
|     } | ||||
|  | ||||
|     public Long getParentId() { | ||||
|         return parentId; | ||||
|     } | ||||
|  | ||||
|     public void setParentId(Long parentId) { | ||||
|         this.parentId = parentId; | ||||
|     } | ||||
|  | ||||
|     public List<ByMath> getChildren() { | ||||
|         return children; | ||||
|     } | ||||
|  | ||||
|     public void setChildren(List<ByMath> children) { | ||||
|         this.children = children; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public String toString() { | ||||
|         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) | ||||
| @@ -131,14 +163,9 @@ public class ByMath extends BaseEntity { | ||||
|                 .append("classtypeId", getClasstypeId()) | ||||
|                 .append("sort", getSort()) | ||||
|                 .append("createTime", getCreateTime()) | ||||
|                 .append("parentId", getParentId()) | ||||
|                 .toString(); | ||||
|     } | ||||
|  | ||||
|     public Date getCreatetime() { | ||||
|         return createtime; | ||||
|     } | ||||
|  | ||||
|     public void setCreatetime(Date createtime) { | ||||
|         this.createtime = createtime; | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -27,6 +27,14 @@ public interface ByMathMapper | ||||
|      */ | ||||
|     public List<ByMath> selectByMathList(ByMath byMath); | ||||
|  | ||||
|     /** | ||||
|      * 查询游戏数学树 | ||||
|      * | ||||
|      * @param byMath 游戏数学 | ||||
|      * @return 游戏数学树集合 | ||||
|      */ | ||||
|     public List<ByMath> selectByMathListTree(ByMath byMath); | ||||
|  | ||||
|     /** | ||||
|      * 新增游戏数学 | ||||
|      * | ||||
|   | ||||
| @@ -1,6 +1,8 @@ | ||||
| package com.ruoyi.project.benyi.service; | ||||
|  | ||||
| import java.util.List; | ||||
|  | ||||
| import com.ruoyi.framework.web.domain.TreeSelect; | ||||
| import com.ruoyi.project.benyi.domain.ByMath; | ||||
|  | ||||
| /** | ||||
| @@ -27,6 +29,33 @@ public interface IByMathService | ||||
|      */ | ||||
|     public List<ByMath> selectByMathList(ByMath byMath); | ||||
|  | ||||
|     /** | ||||
|      * 查询游戏数学列表树 | ||||
|      * | ||||
|      * @param byMath 游戏数学 | ||||
|      * @return 游戏数学树集合 | ||||
|      */ | ||||
|     public List<ByMath> selectByMathListTree(ByMath byMath); | ||||
|  | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 构建前端所需要树结构 | ||||
|      * | ||||
|      * @param byMaths 部门列表 | ||||
|      * @return 树结构列表 | ||||
|      */ | ||||
|     public List<ByMath> buildMathDetailTree(List<ByMath> byMaths); | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 构建前端所需要下拉树结构 | ||||
|      * | ||||
|      * @param byMaths 部门列表 | ||||
|      * @return 树结构列表 | ||||
|      */ | ||||
|     public List<TreeSelect> buildMathTreeSelect(List<ByMath> byMaths); | ||||
|  | ||||
|     /** | ||||
|      * 新增游戏数学 | ||||
|      * | ||||
|   | ||||
| @@ -1,8 +1,14 @@ | ||||
| package com.ruoyi.project.benyi.service.impl; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
|                                                                                                         import com.ruoyi.common.utils.DateUtils; | ||||
|             import org.springframework.beans.factory.annotation.Autowired; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import com.ruoyi.common.utils.DateUtils; | ||||
| import com.ruoyi.common.utils.StringUtils; | ||||
| import com.ruoyi.framework.web.domain.TreeSelect; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import com.ruoyi.project.benyi.mapper.ByMathMapper; | ||||
| import com.ruoyi.project.benyi.domain.ByMath; | ||||
| @@ -15,8 +21,7 @@ import com.ruoyi.project.benyi.service.IByMathService; | ||||
|  * @date 2020-07-20 | ||||
|  */ | ||||
| @Service | ||||
| public class ByMathServiceImpl implements IByMathService | ||||
| { | ||||
| public class ByMathServiceImpl implements IByMathService { | ||||
|     @Autowired | ||||
|     private ByMathMapper byMathMapper; | ||||
|  | ||||
| @@ -27,8 +32,7 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 游戏数学 | ||||
|      */ | ||||
|     @Override | ||||
|     public ByMath selectByMathById(Long id) | ||||
|     { | ||||
|     public ByMath selectByMathById(Long id) { | ||||
|         return byMathMapper.selectByMathById(id); | ||||
|     } | ||||
|  | ||||
| @@ -39,11 +43,105 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 游戏数学 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<ByMath> selectByMathList(ByMath byMath) | ||||
|     { | ||||
|     public List<ByMath> selectByMathList(ByMath byMath) { | ||||
|         return byMathMapper.selectByMathList(byMath); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 查询游戏数学树列表 | ||||
|      * | ||||
|      * @param byMath 游戏数学树 | ||||
|      * @return 游戏数学树 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<ByMath> selectByMathListTree(ByMath byMath) { | ||||
|         return byMathMapper.selectByMathListTree(byMath); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 构建前端所需要树结构 | ||||
|      * | ||||
|      * @param byMaths 部门列表 | ||||
|      * @return 树结构列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<ByMath> buildMathDetailTree(List<ByMath> byMaths) { | ||||
|         //System.out.println("start---"); | ||||
|         List<ByMath> returnList = new ArrayList<ByMath>(); | ||||
|         List<Long> tempList = new ArrayList<Long>(); | ||||
|         for (ByMath item : byMaths) { | ||||
|             tempList.add(item.getId()); | ||||
|         } | ||||
|         for (Iterator<ByMath> iterator = byMaths.iterator(); iterator.hasNext(); ) { | ||||
|             ByMath item = (ByMath) iterator.next(); | ||||
|             //System.out.println("test==="+!tempList.contains(byDayFlowDetail.getParentId())); | ||||
|             // 如果是顶级节点, 遍历该父节点的所有子节点 | ||||
|             if (!tempList.contains(item.getParentId())) { | ||||
|                 recursionFn(byMaths, item); | ||||
|                 returnList.add(item); | ||||
|             } | ||||
|         } | ||||
|         if (returnList.isEmpty()) { | ||||
|             returnList = byMaths; | ||||
|         } | ||||
|         return returnList; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 构建前端所需要下拉树结构 | ||||
|      * | ||||
|      * @param byMaths 部门列表 | ||||
|      * @return 下拉树结构列表 | ||||
|      */ | ||||
|     @Override | ||||
|     public List<TreeSelect> buildMathTreeSelect(List<ByMath> byMaths) { | ||||
|         List<ByMath> byMathTrees = buildMathDetailTree(byMaths); | ||||
|         return byMathTrees.stream().map(TreeSelect::new).collect(Collectors.toList()); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 递归列表 | ||||
|      */ | ||||
|     private void recursionFn(List<ByMath> list, ByMath t) { | ||||
|         // 得到子节点列表 | ||||
|         List<ByMath> childList = getChildList(list, t); | ||||
|         t.setChildren(childList); | ||||
|         for (ByMath tChild : childList) { | ||||
|             if (hasChild(list, tChild)) { | ||||
|                 // 判断是否有子节点 | ||||
|                 Iterator<ByMath> it = childList.iterator(); | ||||
|                 while (it.hasNext()) { | ||||
|                     ByMath n = (ByMath) it.next(); | ||||
|                     recursionFn(list, n); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 得到子节点列表 | ||||
|      */ | ||||
|     private List<ByMath> getChildList(List<ByMath> list, ByMath t) { | ||||
|         List<ByMath> tlist = new ArrayList<ByMath>(); | ||||
|         Iterator<ByMath> it = list.iterator(); | ||||
|         while (it.hasNext()) { | ||||
|             ByMath n = (ByMath) it.next(); | ||||
|             if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getId().longValue()) { | ||||
|                 //System.out.println("parentid="+n.getParentId().longValue()+"---"+t.getId().longValue()); | ||||
|                 tlist.add(n); | ||||
|             } | ||||
|         } | ||||
|         return tlist; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 判断是否有子节点 | ||||
|      */ | ||||
|     private boolean hasChild(List<ByMath> list, ByMath t) { | ||||
|         return getChildList(list, t).size() > 0 ? true : false; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * 新增游戏数学 | ||||
|      * | ||||
| @@ -51,10 +149,9 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int insertByMath(ByMath byMath) | ||||
|     { | ||||
|                                                                                                                                                                                 byMath.setCreateTime(DateUtils.getNowDate()); | ||||
|                             return byMathMapper.insertByMath(byMath); | ||||
|     public int insertByMath(ByMath byMath) { | ||||
|         byMath.setCreateTime(DateUtils.getNowDate()); | ||||
|         return byMathMapper.insertByMath(byMath); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -64,9 +161,8 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int updateByMath(ByMath byMath) | ||||
|     { | ||||
|                                                                                                                                                                                 return byMathMapper.updateByMath(byMath); | ||||
|     public int updateByMath(ByMath byMath) { | ||||
|         return byMathMapper.updateByMath(byMath); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -76,8 +172,7 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int deleteByMathByIds(Long[] ids) | ||||
|     { | ||||
|     public int deleteByMathByIds(Long[] ids) { | ||||
|         return byMathMapper.deleteByMathByIds(ids); | ||||
|     } | ||||
|  | ||||
| @@ -88,8 +183,7 @@ public class ByMathServiceImpl implements IByMathService | ||||
|      * @return 结果 | ||||
|      */ | ||||
|     @Override | ||||
|     public int deleteByMathById(Long id) | ||||
|     { | ||||
|     public int deleteByMathById(Long id) { | ||||
|         return byMathMapper.deleteByMathById(id); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -5,30 +5,49 @@ | ||||
| <mapper namespace="com.ruoyi.project.benyi.mapper.ByMathMapper"> | ||||
|  | ||||
|     <resultMap type="ByMath" id="ByMathResult"> | ||||
|                     <result property="id"    column="id"    /> | ||||
|                     <result property="name"    column="name"    /> | ||||
|                     <result property="target"    column="target"    /> | ||||
|                     <result property="feature"    column="feature"    /> | ||||
|                     <result property="suggest"    column="suggest"    /> | ||||
|                     <result property="classtypeId"    column="classtype_id"    /> | ||||
|                     <result property="sort"    column="sort"    /> | ||||
|                     <result property="createTime"    column="create_time"    /> | ||||
|             </resultMap> | ||||
|         <result property="id" column="id"/> | ||||
|         <result property="name" column="name"/> | ||||
|         <result property="target" column="target"/> | ||||
|         <result property="feature" column="feature"/> | ||||
|         <result property="suggest" column="suggest"/> | ||||
|         <result property="classtypeId" column="classtype_id"/> | ||||
|         <result property="sort" column="sort"/> | ||||
|         <result property="createTime" column="create_time"/> | ||||
|     </resultMap> | ||||
|  | ||||
|     <sql id="selectByMathVo"> | ||||
|         select id, name, target, feature, suggest, classtype_id, sort, create_time from by_math | ||||
|     </sql> | ||||
|  | ||||
|     <sql id="selectByMathVoTree"> | ||||
|         select dict_value+9999 id, 0 parent_id,dict_label name,dict_sort sort   from sys_dict_data where dict_type='sys_yebjlx' and dict_label !='托班(2-3岁)' | ||||
|         union all | ||||
|         select id, classtype_id+9999, name, sort from by_math | ||||
|         order by sort | ||||
|     </sql> | ||||
|  | ||||
|     <select id="selectByMathListTree" parameterType="ByMath" resultMap="ByMathResult"> | ||||
|         <include refid="selectByMathVoTree"/> | ||||
|         <where> | ||||
|             <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="target != null  and target != ''">and target = #{target}</if> | ||||
|             <if test="feature != null  and feature != ''">and feature = #{feature}</if> | ||||
|             <if test="suggest != null  and suggest != ''">and suggest = #{suggest}</if> | ||||
|             <if test="classtypeId != null ">and classtype_id = #{classtypeId}</if> | ||||
|             <if test="sort != null ">and sort = #{sort}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectByMathList" parameterType="ByMath" resultMap="ByMathResult"> | ||||
|         <include refid="selectByMathVo"/> | ||||
|         <where> | ||||
|                                                                                                     <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if> | ||||
|                                                                                                             <if test="target != null  and target != ''"> and target = #{target}</if> | ||||
|                                                                                                             <if test="feature != null  and feature != ''"> and feature = #{feature}</if> | ||||
|                                                                                                             <if test="suggest != null  and suggest != ''"> and suggest = #{suggest}</if> | ||||
|                                                                                                             <if test="classtypeId != null "> and classtype_id = #{classtypeId}</if> | ||||
|                                                                                                             <if test="sort != null "> and sort = #{sort}</if> | ||||
|                                                                                     </where> | ||||
|             <if test="name != null  and name != ''">and name like concat('%', #{name}, '%')</if> | ||||
|             <if test="target != null  and target != ''">and target = #{target}</if> | ||||
|             <if test="feature != null  and feature != ''">and feature = #{feature}</if> | ||||
|             <if test="suggest != null  and suggest != ''">and suggest = #{suggest}</if> | ||||
|             <if test="classtypeId != null ">and classtype_id = #{classtypeId}</if> | ||||
|             <if test="sort != null ">and sort = #{sort}</if> | ||||
|         </where> | ||||
|     </select> | ||||
|  | ||||
|     <select id="selectByMathById" parameterType="Long" resultMap="ByMathResult"> | ||||
| @@ -39,38 +58,38 @@ | ||||
|     <insert id="insertByMath" parameterType="ByMath"> | ||||
|         insert into by_math | ||||
|         <trim prefix="(" suffix=")" suffixOverrides=","> | ||||
|                                                 <if test="id != null ">id,</if> | ||||
|                                                                 <if test="name != null  and name != ''">name,</if> | ||||
|                                                                 <if test="target != null  and target != ''">target,</if> | ||||
|                                                                 <if test="feature != null  and feature != ''">feature,</if> | ||||
|                                                                 <if test="suggest != null  and suggest != ''">suggest,</if> | ||||
|                                                                 <if test="classtypeId != null ">classtype_id,</if> | ||||
|                                                                 <if test="sort != null ">sort,</if> | ||||
|                                                                 <if test="createTime != null ">create_time,</if> | ||||
|                                     </trim> | ||||
|             <if test="id != null ">id,</if> | ||||
|             <if test="name != null  and name != ''">name,</if> | ||||
|             <if test="target != null  and target != ''">target,</if> | ||||
|             <if test="feature != null  and feature != ''">feature,</if> | ||||
|             <if test="suggest != null  and suggest != ''">suggest,</if> | ||||
|             <if test="classtypeId != null ">classtype_id,</if> | ||||
|             <if test="sort != null ">sort,</if> | ||||
|             <if test="createTime != null ">create_time,</if> | ||||
|         </trim> | ||||
|         <trim prefix="values (" suffix=")" suffixOverrides=","> | ||||
|                                                 <if test="id != null ">#{id},</if> | ||||
|                                                                 <if test="name != null  and name != ''">#{name},</if> | ||||
|                                                                 <if test="target != null  and target != ''">#{target},</if> | ||||
|                                                                 <if test="feature != null  and feature != ''">#{feature},</if> | ||||
|                                                                 <if test="suggest != null  and suggest != ''">#{suggest},</if> | ||||
|                                                                 <if test="classtypeId != null ">#{classtypeId},</if> | ||||
|                                                                 <if test="sort != null ">#{sort},</if> | ||||
|                                                                 <if test="createTime != null ">#{createTime},</if> | ||||
|                                     </trim> | ||||
|             <if test="id != null ">#{id},</if> | ||||
|             <if test="name != null  and name != ''">#{name},</if> | ||||
|             <if test="target != null  and target != ''">#{target},</if> | ||||
|             <if test="feature != null  and feature != ''">#{feature},</if> | ||||
|             <if test="suggest != null  and suggest != ''">#{suggest},</if> | ||||
|             <if test="classtypeId != null ">#{classtypeId},</if> | ||||
|             <if test="sort != null ">#{sort},</if> | ||||
|             <if test="createTime != null ">#{createTime},</if> | ||||
|         </trim> | ||||
|     </insert> | ||||
|  | ||||
|     <update id="updateByMath" parameterType="ByMath"> | ||||
|         update by_math | ||||
|         <trim prefix="SET" suffixOverrides=","> | ||||
|                                                                             <if test="name != null  and name != ''">name = #{name},</if> | ||||
|                                                                 <if test="target != null  and target != ''">target = #{target},</if> | ||||
|                                                                 <if test="feature != null  and feature != ''">feature = #{feature},</if> | ||||
|                                                                 <if test="suggest != null  and suggest != ''">suggest = #{suggest},</if> | ||||
|                                                                 <if test="classtypeId != null ">classtype_id = #{classtypeId},</if> | ||||
|                                                                 <if test="sort != null ">sort = #{sort},</if> | ||||
|                                                                 <if test="createTime != null ">create_time = #{createTime},</if> | ||||
|                                     </trim> | ||||
|             <if test="name != null  and name != ''">name = #{name},</if> | ||||
|             <if test="target != null  and target != ''">target = #{target},</if> | ||||
|             <if test="feature != null  and feature != ''">feature = #{feature},</if> | ||||
|             <if test="suggest != null  and suggest != ''">suggest = #{suggest},</if> | ||||
|             <if test="classtypeId != null ">classtype_id = #{classtypeId},</if> | ||||
|             <if test="sort != null ">sort = #{sort},</if> | ||||
|             <if test="createTime != null ">create_time = #{createTime},</if> | ||||
|         </trim> | ||||
|         where id = #{id} | ||||
|     </update> | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user