mirror of
https://gitee.com/ZhongBangKeJi/crmeb_java.git
synced 2026-04-24 20:28:33 +08:00
新增前后端分离代码生成器 菜单在维护-》代码生成
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?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.zbkj.service.dao.MySqlGenDao">
|
||||
<select id="getList" resultType="map">
|
||||
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables
|
||||
where table_schema = (select database())
|
||||
<if test="tables != null and tables.trim() != ''">
|
||||
and table_name like concat('%', #{tables}, '%')
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
<select id="getTable" resultType="map">
|
||||
select table_name tableName, engine, table_comment tableComment, create_time createTime from information_schema.tables
|
||||
where table_schema = (select database()) and table_name = #{tables}
|
||||
</select>
|
||||
<select id="getColumns" resultType="map">
|
||||
select column_name columnName, data_type dataType, column_comment columnComment, column_key columnKey, extra from information_schema.columns
|
||||
where table_name = #{tables} and table_schema = (select database()) order by ordinal_position
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,103 @@
|
||||
package ${package}.${moduleName}.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import ${package}.${moduleName}.entity.${className}Entity;
|
||||
import ${package}.${moduleName}.service.${className}Service;
|
||||
import ${mainPath}.common.utils.PageUtils;
|
||||
import ${mainPath}.common.utils.R;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* ${comments} 控制器
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: ${author}
|
||||
* +----------------------------------------------------------------------
|
||||
* | @date ${datetime}
|
||||
* +----------------------------------------------------------------------
|
||||
* | @date ${email}
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("${moduleName}/${pathName}")
|
||||
public class ${className}Controller {
|
||||
@Autowired
|
||||
private ${className}Service ${classname}Service;
|
||||
|
||||
/**
|
||||
* 列表信息
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
@PreAuthorize("${moduleName}:${pathName}:list")
|
||||
public CommonResult<CommonPage<${classname}>> list(@RequestParam Map<String, Object> params){
|
||||
CommonPage<${classname}> page = CommonPage.restPag(${classname}Service.queryPage(params));
|
||||
|
||||
return CommonResult.success(page);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 详情数据
|
||||
*/
|
||||
@RequestMapping("/info/{${pk.attrname}}")
|
||||
@PreAuthorize("${moduleName}:${pathName}:info")
|
||||
public CommonResult<${classname}> info(@PathVariable("${pk.attrname}") ${pk.attrType} ${pk.attrname}){
|
||||
${className}Entity ${classname} = ${classname}Service.getById(${pk.attrname});
|
||||
|
||||
return CommonResult.success(${classname});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
@PreAuthorize("${moduleName}:${pathName}:save")
|
||||
public CommonResult<String> save(@RequestBody ${className}Entity ${classname}){
|
||||
if (${classname}Service.save(${classname})) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
@PreAuthorize("${moduleName}:${pathName}:update")
|
||||
public CommonResult<String> update(@RequestBody ${className}Entity ${classname}){
|
||||
if (${classname}Service.updateById(${classname})) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除:根据id集合
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
@PreAuthorize("${moduleName}:${pathName}:delete")
|
||||
public CommonResult<String> delete(@RequestBody ${pk.attrType}[] ${pk.attrname}s){
|
||||
if (${classname}Service.removeByIds(Arrays.asList(${pk.attrname}))) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package ${package}.${moduleName}.dao;
|
||||
|
||||
import ${package}.${moduleName}.entity.${className}Entity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* ${comments} DAO 映射层
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* @author: ${author}
|
||||
* +----------------------------------------------------------------------
|
||||
* @date ${datetime}
|
||||
* +----------------------------------------------------------------------
|
||||
* @email ${email}
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Mapper
|
||||
public interface ${className}Dao extends BaseMapper<${className}Entity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package ${package}.${moduleName}.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
#if(${hasBigDecimal})
|
||||
import java.math.BigDecimal;
|
||||
#end
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* ${comments} Entity 实体类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* @author: ${author}
|
||||
* +----------------------------------------------------------------------
|
||||
* @date ${datetime}
|
||||
* +----------------------------------------------------------------------
|
||||
* @email ${email}
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@TableName("${tableName}")
|
||||
public class ${className}Entity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
/**
|
||||
* $column.comments
|
||||
*/
|
||||
#if($column.columnName == $pk.columnName)
|
||||
@TableId
|
||||
#end
|
||||
private $column.attrType $column.attrname;
|
||||
#end
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package ${package}.${moduleName}.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import ${mainPath}.common.utils.PageUtils;
|
||||
import ${package}.${moduleName}.entity.${className}Entity;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* ${comments} 业务接口
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* @author: ${author}
|
||||
* +----------------------------------------------------------------------
|
||||
* @date ${datetime}
|
||||
* +----------------------------------------------------------------------
|
||||
* @email ${email}
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface ${className}Service extends IService<${className}Entity> {
|
||||
|
||||
/**
|
||||
* ${className} 列表查询
|
||||
* @param request 默认是是体类 根据自己需求修改或者创建自己的request
|
||||
* @param pageParamRequest 分页参数对象
|
||||
* @return
|
||||
*/
|
||||
List<${className}> getList(${className}Entity request, PageParamRequest pageParamRequest)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package ${package}.${moduleName}.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.Map;
|
||||
import com.baomidou.mybatisplus.core.conditions.pageQueryUtils.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import ${mainPath}.common.utils.PageUtils;
|
||||
import ${mainPath}.common.utils.Query;
|
||||
|
||||
import ${package}.${moduleName}.dao.${className}Dao;
|
||||
import ${package}.${moduleName}.entity.${className}Entity;
|
||||
import ${package}.${moduleName}.service.${className}Service;
|
||||
|
||||
|
||||
/**
|
||||
* ${comments} 接口实现类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* @author: ${author}
|
||||
* +----------------------------------------------------------------------
|
||||
* @date ${datetime}
|
||||
* +----------------------------------------------------------------------
|
||||
* @email ${email}
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
@Service("${classname}Service")
|
||||
public class ${className}ServiceImpl extends ServiceImpl<${className}Dao, ${className}Entity> implements ${className}Service {
|
||||
|
||||
/**
|
||||
* ${className}列表查询
|
||||
* @param request 默认是是体类 根据自己需求修改或者创建自己的request
|
||||
* @param pageParamRequest 分页参数对象
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageUtils queryPage(${className}Entity request, PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPageNum(), pageParamRequest.getPageSize());
|
||||
|
||||
//列表查询 ${className} 类的多条件查询
|
||||
LambdaQueryWrapper<${className}> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
${className} model = new ${className}();
|
||||
BeanUtils.copyProperties(request, model);
|
||||
lambdaQueryWrapper.setEntity(model);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
-- 自动生成新增菜单SQL 这里仅仅是新增菜单数据,实际开发中需要分配对应权限才可以正常使用
|
||||
-- 菜单目录SQL menu_type = M-目录,C-菜单,A-按钮
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) VALUES (0,'${moduleName}','${moduleName}:${pathName}','','C');
|
||||
-- 目录菜单id 用于按钮新增时作为父ID
|
||||
set @parentId = @@identity;
|
||||
-- 所在表的CRUD菜单 根据自己需求修改添加
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) SELECT @parentId,'DATA_LIST','${moduleName}:${pathName}:list','${moduleName}/${pathName}/list','A';
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) SELECT @parentId,'DATA_INFO','${moduleName}:${pathName}:info','${moduleName}:${pathName}/info','A';
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) SELECT @parentId,'DATA_EDITE','${moduleName}:${pathName}:update','${moduleName}:${pathName}/info','A';
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) SELECT @parentId,'DATA_SAVE','${moduleName}:${pathName}:save','','A';
|
||||
INSERT INTO `eb_system_menu` (`pid`, `name`,`perms`,`component`, `menu_type`) SELECT @parentId,'DATA_DELETE','${moduleName}:${pathName}:delete','','A';
|
||||
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<!-- 基于 Element UI 新增和修改弹窗 -->
|
||||
<el-dialog
|
||||
:title="!dataForm.${pk.attrname} ? '添加-ADD' : '修改-EDITE'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible">
|
||||
<!-- 新增和创建表单表单 -->
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataSubmit()" label-width="80px">
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pk.columnName)
|
||||
<el-form-item label="${column.comments}" prop="${column.attrname}">
|
||||
<el-input v-model="dataForm.${column.attrname}" placeholder="${column.comments}"></el-input>
|
||||
</el-form-item>
|
||||
#end
|
||||
#end
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataSubmit()">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as api from './.${pathName}api.js'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
dataForm: {
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName == $pk.columnName)
|
||||
${column.attrname}: 0,
|
||||
#else
|
||||
${column.attrname}: '' #if($velocityCount != $columns.size()), #end
|
||||
|
||||
#end
|
||||
#end
|
||||
},
|
||||
dataRule: {
|
||||
#foreach($column in $columns)
|
||||
#if($column.columnName != $pk.columnName)
|
||||
${column.attrname}: [
|
||||
{ required: true, message: '${column.comments} 为必填项', trigger: 'blur' }
|
||||
]#if($velocityCount != $columns.size()),#end
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
init (id) { // 初始化表单验证规则
|
||||
this.dataForm.${pk.attrname} = id || 0
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.${pk.attrname}) {
|
||||
api.${pathName}DetailApi(${pk.attrname}).then(res => {
|
||||
this.dataForm = res;
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 表单数据提交
|
||||
dataSubmit () {
|
||||
#[[this.$refs['dataForm'].validate((valid) => {]]#
|
||||
if (valid) {
|
||||
api.${className}CreateApi().then(res =>{
|
||||
// TODO 保存数据
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,71 @@
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
import request from '@/utils/request'
|
||||
|
||||
/**
|
||||
* 新增${className}
|
||||
* @param pram
|
||||
*/
|
||||
export function ${className}CreateApi(data) {
|
||||
return request({
|
||||
url: '${moduleName}/${pathName}/save',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ${pathName}更新
|
||||
* @param pram
|
||||
*/
|
||||
export function ${pathName}UpdateApi(data) {
|
||||
return request({
|
||||
url: '${moduleName}/${pathName}/update',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ${pathName}详情
|
||||
* @param pram
|
||||
*/
|
||||
export function ${pathName}DetailApi(id) {
|
||||
return request({
|
||||
url: `${moduleName}/${pathName}/info/${id}`,
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* ${pathName}删除
|
||||
* @param pram
|
||||
*/
|
||||
export function ${pathName}DeleteApi(id) {
|
||||
return request({
|
||||
url: `${moduleName}/${pathName}/delete/${id}`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ${pathName}列表
|
||||
* @param pram
|
||||
*/
|
||||
export function ${pathName}ListApi(params) {
|
||||
return request({
|
||||
url: '${moduleName}/${pathName}/list',
|
||||
method: 'GET',
|
||||
params
|
||||
})
|
||||
}
|
||||
|
||||
131
crmeb/crmeb-service/src/main/resources/template/vue/index.vue.vm
Normal file
131
crmeb/crmeb-service/src/main/resources/template/vue/index.vue.vm
Normal file
@@ -0,0 +1,131 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item>
|
||||
<el-input v-model="dataForm.key" placeholder="查询参数" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="getDataList()">查询</el-button>
|
||||
<el-button v-hasPermi="['${moduleName}:${pathName}:save']" type="primary" @click="addOrUpdateHandle()">新增数据</el-button>
|
||||
<el-button v-hasPermi="['${moduleName}:${pathName}:delete']" type="danger" @click="deleteHandle()" :disabled="dataListSelections.length <= 0">批量删除</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="dataList"
|
||||
border
|
||||
v-loading="dataListLoading"
|
||||
@selection-change="selectionChangeHandle"
|
||||
style="width: 100%;">
|
||||
<el-table-column
|
||||
type="selection"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="50">
|
||||
</el-table-column>
|
||||
#foreach($column in $columns)
|
||||
<el-table-column
|
||||
prop="${column.attrname}"
|
||||
header-align="center"
|
||||
align="center"
|
||||
label="${column.comments}">
|
||||
</el-table-column>
|
||||
#end
|
||||
<el-table-column
|
||||
fixed="right"
|
||||
header-align="center"
|
||||
align="center"
|
||||
width="150"
|
||||
label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="small" @click="addOrUpdateHandle(scope.row.${pk.attrname})">修改</el-button>
|
||||
<el-button type="text" size="small" @click="deleteHandle(scope.row.${pk.attrname})">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="pageIndex"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="pageSize"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper">
|
||||
</el-pagination>
|
||||
<!-- 表单弹窗, 新增数据和修改数据 -->
|
||||
<add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddOrUpdate from './.${pathName}-add-and-update'
|
||||
import * as api from './.${pathName}api.js'
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
dataForm: {
|
||||
key: ''
|
||||
},
|
||||
dataList: [],
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
totalPage: 0,
|
||||
dataListLoading: false,
|
||||
dataListSelections: [],
|
||||
addOrUpdateVisible: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
AddOrUpdate
|
||||
},
|
||||
activated () {
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
// 获取数据列表
|
||||
getDataList () {
|
||||
this.dataListLoading = true
|
||||
api.${pathName}ListApi().then(res => {
|
||||
// TODO 获取数据列表
|
||||
})
|
||||
},
|
||||
// 每页数
|
||||
sizeChangeHandle (val) {
|
||||
this.pageSize = val
|
||||
this.pageIndex = 1
|
||||
this.getDataList()
|
||||
},
|
||||
// 当前页
|
||||
currentChangeHandle (val) {
|
||||
this.pageIndex = val
|
||||
this.getDataList()
|
||||
},
|
||||
// 多选
|
||||
selectionChangeHandle (val) {
|
||||
this.dataListSelections = val
|
||||
},
|
||||
// 新增 / 修改
|
||||
addOrUpdateHandle (id) {
|
||||
this.addOrUpdateVisible = true
|
||||
#[[this.$nextTick(() => {]]#
|
||||
this.$refs.addOrUpdate.init(id)
|
||||
})
|
||||
},
|
||||
// 删除
|
||||
deleteHandle (id) {
|
||||
var ids = id ? [id] : this.dataListSelections.map(item => {
|
||||
return item.${pk.attrname}
|
||||
})
|
||||
#[[this.$confirm(`您确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {]]#
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
api.${pathName}DeleteApi(id).then(res => {
|
||||
// TODO 处理删除
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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="${package}.${moduleName}.dao.${className}Dao">
|
||||
|
||||
<!-- 根据包名 模块名 以及类名 生成Mapper XML 配置文件 -->
|
||||
<resultMap type="${package}.${moduleName}.entity.${className}Entity" id="${classname}Map">
|
||||
#foreach($column in $columns)
|
||||
<result property="${column.attrname}" column="${column.columnName}"/>
|
||||
#end
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user