20200529-zlp-3

优化代码生成
新增评分评价后台代码
This commit is contained in:
paidaxing444 2020-06-01 10:03:21 +08:00
parent abf9dc0b1b
commit e31e7b6c0d
43 changed files with 2300 additions and 1273 deletions

View File

@ -114,6 +114,18 @@ export const constantRoutes = [{
meta: { title: '一日流程标准', icon: '' } 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', path: '/job',
component: Layout, component: Layout,

View File

@ -71,9 +71,20 @@
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" /> <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="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="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"> <el-table-column label="创建时间" align="center" prop="createtime" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createtime) }}</span> <span>{{ parseTime(scope.row.createtime) }}</span>
@ -110,6 +121,17 @@
<!-- 添加或修改培训对话框 --> <!-- 添加或修改培训对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px"> <el-dialog :title="title" :visible.sync="open" width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <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-form-item label="视频标题" prop="title">
<el-input v-model="form.title" type="textarea" placeholder="请输入内容" /> <el-input v-model="form.title" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
@ -154,15 +176,6 @@
<el-progress v-if="imgFlag == true" type="circle" :percentage="percent"></el-progress> <el-progress v-if="imgFlag == true" type="circle" :percentage="percent"></el-progress>
</el-upload> </el-upload>
</el-form-item> </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> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button> <el-button type="primary" @click="submitForm"> </el-button>
@ -272,6 +285,13 @@ export default {
}); });
}, },
methods: { 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) { typeFormat(row, column) {
var actions = []; var actions = [];

View File

@ -10,7 +10,8 @@
clearable clearable
></el-cascader> ></el-cascader>
</el-form-item> </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-select v-model="queryParams.lecturer" filterable placeholder="请选择讲师">
<el-option <el-option
v-for="item in lecturerOptions" v-for="item in lecturerOptions"
@ -28,7 +29,7 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
placeholder="请输入培训视频标题" placeholder="请输入培训视频标题"
/> />
</el-form-item> </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 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-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -43,10 +44,12 @@
:options="playerOptions[index]" :options="playerOptions[index]"
ref="videoPlayer" ref="videoPlayer"
></video-player> ></video-player>
<div class="to-detail" @click="toDetail(o)"> <div class="to-detail">
<el-tooltip effect="dark" :content="o.title" placement="bottom"> <el-tooltip effect="dark" :content="o.title" placement="bottom">
<div> <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> </div>
</el-tooltip> </el-tooltip>
<p class="info-title info-title-name">讲师:{{o.lecturername}}</p> <p class="info-title info-title-name">讲师:{{o.lecturername}}</p>
@ -79,7 +82,6 @@ export default {
name: "VideoStudy", name: "VideoStudy",
data() { data() {
return { return {
qiniuUrl: "https://files.benyiedu.com", // 访
// //
loading: true, loading: true,
// //
@ -117,9 +119,6 @@ export default {
}); });
}, },
methods: { methods: {
toDetail(arg) {
console.log(arg);
},
// childrenundefined // childrenundefined
getTreeData(data) { getTreeData(data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
@ -201,7 +200,7 @@ export default {
} }
.to-detail { .to-detail {
cursor: pointer; /*cursor: pointer;*/
padding: 14px; padding: 14px;
} }

View File

@ -1,6 +1,6 @@
<template> <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 :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="表名称" prop="tableName"> <el-form-item label="表名称" prop="tableName">
<el-input <el-input

View File

@ -80,7 +80,11 @@
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55"></el-table-column> <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 <el-table-column
label="表名称" label="表名称"
align="center" align="center"
@ -145,7 +149,7 @@
@pagination="getList" @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-tabs v-model="preview.activeName">
<el-tab-pane <el-tab-pane
v-for="(value, key) in preview.data" v-for="(value, key) in preview.data"

View File

@ -1,6 +1,5 @@
package com.ruoyi.project.benyi.controller; package com.ruoyi.project.benyi.controller;
import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;

View File

@ -3,9 +3,7 @@ package com.ruoyi.project.benyi.controller;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.qiniu.util.Auth;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.config.FileConfig;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;

View File

@ -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));
}
}

View File

@ -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));
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -85,8 +85,8 @@ public class SysDictMoedataController extends BaseController {
*/ */
@PreAuthorize("@ss.hasPermi('system:moedata:remove')") @PreAuthorize("@ss.hasPermi('system:moedata:remove')")
@Log(title = "多级字典管理", businessType = BusinessType.DELETE) @Log(title = "多级字典管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}") @DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long id) {
return toAjax(sysDictMoedataService.deleteSysDictMoedataByIds(ids)); return toAjax(sysDictMoedataService.deleteSysDictMoedataById(id));
} }
} }

View File

@ -30,7 +30,7 @@ import com.ruoyi.project.tool.gen.service.IGenTableService;
/** /**
* 代码生成 操作处理 * 代码生成 操作处理
* *
* @author ruoyi * @author ruoyi
*/ */
@RestController @RestController
@ -124,6 +124,9 @@ public class GenController extends BaseController
return AjaxResult.success(); return AjaxResult.success();
} }
/**
* 删除代码生成
*/
@PreAuthorize("@ss.hasPermi('tool:gen:remove')") @PreAuthorize("@ss.hasPermi('tool:gen:remove')")
@Log(title = "代码生成", businessType = BusinessType.DELETE) @Log(title = "代码生成", businessType = BusinessType.DELETE)
@DeleteMapping("/{tableIds}") @DeleteMapping("/{tableIds}")

View File

@ -10,7 +10,7 @@ import com.ruoyi.framework.web.domain.BaseEntity;
/** /**
* 业务表 gen_table * 业务表 gen_table
* *
* @author ruoyi * @author ruoyi
*/ */
public class GenTable extends BaseEntity public class GenTable extends BaseEntity

View File

@ -6,7 +6,7 @@ import com.ruoyi.framework.web.domain.BaseEntity;
/** /**
* 代码生成业务字段表 gen_table_column * 代码生成业务字段表 gen_table_column
* *
* @author ruoyi * @author ruoyi
*/ */
public class GenTableColumn extends BaseEntity public class GenTableColumn extends BaseEntity

View File

@ -5,22 +5,22 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn;
/** /**
* 业务字段 数据层 * 业务字段 数据层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface GenTableColumnMapper public interface GenTableColumnMapper
{ {
/** /**
* 根据表名称查询列信息 * 根据表名称查询列信息
* *
* @param tableName 表名称 * @param tableName 表名称
* @return 列信息 * @return 列信息
*/ */
public List<GenTableColumn> selectDbTableColumnsByName(String tableName); public List<GenTableColumn> selectDbTableColumnsByName(String tableName);
/** /**
* 查询业务字段列表 * 查询业务字段列表
* *
* @param tableId 业务字段编号 * @param tableId 业务字段编号
* @return 业务字段集合 * @return 业务字段集合
*/ */
@ -28,7 +28,7 @@ public interface GenTableColumnMapper
/** /**
* 新增业务字段 * 新增业务字段
* *
* @param genTableColumn 业务字段信息 * @param genTableColumn 业务字段信息
* @return 结果 * @return 结果
*/ */
@ -36,7 +36,7 @@ public interface GenTableColumnMapper
/** /**
* 修改业务字段 * 修改业务字段
* *
* @param genTableColumn 业务字段信息 * @param genTableColumn 业务字段信息
* @return 结果 * @return 结果
*/ */
@ -44,7 +44,7 @@ public interface GenTableColumnMapper
/** /**
* 批量删除业务字段 * 批量删除业务字段
* *
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */

View File

@ -5,14 +5,14 @@ import com.ruoyi.project.tool.gen.domain.GenTable;
/** /**
* 业务 数据层 * 业务 数据层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface GenTableMapper public interface GenTableMapper
{ {
/** /**
* 查询业务列表 * 查询业务列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 业务集合 * @return 业务集合
*/ */
@ -20,7 +20,7 @@ public interface GenTableMapper
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -28,7 +28,7 @@ public interface GenTableMapper
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param tableNames 表名称组 * @param tableNames 表名称组
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -36,7 +36,7 @@ public interface GenTableMapper
/** /**
* 查询表ID业务信息 * 查询表ID业务信息
* *
* @param id 业务ID * @param id 业务ID
* @return 业务信息 * @return 业务信息
*/ */
@ -44,7 +44,7 @@ public interface GenTableMapper
/** /**
* 查询表名称业务信息 * 查询表名称业务信息
* *
* @param tableName 表名称 * @param tableName 表名称
* @return 业务信息 * @return 业务信息
*/ */
@ -52,7 +52,7 @@ public interface GenTableMapper
/** /**
* 新增业务 * 新增业务
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 结果 * @return 结果
*/ */
@ -60,7 +60,7 @@ public interface GenTableMapper
/** /**
* 修改业务 * 修改业务
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 结果 * @return 结果
*/ */
@ -68,7 +68,7 @@ public interface GenTableMapper
/** /**
* 批量删除业务 * 批量删除业务
* *
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */

View File

@ -9,57 +9,57 @@ import com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper;
/** /**
* 业务字段 服务层实现 * 业务字段 服务层实现
* *
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
public class GenTableColumnServiceImpl implements IGenTableColumnService public class GenTableColumnServiceImpl implements IGenTableColumnService
{ {
@Autowired @Autowired
private GenTableColumnMapper genTableColumnMapper; private GenTableColumnMapper genTableColumnMapper;
/** /**
* 查询业务字段列表 * 查询业务字段列表
* *
* @param genTableColumn 业务字段编号 * @param genTableColumn 业务字段编号
* @return 业务字段集合 * @return 业务字段集合
*/ */
@Override @Override
public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId) public List<GenTableColumn> selectGenTableColumnListByTableId(Long tableId)
{ {
return genTableColumnMapper.selectGenTableColumnListByTableId(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);
} }
/** /**
* 删除业务字段对象 * 新增业务字段
* *
* @param ids 需要删除的数据ID * @param genTableColumn 业务字段信息
* @return 结果 * @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 @Override
public int deleteGenTableColumnByIds(String ids) public int deleteGenTableColumnByIds(String ids)
{ {

View File

@ -34,7 +34,7 @@ import com.ruoyi.project.tool.gen.util.VelocityUtils;
/** /**
* 业务 服务层实现 * 业务 服务层实现
* *
* @author ruoyi * @author ruoyi
*/ */
@Service @Service
@ -50,7 +50,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 查询业务信息 * 查询业务信息
* *
* @param id 业务ID * @param id 业务ID
* @return 业务信息 * @return 业务信息
*/ */
@ -64,7 +64,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 查询业务列表 * 查询业务列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 业务集合 * @return 业务集合
*/ */
@ -76,7 +76,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -87,7 +87,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param tableNames 表名称组 * @param tableNames 表名称组
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -98,7 +98,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 修改业务 * 修改业务
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 结果 * @return 结果
*/ */
@ -120,7 +120,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 删除业务对象 * 删除业务对象
* *
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */
@ -134,7 +134,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 导入表结构 * 导入表结构
* *
* @param tableList 导入表列表 * @param tableList 导入表列表
*/ */
@Override @Override
@ -169,7 +169,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 预览代码 * 预览代码
* *
* @param tableId 表编号 * @param tableId 表编号
* @return 预览数据列表 * @return 预览数据列表
*/ */
@ -200,7 +200,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 生成代码 * 生成代码
* *
* @param tableName 表名称 * @param tableName 表名称
* @return 数据 * @return 数据
*/ */
@ -216,7 +216,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 批量生成代码 * 批量生成代码
* *
* @param tableNames 表数组 * @param tableNames 表数组
* @return 数据 * @return 数据
*/ */
@ -262,7 +262,7 @@ public class GenTableServiceImpl implements IGenTableService
zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table))); zip.putNextEntry(new ZipEntry(VelocityUtils.getFileName(template, table)));
IOUtils.write(sw.toString(), zip, Constants.UTF8); IOUtils.write(sw.toString(), zip, Constants.UTF8);
IOUtils.closeQuietly(sw); IOUtils.closeQuietly(sw);
zip.flush(); zip.flush();
zip.closeEntry(); zip.closeEntry();
} }
catch (IOException e) catch (IOException e)
@ -274,7 +274,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 修改保存参数校验 * 修改保存参数校验
* *
* @param genTable 业务信息 * @param genTable 业务信息
*/ */
public void validateEdit(GenTable genTable) public void validateEdit(GenTable genTable)
@ -300,7 +300,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 设置主键列信息 * 设置主键列信息
* *
* @param genTable 业务表信息 * @param genTable 业务表信息
* @param columns 业务字段列表 * @param columns 业务字段列表
*/ */
@ -322,7 +322,7 @@ public class GenTableServiceImpl implements IGenTableService
/** /**
* 设置代码生成其他选项值 * 设置代码生成其他选项值
* *
* @param genTable 设置后的生成对象 * @param genTable 设置后的生成对象
*/ */
public void setTableFromOptions(GenTable genTable) public void setTableFromOptions(GenTable genTable)

View File

@ -5,14 +5,14 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn;
/** /**
* 业务字段 服务层 * 业务字段 服务层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface IGenTableColumnService public interface IGenTableColumnService
{ {
/** /**
* 查询业务字段列表 * 查询业务字段列表
* *
* @param genTableColumn 业务字段编号 * @param genTableColumn 业务字段编号
* @return 业务字段集合 * @return 业务字段集合
*/ */
@ -20,7 +20,7 @@ public interface IGenTableColumnService
/** /**
* 新增业务字段 * 新增业务字段
* *
* @param genTableColumn 业务字段信息 * @param genTableColumn 业务字段信息
* @return 结果 * @return 结果
*/ */
@ -28,7 +28,7 @@ public interface IGenTableColumnService
/** /**
* 修改业务字段 * 修改业务字段
* *
* @param genTableColumn 业务字段信息 * @param genTableColumn 业务字段信息
* @return 结果 * @return 结果
*/ */
@ -36,7 +36,7 @@ public interface IGenTableColumnService
/** /**
* 删除业务字段信息 * 删除业务字段信息
* *
* @param ids 需要删除的数据ID * @param ids 需要删除的数据ID
* @return 结果 * @return 结果
*/ */

View File

@ -6,14 +6,14 @@ import com.ruoyi.project.tool.gen.domain.GenTable;
/** /**
* 业务 服务层 * 业务 服务层
* *
* @author ruoyi * @author ruoyi
*/ */
public interface IGenTableService public interface IGenTableService
{ {
/** /**
* 查询业务列表 * 查询业务列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 业务集合 * @return 业务集合
*/ */
@ -21,7 +21,7 @@ public interface IGenTableService
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -29,7 +29,7 @@ public interface IGenTableService
/** /**
* 查询据库列表 * 查询据库列表
* *
* @param tableNames 表名称组 * @param tableNames 表名称组
* @return 数据库表集合 * @return 数据库表集合
*/ */
@ -37,7 +37,7 @@ public interface IGenTableService
/** /**
* 查询业务信息 * 查询业务信息
* *
* @param id 业务ID * @param id 业务ID
* @return 业务信息 * @return 业务信息
*/ */
@ -45,7 +45,7 @@ public interface IGenTableService
/** /**
* 修改业务 * 修改业务
* *
* @param genTable 业务信息 * @param genTable 业务信息
* @return 结果 * @return 结果
*/ */
@ -53,7 +53,7 @@ public interface IGenTableService
/** /**
* 删除业务信息 * 删除业务信息
* *
* @param tableIds 需要删除的表数据ID * @param tableIds 需要删除的表数据ID
* @return 结果 * @return 结果
*/ */
@ -61,14 +61,14 @@ public interface IGenTableService
/** /**
* 导入表结构 * 导入表结构
* *
* @param tableList 导入表列表 * @param tableList 导入表列表
*/ */
public void importGenTable(List<GenTable> tableList); public void importGenTable(List<GenTable> tableList);
/** /**
* 预览代码 * 预览代码
* *
* @param tableId 表编号 * @param tableId 表编号
* @return 预览数据列表 * @return 预览数据列表
*/ */
@ -76,7 +76,7 @@ public interface IGenTableService
/** /**
* 生成代码 * 生成代码
* *
* @param tableName 表名称 * @param tableName 表名称
* @return 数据 * @return 数据
*/ */
@ -84,7 +84,7 @@ public interface IGenTableService
/** /**
* 批量生成代码 * 批量生成代码
* *
* @param tableNames 表数组 * @param tableNames 表数组
* @return 数据 * @return 数据
*/ */
@ -92,7 +92,7 @@ public interface IGenTableService
/** /**
* 修改保存参数校验 * 修改保存参数校验
* *
* @param genTable 业务信息 * @param genTable 业务信息
*/ */
public void validateEdit(GenTable genTable); public void validateEdit(GenTable genTable);

View File

@ -10,7 +10,7 @@ import com.ruoyi.project.tool.gen.domain.GenTableColumn;
/** /**
* 代码生成器 工具类 * 代码生成器 工具类
* *
* @author ruoyi * @author ruoyi
*/ */
public class GenUtils public class GenUtils
@ -115,7 +115,7 @@ public class GenUtils
/** /**
* 校验数组是否包含指定值 * 校验数组是否包含指定值
* *
* @param arr 数组 * @param arr 数组
* @param targetValue * @param targetValue
* @return 是否包含 * @return 是否包含
@ -127,7 +127,7 @@ public class GenUtils
/** /**
* 获取模块名 * 获取模块名
* *
* @param packageName 包名 * @param packageName 包名
* @return 模块名 * @return 模块名
*/ */
@ -141,7 +141,7 @@ public class GenUtils
/** /**
* 获取业务名 * 获取业务名
* *
* @param tableName 表名 * @param tableName 表名
* @return 业务名 * @return 业务名
*/ */
@ -155,7 +155,7 @@ public class GenUtils
/** /**
* 表名转换成Java类名 * 表名转换成Java类名
* *
* @param tableName 表名称 * @param tableName 表名称
* @return 类名 * @return 类名
*/ */
@ -173,7 +173,7 @@ public class GenUtils
/** /**
* 批量替换前缀 * 批量替换前缀
* *
* @param replacementm 替换值 * @param replacementm 替换值
* @param searchList 替换列表 * @param searchList 替换列表
* @return * @return
@ -194,7 +194,7 @@ public class GenUtils
/** /**
* 关键字替换 * 关键字替换
* *
* @param name 需要被替换的名字 * @param name 需要被替换的名字
* @return 替换后的名字 * @return 替换后的名字
*/ */
@ -205,7 +205,7 @@ public class GenUtils
/** /**
* 获取数据库类型字段 * 获取数据库类型字段
* *
* @param columnType 列类型 * @param columnType 列类型
* @return 截取后的列类型 * @return 截取后的列类型
*/ */
@ -223,7 +223,7 @@ public class GenUtils
/** /**
* 获取字段长度 * 获取字段长度
* *
* @param columnType 列类型 * @param columnType 列类型
* @return 截取后的列类型 * @return 截取后的列类型
*/ */

View File

@ -6,7 +6,7 @@ import com.ruoyi.common.constant.Constants;
/** /**
* VelocityEngine工厂 * VelocityEngine工厂
* *
* @author RuoYi * @author RuoYi
*/ */
public class VelocityInitializer public class VelocityInitializer

View File

@ -21,7 +21,7 @@ public class VelocityUtils
/** /**
* 设置模板变量信息 * 设置模板变量信息
* *
* @return 模板列表 * @return 模板列表
*/ */
public static VelocityContext prepareContext(GenTable genTable) public static VelocityContext prepareContext(GenTable genTable)
@ -81,7 +81,7 @@ public class VelocityUtils
/** /**
* 获取模板信息 * 获取模板信息
* *
* @return 模板列表 * @return 模板列表
*/ */
public static List<String> getTemplateList(String tplCategory) public static List<String> getTemplateList(String tplCategory)
@ -138,7 +138,7 @@ public class VelocityUtils
{ {
fileName = StringUtils.format("{}/service/I{}Service.java", javaPath, className); 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); fileName = StringUtils.format("{}/service/impl/{}ServiceImpl.java", javaPath, className);
} }
@ -171,7 +171,7 @@ public class VelocityUtils
/** /**
* 获取包前缀 * 获取包前缀
* *
* @param packageName 包名称 * @param packageName 包名称
* @return 包前缀名称 * @return 包前缀名称
*/ */
@ -184,7 +184,7 @@ public class VelocityUtils
/** /**
* 根据列类型获取导入包 * 根据列类型获取导入包
* *
* @param column 列集合 * @param column 列集合
* @return 返回需要导入的包列表 * @return 返回需要导入的包列表
*/ */
@ -196,6 +196,7 @@ public class VelocityUtils
if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType())) if (!column.isSuperColumn() && GenConstants.TYPE_DATE.equals(column.getJavaType()))
{ {
importList.add("java.util.Date"); importList.add("java.util.Date");
importList.add("com.fasterxml.jackson.annotation.JsonFormat");
} }
else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType())) else if (!column.isSuperColumn() && GenConstants.TYPE_BIGDECIMAL.equals(column.getJavaType()))
{ {
@ -207,7 +208,7 @@ public class VelocityUtils
/** /**
* 获取权限前缀 * 获取权限前缀
* *
* @param moduleName 模块名称 * @param moduleName 模块名称
* @param businessName 业务名称 * @param businessName 业务名称
* @return 返回权限前缀 * @return 返回权限前缀
@ -220,7 +221,7 @@ public class VelocityUtils
/** /**
* 获取树编码 * 获取树编码
* *
* @param options 生成其他选项 * @param options 生成其他选项
* @return 树编码 * @return 树编码
*/ */
@ -235,7 +236,7 @@ public class VelocityUtils
/** /**
* 获取树父编码 * 获取树父编码
* *
* @param options 生成其他选项 * @param options 生成其他选项
* @return 树父编码 * @return 树父编码
*/ */
@ -250,7 +251,7 @@ public class VelocityUtils
/** /**
* 获取树名称 * 获取树名称
* *
* @param options 生成其他选项 * @param options 生成其他选项
* @return 树名称 * @return 树名称
*/ */
@ -265,7 +266,7 @@ public class VelocityUtils
/** /**
* 获取需要在哪一列上面显示展开按钮 * 获取需要在哪一列上面显示展开按钮
* *
* @param genTable 业务表对象 * @param genTable 业务表对象
* @return 展开按钮列序号 * @return 展开按钮列序号
*/ */

View File

@ -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>

View File

@ -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>

View File

@ -78,11 +78,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteSysDictMoedataById" parameterType="Long"> <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>
<delete id="deleteSysDictMoedataByIds" parameterType="String"> <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=")"> <foreach item="id" collection="array" open="(" separator="," close=")">
#{id} #{id}
</foreach> </foreach>

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper"> <mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableColumnMapper">
<resultMap type="GenTableColumn" id="GenTableColumnResult"> <resultMap type="GenTableColumn" id="GenTableColumnResult">
<id property="columnId" column="column_id" /> <id property="columnId" column="column_id" />
<result property="tableId" column="table_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="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </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 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> </sql>
<select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult"> <select id="selectGenTableColumnListByTableId" parameterType="Long" resultMap="GenTableColumnResult">
<include refid="selectGenTableColumnVo"/> <include refid="selectGenTableColumnVo"/>
where table_id = #{tableId} where table_id = #{tableId}
order by sort order by sort
</select> </select>
<select id="selectDbTableColumnsByName" parameterType="String" resultMap="GenTableColumnResult"> <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 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}) from information_schema.columns where table_schema = (select database()) and table_name = (#{tableName})
order by ordinal_position order by ordinal_position
</select> </select>
<insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId"> <insert id="insertGenTableColumn" parameterType="GenTableColumn" useGeneratedKeys="true" keyProperty="columnId">
insert into gen_table_column ( insert into gen_table_column (
<if test="tableId != null and tableId != ''">table_id,</if> <if test="tableId != null and tableId != ''">table_id,</if>
<if test="columnName != null and columnName != ''">column_name,</if> <if test="columnName != null and columnName != ''">column_name,</if>
<if test="columnComment != null and columnComment != ''">column_comment,</if> <if test="columnComment != null and columnComment != ''">column_comment,</if>
<if test="columnType != null and columnType != ''">column_type,</if> <if test="columnType != null and columnType != ''">column_type,</if>
<if test="javaType != null and javaType != ''">java_type,</if> <if test="javaType != null and javaType != ''">java_type,</if>
<if test="javaField != null and javaField != ''">java_field,</if> <if test="javaField != null and javaField != ''">java_field,</if>
<if test="isPk != null and isPk != ''">is_pk,</if> <if test="isPk != null and isPk != ''">is_pk,</if>
<if test="isIncrement != null and isIncrement != ''">is_increment,</if> <if test="isIncrement != null and isIncrement != ''">is_increment,</if>
<if test="isRequired != null and isRequired != ''">is_required,</if> <if test="isRequired != null and isRequired != ''">is_required,</if>
<if test="isInsert != null and isInsert != ''">is_insert,</if> <if test="isInsert != null and isInsert != ''">is_insert,</if>
<if test="isEdit != null and isEdit != ''">is_edit,</if> <if test="isEdit != null and isEdit != ''">is_edit,</if>
<if test="isList != null and isList != ''">is_list,</if> <if test="isList != null and isList != ''">is_list,</if>
<if test="isQuery != null and isQuery != ''">is_query,</if> <if test="isQuery != null and isQuery != ''">is_query,</if>
<if test="queryType != null and queryType != ''">query_type,</if> <if test="queryType != null and queryType != ''">query_type,</if>
<if test="htmlType != null and htmlType != ''">html_type,</if> <if test="htmlType != null and htmlType != ''">html_type,</if>
<if test="dictType != null and dictType != ''">dict_type,</if> <if test="dictType != null and dictType != ''">dict_type,</if>
<if test="sort != null">sort,</if> <if test="sort != null">sort,</if>
<if test="createBy != null and createBy != ''">create_by,</if> <if test="createBy != null and createBy != ''">create_by,</if>
create_time create_time
)values( )values(
<if test="tableId != null and tableId != ''">#{tableId},</if> <if test="tableId != null and tableId != ''">#{tableId},</if>
<if test="columnName != null and columnName != ''">#{columnName},</if> <if test="columnName != null and columnName != ''">#{columnName},</if>
<if test="columnComment != null and columnComment != ''">#{columnComment},</if> <if test="columnComment != null and columnComment != ''">#{columnComment},</if>
<if test="columnType != null and columnType != ''">#{columnType},</if> <if test="columnType != null and columnType != ''">#{columnType},</if>
<if test="javaType != null and javaType != ''">#{javaType},</if> <if test="javaType != null and javaType != ''">#{javaType},</if>
<if test="javaField != null and javaField != ''">#{javaField},</if> <if test="javaField != null and javaField != ''">#{javaField},</if>
<if test="isPk != null and isPk != ''">#{isPk},</if> <if test="isPk != null and isPk != ''">#{isPk},</if>
<if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if> <if test="isIncrement != null and isIncrement != ''">#{isIncrement},</if>
<if test="isRequired != null and isRequired != ''">#{isRequired},</if> <if test="isRequired != null and isRequired != ''">#{isRequired},</if>
<if test="isInsert != null and isInsert != ''">#{isInsert},</if> <if test="isInsert != null and isInsert != ''">#{isInsert},</if>
<if test="isEdit != null and isEdit != ''">#{isEdit},</if> <if test="isEdit != null and isEdit != ''">#{isEdit},</if>
<if test="isList != null and isList != ''">#{isList},</if> <if test="isList != null and isList != ''">#{isList},</if>
<if test="isQuery != null and isQuery != ''">#{isQuery},</if> <if test="isQuery != null and isQuery != ''">#{isQuery},</if>
<if test="queryType != null and queryType != ''">#{queryType},</if> <if test="queryType != null and queryType != ''">#{queryType},</if>
<if test="htmlType != null and htmlType != ''">#{htmlType},</if> <if test="htmlType != null and htmlType != ''">#{htmlType},</if>
<if test="dictType != null and dictType != ''">#{dictType},</if> <if test="dictType != null and dictType != ''">#{dictType},</if>
<if test="sort != null">#{sort},</if> <if test="sort != null">#{sort},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if> <if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate() sysdate()
) )
</insert> </insert>
<update id="updateGenTableColumn" parameterType="GenTableColumn"> <update id="updateGenTableColumn" parameterType="GenTableColumn">
update gen_table_column update gen_table_column
<set> <set>
@ -111,10 +111,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteGenTableColumnByIds" parameterType="Long"> <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=")"> <foreach collection="array" item="tableId" open="(" separator="," close=")">
#{tableId} #{tableId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableMapper"> <mapper namespace="com.ruoyi.project.tool.gen.mapper.GenTableMapper">
<resultMap type="GenTable" id="GenTableResult"> <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="tableName" column="table_name" />
<result property="tableComment" column="table_comment" /> <result property="tableComment" column="table_comment" />
<result property="className" column="class_name" /> <result property="className" column="class_name" />
@ -23,37 +23,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" /> <collection property="columns" javaType="java.util.List" resultMap="GenTableColumnResult" />
</resultMap> </resultMap>
<resultMap type="GenTableColumn" id="GenTableColumnResult"> <resultMap type="GenTableColumn" id="GenTableColumnResult">
<id property="columnId" column="column_id" /> <id property="columnId" column="column_id" />
<result property="tableId" column="table_id" /> <result property="tableId" column="table_id" />
<result property="columnName" column="column_name" /> <result property="columnName" column="column_name" />
<result property="columnComment" column="column_comment" /> <result property="columnComment" column="column_comment" />
<result property="columnType" column="column_type" /> <result property="columnType" column="column_type" />
<result property="javaType" column="java_type" /> <result property="javaType" column="java_type" />
<result property="javaField" column="java_field" /> <result property="javaField" column="java_field" />
<result property="isPk" column="is_pk" /> <result property="isPk" column="is_pk" />
<result property="isIncrement" column="is_increment" /> <result property="isIncrement" column="is_increment" />
<result property="isRequired" column="is_required" /> <result property="isRequired" column="is_required" />
<result property="isInsert" column="is_insert" /> <result property="isInsert" column="is_insert" />
<result property="isEdit" column="is_edit" /> <result property="isEdit" column="is_edit" />
<result property="isList" column="is_list" /> <result property="isList" column="is_list" />
<result property="isQuery" column="is_query" /> <result property="isQuery" column="is_query" />
<result property="queryType" column="query_type" /> <result property="queryType" column="query_type" />
<result property="htmlType" column="html_type" /> <result property="htmlType" column="html_type" />
<result property="dictType" column="dict_type" /> <result property="dictType" column="dict_type" />
<result property="sort" column="sort" /> <result property="sort" column="sort" />
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
</resultMap> </resultMap>
<sql id="selectGenTableVo"> <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 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> </sql>
<select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult"> <select id="selectGenTableList" parameterType="GenTable" resultMap="GenTableResult">
<include refid="selectGenTableVo"/> <include refid="selectGenTableVo"/>
<where> <where>
<if test="tableName != null and tableName != ''"> <if test="tableName != null and tableName != ''">
@ -62,12 +62,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tableComment != null and tableComment != ''"> <if test="tableComment != null and tableComment != ''">
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%')) AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
</if> </if>
<!-- <if test="beginTime != null and beginTime != ''">开始时间检索 --> <!-- <if test="beginTime != null and beginTime != ''">开始时间检索 -->
<!-- AND date_format(create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') --> <!-- AND date_format(create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') -->
<!-- </if> --> <!-- </if> -->
<!-- <if test="endTime != null and endTime != ''">结束时间检索 --> <!-- <if test="endTime != null and endTime != ''">结束时间检索 -->
<!-- AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') --> <!-- AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') -->
<!-- </if> --> <!-- </if> -->
</where> </where>
</select> </select>
@ -89,22 +89,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') AND date_format(create_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</select> </select>
<select id="selectDbTableListByNames" resultMap="GenTableResult"> <select id="selectDbTableListByNames" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables 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()) where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
and table_name in and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")"> <foreach collection="array" item="name" open="(" separator="," close=")">
#{name} #{name}
</foreach> </foreach>
</select> </select>
<select id="selectTableByName" parameterType="String" resultMap="GenTableResult"> <select id="selectTableByName" parameterType="String" resultMap="GenTableResult">
select table_name, table_comment, create_time, update_time from information_schema.tables select table_name, table_comment, create_time, update_time from information_schema.tables
where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database()) where table_comment <![CDATA[ <> ]]> '' and table_schema = (select database())
and table_name = #{tableName} and table_name = #{tableName}
</select> </select>
<select id="selectGenTableById" parameterType="Long" resultMap="GenTableResult"> <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, 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 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 LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_id = #{tableId} order by c.sort where t.table_id = #{tableId} order by c.sort
</select> </select>
<select id="selectGenTableByName" parameterType="String" resultMap="GenTableResult"> <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, 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 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 LEFT JOIN gen_table_column c ON t.table_id = c.table_id
where t.table_name = #{tableName} order by c.sort where t.table_name = #{tableName} order by c.sort
</select> </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> <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>

View File

@ -25,7 +25,7 @@ import com.ruoyi.framework.web.page.TableDataInfo;
/** /**
* ${functionName}Controller * ${functionName}Controller
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
@ -36,25 +36,25 @@ public class ${ClassName}Controller extends BaseController
@Autowired @Autowired
private I${ClassName}Service ${className}Service; private I${ClassName}Service ${className}Service;
/** /**
* 查询${functionName}列表 * 查询${functionName}列表
*/ */
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:list')")
@GetMapping("/list") @GetMapping("/list")
#if($table.crud) #if($table.crud)
public TableDataInfo list(${ClassName} ${className}) public TableDataInfo list(${ClassName} ${className})
{ {
startPage(); startPage();
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return getDataTable(list); return getDataTable(list);
} }
#elseif($table.tree) #elseif($table.tree)
public AjaxResult list(${ClassName} ${className}) public AjaxResult list(${ClassName} ${className})
{ {
List<${ClassName}> list = ${className}Service.select${ClassName}List(${className}); List<${ClassName}> list = ${className}Service.select${ClassName}List(${className});
return AjaxResult.success(list); return AjaxResult.success(list);
} }
#end #end
/** /**
* 导出${functionName}列表 * 导出${functionName}列表
@ -106,7 +106,7 @@ public class ${ClassName}Controller extends BaseController
*/ */
@PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')") @PreAuthorize("@ss.hasPermi('${permissionPrefix}:remove')")
@Log(title = "${functionName}", businessType = BusinessType.DELETE) @Log(title = "${functionName}", businessType = BusinessType.DELETE)
@DeleteMapping("/{${pkColumn.javaField}s}") @DeleteMapping("/{${pkColumn.javaField}s}")
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s) public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
{ {
return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s)); return toAjax(${className}Service.delete${ClassName}ByIds(${pkColumn.javaField}s));

View File

@ -1,5 +1,8 @@
package ${packageName}.domain; package ${packageName}.domain;
#foreach ($import in $importList)
import ${import};
#end
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel; import com.ruoyi.framework.aspectj.lang.annotation.Excel;
@ -8,77 +11,75 @@ import com.ruoyi.framework.web.domain.BaseEntity;
#elseif($table.tree) #elseif($table.tree)
import com.ruoyi.framework.web.domain.TreeEntity; import com.ruoyi.framework.web.domain.TreeEntity;
#end #end
#foreach ($import in $importList)
import ${import};
#end
/** /**
* ${functionName}对象 ${tableName} * ${functionName}对象 ${tableName}
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
#if($table.crud) #if($table.crud)
#set($Entity="BaseEntity") #set($Entity="BaseEntity")
#elseif($table.tree) #elseif($table.tree)
#set($Entity="TreeEntity") #set($Entity="TreeEntity")
#end #end
public class ${ClassName} extends ${Entity} public class ${ClassName} extends ${Entity}
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
/** $column.columnComment */ /** $column.columnComment */
#if($column.list) #if($column.list)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
#elseif($column.javaType == 'Date') #elseif($column.javaType == 'Date')
@Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
#else @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
@Excel(name = "${comment}") #else
#end @Excel(name = "${comment}")
#end #end
#end
private $column.javaType $column.javaField; private $column.javaType $column.javaField;
#end #end
#end #end
#foreach ($column in $columns) #foreach ($column in $columns)
#if(!$table.isSuperColumn($column.javaField)) #if(!$table.isSuperColumn($column.javaField))
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField) #set($AttrName=$column.javaField)
#else #else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end #end
public void set${AttrName}($column.javaType $column.javaField) public void set${AttrName}($column.javaType $column.javaField)
{ {
this.$column.javaField = $column.javaField; this.$column.javaField = $column.javaField;
} }
public $column.javaType get${AttrName}() public $column.javaType get${AttrName}()
{ {
return $column.javaField; return $column.javaField;
} }
#end #end
#end #end
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]")) #if($column.javaField.length() > 2 && $column.javaField.substring(1,2).matches("[A-Z]"))
#set($AttrName=$column.javaField) #set($AttrName=$column.javaField)
#else #else
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#end #end
.append("${column.javaField}", get${AttrName}()) .append("${column.javaField}", get${AttrName}())
#end #end
.toString(); .toString();
} }
} }

View File

@ -5,15 +5,15 @@ import ${packageName}.domain.${ClassName};
/** /**
* ${functionName}Mapper接口 * ${functionName}Mapper接口
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
public interface ${ClassName}Mapper public interface ${ClassName}Mapper
{ {
/** /**
* 查询${functionName} * 查询${functionName}
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return ${functionName} * @return ${functionName}
*/ */
@ -21,7 +21,7 @@ public interface ${ClassName}Mapper
/** /**
* 查询${functionName}列表 * 查询${functionName}列表
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return ${functionName}集合 * @return ${functionName}集合
*/ */
@ -29,7 +29,7 @@ public interface ${ClassName}Mapper
/** /**
* 新增${functionName} * 新增${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@ -37,7 +37,7 @@ public interface ${ClassName}Mapper
/** /**
* 修改${functionName} * 修改${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@ -45,7 +45,7 @@ public interface ${ClassName}Mapper
/** /**
* 删除${functionName} * 删除${functionName}
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return 结果 * @return 结果
*/ */
@ -53,7 +53,7 @@ public interface ${ClassName}Mapper
/** /**
* 批量删除${functionName} * 批量删除${functionName}
* *
* @param ${pkColumn.javaField}s 需要删除的数据ID * @param ${pkColumn.javaField}s 需要删除的数据ID
* @return 结果 * @return 结果
*/ */

View File

@ -5,15 +5,15 @@ import ${packageName}.domain.${ClassName};
/** /**
* ${functionName}Service接口 * ${functionName}Service接口
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
public interface I${ClassName}Service public interface I${ClassName}Service
{ {
/** /**
* 查询${functionName} * 查询${functionName}
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return ${functionName} * @return ${functionName}
*/ */
@ -21,7 +21,7 @@ public interface I${ClassName}Service
/** /**
* 查询${functionName}列表 * 查询${functionName}列表
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return ${functionName}集合 * @return ${functionName}集合
*/ */
@ -29,7 +29,7 @@ public interface I${ClassName}Service
/** /**
* 新增${functionName} * 新增${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@ -37,7 +37,7 @@ public interface I${ClassName}Service
/** /**
* 修改${functionName} * 修改${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@ -45,7 +45,7 @@ public interface I${ClassName}Service
/** /**
* 批量删除${functionName} * 批量删除${functionName}
* *
* @param ${pkColumn.javaField}s 需要删除的${functionName}ID * @param ${pkColumn.javaField}s 需要删除的${functionName}ID
* @return 结果 * @return 结果
*/ */
@ -53,7 +53,7 @@ public interface I${ClassName}Service
/** /**
* 删除${functionName}信息 * 删除${functionName}信息
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return 结果 * @return 结果
*/ */

View File

@ -1,12 +1,12 @@
package ${packageName}.service.impl; package ${packageName}.service.impl;
import java.util.List; import java.util.List;
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.javaField == 'createTime' || $column.javaField == 'updateTime') #if($column.javaField == 'createTime' || $column.javaField == 'updateTime')
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
#break #break
#end #end
#end #end
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import ${packageName}.mapper.${ClassName}Mapper; import ${packageName}.mapper.${ClassName}Mapper;
@ -15,19 +15,19 @@ import ${packageName}.service.I${ClassName}Service;
/** /**
* ${functionName}Service业务层处理 * ${functionName}Service业务层处理
* *
* @author ${author} * @author ${author}
* @date ${datetime} * @date ${datetime}
*/ */
@Service @Service
public class ${ClassName}ServiceImpl implements I${ClassName}Service public class ${ClassName}ServiceImpl implements I${ClassName}Service
{ {
@Autowired @Autowired
private ${ClassName}Mapper ${className}Mapper; private ${ClassName}Mapper ${className}Mapper;
/** /**
* 查询${functionName} * 查询${functionName}
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return ${functionName} * @return ${functionName}
*/ */
@ -39,7 +39,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/** /**
* 查询${functionName}列表 * 查询${functionName}列表
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return ${functionName} * @return ${functionName}
*/ */
@ -51,41 +51,41 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/** /**
* 新增${functionName} * 新增${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insert${ClassName}(${ClassName} ${className}) public int insert${ClassName}(${ClassName} ${className})
{ {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.javaField == 'createTime') #if($column.javaField == 'createTime')
${className}.setCreateTime(DateUtils.getNowDate()); ${className}.setCreateTime(DateUtils.getNowDate());
#end #end
#end #end
return ${className}Mapper.insert${ClassName}(${className}); return ${className}Mapper.insert${ClassName}(${className});
} }
/** /**
* 修改${functionName} * 修改${functionName}
* *
* @param ${className} ${functionName} * @param ${className} ${functionName}
* @return 结果 * @return 结果
*/ */
@Override @Override
public int update${ClassName}(${ClassName} ${className}) public int update${ClassName}(${ClassName} ${className})
{ {
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.javaField == 'updateTime') #if($column.javaField == 'updateTime')
${className}.setUpdateTime(DateUtils.getNowDate()); ${className}.setUpdateTime(DateUtils.getNowDate());
#end #end
#end #end
return ${className}Mapper.update${ClassName}(${className}); return ${className}Mapper.update${ClassName}(${className});
} }
/** /**
* 批量删除${functionName} * 批量删除${functionName}
* *
* @param ${pkColumn.javaField}s 需要删除的${functionName}ID * @param ${pkColumn.javaField}s 需要删除的${functionName}ID
* @return 结果 * @return 结果
*/ */
@ -97,7 +97,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
/** /**
* 删除${functionName}信息 * 删除${functionName}信息
* *
* @param ${pkColumn.javaField} ${functionName}ID * @param ${pkColumn.javaField} ${functionName}ID
* @return 结果 * @return 结果
*/ */

View File

@ -1,410 +1,407 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.query) #if($column.query)
#set($dictType=$column.dictType) #set($dictType=$column.dictType)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.htmlType == "input") #if($column.htmlType == "input")
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-input <el-input
v-model="queryParams.${column.javaField}" v-model="queryParams.${column.javaField}"
placeholder="请输入${comment}" placeholder="请输入${comment}"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType) #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && "" != $dictType)
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
<el-option <el-option
v-for="dict in ${column.javaField}Options" v-for="dict in ${column.javaField}Options"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" :value="dict.dictValue"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) #elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType)
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small"> <el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable size="small">
<el-option label="请选择字典生成" value="" /> <el-option label="请选择字典生成" value="" />
</el-select> </el-select>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "datetime") #elseif($column.htmlType == "datetime")
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-date-picker clearable size="small" style="width: 200px" <el-date-picker clearable size="small" style="width: 200px"
v-model="queryParams.${column.javaField}" v-model="queryParams.${column.javaField}"
type="date" type="date"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择${comment}"> placeholder="选择${comment}">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
#end #end
#end #end
#end #end
<el-form-item> <el-form-item>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-search" icon="el-icon-search"
size="mini" size="mini"
@click="handleQuery" @click="handleQuery"
>搜索</el-button> >搜索</el-button>
<el-button <el-button
class="filter-item" class="filter-item"
type="primary" type="primary"
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['${moduleName}:${businessName}:add']" v-hasPermi="['${moduleName}:${businessName}:add']"
>新增</el-button> >新增</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-table <el-table
v-loading="loading" v-loading="loading"
:data="${businessName}List" :data="${businessName}List"
row-key="${treeCode}" row-key="${treeCode}"
default-expand-all default-expand-all
:tree-props="{children: 'children', hasChildren: 'hasChildren'}" :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
> >
#foreach($column in $columns) #foreach($column in $columns)
#set($javaField=$column.javaField) #set($javaField=$column.javaField)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.pk) #if($column.pk)
#elseif($column.list && $column.htmlType == "datetime") #elseif($column.list && $column.htmlType == "datetime")
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> <el-table-column label="${comment}" align="center" prop="${javaField}" width="180">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.${javaField}) }}</span> <span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span>
</template> </template>
</el-table-column> </el-table-column>
#elseif($column.list && "" != $column.dictType) #elseif($column.list && "" != $column.dictType)
<el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" /> <el-table-column label="${comment}" align="center" prop="${javaField}" :formatter="${javaField}Format" />
#elseif($column.list && "" != $javaField) #elseif($column.list && "" != $javaField)
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-table-column label="${comment}" align="center" prop="${javaField}" />
#end #end
#end #end
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:edit']" v-hasPermi="['${moduleName}:${businessName}:edit']"
>修改</el-button> >修改</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['${moduleName}:${businessName}:remove']" v-hasPermi="['${moduleName}:${businessName}:remove']"
>删除</el-button> >删除</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<!-- 添加或修改${functionName}对话框 --> <!-- 添加或修改${functionName}对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
#foreach($column in $columns) #foreach($column in $columns)
#set($field=$column.javaField) #set($field=$column.javaField)
#if($column.insert && !$column.pk) #if($column.insert && !$column.pk)
#if(($column.usableColumn) || (!$column.superColumn)) #if(($column.usableColumn) || (!$column.superColumn))
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#set($dictType=$column.dictType) #set($dictType=$column.dictType)
#if("" != $treeParentCode && $column.javaField == $treeParentCode) #if("" != $treeParentCode && $column.javaField == $treeParentCode)
<el-form-item label="${comment}" prop="${treeParentCode}"> <el-form-item label="${comment}" prop="${treeParentCode}">
<treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" /> <treeselect v-model="form.${treeParentCode}" :options="${businessName}Options" :normalizer="normalizer" placeholder="请选择${comment}" />
</el-form-item> </el-form-item>
#elseif($column.htmlType == "input") #elseif($column.htmlType == "input")
<el-form-item label="${comment}" prop="${field}"> <el-form-item label="${comment}" prop="${field}">
<el-input v-model="form.${field}" placeholder="请输入${comment}" /> <el-input v-model="form.${field}" placeholder="请输入${comment}" />
</el-form-item> </el-form-item>
#elseif($column.htmlType == "select" && "" != $dictType) #elseif($column.htmlType == "select" && "" != $dictType)
<el-form-item label="${comment}"> <el-form-item label="${comment}">
<el-select v-model="form.${field}" placeholder="请选择${comment}"> <el-select v-model="form.${field}" placeholder="请选择${comment}">
<el-option <el-option
v-for="dict in ${field}Options" v-for="dict in ${field}Options"
:key="dict.dictValue" :key="dict.dictValue"
:label="dict.dictLabel" :label="dict.dictLabel"
:value="dict.dictValue" #if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
></el-option>
</el-select> ></el-option>
</el-form-item> </el-select>
#elseif($column.htmlType == "select" && $dictType) </el-form-item>
<el-form-item label="${comment}"> #elseif($column.htmlType == "select" && $dictType)
<el-select v-model="form.${field}" placeholder="请选择${comment}"> <el-form-item label="${comment}">
<el-option label="请选择字典生成" value="" /> <el-select v-model="form.${field}" placeholder="请选择${comment}">
</el-select> <el-option label="请选择字典生成" value="" />
</el-form-item> </el-select>
#elseif($column.htmlType == "radio" && "" != $dictType) </el-form-item>
<el-form-item label="${comment}"> #elseif($column.htmlType == "radio" && "" != $dictType)
<el-radio-group v-model="form.${field}"> <el-form-item label="${comment}">
<el-radio <el-radio-group v-model="form.${field}">
v-for="dict in ${field}Options" <el-radio
:key="dict.dictValue" v-for="dict in ${field}Options"
:label="dict.dictValue" :key="dict.dictValue"
>{{dict.dictLabel}}</el-radio> #if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
</el-radio-group>
</el-form-item> >{{dict.dictLabel}}</el-radio>
#elseif($column.htmlType == "radio" && $dictType) </el-radio-group>
<el-form-item label="${comment}"> </el-form-item>
<el-radio-group v-model="form.${field}"> #elseif($column.htmlType == "radio" && $dictType)
<el-radio label="1">请选择字典生成</el-radio> <el-form-item label="${comment}">
</el-radio-group> <el-radio-group v-model="form.${field}">
</el-form-item> <el-radio label="1">请选择字典生成</el-radio>
#elseif($column.htmlType == "datetime") </el-radio-group>
<el-form-item label="${comment}" prop="${field}"> </el-form-item>
<el-date-picker clearable size="small" style="width: 200px" #elseif($column.htmlType == "datetime")
v-model="form.${field}" <el-form-item label="${comment}" prop="${field}">
type="date" <el-date-picker clearable size="small" style="width: 200px"
value-format="yyyy-MM-dd" v-model="form.${field}"
placeholder="选择${comment}"> type="date"
</el-date-picker> value-format="yyyy-MM-dd"
</el-form-item> placeholder="选择${comment}">
#elseif($column.htmlType == "textarea") </el-date-picker>
<el-form-item label="${comment}" prop="${field}"> </el-form-item>
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> #elseif($column.htmlType == "textarea")
</el-form-item> <el-form-item label="${comment}" prop="${field}">
#end <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
#end </el-form-item>
#end #end
#end #end
</el-form> #end
<div slot="footer" class="dialog-footer"> #end
<el-button type="primary" @click="submitForm">确 定</el-button> </el-form>
<el-button @click="cancel">取 消</el-button> <div slot="footer" class="dialog-footer">
</div> <el-button type="primary" @click="submitForm">确 定</el-button>
</el-dialog> <el-button @click="cancel">取 消</el-button>
</div> </div>
</el-dialog>
</div>
</template> </template>
<script> <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}";
import Treeselect from "@riophae/vue-treeselect"; import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default { export default {
name: "${BusinessName}", name: "${BusinessName}",
components: { Treeselect }, components: { Treeselect },
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// ${functionName}表格数据 // ${functionName}表格数据
${businessName}List: [], ${businessName}List: [],
// ${functionName}树选项 // ${functionName}树选项
${businessName}Options: [], ${businessName}Options: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
#foreach ($column in $columns) #foreach ($column in $columns)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if(${column.dictType} != '') #if(${column.dictType} != '')
// $comment字典 // $comment字典
${column.javaField}Options: []#if($velocityCount != $columns.size()),#end ${column.javaField}Options: [],
#end
#end
// 查询参数
queryParams: {
#foreach ($column in $columns)
#if($column.query)
$column.javaField: undefined#if($velocityCount != $columns.size()),#end
#end #end
#end #end
// 查询参数 },
queryParams: { // 表单参数
#foreach ($column in $columns) form: {},
#if($column.query) // 表单校验
$column.javaField: undefined#if($velocityCount != $columns.size()),#end 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
#end #end
}, }
// 表单参数 };
form: {}, },
// 表单校验 created() {
rules: { this.getList();
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.required) #if(${column.dictType} != '')
#set($parentheseIndex=$column.columnComment.indexOf("")) this.getDicts("${column.dictType}").then(response => {
#if($parentheseIndex != -1) this.${column.javaField}Options = response.data;
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) });
#else #end
#set($comment=$column.columnComment) #end
#end },
#set($comment=$column.columnComment) methods: {
$column.javaField: [ /** 查询${functionName}列表 */
{ required: true, message: "$comment不能为空", trigger: "blur" } getList() {
]#if($velocityCount != $columns.size()),#end this.loading = true;
list${BusinessName}(this.queryParams).then(response => {
#end this.${businessName}List = this.handleTree(response.data, "${treeCode}", "${treeParentCode}");
#end this.loading = false;
}
};
},
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);
}
}); });
} else { },
add${BusinessName}(this.form).then(response => { /** 转换${functionName}数据结构 */
if (response.code === 200) { normalizer(node) {
this.msgSuccess("新增成功"); if (node.children && !node.children.length) {
this.open = false; delete node.children;
this.getList(); }
} else { return {
this.msgError(response.msg); 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> </script>

View File

@ -1,441 +1,438 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px"> <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.query) #if($column.query)
#set($dictType=$column.dictType) #set($dictType=$column.dictType)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if($column.htmlType == "input") #if($column.htmlType == "input")
<el-form-item label="${comment}" prop="${column.javaField}"> <el-form-item label="${comment}" prop="${column.javaField}">
<el-input <el-input
v-model="queryParams.${column.javaField}" v-model="queryParams.${column.javaField}"
placeholder="请输入${comment}" placeholder="请输入${comment}"
clearable clearable
size="small" size="small"
@keyup.enter.native="handleQuery" @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"> <!-- 添加或修改${functionName}对话框 -->
<el-col :span="1.5"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-button <el-form ref="form" :model="form" :rules="rules" label-width="80px">
type="primary" #foreach($column in $columns)
icon="el-icon-plus" #set($field=$column.javaField)
size="mini" #if($column.insert && !$column.pk)
@click="handleAdd" #if(($column.usableColumn) || (!$column.superColumn))
v-hasPermi="['${moduleName}:${businessName}:add']" #set($parentheseIndex=$column.columnComment.indexOf(""))
>新增</el-button> #if($parentheseIndex != -1)
</el-col> #set($comment=$column.columnComment.substring(0, $parentheseIndex))
<el-col :span="1.5"> #else
<el-button #set($comment=$column.columnComment)
type="success" #end
icon="el-icon-edit" #set($dictType=$column.dictType)
size="mini" #if($column.htmlType == "input")
:disabled="single" <el-form-item label="${comment}" prop="${field}">
@click="handleUpdate" <el-input v-model="form.${field}" placeholder="请输入${comment}" />
v-hasPermi="['${moduleName}:${businessName}:edit']" </el-form-item>
>修改</el-button> #elseif($column.htmlType == "select" && "" != $dictType)
</el-col> <el-form-item label="${comment}">
<el-col :span="1.5"> <el-select v-model="form.${field}" placeholder="请选择${comment}">
<el-button <el-option
type="danger" v-for="dict in ${field}Options"
icon="el-icon-delete" :key="dict.dictValue"
size="mini" :label="dict.dictLabel"
:disabled="multiple" #if($column.javaType == "Integer"):value="parseInt(dict.dictValue)"#else:value="dict.dictValue"#end
@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-option>
<el-table-column type="selection" width="55" align="center" /> </el-select>
#foreach($column in $columns) </el-form-item>
#set($javaField=$column.javaField) #elseif($column.htmlType == "select" && $dictType)
#set($parentheseIndex=$column.columnComment.indexOf("")) <el-form-item label="${comment}">
#if($parentheseIndex != -1) <el-select v-model="form.${field}" placeholder="请选择${comment}">
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) <el-option label="请选择字典生成" value="" />
#else </el-select>
#set($comment=$column.columnComment) </el-form-item>
#end #elseif($column.htmlType == "radio" && "" != $dictType)
#if($column.pk) <el-form-item label="${comment}">
<el-table-column label="${comment}" align="center" prop="${javaField}" /> <el-radio-group v-model="form.${field}">
#elseif($column.list && $column.htmlType == "datetime") <el-radio
<el-table-column label="${comment}" align="center" prop="${javaField}" width="180"> v-for="dict in ${field}Options"
<template slot-scope="scope"> :key="dict.dictValue"
<span>{{ parseTime(scope.row.${javaField}) }}</span> #if($column.javaType == "Integer"):label="parseInt(dict.dictValue)"#else:label="dict.dictValue"#end
</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"
/>
<!-- 添加或修改${functionName}对话框 --> >{{dict.dictLabel}}</el-radio>
<el-dialog :title="title" :visible.sync="open" width="500px"> </el-radio-group>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> </el-form-item>
#foreach($column in $columns) #elseif($column.htmlType == "radio" && $dictType)
#set($field=$column.javaField) <el-form-item label="${comment}">
#if($column.insert && !$column.pk) <el-radio-group v-model="form.${field}">
#if(($column.usableColumn) || (!$column.superColumn)) <el-radio label="1">请选择字典生成</el-radio>
#set($parentheseIndex=$column.columnComment.indexOf("")) </el-radio-group>
#if($parentheseIndex != -1) </el-form-item>
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #elseif($column.htmlType == "datetime")
#else <el-form-item label="${comment}" prop="${field}">
#set($comment=$column.columnComment) <el-date-picker clearable size="small" style="width: 200px"
#end v-model="form.${field}"
#set($dictType=$column.dictType) type="date"
#if($column.htmlType == "input") value-format="yyyy-MM-dd"
<el-form-item label="${comment}" prop="${field}"> placeholder="选择${comment}">
<el-input v-model="form.${field}" placeholder="请输入${comment}" /> </el-date-picker>
</el-form-item> </el-form-item>
#elseif($column.htmlType == "select" && "" != $dictType) #elseif($column.htmlType == "textarea")
<el-form-item label="${comment}"> <el-form-item label="${comment}" prop="${field}">
<el-select v-model="form.${field}" placeholder="请选择${comment}"> <el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" />
<el-option </el-form-item>
v-for="dict in ${field}Options" #end
:key="dict.dictValue" #end
:label="dict.dictLabel" #end
:value="dict.dictValue" #end
></el-option> </el-form>
</el-select> <div slot="footer" class="dialog-footer">
</el-form-item> <el-button type="primary" @click="submitForm">确 定</el-button>
#elseif($column.htmlType == "select" && $dictType) <el-button @click="cancel">取 消</el-button>
<el-form-item label="${comment}"> </div>
<el-select v-model="form.${field}" placeholder="请选择${comment}"> </el-dialog>
<el-option label="请选择字典生成" value="" /> </div>
</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>
</template> </template>
<script> <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 { export default {
name: "${BusinessName}", name: "${BusinessName}",
data() { data() {
return { return {
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
ids: [], ids: [],
// 非单个禁用 // 非单个禁用
single: true, single: true,
// 非多个禁用 // 非多个禁用
multiple: true, multiple: true,
// 总条数 // 总条数
total: 0, total: 0,
// ${functionName}表格数据 // ${functionName}表格数据
${businessName}List: [], ${businessName}List: [],
// 弹出层标题 // 弹出层标题
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
#foreach ($column in $columns) #foreach ($column in $columns)
#set($parentheseIndex=$column.columnComment.indexOf("")) #set($parentheseIndex=$column.columnComment.indexOf(""))
#if($parentheseIndex != -1) #if($parentheseIndex != -1)
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) #set($comment=$column.columnComment.substring(0, $parentheseIndex))
#else #else
#set($comment=$column.columnComment) #set($comment=$column.columnComment)
#end #end
#if(${column.dictType} != '') #if(${column.dictType} != '')
// $comment字典 // $comment字典
${column.javaField}Options: []#if($velocityCount != $columns.size()),#end ${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
#end #end
// 查询参数 },
queryParams: { // 表单参数
pageNum: 1, form: {},
pageSize: 10, // 表单校验
#foreach ($column in $columns) rules: {
#if($column.query) #foreach ($column in $columns)
$column.javaField: undefined#if($velocityCount != $columns.size()),#end #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
#end #end
}, }
// 表单参数 };
form: {}, },
// 表单校验 created() {
rules: { this.getList();
#foreach ($column in $columns) #foreach ($column in $columns)
#if($column.required) #if(${column.dictType} != '')
#set($parentheseIndex=$column.columnComment.indexOf("")) this.getDicts("${column.dictType}").then(response => {
#if($parentheseIndex != -1) this.${column.javaField}Options = response.data;
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) });
#else #end
#set($comment=$column.columnComment) #end
#end },
#set($comment=$column.columnComment) methods: {
$column.javaField: [ /** 查询${functionName}列表 */
{ required: true, message: "$comment不能为空", trigger: "blur" } getList() {
]#if($velocityCount != $columns.size()),#end this.loading = true;
list${BusinessName}(this.queryParams).then(response => {
#end this.${businessName}List = response.rows;
#end this.total = response.total;
} this.loading = false;
};
},
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);
}
}); });
} else { },
add${BusinessName}(this.form).then(response => { #foreach ($column in $columns)
if (response.code === 200) { #if(${column.dictType} != '')
this.msgSuccess("新增成功"); #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.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(); 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> </script>

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageName}.mapper.${ClassName}Mapper"> <mapper namespace="${packageName}.mapper.${ClassName}Mapper">
<resultMap type="${ClassName}" id="${ClassName}Result"> <resultMap type="${ClassName}" id="${ClassName}Result">
#foreach ($column in $columns) #foreach ($column in $columns)
<result property="${column.javaField}" column="${column.columnName}" /> <result property="${column.javaField}" column="${column.columnName}" />
#end #end
</resultMap> </resultMap>
<sql id="select${ClassName}Vo"> <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"> <select id="select${ClassName}List" parameterType="${ClassName}" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/> <include refid="select${ClassName}Vo"/>
<where> <where>
#foreach($column in $columns) #foreach($column in $columns)
#set($queryType=$column.queryType) #set($queryType=$column.queryType)
#set($javaField=$column.javaField) #set($javaField=$column.javaField)
#set($javaType=$column.javaType) #set($javaType=$column.javaType)
#set($columnName=$column.columnName) #set($columnName=$column.columnName)
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) #set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})
#if($column.query) #if($column.query)
#if($column.queryType == "EQ") #if($column.queryType == "EQ")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName = #{$javaField}</if>
#elseif($queryType == "NE") #elseif($queryType == "NE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName != #{$javaField}</if>
#elseif($queryType == "GT") #elseif($queryType == "GT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt; #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt; #{$javaField}</if>
#elseif($queryType == "GTE") #elseif($queryType == "GTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt;= #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &gt;= #{$javaField}</if>
#elseif($queryType == "LT") #elseif($queryType == "LT")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt; #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt; #{$javaField}</if>
#elseif($queryType == "LTE") #elseif($queryType == "LTE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName &lt;= #{$javaField}</if>
#elseif($queryType == "LIKE") #elseif($queryType == "LIKE")
<if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if> <if test="$javaField != null #if($javaType == 'String' ) and $javaField.trim() != ''#end"> and $columnName like concat('%', #{$javaField}, '%')</if>
#elseif($queryType == "BETWEEN") #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> <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 #end
#end #end
</where> </where>
</select> </select>
<select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="${ClassName}Result"> <select id="select${ClassName}ById" parameterType="${pkColumn.javaType}" resultMap="${ClassName}Result">
<include refid="select${ClassName}Vo"/> <include refid="select${ClassName}Vo"/>
where ${pkColumn.columnName} = #{${pkColumn.javaField}} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</select> </select>
<insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end> <insert id="insert${ClassName}" parameterType="${ClassName}"#if($pkColumn.increment) useGeneratedKeys="true" keyProperty="$pkColumn.javaField"#end>
insert into ${tableName} insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName,</if> <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName,</if>
#end #end
#end #end
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName || !$pkColumn.increment) #if($column.columnName != $pkColumn.columnName || !$pkColumn.increment)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">#{$column.javaField},</if> <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">#{$column.javaField},</if>
#end #end
#end #end
</trim> </trim>
</insert> </insert>
<update id="update${ClassName}" parameterType="${ClassName}"> <update id="update${ClassName}" parameterType="${ClassName}">
update ${tableName} update ${tableName}
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
#foreach($column in $columns) #foreach($column in $columns)
#if($column.columnName != $pkColumn.columnName) #if($column.columnName != $pkColumn.columnName)
<if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if> <if test="$column.javaField != null #if($column.javaType == 'String' ) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
#end #end
#end #end
</trim> </trim>
where ${pkColumn.columnName} = #{${pkColumn.javaField}} where ${pkColumn.columnName} = #{${pkColumn.javaField}}
</update> </update>
@ -86,10 +86,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="delete${ClassName}ByIds" parameterType="String"> <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=")"> <foreach item="${pkColumn.javaField}" collection="array" open="(" separator="," close=")">
#{${pkColumn.javaField}} #{${pkColumn.javaField}}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>