From e31e7b6c0d595896f5ca5f82d146551f053b95bd Mon Sep 17 00:00:00 2001 From: paidaxing444 <12qwaszx> Date: Mon, 1 Jun 2020 10:03:21 +0800 Subject: [PATCH] =?UTF-8?q?20200529-zlp-3=20=E4=BC=98=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90=20=E6=96=B0=E5=A2=9E=E8=AF=84?= =?UTF-8?q?=E5=88=86=E8=AF=84=E4=BB=B7=E5=90=8E=E5=8F=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/router/index.js | 12 + .../src/views/benyi_train/video/index.vue | 42 +- .../views/benyi_train/video_study/index.vue | 17 +- ruoyi-ui/src/views/tool/gen/importTable.vue | 2 +- ruoyi-ui/src/views/tool/gen/index.vue | 8 +- .../controller/ByDayFlowDetailController.java | 1 - .../controller/ByTrainVideoController.java | 2 - .../ByTrainVideoFeedbackController.java | 103 +++ .../ByTrainVideoScoreController.java | 103 +++ .../benyi/domain/ByTrainVideoFeedback.java | 97 ++ .../benyi/domain/ByTrainVideoScore.java | 110 +++ .../mapper/ByTrainVideoFeedbackMapper.java | 61 ++ .../benyi/mapper/ByTrainVideoScoreMapper.java | 61 ++ .../service/IByTrainVideoFeedbackService.java | 61 ++ .../service/IByTrainVideoScoreService.java | 61 ++ .../impl/ByTrainVideoFeedbackServiceImpl.java | 93 ++ .../impl/ByTrainVideoScoreServiceImpl.java | 93 ++ .../controller/SysDictMoedataController.java | 6 +- .../tool/gen/controller/GenController.java | 5 +- .../project/tool/gen/domain/GenTable.java | 2 +- .../tool/gen/domain/GenTableColumn.java | 2 +- .../tool/gen/mapper/GenTableColumnMapper.java | 14 +- .../tool/gen/mapper/GenTableMapper.java | 18 +- .../service/GenTableColumnServiceImpl.java | 74 +- .../tool/gen/service/GenTableServiceImpl.java | 30 +- .../gen/service/IGenTableColumnService.java | 10 +- .../tool/gen/service/IGenTableService.java | 24 +- .../ruoyi/project/tool/gen/util/GenUtils.java | 18 +- .../tool/gen/util/VelocityInitializer.java | 2 +- .../project/tool/gen/util/VelocityUtils.java | 21 +- .../benyi/ByTrainVideoFeedbackMapper.xml | 74 ++ .../mybatis/benyi/ByTrainVideoScoreMapper.xml | 79 ++ .../mybatis/system/SysDictMoedataMapper.xml | 4 +- .../mybatis/tool/GenTableColumnMapper.xml | 102 +-- .../resources/mybatis/tool/GenTableMapper.xml | 202 ++--- .../main/resources/vm/java/controller.java.vm | 30 +- .../src/main/resources/vm/java/domain.java.vm | 105 +-- .../src/main/resources/vm/java/mapper.java.vm | 16 +- .../main/resources/vm/java/service.java.vm | 16 +- .../resources/vm/java/serviceImpl.java.vm | 48 +- .../main/resources/vm/vue/index-tree.vue.vm | 791 ++++++++-------- ruoyi/src/main/resources/vm/vue/index.vue.vm | 845 +++++++++--------- ruoyi/src/main/resources/vm/xml/mapper.xml.vm | 108 +-- 43 files changed, 2300 insertions(+), 1273 deletions(-) create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoScore.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoFeedbackMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoScoreMapper.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoFeedbackService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoScoreService.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoFeedbackServiceImpl.java create mode 100644 ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoScoreServiceImpl.java create mode 100644 ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml create mode 100644 ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoScoreMapper.xml diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index 75c88b92a..a7e13631a 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -114,6 +114,18 @@ export const constantRoutes = [{ meta: { title: '一日流程标准', icon: '' } }] }, + { + path: '/video_study', + component: Layout, + hidden: true, + children: [{ + path: 'study/detail/:id(\\d+)', + component: () => + import ('@/views/benyi_train/video_study/detail'), + name: 'Detail', + meta: { title: '培训视频详情', icon: '' } + }] + }, { path: '/job', component: Layout, diff --git a/ruoyi-ui/src/views/benyi_train/video/index.vue b/ruoyi-ui/src/views/benyi_train/video/index.vue index 441a60176..299679104 100644 --- a/ruoyi-ui/src/views/benyi_train/video/index.vue +++ b/ruoyi-ui/src/views/benyi_train/video/index.vue @@ -71,9 +71,20 @@ <el-table-column type="selection" width="55" align="center" /> <el-table-column label="编号" align="center" prop="id" /> <el-table-column label="培训视频标题" align="center" prop="title" :show-overflow-tooltip="true" /> - <el-table-column label="视频简介" align="center" prop="information" :show-overflow-tooltip="true" /> + <el-table-column + label="视频简介" + align="center" + prop="information" + :show-overflow-tooltip="true" + /> <el-table-column label="培训讲师" align="center" prop="lecturername" /> - <el-table-column label="所属类别" align="center" prop="type" :formatter="typeFormat" /> + <el-table-column + label="所属类别" + align="center" + prop="type" + :formatter="typeFormat" + :show-overflow-tooltip="true" + /> <el-table-column label="创建时间" align="center" prop="createtime" width="180"> <template slot-scope="scope"> <span>{{ parseTime(scope.row.createtime) }}</span> @@ -110,6 +121,17 @@ <!-- 添加或修改培训对话框 --> <el-dialog :title="title" :visible.sync="open" width="500px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + <el-form-item label="所属类别" prop="type"> + <el-cascader + ref="typeCascader" + placeholder="请选择所属类别" + v-model="form.type" + :options="optionTypes" + :props="{ checkStrictly: true, value: 'id', label: 'name' }" + clearable + @change="getLastChildName" + ></el-cascader> + </el-form-item> <el-form-item label="视频标题" prop="title"> <el-input v-model="form.title" type="textarea" placeholder="请输入内容" /> </el-form-item> @@ -154,15 +176,6 @@ <el-progress v-if="imgFlag == true" type="circle" :percentage="percent"></el-progress> </el-upload> </el-form-item> - <el-form-item label="所属类别" prop="type"> - <el-cascader - placeholder="请选择所属类别" - v-model="form.type" - :options="optionTypes" - :props="{ checkStrictly: true, value: 'id', label: 'name' }" - clearable - ></el-cascader> - </el-form-item> </el-form> <div slot="footer" class="dialog-footer"> <el-button type="primary" @click="submitForm">确 定</el-button> @@ -272,6 +285,13 @@ export default { }); }, methods: { + //获取选中节点的label用作标题 + getLastChildName(val) { + //console.log(val[val.length-1]); + //console.log(this.$refs.myCascader.getCheckedNodes()[0].pathLabels[val.length-1]); + var lastLable=this.$refs.typeCascader.getCheckedNodes()[0].pathLabels[val.length-1]; + this.form.title=lastLable; + }, // 字典状态字典翻译 typeFormat(row, column) { var actions = []; diff --git a/ruoyi-ui/src/views/benyi_train/video_study/index.vue b/ruoyi-ui/src/views/benyi_train/video_study/index.vue index 5ec599292..5a41bb8e7 100644 --- a/ruoyi-ui/src/views/benyi_train/video_study/index.vue +++ b/ruoyi-ui/src/views/benyi_train/video_study/index.vue @@ -10,7 +10,8 @@ clearable ></el-cascader> </el-form-item> - <el-form-item label="讲师姓名" prop="lecturer"> + <!-- 博士要求注释掉,不需要该过滤条件 2020-05-30 zlp --> + <!-- <el-form-item label="讲师姓名" prop="lecturer"> <el-select v-model="queryParams.lecturer" filterable placeholder="请选择讲师"> <el-option v-for="item in lecturerOptions" @@ -28,7 +29,7 @@ @keyup.enter.native="handleQuery" placeholder="请输入培训视频标题" /> - </el-form-item> + </el-form-item>--> <el-form-item> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> @@ -43,10 +44,12 @@ :options="playerOptions[index]" ref="videoPlayer" ></video-player> - <div class="to-detail" @click="toDetail(o)"> + <div class="to-detail"> <el-tooltip effect="dark" :content="o.title" placement="bottom"> <div> - <p class="info-title">{{o.title}}</p> + <router-link :to="'/video_study/study/detail/' + o.id" class="link-type"> + <p class="info-title">{{o.title}}</p> + </router-link> </div> </el-tooltip> <p class="info-title info-title-name">讲师:{{o.lecturername}}</p> @@ -79,7 +82,6 @@ export default { name: "VideoStudy", data() { return { - qiniuUrl: "https://files.benyiedu.com", // 个人七牛访问前缀 // 遮罩层 loading: true, // 总条数 @@ -117,9 +119,6 @@ export default { }); }, methods: { - toDetail(arg) { - console.log(arg); - }, // 递归判断列表,把最后的children设为undefined getTreeData(data) { for (var i = 0; i < data.length; i++) { @@ -201,7 +200,7 @@ export default { } .to-detail { - cursor: pointer; + /*cursor: pointer;*/ padding: 14px; } diff --git a/ruoyi-ui/src/views/tool/gen/importTable.vue b/ruoyi-ui/src/views/tool/gen/importTable.vue index 01606e6ef..6c56c771b 100644 --- a/ruoyi-ui/src/views/tool/gen/importTable.vue +++ b/ruoyi-ui/src/views/tool/gen/importTable.vue @@ -1,6 +1,6 @@ <template> <!-- 导入表 --> - <el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh"> + <el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body> <el-form :model="queryParams" ref="queryForm" :inline="true"> <el-form-item label="表名称" prop="tableName"> <el-input diff --git a/ruoyi-ui/src/views/tool/gen/index.vue b/ruoyi-ui/src/views/tool/gen/index.vue index e71858a9b..f32c7d4f1 100644 --- a/ruoyi-ui/src/views/tool/gen/index.vue +++ b/ruoyi-ui/src/views/tool/gen/index.vue @@ -80,7 +80,11 @@ <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55"></el-table-column> - <el-table-column label="序号" align="center" prop="tableId" width="60px" /> + <el-table-column label="序号" type="index" width="50" align="center"> + <template slot-scope="scope"> + <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> + </template> + </el-table-column> <el-table-column label="表名称" align="center" @@ -145,7 +149,7 @@ @pagination="getList" /> <!-- 预览界面 --> - <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh"> + <el-dialog :title="preview.title" :visible.sync="preview.open" width="80%" top="5vh" append-to-body> <el-tabs v-model="preview.activeName"> <el-tab-pane v-for="(value, key) in preview.data" diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java index 4e3bb8ae8..963234423 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByDayFlowDetailController.java @@ -1,6 +1,5 @@ package com.ruoyi.project.benyi.controller; -import java.util.Date; import java.util.List; import com.ruoyi.common.utils.SecurityUtils; diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java index cb13b17fc..f93beee6a 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoController.java @@ -3,9 +3,7 @@ package com.ruoyi.project.benyi.controller; import java.util.Date; import java.util.List; -import com.qiniu.util.Auth; import com.ruoyi.common.utils.SecurityUtils; -import com.ruoyi.framework.config.FileConfig; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java new file mode 100644 index 000000000..30137dc97 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoFeedbackController.java @@ -0,0 +1,103 @@ +package com.ruoyi.project.benyi.service.impl; + +import java.util.List; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback; +import com.ruoyi.project.benyi.service.IByTrainVideoFeedbackService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.page.TableDataInfo; + +/** + * 培训视频评价反馈Controller + * + * @author tsbz + * @date 2020-06-01 + */ +@RestController +@RequestMapping("/benyi/feedback") +public class ByTrainVideoFeedbackController extends BaseController +{ + @Autowired + private IByTrainVideoFeedbackService byTrainVideoFeedbackService; + + /** + * 查询培训视频评价反馈列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:list')") + @GetMapping("/list") + public TableDataInfo list(ByTrainVideoFeedback byTrainVideoFeedback) + { + startPage(); + List<ByTrainVideoFeedback> list = byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback); + return getDataTable(list); + } + + /** + * 导出培训视频评价反馈列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:export')") + @Log(title = "培训视频评价反馈", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(ByTrainVideoFeedback byTrainVideoFeedback) + { + List<ByTrainVideoFeedback> list = byTrainVideoFeedbackService.selectByTrainVideoFeedbackList(byTrainVideoFeedback); + ExcelUtil<ByTrainVideoFeedback> util = new ExcelUtil<ByTrainVideoFeedback>(ByTrainVideoFeedback.class); + return util.exportExcel(list, "feedback"); + } + + /** + * 获取培训视频评价反馈详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(byTrainVideoFeedbackService.selectByTrainVideoFeedbackById(id)); + } + + /** + * 新增培训视频评价反馈 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:add')") + @Log(title = "培训视频评价反馈", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback) + { + return toAjax(byTrainVideoFeedbackService.insertByTrainVideoFeedback(byTrainVideoFeedback)); + } + + /** + * 修改培训视频评价反馈 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:edit')") + @Log(title = "培训视频评价反馈", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ByTrainVideoFeedback byTrainVideoFeedback) + { + return toAjax(byTrainVideoFeedbackService.updateByTrainVideoFeedback(byTrainVideoFeedback)); + } + + /** + * 删除培训视频评价反馈 + */ + @PreAuthorize("@ss.hasPermi('benyi:feedback:remove')") + @Log(title = "培训视频评价反馈", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(byTrainVideoFeedbackService.deleteByTrainVideoFeedbackByIds(ids)); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java new file mode 100644 index 000000000..dcc1c89e8 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/controller/ByTrainVideoScoreController.java @@ -0,0 +1,103 @@ +package com.ruoyi.project.benyi.controller; + +import java.util.List; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.framework.aspectj.lang.annotation.Log; +import com.ruoyi.framework.aspectj.lang.enums.BusinessType; +import com.ruoyi.project.benyi.domain.ByTrainVideoScore; +import com.ruoyi.project.benyi.service.IByTrainVideoScoreService; +import com.ruoyi.framework.web.controller.BaseController; +import com.ruoyi.framework.web.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.framework.web.page.TableDataInfo; + +/** + * 培训视频评分Controller + * + * @author tsbz + * @date 2020-06-01 + */ +@RestController +@RequestMapping("/benyi/score") +public class ByTrainVideoScoreController extends BaseController +{ + @Autowired + private IByTrainVideoScoreService byTrainVideoScoreService; + + /** + * 查询培训视频评分列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:list')") + @GetMapping("/list") + public TableDataInfo list(ByTrainVideoScore byTrainVideoScore) + { + startPage(); + List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); + return getDataTable(list); + } + + /** + * 导出培训视频评分列表 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:export')") + @Log(title = "培训视频评分", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(ByTrainVideoScore byTrainVideoScore) + { + List<ByTrainVideoScore> list = byTrainVideoScoreService.selectByTrainVideoScoreList(byTrainVideoScore); + ExcelUtil<ByTrainVideoScore> util = new ExcelUtil<ByTrainVideoScore>(ByTrainVideoScore.class); + return util.exportExcel(list, "score"); + } + + /** + * 获取培训视频评分详细信息 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(byTrainVideoScoreService.selectByTrainVideoScoreById(id)); + } + + /** + * 新增培训视频评分 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:add')") + @Log(title = "培训视频评分", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody ByTrainVideoScore byTrainVideoScore) + { + return toAjax(byTrainVideoScoreService.insertByTrainVideoScore(byTrainVideoScore)); + } + + /** + * 修改培训视频评分 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:edit')") + @Log(title = "培训视频评分", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody ByTrainVideoScore byTrainVideoScore) + { + return toAjax(byTrainVideoScoreService.updateByTrainVideoScore(byTrainVideoScore)); + } + + /** + * 删除培训视频评分 + */ + @PreAuthorize("@ss.hasPermi('benyi:score:remove')") + @Log(title = "培训视频评分", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(byTrainVideoScoreService.deleteByTrainVideoScoreByIds(ids)); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java new file mode 100644 index 000000000..b30eebaef --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoFeedback.java @@ -0,0 +1,97 @@ +package com.ruoyi.project.benyi.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +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.Date; + +/** + * 培训视频评价反馈对象 by_train_video_feedback + * + * @author tsbz + * @date 2020-06-01 + */ +public class ByTrainVideoFeedback extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long id; + + /** 视频id */ + @Excel(name = "视频id") + private Long videoid; + + /** 反馈意见建议 */ + @Excel(name = "反馈意见建议") + private String content; + + /** 创建人 */ + @Excel(name = "创建人") + private Long createuserid; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createtime; + + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setVideoid(Long videoid) + { + this.videoid = videoid; + } + + public Long getVideoid() + { + return videoid; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + public void setCreateuserid(Long createuserid) + { + this.createuserid = createuserid; + } + + public Long getCreateuserid() + { + return createuserid; + } + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getCreatetime() { + return createtime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("videoid", getVideoid()) + .append("content", getContent()) + .append("createuserid", getCreateuserid()) + .append("createtime", getCreatetime()) + .toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoScore.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoScore.java new file mode 100644 index 000000000..a83097441 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/domain/ByTrainVideoScore.java @@ -0,0 +1,110 @@ +package com.ruoyi.project.benyi.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +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.Date; + +/** + * 培训视频评分对象 by_train_video_score + * + * @author tsbz + * @date 2020-06-01 + */ +public class ByTrainVideoScore extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 编号 */ + private Long id; + + /** 视频编号 */ + @Excel(name = "视频编号") + private Long videoid; + + /** 讲师id */ + @Excel(name = "讲师id") + private Long lecturerid; + + /** 评分 */ + @Excel(name = "评分") + private Long score; + + /** 创建人 */ + @Excel(name = "创建人") + private Long createuserid; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createtime; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setVideoid(Long videoid) + { + this.videoid = videoid; + } + + public Long getVideoid() + { + return videoid; + } + public void setLecturerid(Long lecturerid) + { + this.lecturerid = lecturerid; + } + + public Long getLecturerid() + { + return lecturerid; + } + public void setScore(Long score) + { + this.score = score; + } + + public Long getScore() + { + return score; + } + public void setCreateuserid(Long createuserid) + { + this.createuserid = createuserid; + } + + public Long getCreateuserid() + { + return createuserid; + } + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } + + public Date getCreatetime() { + return createtime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("videoid", getVideoid()) + .append("lecturerid", getLecturerid()) + .append("score", getScore()) + .append("createuserid", getCreateuserid()) + .append("createtime", getCreatetime()) + .toString(); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoFeedbackMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoFeedbackMapper.java new file mode 100644 index 000000000..1803b973a --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoFeedbackMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback; + +/** + * 培训视频评价反馈Mapper接口 + * + * @author tsbz + * @date 2020-06-01 + */ +public interface ByTrainVideoFeedbackMapper +{ + /** + * 查询培训视频评价反馈 + * + * @param id 培训视频评价反馈ID + * @return 培训视频评价反馈 + */ + public ByTrainVideoFeedback selectByTrainVideoFeedbackById(Long id); + + /** + * 查询培训视频评价反馈列表 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 培训视频评价反馈集合 + */ + public List<ByTrainVideoFeedback> selectByTrainVideoFeedbackList(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 新增培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + public int insertByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 修改培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + public int updateByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 删除培训视频评价反馈 + * + * @param id 培训视频评价反馈ID + * @return 结果 + */ + public int deleteByTrainVideoFeedbackById(Long id); + + /** + * 批量删除培训视频评价反馈 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteByTrainVideoFeedbackByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoScoreMapper.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoScoreMapper.java new file mode 100644 index 000000000..937b62e2e --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/mapper/ByTrainVideoScoreMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.mapper; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByTrainVideoScore; + +/** + * 培训视频评分Mapper接口 + * + * @author tsbz + * @date 2020-06-01 + */ +public interface ByTrainVideoScoreMapper +{ + /** + * 查询培训视频评分 + * + * @param id 培训视频评分ID + * @return 培训视频评分 + */ + public ByTrainVideoScore selectByTrainVideoScoreById(Long id); + + /** + * 查询培训视频评分列表 + * + * @param byTrainVideoScore 培训视频评分 + * @return 培训视频评分集合 + */ + public List<ByTrainVideoScore> selectByTrainVideoScoreList(ByTrainVideoScore byTrainVideoScore); + + /** + * 新增培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + public int insertByTrainVideoScore(ByTrainVideoScore byTrainVideoScore); + + /** + * 修改培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + public int updateByTrainVideoScore(ByTrainVideoScore byTrainVideoScore); + + /** + * 删除培训视频评分 + * + * @param id 培训视频评分ID + * @return 结果 + */ + public int deleteByTrainVideoScoreById(Long id); + + /** + * 批量删除培训视频评分 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ + public int deleteByTrainVideoScoreByIds(Long[] ids); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoFeedbackService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoFeedbackService.java new file mode 100644 index 000000000..5e1a34785 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoFeedbackService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback; + +/** + * 培训视频评价反馈Service接口 + * + * @author tsbz + * @date 2020-06-01 + */ +public interface IByTrainVideoFeedbackService +{ + /** + * 查询培训视频评价反馈 + * + * @param id 培训视频评价反馈ID + * @return 培训视频评价反馈 + */ + public ByTrainVideoFeedback selectByTrainVideoFeedbackById(Long id); + + /** + * 查询培训视频评价反馈列表 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 培训视频评价反馈集合 + */ + public List<ByTrainVideoFeedback> selectByTrainVideoFeedbackList(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 新增培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + public int insertByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 修改培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + public int updateByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback); + + /** + * 批量删除培训视频评价反馈 + * + * @param ids 需要删除的培训视频评价反馈ID + * @return 结果 + */ + public int deleteByTrainVideoFeedbackByIds(Long[] ids); + + /** + * 删除培训视频评价反馈信息 + * + * @param id 培训视频评价反馈ID + * @return 结果 + */ + public int deleteByTrainVideoFeedbackById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoScoreService.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoScoreService.java new file mode 100644 index 000000000..b4f5c456e --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/IByTrainVideoScoreService.java @@ -0,0 +1,61 @@ +package com.ruoyi.project.benyi.service; + +import java.util.List; +import com.ruoyi.project.benyi.domain.ByTrainVideoScore; + +/** + * 培训视频评分Service接口 + * + * @author tsbz + * @date 2020-06-01 + */ +public interface IByTrainVideoScoreService +{ + /** + * 查询培训视频评分 + * + * @param id 培训视频评分ID + * @return 培训视频评分 + */ + public ByTrainVideoScore selectByTrainVideoScoreById(Long id); + + /** + * 查询培训视频评分列表 + * + * @param byTrainVideoScore 培训视频评分 + * @return 培训视频评分集合 + */ + public List<ByTrainVideoScore> selectByTrainVideoScoreList(ByTrainVideoScore byTrainVideoScore); + + /** + * 新增培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + public int insertByTrainVideoScore(ByTrainVideoScore byTrainVideoScore); + + /** + * 修改培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + public int updateByTrainVideoScore(ByTrainVideoScore byTrainVideoScore); + + /** + * 批量删除培训视频评分 + * + * @param ids 需要删除的培训视频评分ID + * @return 结果 + */ + public int deleteByTrainVideoScoreByIds(Long[] ids); + + /** + * 删除培训视频评分信息 + * + * @param id 培训视频评分ID + * @return 结果 + */ + public int deleteByTrainVideoScoreById(Long id); +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoFeedbackServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoFeedbackServiceImpl.java new file mode 100644 index 000000000..5fe3542c0 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoFeedbackServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.project.benyi.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.project.benyi.mapper.ByTrainVideoFeedbackMapper; +import com.ruoyi.project.benyi.domain.ByTrainVideoFeedback; +import com.ruoyi.project.benyi.service.IByTrainVideoFeedbackService; + +/** + * 培训视频评价反馈Service业务层处理 + * + * @author tsbz + * @date 2020-06-01 + */ +@Service +public class ByTrainVideoFeedbackServiceImpl implements IByTrainVideoFeedbackService +{ + @Autowired + private ByTrainVideoFeedbackMapper byTrainVideoFeedbackMapper; + + /** + * 查询培训视频评价反馈 + * + * @param id 培训视频评价反馈ID + * @return 培训视频评价反馈 + */ + @Override + public ByTrainVideoFeedback selectByTrainVideoFeedbackById(Long id) + { + return byTrainVideoFeedbackMapper.selectByTrainVideoFeedbackById(id); + } + + /** + * 查询培训视频评价反馈列表 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 培训视频评价反馈 + */ + @Override + public List<ByTrainVideoFeedback> selectByTrainVideoFeedbackList(ByTrainVideoFeedback byTrainVideoFeedback) + { + return byTrainVideoFeedbackMapper.selectByTrainVideoFeedbackList(byTrainVideoFeedback); + } + + /** + * 新增培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + @Override + public int insertByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback) + { + return byTrainVideoFeedbackMapper.insertByTrainVideoFeedback(byTrainVideoFeedback); + } + + /** + * 修改培训视频评价反馈 + * + * @param byTrainVideoFeedback 培训视频评价反馈 + * @return 结果 + */ + @Override + public int updateByTrainVideoFeedback(ByTrainVideoFeedback byTrainVideoFeedback) + { + return byTrainVideoFeedbackMapper.updateByTrainVideoFeedback(byTrainVideoFeedback); + } + + /** + * 批量删除培训视频评价反馈 + * + * @param ids 需要删除的培训视频评价反馈ID + * @return 结果 + */ + @Override + public int deleteByTrainVideoFeedbackByIds(Long[] ids) + { + return byTrainVideoFeedbackMapper.deleteByTrainVideoFeedbackByIds(ids); + } + + /** + * 删除培训视频评价反馈信息 + * + * @param id 培训视频评价反馈ID + * @return 结果 + */ + @Override + public int deleteByTrainVideoFeedbackById(Long id) + { + return byTrainVideoFeedbackMapper.deleteByTrainVideoFeedbackById(id); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoScoreServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoScoreServiceImpl.java new file mode 100644 index 000000000..58d024a03 --- /dev/null +++ b/ruoyi/src/main/java/com/ruoyi/project/benyi/service/impl/ByTrainVideoScoreServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.project.benyi.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.project.benyi.mapper.ByTrainVideoScoreMapper; +import com.ruoyi.project.benyi.domain.ByTrainVideoScore; +import com.ruoyi.project.benyi.service.IByTrainVideoScoreService; + +/** + * 培训视频评分Service业务层处理 + * + * @author tsbz + * @date 2020-06-01 + */ +@Service +public class ByTrainVideoScoreServiceImpl implements IByTrainVideoScoreService +{ + @Autowired + private ByTrainVideoScoreMapper byTrainVideoScoreMapper; + + /** + * 查询培训视频评分 + * + * @param id 培训视频评分ID + * @return 培训视频评分 + */ + @Override + public ByTrainVideoScore selectByTrainVideoScoreById(Long id) + { + return byTrainVideoScoreMapper.selectByTrainVideoScoreById(id); + } + + /** + * 查询培训视频评分列表 + * + * @param byTrainVideoScore 培训视频评分 + * @return 培训视频评分 + */ + @Override + public List<ByTrainVideoScore> selectByTrainVideoScoreList(ByTrainVideoScore byTrainVideoScore) + { + return byTrainVideoScoreMapper.selectByTrainVideoScoreList(byTrainVideoScore); + } + + /** + * 新增培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + @Override + public int insertByTrainVideoScore(ByTrainVideoScore byTrainVideoScore) + { + return byTrainVideoScoreMapper.insertByTrainVideoScore(byTrainVideoScore); + } + + /** + * 修改培训视频评分 + * + * @param byTrainVideoScore 培训视频评分 + * @return 结果 + */ + @Override + public int updateByTrainVideoScore(ByTrainVideoScore byTrainVideoScore) + { + return byTrainVideoScoreMapper.updateByTrainVideoScore(byTrainVideoScore); + } + + /** + * 批量删除培训视频评分 + * + * @param ids 需要删除的培训视频评分ID + * @return 结果 + */ + @Override + public int deleteByTrainVideoScoreByIds(Long[] ids) + { + return byTrainVideoScoreMapper.deleteByTrainVideoScoreByIds(ids); + } + + /** + * 删除培训视频评分信息 + * + * @param id 培训视频评分ID + * @return 结果 + */ + @Override + public int deleteByTrainVideoScoreById(Long id) + { + return byTrainVideoScoreMapper.deleteByTrainVideoScoreById(id); + } +} diff --git a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDictMoedataController.java b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDictMoedataController.java index d6f193e54..a28c9956d 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDictMoedataController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/system/controller/SysDictMoedataController.java @@ -85,8 +85,8 @@ public class SysDictMoedataController extends BaseController { */ @PreAuthorize("@ss.hasPermi('system:moedata:remove')") @Log(title = "多级字典管理", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(sysDictMoedataService.deleteSysDictMoedataByIds(ids)); + @DeleteMapping("/{id}") + public AjaxResult remove(@PathVariable Long id) { + return toAjax(sysDictMoedataService.deleteSysDictMoedataById(id)); } } diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java index 29510122c..3bb13f845 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/controller/GenController.java @@ -30,7 +30,7 @@ import com.ruoyi.project.tool.gen.service.IGenTableService; /** * 代码生成 操作处理 - * + * * @author ruoyi */ @RestController @@ -124,6 +124,9 @@ public class GenController extends BaseController return AjaxResult.success(); } + /** + * 删除代码生成 + */ @PreAuthorize("@ss.hasPermi('tool:gen:remove')") @Log(title = "代码生成", businessType = BusinessType.DELETE) @DeleteMapping("/{tableIds}") diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java index 039af5eb2..a26f54e0f 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTable.java @@ -10,7 +10,7 @@ import com.ruoyi.framework.web.domain.BaseEntity; /** * 业务表 gen_table - * + * * @author ruoyi */ public class GenTable extends BaseEntity diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java index 303575f55..50eb5b9c5 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/domain/GenTableColumn.java @@ -6,7 +6,7 @@ import com.ruoyi.framework.web.domain.BaseEntity; /** * 代码生成业务字段表 gen_table_column - * + * * @author ruoyi */ public class GenTableColumn extends BaseEntity diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java index dfd8ddd09..c82b2646c 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableColumnMapper.java @@ -5,22 +5,22 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn; /** * 业务字段 数据层 - * + * * @author ruoyi */ public interface GenTableColumnMapper { /** * 根据表名称查询列信息 - * + * * @param tableName 表名称 * @return 列信息 */ public List<GenTableColumn> selectDbTableColumnsByName(String tableName); - + /** * 查询业务字段列表 - * + * * @param tableId 业务字段编号 * @return 业务字段集合 */ @@ -28,7 +28,7 @@ public interface GenTableColumnMapper /** * 新增业务字段 - * + * * @param genTableColumn 业务字段信息 * @return 结果 */ @@ -36,7 +36,7 @@ public interface GenTableColumnMapper /** * 修改业务字段 - * + * * @param genTableColumn 业务字段信息 * @return 结果 */ @@ -44,7 +44,7 @@ public interface GenTableColumnMapper /** * 批量删除业务字段 - * + * * @param ids 需要删除的数据ID * @return 结果 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java index eae10e485..80d222d68 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/mapper/GenTableMapper.java @@ -5,14 +5,14 @@ import com.ruoyi.project.tool.gen.domain.GenTable; /** * 业务 数据层 - * + * * @author ruoyi */ public interface GenTableMapper { /** * 查询业务列表 - * + * * @param genTable 业务信息 * @return 业务集合 */ @@ -20,7 +20,7 @@ public interface GenTableMapper /** * 查询据库列表 - * + * * @param genTable 业务信息 * @return 数据库表集合 */ @@ -28,7 +28,7 @@ public interface GenTableMapper /** * 查询据库列表 - * + * * @param tableNames 表名称组 * @return 数据库表集合 */ @@ -36,7 +36,7 @@ public interface GenTableMapper /** * 查询表ID业务信息 - * + * * @param id 业务ID * @return 业务信息 */ @@ -44,7 +44,7 @@ public interface GenTableMapper /** * 查询表名称业务信息 - * + * * @param tableName 表名称 * @return 业务信息 */ @@ -52,7 +52,7 @@ public interface GenTableMapper /** * 新增业务 - * + * * @param genTable 业务信息 * @return 结果 */ @@ -60,7 +60,7 @@ public interface GenTableMapper /** * 修改业务 - * + * * @param genTable 业务信息 * @return 结果 */ @@ -68,7 +68,7 @@ public interface GenTableMapper /** * 批量删除业务 - * + * * @param ids 需要删除的数据ID * @return 结果 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java index 38c6359f4..4892c7922 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableColumnServiceImpl.java @@ -9,57 +9,57 @@ import com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper; /** * 业务字段 服务层实现 - * + * * @author ruoyi */ @Service -public class GenTableColumnServiceImpl implements IGenTableColumnService +public class GenTableColumnServiceImpl implements IGenTableColumnService { @Autowired private GenTableColumnMapper genTableColumnMapper; /** - * 查询业务字段列表 - * - * @param genTableColumn 业务字段编号 - * @return 业务字段集合 - */ + * 查询业务字段列表 + * + * @param genTableColumn 业务字段编号 + * @return 业务字段集合 + */ @Override public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) { - return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); - } - - /** - * 新增业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int insertGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.insertGenTableColumn(genTableColumn); - } - - /** - * 修改业务字段 - * - * @param genTableColumn 业务字段信息 - * @return 结果 - */ - @Override - public int updateGenTableColumn(GenTableColumn genTableColumn) - { - return genTableColumnMapper.updateGenTableColumn(genTableColumn); + return genTableColumnMapper.selectGenTableColumnListByTableId(tableId); } /** - * 删除业务字段对象 - * - * @param ids 需要删除的数据ID - * @return 结果 - */ + * 新增业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int insertGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.insertGenTableColumn(genTableColumn); + } + + /** + * 修改业务字段 + * + * @param genTableColumn 业务字段信息 + * @return 结果 + */ + @Override + public int updateGenTableColumn(GenTableColumn genTableColumn) + { + return genTableColumnMapper.updateGenTableColumn(genTableColumn); + } + + /** + * 删除业务字段对象 + * + * @param ids 需要删除的数据ID + * @return 结果 + */ @Override public int deleteGenTableColumnByIds(String ids) { diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java index c9fda50dd..221b4beb2 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/GenTableServiceImpl.java @@ -34,7 +34,7 @@ import com.ruoyi.project.tool.gen.util.VelocityUtils; /** * 业务 服务层实现 - * + * * @author ruoyi */ @Service @@ -50,7 +50,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 查询业务信息 - * + * * @param id 业务ID * @return 业务信息 */ @@ -64,7 +64,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 查询业务列表 - * + * * @param genTable 业务信息 * @return 业务集合 */ @@ -76,7 +76,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 查询据库列表 - * + * * @param genTable 业务信息 * @return 数据库表集合 */ @@ -87,7 +87,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 查询据库列表 - * + * * @param tableNames 表名称组 * @return 数据库表集合 */ @@ -98,7 +98,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 修改业务 - * + * * @param genTable 业务信息 * @return 结果 */ @@ -120,7 +120,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 删除业务对象 - * + * * @param ids 需要删除的数据ID * @return 结果 */ @@ -134,7 +134,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 导入表结构 - * + * * @param tableList 导入表列表 */ @Override @@ -169,7 +169,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 预览代码 - * + * * @param tableId 表编号 * @return 预览数据列表 */ @@ -200,7 +200,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 生成代码 - * + * * @param tableName 表名称 * @return 数据 */ @@ -216,7 +216,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 批量生成代码 - * + * * @param tableNames 表数组 * @return 数据 */ @@ -262,7 +262,7 @@ public class GenTableServiceImpl implements IGenTableService zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); IOUtils.write(sw.toString(), zip, Constants.UTF8); IOUtils.closeQuietly(sw); - zip.flush(); + zip.flush(); zip.closeEntry(); } catch (IOException e) @@ -274,7 +274,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 修改保存参数校验 - * + * * @param genTable 业务信息 */ public void validateEdit(GenTable genTable) @@ -300,7 +300,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 设置主键列信息 - * + * * @param genTable 业务表信息 * @param columns 业务字段列表 */ @@ -322,7 +322,7 @@ public class GenTableServiceImpl implements IGenTableService /** * 设置代码生成其他选项值 - * + * * @param genTable 设置后的生成对象 */ public void setTableFromOptions(GenTable genTable) diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java index d74c3e7c3..ebabb16cc 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableColumnService.java @@ -5,14 +5,14 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn; /** * 业务字段 服务层 - * + * * @author ruoyi */ public interface IGenTableColumnService { /** * 查询业务字段列表 - * + * * @param genTableColumn 业务字段编号 * @return 业务字段集合 */ @@ -20,7 +20,7 @@ public interface IGenTableColumnService /** * 新增业务字段 - * + * * @param genTableColumn 业务字段信息 * @return 结果 */ @@ -28,7 +28,7 @@ public interface IGenTableColumnService /** * 修改业务字段 - * + * * @param genTableColumn 业务字段信息 * @return 结果 */ @@ -36,7 +36,7 @@ public interface IGenTableColumnService /** * 删除业务字段信息 - * + * * @param ids 需要删除的数据ID * @return 结果 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java index 73093fe5e..b910d087b 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/service/IGenTableService.java @@ -6,14 +6,14 @@ import com.ruoyi.project.tool.gen.domain.GenTable; /** * 业务 服务层 - * + * * @author ruoyi */ public interface IGenTableService { /** * 查询业务列表 - * + * * @param genTable 业务信息 * @return 业务集合 */ @@ -21,7 +21,7 @@ public interface IGenTableService /** * 查询据库列表 - * + * * @param genTable 业务信息 * @return 数据库表集合 */ @@ -29,7 +29,7 @@ public interface IGenTableService /** * 查询据库列表 - * + * * @param tableNames 表名称组 * @return 数据库表集合 */ @@ -37,7 +37,7 @@ public interface IGenTableService /** * 查询业务信息 - * + * * @param id 业务ID * @return 业务信息 */ @@ -45,7 +45,7 @@ public interface IGenTableService /** * 修改业务 - * + * * @param genTable 业务信息 * @return 结果 */ @@ -53,7 +53,7 @@ public interface IGenTableService /** * 删除业务信息 - * + * * @param tableIds 需要删除的表数据ID * @return 结果 */ @@ -61,14 +61,14 @@ public interface IGenTableService /** * 导入表结构 - * + * * @param tableList 导入表列表 */ public void importGenTable(List<GenTable> tableList); /** * 预览代码 - * + * * @param tableId 表编号 * @return 预览数据列表 */ @@ -76,7 +76,7 @@ public interface IGenTableService /** * 生成代码 - * + * * @param tableName 表名称 * @return 数据 */ @@ -84,7 +84,7 @@ public interface IGenTableService /** * 批量生成代码 - * + * * @param tableNames 表数组 * @return 数据 */ @@ -92,7 +92,7 @@ public interface IGenTableService /** * 修改保存参数校验 - * + * * @param genTable 业务信息 */ public void validateEdit(GenTable genTable); diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java index 047cd2d5a..a51d837ee 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/GenUtils.java @@ -10,7 +10,7 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn; /** * 代码生成器 工具类 - * + * * @author ruoyi */ public class GenUtils @@ -115,7 +115,7 @@ public class GenUtils /** * 校验数组是否包含指定值 - * + * * @param arr 数组 * @param targetValue 值 * @return 是否包含 @@ -127,7 +127,7 @@ public class GenUtils /** * 获取模块名 - * + * * @param packageName 包名 * @return 模块名 */ @@ -141,7 +141,7 @@ public class GenUtils /** * 获取业务名 - * + * * @param tableName 表名 * @return 业务名 */ @@ -155,7 +155,7 @@ public class GenUtils /** * 表名转换成Java类名 - * + * * @param tableName 表名称 * @return 类名 */ @@ -173,7 +173,7 @@ public class GenUtils /** * 批量替换前缀 - * + * * @param replacementm 替换值 * @param searchList 替换列表 * @return @@ -194,7 +194,7 @@ public class GenUtils /** * 关键字替换 - * + * * @param name 需要被替换的名字 * @return 替换后的名字 */ @@ -205,7 +205,7 @@ public class GenUtils /** * 获取数据库类型字段 - * + * * @param columnType 列类型 * @return 截取后的列类型 */ @@ -223,7 +223,7 @@ public class GenUtils /** * 获取字段长度 - * + * * @param columnType 列类型 * @return 截取后的列类型 */ diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java index 7f932fc3b..939c9d335 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityInitializer.java @@ -6,7 +6,7 @@ import com.ruoyi.common.constant.Constants; /** * VelocityEngine工厂 - * + * * @author RuoYi */ public class VelocityInitializer diff --git a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java index 506582112..5e9732f41 100644 --- a/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java +++ b/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/VelocityUtils.java @@ -21,7 +21,7 @@ public class VelocityUtils /** * 设置模板变量信息 - * + * * @return 模板列表 */ public static VelocityContext prepareContext(GenTable genTable) @@ -81,7 +81,7 @@ public class VelocityUtils /** * 获取模板信息 - * + * * @return 模板列表 */ public static List<String> getTemplateList(String tplCategory) @@ -138,7 +138,7 @@ public class VelocityUtils { fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); } - else if (template.contains("service.java.vm")) + else if (template.contains("serviceImpl.java.vm")) { fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className); } @@ -171,7 +171,7 @@ public class VelocityUtils /** * 获取包前缀 - * + * * @param packageName 包名称 * @return 包前缀名称 */ @@ -184,7 +184,7 @@ public class VelocityUtils /** * 根据列类型获取导入包 - * + * * @param column 列集合 * @return 返回需要导入的包列表 */ @@ -196,6 +196,7 @@ public class VelocityUtils if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) { importList.add("java.util.Date"); + importList.add("com.fasterxml.jackson.annotation.JsonFormat"); } else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) { @@ -207,7 +208,7 @@ public class VelocityUtils /** * 获取权限前缀 - * + * * @param moduleName 模块名称 * @param businessName 业务名称 * @return 返回权限前缀 @@ -220,7 +221,7 @@ public class VelocityUtils /** * 获取树编码 - * + * * @param options 生成其他选项 * @return 树编码 */ @@ -235,7 +236,7 @@ public class VelocityUtils /** * 获取树父编码 - * + * * @param options 生成其他选项 * @return 树父编码 */ @@ -250,7 +251,7 @@ public class VelocityUtils /** * 获取树名称 - * + * * @param options 生成其他选项 * @return 树名称 */ @@ -265,7 +266,7 @@ public class VelocityUtils /** * 获取需要在哪一列上面显示展开按钮 - * + * * @param genTable 业务表对象 * @return 展开按钮列序号 */ diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml new file mode 100644 index 000000000..70ddc308d --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoFeedbackMapper.xml @@ -0,0 +1,74 @@ +<?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.ruoyi.project.benyi.mapper.ByTrainVideoFeedbackMapper"> + + <resultMap type="ByTrainVideoFeedback" id="ByTrainVideoFeedbackResult"> + <result property="id" column="id" /> + <result property="videoid" column="videoid" /> + <result property="content" column="content" /> + <result property="createuserid" column="createuserid" /> + <result property="createtime" column="createtime" /> + </resultMap> + + <sql id="selectByTrainVideoFeedbackVo"> + select id, videoid, content, createuserid, createtime from by_train_video_feedback + </sql> + + <select id="selectByTrainVideoFeedbackList" parameterType="ByTrainVideoFeedback" resultMap="ByTrainVideoFeedbackResult"> + <include refid="selectByTrainVideoFeedbackVo"/> + <where> + <if test="videoid != null "> and videoid = #{videoid}</if> + <if test="content != null and content != ''"> and content = #{content}</if> + <if test="createuserid != null "> and createuserid = #{createuserid}</if> + <if test="createtime != null "> and createtime = #{createtime}</if> + </where> + </select> + + <select id="selectByTrainVideoFeedbackById" parameterType="Long" resultMap="ByTrainVideoFeedbackResult"> + <include refid="selectByTrainVideoFeedbackVo"/> + where id = #{id} + </select> + + <insert id="insertByTrainVideoFeedback" parameterType="ByTrainVideoFeedback"> + insert into by_train_video_feedback + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null ">id,</if> + <if test="videoid != null ">videoid,</if> + <if test="content != null and content != ''">content,</if> + <if test="createuserid != null ">createuserid,</if> + <if test="createtime != null ">createtime,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null ">#{id},</if> + <if test="videoid != null ">#{videoid},</if> + <if test="content != null and content != ''">#{content},</if> + <if test="createuserid != null ">#{createuserid},</if> + <if test="createtime != null ">#{createtime},</if> + </trim> + </insert> + + <update id="updateByTrainVideoFeedback" parameterType="ByTrainVideoFeedback"> + update by_train_video_feedback + <trim prefix="SET" suffixOverrides=","> + <if test="videoid != null ">videoid = #{videoid},</if> + <if test="content != null and content != ''">content = #{content},</if> + <if test="createuserid != null ">createuserid = #{createuserid},</if> + <if test="createtime != null ">createtime = #{createtime},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteByTrainVideoFeedbackById" parameterType="Long"> + delete from by_train_video_feedback where id = #{id} + </delete> + + <delete id="deleteByTrainVideoFeedbackByIds" parameterType="String"> + delete from by_train_video_feedback where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> + +</mapper> \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoScoreMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoScoreMapper.xml new file mode 100644 index 000000000..06ab71ddf --- /dev/null +++ b/ruoyi/src/main/resources/mybatis/benyi/ByTrainVideoScoreMapper.xml @@ -0,0 +1,79 @@ +<?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.ruoyi.project.benyi.mapper.ByTrainVideoScoreMapper"> + + <resultMap type="ByTrainVideoScore" id="ByTrainVideoScoreResult"> + <result property="id" column="id" /> + <result property="videoid" column="videoid" /> + <result property="lecturerid" column="lecturerid" /> + <result property="score" column="score" /> + <result property="createuserid" column="createuserid" /> + <result property="createtime" column="createtime" /> + </resultMap> + + <sql id="selectByTrainVideoScoreVo"> + select id, videoid, lecturerid, score, createuserid, createtime from by_train_video_score + </sql> + + <select id="selectByTrainVideoScoreList" parameterType="ByTrainVideoScore" resultMap="ByTrainVideoScoreResult"> + <include refid="selectByTrainVideoScoreVo"/> + <where> + <if test="videoid != null "> and videoid = #{videoid}</if> + <if test="lecturerid != null "> and lecturerid = #{lecturerid}</if> + <if test="score != null "> and score = #{score}</if> + <if test="createuserid != null "> and createuserid = #{createuserid}</if> + <if test="createtime != null "> and createtime = #{createtime}</if> + </where> + </select> + + <select id="selectByTrainVideoScoreById" parameterType="Long" resultMap="ByTrainVideoScoreResult"> + <include refid="selectByTrainVideoScoreVo"/> + where id = #{id} + </select> + + <insert id="insertByTrainVideoScore" parameterType="ByTrainVideoScore"> + insert into by_train_video_score + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null ">id,</if> + <if test="videoid != null ">videoid,</if> + <if test="lecturerid != null ">lecturerid,</if> + <if test="score != null ">score,</if> + <if test="createuserid != null ">createuserid,</if> + <if test="createtime != null ">createtime,</if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null ">#{id},</if> + <if test="videoid != null ">#{videoid},</if> + <if test="lecturerid != null ">#{lecturerid},</if> + <if test="score != null ">#{score},</if> + <if test="createuserid != null ">#{createuserid},</if> + <if test="createtime != null ">#{createtime},</if> + </trim> + </insert> + + <update id="updateByTrainVideoScore" parameterType="ByTrainVideoScore"> + update by_train_video_score + <trim prefix="SET" suffixOverrides=","> + <if test="videoid != null ">videoid = #{videoid},</if> + <if test="lecturerid != null ">lecturerid = #{lecturerid},</if> + <if test="score != null ">score = #{score},</if> + <if test="createuserid != null ">createuserid = #{createuserid},</if> + <if test="createtime != null ">createtime = #{createtime},</if> + </trim> + where id = #{id} + </update> + + <delete id="deleteByTrainVideoScoreById" parameterType="Long"> + delete from by_train_video_score where id = #{id} + </delete> + + <delete id="deleteByTrainVideoScoreByIds" parameterType="String"> + delete from by_train_video_score where id in + <foreach item="id" collection="array" open="(" separator="," close=")"> + #{id} + </foreach> + </delete> + +</mapper> \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/system/SysDictMoedataMapper.xml b/ruoyi/src/main/resources/mybatis/system/SysDictMoedataMapper.xml index 08c422bbf..ad808f83f 100644 --- a/ruoyi/src/main/resources/mybatis/system/SysDictMoedataMapper.xml +++ b/ruoyi/src/main/resources/mybatis/system/SysDictMoedataMapper.xml @@ -78,11 +78,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" </update> <delete id="deleteSysDictMoedataById" parameterType="Long"> - update from sys_dict_moedata set isdel='1' where id = #{id} + update sys_dict_moedata set isdel='1' where id = #{id} </delete> <delete id="deleteSysDictMoedataByIds" parameterType="String"> - update from sys_dict_moedata set isdel='1' where id in + update sys_dict_moedata set isdel='1' where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> diff --git a/ruoyi/src/main/resources/mybatis/tool/GenTableColumnMapper.xml b/ruoyi/src/main/resources/mybatis/tool/GenTableColumnMapper.xml index c936fe07f..813c314e0 100644 --- a/ruoyi/src/main/resources/mybatis/tool/GenTableColumnMapper.xml +++ b/ruoyi/src/main/resources/mybatis/tool/GenTableColumnMapper.xml @@ -1,9 +1,9 @@ <?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"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper"> - + <resultMap type="GenTableColumn" id="GenTableColumnResult"> <id property="columnId" column="column_id" /> <result property="tableId" column="table_id" /> @@ -28,67 +28,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> </resultMap> - - <sql id="selectGenTableColumnVo"> + + <sql id="selectGenTableColumnVo"> select column_id, table_id, column_name, column_comment, column_type, java_type, java_field, is_pk, is_increment, is_required, is_insert, is_edit, is_list, is_query, query_type, html_type, dict_type, sort, create_by, create_time, update_by, update_time from gen_table_column </sql> - + <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult"> <include refid="selectGenTableColumnVo"/> where table_id = #{tableId} order by sort </select> - + <select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> select column_name, (case when (is_nullable = 'no' <![CDATA[ && ]]> column_key != 'PRI') then '1' else null end) as is_required, (case when column_key = 'PRI' then '1' else '0' end) as is_pk, ordinal_position as sort, column_comment, (case when extra = 'auto_increment' then '1' else '0' end) as is_increment, column_type from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName}) order by ordinal_position </select> - + <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> insert into gen_table_column ( - <if test="tableId != null and tableId != ''">table_id,</if> - <if test="columnName != null and columnName != ''">column_name,</if> - <if test="columnComment != null and columnComment != ''">column_comment,</if> - <if test="columnType != null and columnType != ''">column_type,</if> - <if test="javaType != null and javaType != ''">java_type,</if> - <if test="javaField != null and javaField != ''">java_field,</if> - <if test="isPk != null and isPk != ''">is_pk,</if> - <if test="isIncrement != null and isIncrement != ''">is_increment,</if> - <if test="isRequired != null and isRequired != ''">is_required,</if> - <if test="isInsert != null and isInsert != ''">is_insert,</if> - <if test="isEdit != null and isEdit != ''">is_edit,</if> - <if test="isList != null and isList != ''">is_list,</if> - <if test="isQuery != null and isQuery != ''">is_query,</if> - <if test="queryType != null and queryType != ''">query_type,</if> - <if test="htmlType != null and htmlType != ''">html_type,</if> - <if test="dictType != null and dictType != ''">dict_type,</if> - <if test="sort != null">sort,</if> - <if test="createBy != null and createBy != ''">create_by,</if> - create_time - )values( - <if test="tableId != null and tableId != ''">#{tableId},</if> - <if test="columnName != null and columnName != ''">#{columnName},</if> - <if test="columnComment != null and columnComment != ''">#{columnComment},</if> - <if test="columnType != null and columnType != ''">#{columnType},</if> - <if test="javaType != null and javaType != ''">#{javaType},</if> - <if test="javaField != null and javaField != ''">#{javaField},</if> - <if test="isPk != null and isPk != ''">#{isPk},</if> - <if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if> - <if test="isRequired != null and isRequired != ''">#{isRequired},</if> - <if test="isInsert != null and isInsert != ''">#{isInsert},</if> - <if test="isEdit != null and isEdit != ''">#{isEdit},</if> - <if test="isList != null and isList != ''">#{isList},</if> - <if test="isQuery != null and isQuery != ''">#{isQuery},</if> - <if test="queryType != null and queryType != ''">#{queryType},</if> - <if test="htmlType != null and htmlType != ''">#{htmlType},</if> - <if test="dictType != null and dictType != ''">#{dictType},</if> - <if test="sort != null">#{sort},</if> - <if test="createBy != null and createBy != ''">#{createBy},</if> - sysdate() - ) + <if test="tableId != null and tableId != ''">table_id,</if> + <if test="columnName != null and columnName != ''">column_name,</if> + <if test="columnComment != null and columnComment != ''">column_comment,</if> + <if test="columnType != null and columnType != ''">column_type,</if> + <if test="javaType != null and javaType != ''">java_type,</if> + <if test="javaField != null and javaField != ''">java_field,</if> + <if test="isPk != null and isPk != ''">is_pk,</if> + <if test="isIncrement != null and isIncrement != ''">is_increment,</if> + <if test="isRequired != null and isRequired != ''">is_required,</if> + <if test="isInsert != null and isInsert != ''">is_insert,</if> + <if test="isEdit != null and isEdit != ''">is_edit,</if> + <if test="isList != null and isList != ''">is_list,</if> + <if test="isQuery != null and isQuery != ''">is_query,</if> + <if test="queryType != null and queryType != ''">query_type,</if> + <if test="htmlType != null and htmlType != ''">html_type,</if> + <if test="dictType != null and dictType != ''">dict_type,</if> + <if test="sort != null">sort,</if> + <if test="createBy != null and createBy != ''">create_by,</if> + create_time + )values( + <if test="tableId != null and tableId != ''">#{tableId},</if> + <if test="columnName != null and columnName != ''">#{columnName},</if> + <if test="columnComment != null and columnComment != ''">#{columnComment},</if> + <if test="columnType != null and columnType != ''">#{columnType},</if> + <if test="javaType != null and javaType != ''">#{javaType},</if> + <if test="javaField != null and javaField != ''">#{javaField},</if> + <if test="isPk != null and isPk != ''">#{isPk},</if> + <if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if> + <if test="isRequired != null and isRequired != ''">#{isRequired},</if> + <if test="isInsert != null and isInsert != ''">#{isInsert},</if> + <if test="isEdit != null and isEdit != ''">#{isEdit},</if> + <if test="isList != null and isList != ''">#{isList},</if> + <if test="isQuery != null and isQuery != ''">#{isQuery},</if> + <if test="queryType != null and queryType != ''">#{queryType},</if> + <if test="htmlType != null and htmlType != ''">#{htmlType},</if> + <if test="dictType != null and dictType != ''">#{dictType},</if> + <if test="sort != null">#{sort},</if> + <if test="createBy != null and createBy != ''">#{createBy},</if> + sysdate() + ) </insert> - + <update id="updateGenTableColumn" parameterType="GenTableColumn"> update gen_table_column <set> @@ -111,10 +111,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" </update> <delete id="deleteGenTableColumnByIds" parameterType="Long"> - delete from gen_table_column where table_id in + delete from gen_table_column where table_id in <foreach collection="array" item="tableId" open="(" separator="," close=")"> #{tableId} </foreach> </delete> - + </mapper> \ No newline at end of file diff --git a/ruoyi/src/main/resources/mybatis/tool/GenTableMapper.xml b/ruoyi/src/main/resources/mybatis/tool/GenTableMapper.xml index d688599a7..c810f8e13 100644 --- a/ruoyi/src/main/resources/mybatis/tool/GenTableMapper.xml +++ b/ruoyi/src/main/resources/mybatis/tool/GenTableMapper.xml @@ -1,11 +1,11 @@ <?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"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableMapper"> <resultMap type="GenTable" id="GenTableResult"> - <id property="tableId" column="table_id" /> + <id property="tableId" column="table_id" /> <result property="tableName" column="table_name" /> <result property="tableComment" column="table_comment" /> <result property="className" column="class_name" /> @@ -23,37 +23,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <result property="remark" column="remark" /> <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" /> </resultMap> - + <resultMap type="GenTableColumn" id="GenTableColumnResult"> - <id property="columnId" column="column_id" /> - <result property="tableId" column="table_id" /> - <result property="columnName" column="column_name" /> - <result property="columnComment" column="column_comment" /> - <result property="columnType" column="column_type" /> - <result property="javaType" column="java_type" /> - <result property="javaField" column="java_field" /> - <result property="isPk" column="is_pk" /> - <result property="isIncrement" column="is_increment" /> - <result property="isRequired" column="is_required" /> - <result property="isInsert" column="is_insert" /> - <result property="isEdit" column="is_edit" /> - <result property="isList" column="is_list" /> - <result property="isQuery" column="is_query" /> - <result property="queryType" column="query_type" /> - <result property="htmlType" column="html_type" /> - <result property="dictType" column="dict_type" /> - <result property="sort" column="sort" /> - <result property="createBy" column="create_by" /> - <result property="createTime" column="create_time" /> - <result property="updateBy" column="update_by" /> - <result property="updateTime" column="update_time" /> - </resultMap> - + <id property="columnId" column="column_id" /> + <result property="tableId" column="table_id" /> + <result property="columnName" column="column_name" /> + <result property="columnComment" column="column_comment" /> + <result property="columnType" column="column_type" /> + <result property="javaType" column="java_type" /> + <result property="javaField" column="java_field" /> + <result property="isPk" column="is_pk" /> + <result property="isIncrement" column="is_increment" /> + <result property="isRequired" column="is_required" /> + <result property="isInsert" column="is_insert" /> + <result property="isEdit" column="is_edit" /> + <result property="isList" column="is_list" /> + <result property="isQuery" column="is_query" /> + <result property="queryType" column="query_type" /> + <result property="htmlType" column="html_type" /> + <result property="dictType" column="dict_type" /> + <result property="sort" column="sort" /> + <result property="createBy" column="create_by" /> + <result property="createTime" column="create_time" /> + <result property="updateBy" column="update_by" /> + <result property="updateTime" column="update_time" /> + </resultMap> + <sql id="selectGenTableVo"> select table_id, table_name, table_comment, class_name, tpl_category, package_name, module_name, business_name, function_name, function_author, options, create_by, create_time, update_by, update_time, remark from gen_table </sql> - - <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> + + <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> <include refid="selectGenTableVo"/> <where> <if test="tableName != null and tableName != ''"> @@ -62,12 +62,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <if test="tableComment != null and tableComment != ''"> AND lower(table_comment) like lower(concat('%', #{tableComment}, '%')) </if> -<!-- <if test="beginTime != null and beginTime != ''">开始时间检索 --> -<!-- AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d') --> -<!-- </if> --> -<!-- <if test="endTime != null and endTime != ''">结束时间检索 --> -<!-- AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') --> -<!-- </if> --> + <!-- <if test="beginTime != null and beginTime != ''">开始时间检索 --> + <!-- AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d') --> + <!-- </if> --> + <!-- <if test="endTime != null and endTime != ''">结束时间检索 --> + <!-- AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') --> + <!-- </if> --> </where> </select> @@ -89,22 +89,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d') </if> </select> - + <select id="selectDbTableListByNames" resultMap="GenTableResult"> select table_name, table_comment, create_time, update_time from information_schema.tables where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database()) and table_name in - <foreach collection="array" item="name" open="(" separator="," close=")"> - #{name} - </foreach> + <foreach collection="array" item="name" open="(" separator="," close=")"> + #{name} + </foreach> </select> - + <select id="selectTableByName" parameterType="String" resultMap="GenTableResult"> select table_name, table_comment, create_time, update_time from information_schema.tables where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database()) and table_name = #{tableName} </select> - + <select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort @@ -112,7 +112,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN gen_table_column c ON t.table_id = c.table_id where t.table_id = #{tableId} order by c.sort </select> - + <select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> SELECT t.table_id, t.table_name, t.table_comment, t.class_name, t.tpl_category, t.package_name, t.module_name, t.business_name, t.function_name, t.function_author, t.options, t.remark, c.column_id, c.column_name, c.column_comment, c.column_type, c.java_type, c.java_field, c.is_pk, c.is_increment, c.is_required, c.is_insert, c.is_edit, c.is_list, c.is_query, c.query_type, c.html_type, c.dict_type, c.sort @@ -120,62 +120,62 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN gen_table_column c ON t.table_id = c.table_id where t.table_name = #{tableName} order by c.sort </select> - - <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId"> - insert into gen_table ( - <if test="tableName != null">table_name,</if> - <if test="tableComment != null and tableComment != ''">table_comment,</if> - <if test="className != null and className != ''">class_name,</if> - <if test="tplCategory != null and tplCategory != ''">tpl_category,</if> - <if test="packageName != null and packageName != ''">package_name,</if> - <if test="moduleName != null and moduleName != ''">module_name,</if> - <if test="businessName != null and businessName != ''">business_name,</if> - <if test="functionName != null and functionName != ''">function_name,</if> - <if test="functionAuthor != null and functionAuthor != ''">function_author,</if> - <if test="remark != null and remark != ''">remark,</if> - <if test="createBy != null and createBy != ''">create_by,</if> - create_time - )values( - <if test="tableName != null">#{tableName},</if> - <if test="tableComment != null and tableComment != ''">#{tableComment},</if> - <if test="className != null and className != ''">#{className},</if> - <if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if> - <if test="packageName != null and packageName != ''">#{packageName},</if> - <if test="moduleName != null and moduleName != ''">#{moduleName},</if> - <if test="businessName != null and businessName != ''">#{businessName},</if> - <if test="functionName != null and functionName != ''">#{functionName},</if> - <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if> - <if test="remark != null and remark != ''">#{remark},</if> - <if test="createBy != null and createBy != ''">#{createBy},</if> - sysdate() - ) - </insert> - - <update id="updateGenTable" parameterType="GenTable"> - update gen_table - <set> - <if test="tableName != null">table_name = #{tableName},</if> - <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if> - <if test="className != null and className != ''">class_name = #{className},</if> - <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if> - <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if> - <if test="packageName != null and packageName != ''">package_name = #{packageName},</if> - <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if> - <if test="businessName != null and businessName != ''">business_name = #{businessName},</if> - <if test="functionName != null and functionName != ''">function_name = #{functionName},</if> - <if test="options != null and options != ''">options = #{options},</if> - <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> - <if test="remark != null">remark = #{remark},</if> - update_time = sysdate() - </set> - where table_id = #{tableId} - </update> - - <delete id="deleteGenTableByIds" parameterType="Long"> - delete from gen_table where table_id in - <foreach collection="array" item="tableId" open="(" separator="," close=")"> - #{tableId} - </foreach> - </delete> -</mapper> \ No newline at end of file + <insert id="insertGenTable" parameterType="GenTable" useGeneratedKeys="true" keyProperty="tableId"> + insert into gen_table ( + <if test="tableName != null">table_name,</if> + <if test="tableComment != null and tableComment != ''">table_comment,</if> + <if test="className != null and className != ''">class_name,</if> + <if test="tplCategory != null and tplCategory != ''">tpl_category,</if> + <if test="packageName != null and packageName != ''">package_name,</if> + <if test="moduleName != null and moduleName != ''">module_name,</if> + <if test="businessName != null and businessName != ''">business_name,</if> + <if test="functionName != null and functionName != ''">function_name,</if> + <if test="functionAuthor != null and functionAuthor != ''">function_author,</if> + <if test="remark != null and remark != ''">remark,</if> + <if test="createBy != null and createBy != ''">create_by,</if> + create_time + )values( + <if test="tableName != null">#{tableName},</if> + <if test="tableComment != null and tableComment != ''">#{tableComment},</if> + <if test="className != null and className != ''">#{className},</if> + <if test="tplCategory != null and tplCategory != ''">#{tplCategory},</if> + <if test="packageName != null and packageName != ''">#{packageName},</if> + <if test="moduleName != null and moduleName != ''">#{moduleName},</if> + <if test="businessName != null and businessName != ''">#{businessName},</if> + <if test="functionName != null and functionName != ''">#{functionName},</if> + <if test="functionAuthor != null and functionAuthor != ''">#{functionAuthor},</if> + <if test="remark != null and remark != ''">#{remark},</if> + <if test="createBy != null and createBy != ''">#{createBy},</if> + sysdate() + ) + </insert> + + <update id="updateGenTable" parameterType="GenTable"> + update gen_table + <set> + <if test="tableName != null">table_name = #{tableName},</if> + <if test="tableComment != null and tableComment != ''">table_comment = #{tableComment},</if> + <if test="className != null and className != ''">class_name = #{className},</if> + <if test="functionAuthor != null and functionAuthor != ''">function_author = #{functionAuthor},</if> + <if test="tplCategory != null and tplCategory != ''">tpl_category = #{tplCategory},</if> + <if test="packageName != null and packageName != ''">package_name = #{packageName},</if> + <if test="moduleName != null and moduleName != ''">module_name = #{moduleName},</if> + <if test="businessName != null and businessName != ''">business_name = #{businessName},</if> + <if test="functionName != null and functionName != ''">function_name = #{functionName},</if> + <if test="options != null and options != ''">options = #{options},</if> + <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if> + <if test="remark != null">remark = #{remark},</if> + update_time = sysdate() + </set> + where table_id = #{tableId} + </update> + + <delete id="deleteGenTableByIds" parameterType="Long"> + delete from gen_table where table_id in + <foreach collection="array" item="tableId" open="(" separator="," close=")"> + #{tableId} + </foreach> + </delete> + +</mapper> \ No newline at end of file diff --git a/ruoyi/src/main/resources/vm/java/controller.java.vm b/ruoyi/src/main/resources/vm/java/controller.java.vm index c45ba6699..a5b19b425 100644 --- a/ruoyi/src/main/resources/vm/java/controller.java.vm +++ b/ruoyi/src/main/resources/vm/java/controller.java.vm @@ -25,7 +25,7 @@ import com.ruoyi.framework.web.page.TableDataInfo; /** * ${functionName}Controller - * + * * @author ${author} * @date ${datetime} */ @@ -36,25 +36,25 @@ public class ${ClassName}Controller extends BaseController @Autowired private I${ClassName}Service ${className}Service; - /** - * 查询${functionName}列表 - */ - @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") - @GetMapping("/list") -#if($table.crud) +/** + * 查询${functionName}列表 + */ +@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") +@GetMapping("/list") + #if($table.crud) public TableDataInfo list(${ClassName} ${className}) { startPage(); List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); return getDataTable(list); } -#elseif($table.tree) - public AjaxResult list(${ClassName} ${className}) - { - List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); - return AjaxResult.success(list); - } -#end + #elseif($table.tree) + public AjaxResult list(${ClassName} ${className}) + { + List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); + return AjaxResult.success(list); + } + #end /** * 导出${functionName}列表 @@ -106,7 +106,7 @@ public class ${ClassName}Controller extends BaseController */ @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") @Log(title = "${functionName}", businessType = BusinessType.DELETE) - @DeleteMapping("/{${pkColumn.javaField}s}") + @DeleteMapping("/{${pkColumn.javaField}s}") public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) { return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s)); diff --git a/ruoyi/src/main/resources/vm/java/domain.java.vm b/ruoyi/src/main/resources/vm/java/domain.java.vm index e99ef2cf2..4751cc596 100644 --- a/ruoyi/src/main/resources/vm/java/domain.java.vm +++ b/ruoyi/src/main/resources/vm/java/domain.java.vm @@ -1,5 +1,8 @@ package ${packageName}.domain; +#foreach ($import in $importList) +import ${import}; +#end import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.framework.aspectj.lang.annotation.Excel; @@ -8,77 +11,75 @@ import com.ruoyi.framework.web.domain.BaseEntity; #elseif($table.tree) import com.ruoyi.framework.web.domain.TreeEntity; #end -#foreach ($import in $importList) -import ${import}; -#end /** * ${functionName}对象 ${tableName} - * + * * @author ${author} * @date ${datetime} */ #if($table.crud) -#set($Entity="BaseEntity") + #set($Entity="BaseEntity") #elseif($table.tree) -#set($Entity="TreeEntity") + #set($Entity="TreeEntity") #end public class ${ClassName} extends ${Entity} -{ - private static final long serialVersionUID = 1L; + { +private static final long serialVersionUID = 1L; #foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) + #if(!$table.isSuperColumn($column.javaField)) /** $column.columnComment */ -#if($column.list) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($parentheseIndex != -1) - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") -#elseif($column.javaType == 'Date') - @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") -#else - @Excel(name = "${comment}") -#end -#end + #if($column.list) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($parentheseIndex != -1) + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + #elseif($column.javaType == 'Date') + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") + #else + @Excel(name = "${comment}") + #end + #end private $column.javaType $column.javaField; -#end + #end #end #foreach ($column in $columns) -#if(!$table.isSuperColumn($column.javaField)) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end - public void set${AttrName}($column.javaType $column.javaField) - { - this.$column.javaField = $column.javaField; - } + #if(!$table.isSuperColumn($column.javaField)) + #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) + #set($AttrName=$column.javaField) + #else + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #end + public void set${AttrName}($column.javaType $column.javaField) + { + this.$column.javaField = $column.javaField; + } - public $column.javaType get${AttrName}() - { - return $column.javaField; - } -#end + public $column.javaType get${AttrName}() + { + return $column.javaField; + } + #end #end - @Override - public String toString() { +@Override +public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) -#foreach ($column in $columns) -#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) -#set($AttrName=$column.javaField) -#else -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#end + #foreach ($column in $columns) + #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) + #set($AttrName=$column.javaField) + #else + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #end .append("${column.javaField}", get${AttrName}()) -#end - .toString(); - } -} + #end + .toString(); + } + } diff --git a/ruoyi/src/main/resources/vm/java/mapper.java.vm b/ruoyi/src/main/resources/vm/java/mapper.java.vm index 5502baf6d..783a553a4 100644 --- a/ruoyi/src/main/resources/vm/java/mapper.java.vm +++ b/ruoyi/src/main/resources/vm/java/mapper.java.vm @@ -5,15 +5,15 @@ import ${packageName}.domain.${ClassName}; /** * ${functionName}Mapper接口 - * + * * @author ${author} * @date ${datetime} */ -public interface ${ClassName}Mapper +public interface ${ClassName}Mapper { /** * 查询${functionName} - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return ${functionName} */ @@ -21,7 +21,7 @@ public interface ${ClassName}Mapper /** * 查询${functionName}列表 - * + * * @param ${className} ${functionName} * @return ${functionName}集合 */ @@ -29,7 +29,7 @@ public interface ${ClassName}Mapper /** * 新增${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @@ -37,7 +37,7 @@ public interface ${ClassName}Mapper /** * 修改${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @@ -45,7 +45,7 @@ public interface ${ClassName}Mapper /** * 删除${functionName} - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return 结果 */ @@ -53,7 +53,7 @@ public interface ${ClassName}Mapper /** * 批量删除${functionName} - * + * * @param ${pkColumn.javaField}s 需要删除的数据ID * @return 结果 */ diff --git a/ruoyi/src/main/resources/vm/java/service.java.vm b/ruoyi/src/main/resources/vm/java/service.java.vm index af422f342..5d910f500 100644 --- a/ruoyi/src/main/resources/vm/java/service.java.vm +++ b/ruoyi/src/main/resources/vm/java/service.java.vm @@ -5,15 +5,15 @@ import ${packageName}.domain.${ClassName}; /** * ${functionName}Service接口 - * + * * @author ${author} * @date ${datetime} */ -public interface I${ClassName}Service +public interface I${ClassName}Service { /** * 查询${functionName} - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return ${functionName} */ @@ -21,7 +21,7 @@ public interface I${ClassName}Service /** * 查询${functionName}列表 - * + * * @param ${className} ${functionName} * @return ${functionName}集合 */ @@ -29,7 +29,7 @@ public interface I${ClassName}Service /** * 新增${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @@ -37,7 +37,7 @@ public interface I${ClassName}Service /** * 修改${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @@ -45,7 +45,7 @@ public interface I${ClassName}Service /** * 批量删除${functionName} - * + * * @param ${pkColumn.javaField}s 需要删除的${functionName}ID * @return 结果 */ @@ -53,7 +53,7 @@ public interface I${ClassName}Service /** * 删除${functionName}信息 - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return 结果 */ diff --git a/ruoyi/src/main/resources/vm/java/serviceImpl.java.vm b/ruoyi/src/main/resources/vm/java/serviceImpl.java.vm index 05a3de84c..3f6997b40 100644 --- a/ruoyi/src/main/resources/vm/java/serviceImpl.java.vm +++ b/ruoyi/src/main/resources/vm/java/serviceImpl.java.vm @@ -1,12 +1,12 @@ package ${packageName}.service.impl; import java.util.List; -#foreach ($column in $columns) -#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') -import com.ruoyi.common.utils.DateUtils; -#break -#end -#end + #foreach ($column in $columns) + #if($column.javaField == 'createTime' || $column.javaField == 'updateTime') + import com.ruoyi.common.utils.DateUtils; + #break + #end + #end import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import ${packageName}.mapper.${ClassName}Mapper; @@ -15,19 +15,19 @@ import ${packageName}.service.I${ClassName}Service; /** * ${functionName}Service业务层处理 - * + * * @author ${author} * @date ${datetime} */ @Service -public class ${ClassName}ServiceImpl implements I${ClassName}Service +public class ${ClassName}ServiceImpl implements I${ClassName}Service { @Autowired private ${ClassName}Mapper ${className}Mapper; /** * 查询${functionName} - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return ${functionName} */ @@ -39,7 +39,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service /** * 查询${functionName}列表 - * + * * @param ${className} ${functionName} * @return ${functionName} */ @@ -51,41 +51,41 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service /** * 新增${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @Override public int insert${ClassName}(${ClassName} ${className}) { -#foreach ($column in $columns) -#if($column.javaField == 'createTime') - ${className}.setCreateTime(DateUtils.getNowDate()); -#end -#end + #foreach ($column in $columns) + #if($column.javaField == 'createTime') + ${className}.setCreateTime(DateUtils.getNowDate()); + #end + #end return ${className}Mapper.insert${ClassName}(${className}); } /** * 修改${functionName} - * + * * @param ${className} ${functionName} * @return 结果 */ @Override public int update${ClassName}(${ClassName} ${className}) { -#foreach ($column in $columns) -#if($column.javaField == 'updateTime') - ${className}.setUpdateTime(DateUtils.getNowDate()); -#end -#end + #foreach ($column in $columns) + #if($column.javaField == 'updateTime') + ${className}.setUpdateTime(DateUtils.getNowDate()); + #end + #end return ${className}Mapper.update${ClassName}(${className}); } /** * 批量删除${functionName} - * + * * @param ${pkColumn.javaField}s 需要删除的${functionName}ID * @return 结果 */ @@ -97,7 +97,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service /** * 删除${functionName}信息 - * + * * @param ${pkColumn.javaField} ${functionName}ID * @return 结果 */ diff --git a/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm b/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm index 280417a32..ff8f4e424 100644 --- a/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm +++ b/ruoyi/src/main/resources/vm/vue/index-tree.vue.vm @@ -1,410 +1,407 @@ <template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="请输入${comment}" - clearable - size="small" - @keyup.enter.native="handleQuery" - /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> - <el-option - v-for="dict in ${column.javaField}Options" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> - <el-option label="请选择字典生成" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable size="small" style="width: 200px" - v-model="queryParams.${column.javaField}" - type="date" - value-format="yyyy-MM-dd" - placeholder="选择${comment}"> - </el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button - class="filter-item" - type="primary" - icon="el-icon-search" - size="mini" - @click="handleQuery" - >搜索</el-button> - <el-button - class="filter-item" - type="primary" - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >新增</el-button> - </el-form-item> - </el-form> + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + #foreach($column in $columns) + #if($column.query) + #set($dictType=$column.dictType) + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($column.htmlType == "input") + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-input + v-model="queryParams.${column.javaField}" + placeholder="请输入${comment}" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> + <el-option + v-for="dict in ${column.javaField}Options" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> + <el-option label="请选择字典生成" value="" /> + </el-select> + </el-form-item> + #elseif($column.htmlType == "datetime") + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-date-picker clearable size="small" style="width: 200px" + v-model="queryParams.${column.javaField}" + type="date" + value-format="yyyy-MM-dd" + placeholder="选择${comment}"> + </el-date-picker> + </el-form-item> + #end + #end + #end + <el-form-item> + <el-button + class="filter-item" + type="primary" + icon="el-icon-search" + size="mini" + @click="handleQuery" + >搜索</el-button> + <el-button + class="filter-item" + type="primary" + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['${moduleName}:${businessName}:add']" + >新增</el-button> + </el-form-item> + </el-form> - <el-table - v-loading="loading" - :data="${businessName}List" - row-key="${treeCode}" - default-expand-all - :tree-props="{children: 'children', hasChildren: 'hasChildren'}" - > -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.${javaField}) }}</span> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> -#elseif($column.list && "" != $javaField) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >修改</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >删除</el-button> - </template> - </el-table-column> - </el-table> + <el-table + v-loading="loading" + :data="${businessName}List" + row-key="${treeCode}" + default-expand-all + :tree-props="{children: 'children', hasChildren: 'hasChildren'}" + > + #foreach($column in $columns) + #set($javaField=$column.javaField) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($column.pk) + #elseif($column.list && $column.htmlType == "datetime") + <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + #elseif($column.list && "" != $column.dictType) + <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> + #elseif($column.list && "" != $javaField) + <el-table-column label="${comment}" align="center" prop="${javaField}" /> + #end + #end + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['${moduleName}:${businessName}:edit']" + >修改</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['${moduleName}:${businessName}:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> - <!-- 添加或修改${functionName}对话框 --> - <el-dialog :title="title" :visible.sync="open" width="500px"> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if("" != $treeParentCode && $column.javaField == $treeParentCode) - <el-form-item label="${comment}" prop="${treeParentCode}"> - <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" /> - </el-form-item> -#elseif($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="请输入${comment}" /> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}"> - <el-select v-model="form.${field}" placeholder="请选择${comment}"> - <el-option - v-for="dict in ${field}Options" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}"> - <el-select v-model="form.${field}" placeholder="请选择${comment}"> - <el-option label="请选择字典生成" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in ${field}Options" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">请选择字典生成</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable size="small" style="width: 200px" - v-model="form.${field}" - type="date" - value-format="yyyy-MM-dd" - placeholder="选择${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> - </el-form-item> -#end -#end -#end -#end - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">确 定</el-button> - <el-button @click="cancel">取 消</el-button> - </div> - </el-dialog> - </div> + <!-- 添加或修改${functionName}对话框 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + #foreach($column in $columns) + #set($field=$column.javaField) + #if($column.insert && !$column.pk) + #if(($column.usableColumn) || (!$column.superColumn)) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #set($dictType=$column.dictType) + #if("" != $treeParentCode && $column.javaField == $treeParentCode) + <el-form-item label="${comment}" prop="${treeParentCode}"> + <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" /> + </el-form-item> + #elseif($column.htmlType == "input") + <el-form-item label="${comment}" prop="${field}"> + <el-input v-model="form.${field}" placeholder="请输入${comment}" /> + </el-form-item> + #elseif($column.htmlType == "select" && "" != $dictType) + <el-form-item label="${comment}"> + <el-select v-model="form.${field}" placeholder="请选择${comment}"> + <el-option + v-for="dict in ${field}Options" + :key="dict.dictValue" + :label="dict.dictLabel" + #if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end + + ></el-option> + </el-select> + </el-form-item> + #elseif($column.htmlType == "select" && $dictType) + <el-form-item label="${comment}"> + <el-select v-model="form.${field}" placeholder="请选择${comment}"> + <el-option label="请选择字典生成" value="" /> + </el-select> + </el-form-item> + #elseif($column.htmlType == "radio" && "" != $dictType) + <el-form-item label="${comment}"> + <el-radio-group v-model="form.${field}"> + <el-radio + v-for="dict in ${field}Options" + :key="dict.dictValue" + #if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end + + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + #elseif($column.htmlType == "radio" && $dictType) + <el-form-item label="${comment}"> + <el-radio-group v-model="form.${field}"> + <el-radio label="1">请选择字典生成</el-radio> + </el-radio-group> + </el-form-item> + #elseif($column.htmlType == "datetime") + <el-form-item label="${comment}" prop="${field}"> + <el-date-picker clearable size="small" style="width: 200px" + v-model="form.${field}" + type="date" + value-format="yyyy-MM-dd" + placeholder="选择${comment}"> + </el-date-picker> + </el-form-item> + #elseif($column.htmlType == "textarea") + <el-form-item label="${comment}" prop="${field}"> + <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> + </el-form-item> + #end + #end + #end + #end + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button @click="cancel">取 消</el-button> + </div> + </el-dialog> + </div> </template> <script> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; -import Treeselect from "@riophae/vue-treeselect"; -import "@riophae/vue-treeselect/dist/vue-treeselect.css"; + import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; + import Treeselect from "@riophae/vue-treeselect"; + import "@riophae/vue-treeselect/dist/vue-treeselect.css"; -export default { - name: "${BusinessName}", - components: { Treeselect }, - data() { - return { - // 遮罩层 - loading: true, - // ${functionName}表格数据 - ${businessName}List: [], - // ${functionName}树选项 - ${businessName}Options: [], - // 弹出层标题 - title: "", - // 是否显示弹出层 - open: false, -#foreach ($column in $columns) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if(${column.dictType} != '') - // $comment字典 - ${column.javaField}Options: []#if($velocityCount != $columns.size()),#end + export default { + name: "${BusinessName}", + components: { Treeselect }, + data() { + return { + // 遮罩层 + loading: true, + // ${functionName}表格数据 + ${businessName}List: [], + // ${functionName}树选项 + ${businessName}Options: [], + // 弹出层标题 + title: "", + // 是否显示弹出层 + open: false, + #foreach ($column in $columns) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if(${column.dictType} != '') + // $comment字典 + ${column.javaField}Options: [], + #end + #end + // 查询参数 + queryParams: { + #foreach ($column in $columns) + #if($column.query) + $column.javaField: undefined#if($velocityCount != $columns.size()),#end -#end -#end - // 查询参数 - queryParams: { -#foreach ($column in $columns) -#if($column.query) - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + #end + #end + }, + // 表单参数 + form: {}, + // 表单校验 + rules: { + #foreach ($column in $columns) + #if($column.required) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #set($comment=$column.columnComment) + $column.javaField: [ + { required: true, message: "$comment不能为空", trigger: "blur" } + ]#if($velocityCount != $columns.size()),#end -#end -#end - }, - // 表单参数 - form: {}, - // 表单校验 - rules: { -#foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($comment=$column.columnComment) - $column.javaField: [ - { required: true, message: "$comment不能为空", trigger: "blur" } - ]#if($velocityCount != $columns.size()),#end - -#end -#end - } - }; - }, - created() { - this.getList(); -#foreach ($column in $columns) -#if(${column.dictType} != '') - this.getDicts("${column.dictType}").then(response => { - this.${column.javaField}Options = response.data; - }); -#end -#end - }, - methods: { - /** 查询${functionName}列表 */ - getList() { - this.loading = true; - list${BusinessName}(this.queryParams).then(response => { - this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - this.loading = false; - }); - }, - /** 转换${functionName}数据结构 */ - normalizer(node) { - if (node.children && !node.children.length) { - delete node.children; - } - return { - id: node.${treeCode}, - label: node.${treeName}, - children: node.children - }; - }, - /** 查询部门下拉树结构 */ - getTreeselect() { - list${BusinessName}().then(response => { - this.${businessName}Options = []; - const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; - data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); - this.${businessName}Options.push(data); - }); - }, -#foreach ($column in $columns) -#if(${column.dictType} != '') -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - // $comment字典翻译 - ${column.javaField}Format(row, column) { - return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); - }, -#end -#end - // 取消按钮 - cancel() { - this.open = false; - this.reset(); - }, - // 表单重置 - reset() { - this.form = { -#foreach ($column in $columns) -#if($column.htmlType == "radio") - $column.javaField: "0"#if($velocityCount != $columns.size()),#end - -#else - $column.javaField: undefined#if($velocityCount != $columns.size()),#end - -#end -#end - }; - this.resetForm("form"); - }, - /** 搜索按钮操作 */ - handleQuery() { - this.getList(); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - /** 新增按钮操作 */ - handleAdd() { - this.reset(); - this.getTreeselect(); - this.open = true; - this.title = "添加${functionName}"; - }, - /** 修改按钮操作 */ - handleUpdate(row) { - this.reset(); - this.getTreeselect(); - if (row != undefined) { - this.form.${treeParentCode} = row.${treeCode}; - } - get${BusinessName}(row.${pkColumn.javaField}).then(response => { - this.form = response.data; - this.open = true; - this.title = "修改${functionName}"; - }); - }, - /** 提交按钮 */ - submitForm: function() { - this.#[[$]]#refs["form"].validate(valid => { - if (valid) { - if (this.form.${pkColumn.javaField} != undefined) { - update${BusinessName}(this.form).then(response => { - if (response.code === 200) { - this.msgSuccess("修改成功"); - this.open = false; - this.getList(); - } else { - this.msgError(response.msg); - } + #end + #end + } + }; + }, + created() { + this.getList(); + #foreach ($column in $columns) + #if(${column.dictType} != '') + this.getDicts("${column.dictType}").then(response => { + this.${column.javaField}Options = response.data; + }); + #end + #end + }, + methods: { + /** 查询${functionName}列表 */ + getList() { + this.loading = true; + list${BusinessName}(this.queryParams).then(response => { + this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); + this.loading = false; }); - } else { - add${BusinessName}(this.form).then(response => { - if (response.code === 200) { - this.msgSuccess("新增成功"); - this.open = false; - this.getList(); - } else { - this.msgError(response.msg); - } + }, + /** 转换${functionName}数据结构 */ + normalizer(node) { + if (node.children && !node.children.length) { + delete node.children; + } + return { + id: node.${treeCode}, + label: node.${treeName}, + children: node.children + }; + }, + /** 查询部门下拉树结构 */ + getTreeselect() { + list${BusinessName}().then(response => { + this.${businessName}Options = []; + const data = { ${treeCode}: 0, ${treeName}: '顶级节点', children: [] }; + data.children = this.handleTree(response.data, "${treeCode}", "${treeParentCode}"); + this.${businessName}Options.push(data); }); - } + }, + #foreach ($column in $columns) + #if(${column.dictType} != '') + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + // $comment字典翻译 + ${column.javaField}Format(row, column) { + return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); + }, + #end + #end + // 取消按钮 + cancel() { + this.open = false; + this.reset(); + }, + // 表单重置 + reset() { + this.form = { + #foreach ($column in $columns) + #if($column.htmlType == "radio") + $column.javaField: "0"#if($velocityCount != $columns.size()),#end + + #else + $column.javaField: undefined#if($velocityCount != $columns.size()),#end + + #end + #end + }; + this.resetForm("form"); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.getTreeselect(); + this.open = true; + this.title = "添加${functionName}"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + this.getTreeselect(); + if (row != undefined) { + this.form.${treeParentCode} = row.${treeCode}; + } + get${BusinessName}(row.${pkColumn.javaField}).then(response => { + this.form = response.data; + this.open = true; + this.title = "修改${functionName}"; + }); + }, + /** 提交按钮 */ + submitForm: function() { + this.#[[$]]#refs["form"].validate(valid => { + if (valid) { + if (this.form.${pkColumn.javaField} != undefined) { + update${BusinessName}(this.form).then(response => { + if (response.code === 200) { + this.msgSuccess("修改成功"); + this.open = false; + this.getList(); + } + }); + } else { + add${BusinessName}(this.form).then(response => { + if (response.code === 200) { + this.msgSuccess("新增成功"); + this.open = false; + this.getList(); + } + }); + } + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(function() { + return del${BusinessName}(row.${pkColumn.javaField}); + }).then(() => { + this.getList(); + this.msgSuccess("删除成功"); + }).catch(function() {}); + } } - }); - }, - /** 删除按钮操作 */ - handleDelete(row) { - this.$confirm('是否确认删除${functionName}编号为"' + row.${pkColumn.javaField} + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return del${BusinessName}(row.${pkColumn.javaField}); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(function() {}); - } - } -}; + }; </script> \ No newline at end of file diff --git a/ruoyi/src/main/resources/vm/vue/index.vue.vm b/ruoyi/src/main/resources/vm/vue/index.vue.vm index 3110a169a..265f64229 100644 --- a/ruoyi/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi/src/main/resources/vm/vue/index.vue.vm @@ -1,441 +1,438 @@ <template> - <div class="app-container"> - <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> -#foreach($column in $columns) -#if($column.query) -#set($dictType=$column.dictType) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-input - v-model="queryParams.${column.javaField}" - placeholder="请输入${comment}" - clearable - size="small" - @keyup.enter.native="handleQuery" + <div class="app-container"> + <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> + #foreach($column in $columns) + #if($column.query) + #set($dictType=$column.dictType) + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($column.htmlType == "input") + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-input + v-model="queryParams.${column.javaField}" + placeholder="请输入${comment}" + clearable + size="small" + @keyup.enter.native="handleQuery" + /> + </el-form-item> + #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> + <el-option + v-for="dict in ${column.javaField}Options" + :key="dict.dictValue" + :label="dict.dictLabel" + :value="dict.dictValue" + /> + </el-select> + </el-form-item> + #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> + <el-option label="请选择字典生成" value="" /> + </el-select> + </el-form-item> + #elseif($column.htmlType == "datetime") + <el-form-item label="${comment}" prop="${column.javaField}"> + <el-date-picker clearable size="small" style="width: 200px" + v-model="queryParams.${column.javaField}" + type="date" + value-format="yyyy-MM-dd" + placeholder="选择${comment}"> + </el-date-picker> + </el-form-item> + #end + #end + #end + <el-form-item> + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> + </el-form-item> + </el-form> + + <el-row :gutter="10" class="mb8"> + <el-col :span="1.5"> + <el-button + type="primary" + icon="el-icon-plus" + size="mini" + @click="handleAdd" + v-hasPermi="['${moduleName}:${businessName}:add']" + >新增</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="success" + icon="el-icon-edit" + size="mini" + :disabled="single" + @click="handleUpdate" + v-hasPermi="['${moduleName}:${businessName}:edit']" + >修改</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="danger" + icon="el-icon-delete" + size="mini" + :disabled="multiple" + @click="handleDelete" + v-hasPermi="['${moduleName}:${businessName}:remove']" + >删除</el-button> + </el-col> + <el-col :span="1.5"> + <el-button + type="warning" + icon="el-icon-download" + size="mini" + @click="handleExport" + v-hasPermi="['${moduleName}:${businessName}:export']" + >导出</el-button> + </el-col> + </el-row> + + <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> + <el-table-column type="selection" width="55" align="center" /> + #foreach($column in $columns) + #set($javaField=$column.javaField) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if($column.pk) + <el-table-column label="${comment}" align="center" prop="${javaField}" /> + #elseif($column.list && $column.htmlType == "datetime") + <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> + <template slot-scope="scope"> + <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> + </template> + </el-table-column> + #elseif($column.list && "" != $column.dictType) + <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> + #elseif($column.list && "" != $javaField) + <el-table-column label="${comment}" align="center" prop="${javaField}" /> + #end + #end + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> + <template slot-scope="scope"> + <el-button + size="mini" + type="text" + icon="el-icon-edit" + @click="handleUpdate(scope.row)" + v-hasPermi="['${moduleName}:${businessName}:edit']" + >修改</el-button> + <el-button + size="mini" + type="text" + icon="el-icon-delete" + @click="handleDelete(scope.row)" + v-hasPermi="['${moduleName}:${businessName}:remove']" + >删除</el-button> + </template> + </el-table-column> + </el-table> + + <pagination + v-show="total>0" + :total="total" + :page.sync="queryParams.pageNum" + :limit.sync="queryParams.pageSize" + @pagination="getList" /> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> - <el-option - v-for="dict in ${column.javaField}Options" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - /> - </el-select> - </el-form-item> -#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> - <el-option label="请选择字典生成" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${column.javaField}"> - <el-date-picker clearable size="small" style="width: 200px" - v-model="queryParams.${column.javaField}" - type="date" - value-format="yyyy-MM-dd" - placeholder="选择${comment}"> - </el-date-picker> - </el-form-item> -#end -#end -#end - <el-form-item> - <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> - <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> - </el-form-item> - </el-form> - <el-row :gutter="10" class="mb8"> - <el-col :span="1.5"> - <el-button - type="primary" - icon="el-icon-plus" - size="mini" - @click="handleAdd" - v-hasPermi="['${moduleName}:${businessName}:add']" - >新增</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="success" - icon="el-icon-edit" - size="mini" - :disabled="single" - @click="handleUpdate" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >修改</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="danger" - icon="el-icon-delete" - size="mini" - :disabled="multiple" - @click="handleDelete" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >删除</el-button> - </el-col> - <el-col :span="1.5"> - <el-button - type="warning" - icon="el-icon-download" - size="mini" - @click="handleExport" - v-hasPermi="['${moduleName}:${businessName}:export']" - >导出</el-button> - </el-col> - </el-row> + <!-- 添加或修改${functionName}对话框 --> + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> + <el-form ref="form" :model="form" :rules="rules" label-width="80px"> + #foreach($column in $columns) + #set($field=$column.javaField) + #if($column.insert && !$column.pk) + #if(($column.usableColumn) || (!$column.superColumn)) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #set($dictType=$column.dictType) + #if($column.htmlType == "input") + <el-form-item label="${comment}" prop="${field}"> + <el-input v-model="form.${field}" placeholder="请输入${comment}" /> + </el-form-item> + #elseif($column.htmlType == "select" && "" != $dictType) + <el-form-item label="${comment}"> + <el-select v-model="form.${field}" placeholder="请选择${comment}"> + <el-option + v-for="dict in ${field}Options" + :key="dict.dictValue" + :label="dict.dictLabel" + #if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end - <el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange"> - <el-table-column type="selection" width="55" align="center" /> -#foreach($column in $columns) -#set($javaField=$column.javaField) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if($column.pk) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#elseif($column.list && $column.htmlType == "datetime") - <el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> - <template slot-scope="scope"> - <span>{{ parseTime(scope.row.${javaField}) }}</span> - </template> - </el-table-column> -#elseif($column.list && "" != $column.dictType) - <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> -#elseif($column.list && "" != $javaField) - <el-table-column label="${comment}" align="center" prop="${javaField}" /> -#end -#end - <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> - <template slot-scope="scope"> - <el-button - size="mini" - type="text" - icon="el-icon-edit" - @click="handleUpdate(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:edit']" - >修改</el-button> - <el-button - size="mini" - type="text" - icon="el-icon-delete" - @click="handleDelete(scope.row)" - v-hasPermi="['${moduleName}:${businessName}:remove']" - >删除</el-button> - </template> - </el-table-column> - </el-table> - - <pagination - v-show="total>0" - :total="total" - :page.sync="queryParams.pageNum" - :limit.sync="queryParams.pageSize" - @pagination="getList" - /> + ></el-option> + </el-select> + </el-form-item> + #elseif($column.htmlType == "select" && $dictType) + <el-form-item label="${comment}"> + <el-select v-model="form.${field}" placeholder="请选择${comment}"> + <el-option label="请选择字典生成" value="" /> + </el-select> + </el-form-item> + #elseif($column.htmlType == "radio" && "" != $dictType) + <el-form-item label="${comment}"> + <el-radio-group v-model="form.${field}"> + <el-radio + v-for="dict in ${field}Options" + :key="dict.dictValue" + #if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end - <!-- 添加或修改${functionName}对话框 --> - <el-dialog :title="title" :visible.sync="open" width="500px"> - <el-form ref="form" :model="form" :rules="rules" label-width="80px"> -#foreach($column in $columns) -#set($field=$column.javaField) -#if($column.insert && !$column.pk) -#if(($column.usableColumn) || (!$column.superColumn)) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($dictType=$column.dictType) -#if($column.htmlType == "input") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" placeholder="请输入${comment}" /> - </el-form-item> -#elseif($column.htmlType == "select" && "" != $dictType) - <el-form-item label="${comment}"> - <el-select v-model="form.${field}" placeholder="请选择${comment}"> - <el-option - v-for="dict in ${field}Options" - :key="dict.dictValue" - :label="dict.dictLabel" - :value="dict.dictValue" - ></el-option> - </el-select> - </el-form-item> -#elseif($column.htmlType == "select" && $dictType) - <el-form-item label="${comment}"> - <el-select v-model="form.${field}" placeholder="请选择${comment}"> - <el-option label="请选择字典生成" value="" /> - </el-select> - </el-form-item> -#elseif($column.htmlType == "radio" && "" != $dictType) - <el-form-item label="${comment}"> - <el-radio-group v-model="form.${field}"> - <el-radio - v-for="dict in ${field}Options" - :key="dict.dictValue" - :label="dict.dictValue" - >{{dict.dictLabel}}</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "radio" && $dictType) - <el-form-item label="${comment}"> - <el-radio-group v-model="form.${field}"> - <el-radio label="1">请选择字典生成</el-radio> - </el-radio-group> - </el-form-item> -#elseif($column.htmlType == "datetime") - <el-form-item label="${comment}" prop="${field}"> - <el-date-picker clearable size="small" style="width: 200px" - v-model="form.${field}" - type="date" - value-format="yyyy-MM-dd" - placeholder="选择${comment}"> - </el-date-picker> - </el-form-item> -#elseif($column.htmlType == "textarea") - <el-form-item label="${comment}" prop="${field}"> - <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> - </el-form-item> -#end -#end -#end -#end - </el-form> - <div slot="footer" class="dialog-footer"> - <el-button type="primary" @click="submitForm">确 定</el-button> - <el-button @click="cancel">取 消</el-button> - </div> - </el-dialog> - </div> + >{{dict.dictLabel}}</el-radio> + </el-radio-group> + </el-form-item> + #elseif($column.htmlType == "radio" && $dictType) + <el-form-item label="${comment}"> + <el-radio-group v-model="form.${field}"> + <el-radio label="1">请选择字典生成</el-radio> + </el-radio-group> + </el-form-item> + #elseif($column.htmlType == "datetime") + <el-form-item label="${comment}" prop="${field}"> + <el-date-picker clearable size="small" style="width: 200px" + v-model="form.${field}" + type="date" + value-format="yyyy-MM-dd" + placeholder="选择${comment}"> + </el-date-picker> + </el-form-item> + #elseif($column.htmlType == "textarea") + <el-form-item label="${comment}" prop="${field}"> + <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> + </el-form-item> + #end + #end + #end + #end + </el-form> + <div slot="footer" class="dialog-footer"> + <el-button type="primary" @click="submitForm">确 定</el-button> + <el-button @click="cancel">取 消</el-button> + </div> + </el-dialog> + </div> </template> <script> -import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; + import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName}, export${BusinessName} } from "@/api/${moduleName}/${businessName}"; -export default { - name: "${BusinessName}", - data() { - return { - // 遮罩层 - loading: true, - // 选中数组 - ids: [], - // 非单个禁用 - single: true, - // 非多个禁用 - multiple: true, - // 总条数 - total: 0, - // ${functionName}表格数据 - ${businessName}List: [], - // 弹出层标题 - title: "", - // 是否显示弹出层 - open: false, -#foreach ($column in $columns) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#if(${column.dictType} != '') - // $comment字典 - ${column.javaField}Options: []#if($velocityCount != $columns.size()),#end + export default { + name: "${BusinessName}", + data() { + return { + // 遮罩层 + loading: true, + // 选中数组 + ids: [], + // 非单个禁用 + single: true, + // 非多个禁用 + multiple: true, + // 总条数 + total: 0, + // ${functionName}表格数据 + ${businessName}List: [], + // 弹出层标题 + title: "", + // 是否显示弹出层 + open: false, + #foreach ($column in $columns) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #if(${column.dictType} != '') + // $comment字典 + ${column.javaField}Options: [], + #end + #end + // 查询参数 + queryParams: { + pageNum: 1, + pageSize: 10, + #foreach ($column in $columns) + #if($column.query) + $column.javaField: undefined#if($velocityCount != $columns.size()),#end -#end -#end - // 查询参数 - queryParams: { - pageNum: 1, - pageSize: 10, -#foreach ($column in $columns) -#if($column.query) - $column.javaField: undefined#if($velocityCount != $columns.size()),#end + #end + #end + }, + // 表单参数 + form: {}, + // 表单校验 + rules: { + #foreach ($column in $columns) + #if($column.required) + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + #set($comment=$column.columnComment) + $column.javaField: [ + { required: true, message: "$comment不能为空", trigger: "blur" } + ]#if($velocityCount != $columns.size()),#end -#end -#end - }, - // 表单参数 - form: {}, - // 表单校验 - rules: { -#foreach ($column in $columns) -#if($column.required) -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end -#set($comment=$column.columnComment) - $column.javaField: [ - { required: true, message: "$comment不能为空", trigger: "blur" } - ]#if($velocityCount != $columns.size()),#end - -#end -#end - } - }; - }, - created() { - this.getList(); -#foreach ($column in $columns) -#if(${column.dictType} != '') - this.getDicts("${column.dictType}").then(response => { - this.${column.javaField}Options = response.data; - }); -#end -#end - }, - methods: { - /** 查询${functionName}列表 */ - getList() { - this.loading = true; - list${BusinessName}(this.queryParams).then(response => { - this.${businessName}List = response.rows; - this.total = response.total; - this.loading = false; - }); - }, -#foreach ($column in $columns) -#if(${column.dictType} != '') -#set($parentheseIndex=$column.columnComment.indexOf("(")) -#if($parentheseIndex != -1) -#set($comment=$column.columnComment.substring(0, $parentheseIndex)) -#else -#set($comment=$column.columnComment) -#end - // $comment字典翻译 - ${column.javaField}Format(row, column) { - return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); - }, -#end -#end - // 取消按钮 - cancel() { - this.open = false; - this.reset(); - }, - // 表单重置 - reset() { - this.form = { -#foreach ($column in $columns) -#if($column.htmlType == "radio") - $column.javaField: "0"#if($velocityCount != $columns.size()),#end - -#else - $column.javaField: undefined#if($velocityCount != $columns.size()),#end - -#end -#end - }; - this.resetForm("form"); - }, - /** 搜索按钮操作 */ - handleQuery() { - this.queryParams.pageNum = 1; - this.getList(); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm("queryForm"); - this.handleQuery(); - }, - // 多选框选中数据 - handleSelectionChange(selection) { - this.ids = selection.map(item => item.${pkColumn.javaField}) - this.single = selection.length!=1 - this.multiple = !selection.length - }, - /** 新增按钮操作 */ - handleAdd() { - this.reset(); - this.open = true; - this.title = "添加${functionName}"; - }, - /** 修改按钮操作 */ - handleUpdate(row) { - this.reset(); - const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids - get${BusinessName}(${pkColumn.javaField}).then(response => { - this.form = response.data; - this.open = true; - this.title = "修改${functionName}"; - }); - }, - /** 提交按钮 */ - submitForm: function() { - this.#[[$]]#refs["form"].validate(valid => { - if (valid) { - if (this.form.${pkColumn.javaField} != undefined) { - update${BusinessName}(this.form).then(response => { - if (response.code === 200) { - this.msgSuccess("修改成功"); - this.open = false; - this.getList(); - } else { - this.msgError(response.msg); - } + #end + #end + } + }; + }, + created() { + this.getList(); + #foreach ($column in $columns) + #if(${column.dictType} != '') + this.getDicts("${column.dictType}").then(response => { + this.${column.javaField}Options = response.data; + }); + #end + #end + }, + methods: { + /** 查询${functionName}列表 */ + getList() { + this.loading = true; + list${BusinessName}(this.queryParams).then(response => { + this.${businessName}List = response.rows; + this.total = response.total; + this.loading = false; }); - } else { - add${BusinessName}(this.form).then(response => { - if (response.code === 200) { - this.msgSuccess("新增成功"); + }, + #foreach ($column in $columns) + #if(${column.dictType} != '') + #set($parentheseIndex=$column.columnComment.indexOf("(")) + #if($parentheseIndex != -1) + #set($comment=$column.columnComment.substring(0, $parentheseIndex)) + #else + #set($comment=$column.columnComment) + #end + // $comment字典翻译 + ${column.javaField}Format(row, column) { + return this.selectDictLabel(this.${column.javaField}Options, row.${column.javaField}); + }, + #end + #end + // 取消按钮 + cancel() { this.open = false; + this.reset(); + }, + // 表单重置 + reset() { + this.form = { + #foreach ($column in $columns) + #if($column.htmlType == "radio") + $column.javaField: "0"#if($velocityCount != $columns.size()),#end + + #else + $column.javaField: undefined#if($velocityCount != $columns.size()),#end + + #end + #end + }; + this.resetForm("form"); + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1; this.getList(); - } else { - this.msgError(response.msg); - } + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + // 多选框选中数据 + handleSelectionChange(selection) { + this.ids = selection.map(item => item.${pkColumn.javaField}) + this.single = selection.length!=1 + this.multiple = !selection.length + }, + /** 新增按钮操作 */ + handleAdd() { + this.reset(); + this.open = true; + this.title = "添加${functionName}"; + }, + /** 修改按钮操作 */ + handleUpdate(row) { + this.reset(); + const ${pkColumn.javaField} = row.${pkColumn.javaField} || this.ids + get${BusinessName}(${pkColumn.javaField}).then(response => { + this.form = response.data; + this.open = true; + this.title = "修改${functionName}"; }); - } + }, + /** 提交按钮 */ + submitForm: function() { + this.#[[$]]#refs["form"].validate(valid => { + if (valid) { + if (this.form.${pkColumn.javaField} != undefined) { + update${BusinessName}(this.form).then(response => { + if (response.code === 200) { + this.msgSuccess("修改成功"); + this.open = false; + this.getList(); + } + }); + } else { + add${BusinessName}(this.form).then(response => { + if (response.code === 200) { + this.msgSuccess("新增成功"); + this.open = false; + this.getList(); + } + }); + } + } + }); + }, + /** 删除按钮操作 */ + handleDelete(row) { + const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; + this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(function() { + return del${BusinessName}(${pkColumn.javaField}s); + }).then(() => { + this.getList(); + this.msgSuccess("删除成功"); + }).catch(function() {}); + }, + /** 导出按钮操作 */ + handleExport() { + const queryParams = this.queryParams; + this.$confirm('是否确认导出所有${functionName}数据项?', "警告", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }).then(function() { + return export${BusinessName}(queryParams); + }).then(response => { + this.download(response.msg); + }).catch(function() {}); + } } - }); - }, - /** 删除按钮操作 */ - handleDelete(row) { - const ${pkColumn.javaField}s = row.${pkColumn.javaField} || this.ids; - this.$confirm('是否确认删除${functionName}编号为"' + ${pkColumn.javaField}s + '"的数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return del${BusinessName}(${pkColumn.javaField}s); - }).then(() => { - this.getList(); - this.msgSuccess("删除成功"); - }).catch(function() {}); - }, - /** 导出按钮操作 */ - handleExport() { - const queryParams = this.queryParams; - this.$confirm('是否确认导出所有${functionName}数据项?', "警告", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" - }).then(function() { - return export${BusinessName}(queryParams); - }).then(response => { - this.download(response.msg); - }).catch(function() {}); - } - } -}; + }; </script> \ No newline at end of file diff --git a/ruoyi/src/main/resources/vm/xml/mapper.xml.vm b/ruoyi/src/main/resources/vm/xml/mapper.xml.vm index ef9d682b8..d0651334f 100644 --- a/ruoyi/src/main/resources/vm/xml/mapper.xml.vm +++ b/ruoyi/src/main/resources/vm/xml/mapper.xml.vm @@ -1,13 +1,13 @@ <?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"> + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="${packageName}.mapper.${ClassName}Mapper"> - + <resultMap type="${ClassName}" id="${ClassName}Result"> -#foreach ($column in $columns) - <result property="${column.javaField}" column="${column.columnName}" /> -#end + #foreach ($column in $columns) + <result property="${column.javaField}" column="${column.columnName}" /> + #end </resultMap> <sql id="select${ClassName}Vo"> @@ -16,67 +16,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" <select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result"> <include refid="select${ClassName}Vo"/> - <where> -#foreach($column in $columns) -#set($queryType=$column.queryType) -#set($javaField=$column.javaField) -#set($javaType=$column.javaType) -#set($columnName=$column.columnName) -#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) -#if($column.query) -#if($column.queryType == "EQ") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> -#elseif($queryType == "NE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> -#elseif($queryType == "GT") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> -#elseif($queryType == "GTE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> -#elseif($queryType == "LT") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> -#elseif($queryType == "LTE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> -#elseif($queryType == "LIKE") - <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> -#elseif($queryType == "BETWEEN") - <if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> -#end -#end -#end + <where> + #foreach($column in $columns) + #set($queryType=$column.queryType) + #set($javaField=$column.javaField) + #set($javaType=$column.javaType) + #set($columnName=$column.columnName) + #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) + #if($column.query) + #if($column.queryType == "EQ") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> + #elseif($queryType == "NE") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> + #elseif($queryType == "GT") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName > #{$javaField}</if> + #elseif($queryType == "GTE") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName >= #{$javaField}</if> + #elseif($queryType == "LT") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName < #{$javaField}</if> + #elseif($queryType == "LTE") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName <= #{$javaField}</if> + #elseif($queryType == "LIKE") + <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> + #elseif($queryType == "BETWEEN") + <if test="params.begin$AttrName != null and params.begin$AttrName != '' and params.end$AttrName != null and params.end$AttrName != ''"> and $columnName between #{params.begin$AttrName} and #{params.end$AttrName}</if> + #end + #end + #end </where> </select> - + <select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="${ClassName}Result"> <include refid="select${ClassName}Vo"/> where ${pkColumn.columnName} = #{${pkColumn.javaField}} </select> - + <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> insert into ${tableName} <trim prefix="(" suffix=")" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName,</if> -#end -#end - </trim> + #foreach($column in $columns) + #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName,</if> + #end + #end + </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) - <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">#{$column.javaField},</if> -#end -#end - </trim> + #foreach($column in $columns) + #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) + <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">#{$column.javaField},</if> + #end + #end + </trim> </insert> <update id="update${ClassName}" parameterType="${ClassName}"> update ${tableName} <trim prefix="SET" suffixOverrides=","> -#foreach($column in $columns) -#if($column.columnName != $pkColumn.columnName) - <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> -#end -#end + #foreach($column in $columns) + #if($column.columnName != $pkColumn.columnName) + <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> + #end + #end </trim> where ${pkColumn.columnName} = #{${pkColumn.javaField}} </update> @@ -86,10 +86,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" </delete> <delete id="delete${ClassName}ByIds" parameterType="String"> - delete from ${tableName} where ${pkColumn.columnName} in + delete from ${tableName} where ${pkColumn.columnName} in <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")"> #{${pkColumn.javaField}} </foreach> </delete> - + </mapper> \ No newline at end of file