修改代码生成模板
This commit is contained in:
parent
37ea4fc0a0
commit
5fd4f17be9
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ZR.Admin.WebApi.Filters;
|
using ZR.Admin.WebApi.Filters;
|
||||||
using ZR.Admin.WebApi.Controllers;
|
using ZR.Admin.WebApi.Controllers;
|
||||||
using ZR.Service;
|
using ZR.Service.Business;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Infrastructure;
|
using Infrastructure;
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
@ -12,7 +12,8 @@ using Infrastructure.Enums;
|
|||||||
using Infrastructure.Model;
|
using Infrastructure.Model;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using ZR.Admin.WebApi.Extensions;
|
using ZR.Admin.WebApi.Extensions;
|
||||||
using ZR.Model;
|
using ZR.Model.Dto;
|
||||||
|
using ZR.Model.Models;
|
||||||
|
|
||||||
namespace ZRAdmin.Controllers
|
namespace ZRAdmin.Controllers
|
||||||
{
|
{
|
||||||
@ -59,6 +60,7 @@ namespace ZRAdmin.Controllers
|
|||||||
/// <param name="{primaryKey}"></param>
|
/// <param name="{primaryKey}"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpGet("{{primaryKey}}")]
|
[HttpGet("{{primaryKey}}")]
|
||||||
|
[ActionPermissionFilter(Permission = "<#=Permission#>:query")]
|
||||||
public IActionResult Get({KeyTypeName} {primaryKey})
|
public IActionResult Get({KeyTypeName} {primaryKey})
|
||||||
{
|
{
|
||||||
var response = _<#=ServiceName#>.GetId({primaryKey});
|
var response = _<#=ServiceName#>.GetId({primaryKey});
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using ZR.Model.System;
|
using ZR.Model.Models;
|
||||||
using ZR.Model;
|
|
||||||
|
|
||||||
namespace {IServicsNamespace}
|
namespace {IServicsNamespace}.Business
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 定义{TableNameDesc}服务接口
|
/// 定义{TableNameDesc}服务接口
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using {ModelsNamespace};
|
using {ModelsNamespace}.Dto;
|
||||||
|
|
||||||
namespace {DtosNamespace}
|
namespace {DtosNamespace}.Dto
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {TableNameDesc}输入对象模型
|
/// {TableNameDesc}输入对象模型
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace {ModelsNamespace}
|
namespace {ModelsNamespace}.Models
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {TableNameDesc},数据实体对象
|
/// {TableNameDesc},数据实体对象
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Infrastructure.Attribute;
|
using Infrastructure.Attribute;
|
||||||
using {RepositoriesNamespace}.System;
|
using {RepositoriesNamespace}.System;
|
||||||
using {ModelsNamespace};
|
using {ModelsNamespace}.Models;
|
||||||
|
|
||||||
namespace {RepositoriesNamespace}
|
namespace {RepositoriesNamespace}
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,11 +7,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using ZR.Common;
|
using ZR.Common;
|
||||||
using ZR.Model;
|
using ZR.Model.Models;
|
||||||
using ZR.Repository;
|
using ZR.Repository;
|
||||||
using ZR.Service.IService;
|
using ZR.Service.IService;
|
||||||
|
|
||||||
namespace {ServicesNamespace}
|
namespace {ServicesNamespace}.Business
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// {TableNameDesc}服务接口实现
|
/// {TableNameDesc}服务接口实现
|
||||||
|
|||||||
@ -1,85 +1,59 @@
|
|||||||
import http from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
import defaultSettings from '@/settings'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {ModelTypeDesc}分页查询
|
* {ModelTypeDesc}分页查询
|
||||||
* @param {查询条件} data
|
* @param {查询条件} data
|
||||||
*/
|
*/
|
||||||
export function get{ModelTypeName}ListWithPager(data) {
|
export function list{ModelTypeName}(data) {
|
||||||
return http.request({
|
return request({
|
||||||
url: '{ModelTypeName}/FindWithPagerAsync',
|
url: 'bus/{ModelTypeName}/list',
|
||||||
method: 'post',
|
|
||||||
data: data,
|
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
|
||||||
})
|
|
||||||
}/**
|
|
||||||
* 获取所有可用的{ModelTypeDesc}
|
|
||||||
*/
|
|
||||||
export function getAll{ModelTypeName}List() {
|
|
||||||
return http.request({
|
|
||||||
url: '{ModelTypeName}/GetAllEnable',
|
|
||||||
method: 'get',
|
method: 'get',
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
params: data,
|
||||||
})
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 新增或修改保存{ModelTypeDesc}
|
|
||||||
* @param data
|
|
||||||
*/
|
|
||||||
export function save{ModelTypeName}(data, url) {
|
|
||||||
return http.request({
|
|
||||||
url: url,
|
|
||||||
method: 'post',
|
|
||||||
data: data,
|
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 获取{ModelTypeDesc}详情
|
|
||||||
* @param {Id} {ModelTypeDesc}Id
|
|
||||||
*/
|
|
||||||
export function get{ModelTypeName}Detail(id) {
|
|
||||||
return http({
|
|
||||||
url: '{ModelTypeName}/GetById',
|
|
||||||
method: 'get',
|
|
||||||
params: { id: id },
|
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量设置启用状态
|
|
||||||
* @param {id集合} ids
|
|
||||||
*/
|
|
||||||
export function set{ModelTypeName}Enable(data) {
|
|
||||||
return http({
|
|
||||||
url: '{ModelTypeName}/SetEnabledMarktBatchAsync',
|
|
||||||
method: 'post',
|
|
||||||
data: data,
|
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 批量软删除
|
|
||||||
* @param {id集合} ids
|
|
||||||
*/
|
|
||||||
export function deleteSoft{ModelTypeName}(data) {
|
|
||||||
return http({
|
|
||||||
url: '{ModelTypeName}/DeleteSoftBatchAsync',
|
|
||||||
method: 'post',
|
|
||||||
data: data,
|
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除
|
* 新增{ModelTypeDesc}
|
||||||
* @param {id集合} ids
|
* @param data
|
||||||
*/
|
*/
|
||||||
export function delete{ModelTypeName}(data) {
|
export function add{ModelTypeName}(data) {
|
||||||
return http({
|
return request({
|
||||||
url: '{ModelTypeName}/DeleteBatchAsync',
|
url: '/bus/{ModelTypeName}',
|
||||||
method: 'delete',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
baseURL: defaultSettings.api{fileClassName}Url // 直接通过覆盖的方式
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改{ModelTypeDesc}
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
export function update{ModelTypeName}(data) {
|
||||||
|
return request({
|
||||||
|
url: '/bus/{ModelTypeName}',
|
||||||
|
method: 'PUT',
|
||||||
|
data: data,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取{ModelTypeDesc}详情
|
||||||
|
* @param {Id} {ModelTypeDesc}Id
|
||||||
|
*/
|
||||||
|
export function get{ModelTypeName}(id) {
|
||||||
|
return request({
|
||||||
|
url: '/bus/{ModelTypeName}/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除
|
||||||
|
* @param {主键} pid
|
||||||
|
*/
|
||||||
|
export function del{ModelTypeName}(pid) {
|
||||||
|
return request({
|
||||||
|
url: '/bus/{ModelTypeName}/' + pid,
|
||||||
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,20 +36,14 @@
|
|||||||
<!-- 工具区域 -->
|
<!-- 工具区域 -->
|
||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="primary" v-hasPermi="['{ModelTypeName}:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
<el-button type="primary" v-hasPermi="['{Permission}:add']" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="success" v-hasPermi="['{ModelTypeName}:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
<el-button type="success" v-hasPermi="['{Permission}:update']" plain icon="el-icon-edit" size="mini" @click="handleUpdate">修改</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button type="danger" v-hasPermi="['{ModelTypeName}:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
<el-button type="danger" v-hasPermi="['{Permission}:delete']" plain icon="el-icon-delete" size="mini" @click="handleDelete">删除</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<!-- <el-col :span="1.5">
|
|
||||||
<el-button type="info" plain icon="el-icon-upload2" size="mini" @click="handleImport">导入</el-button>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="1.5">
|
|
||||||
<el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
|
|
||||||
</el-col> -->
|
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@ -59,10 +53,9 @@
|
|||||||
{VueViewListContent}
|
{VueViewListContent}
|
||||||
<el-table-column label="操作" align="center" width="200">
|
<el-table-column label="操作" align="center" width="200">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button size="mini" type="text" icon="el-icon-view" @click="handleView(scope.row)">详情</el-button>
|
<el-button size="mini" v-hasPermi="['{Permission}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
||||||
<el-button size="mini" v-hasPermi="['{ModelTypeName}:update']" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">编辑</el-button>
|
|
||||||
<el-popconfirm title="确定删除吗?" @onConfirm="handleDelete(scope.row)" style="margin-left:10px">
|
<el-popconfirm title="确定删除吗?" @onConfirm="handleDelete(scope.row)" style="margin-left:10px">
|
||||||
<el-button slot="reference" v-hasPermi="['{ModelTypeName}:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
<el-button slot="reference" v-hasPermi="['{Permission}:delete']" size="mini" type="text" icon="el-icon-delete">删除</el-button>
|
||||||
</el-popconfirm>
|
</el-popconfirm>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
@ -70,8 +63,8 @@
|
|||||||
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
<pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
|
||||||
|
|
||||||
<!-- 添加或修改菜单对话框 -->
|
<!-- 添加或修改菜单对话框 -->
|
||||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
<el-dialog :title="title" :visible.sync="open" append-to-body>
|
||||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
|
||||||
{VueViewFromContent}
|
{VueViewFromContent}
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
<div slot="footer" class="dialog-footer" v-if="btnSubmitVisible">
|
||||||
@ -83,15 +76,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { list{ModelTypeName},add{ModelTypeName},del{ModelTypeName},edit{ModelTypeName} } from '@{ModelTypeName}.js'
|
import {
|
||||||
|
list{ModelTypeName},
|
||||||
|
add{ModelTypeName},
|
||||||
|
del{ModelTypeName},
|
||||||
|
update{ModelTypeName},
|
||||||
|
get{ModelTypeName}
|
||||||
|
} from '@/api/{fileClassName}.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: '{ModelTypeName}',
|
name: '{ModelTypeName}',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
labelWidth: "70px",
|
labelWidth: "100px",
|
||||||
// 选中数组
|
// 选中数组
|
||||||
ids: [],
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
// 非多个禁用
|
// 非多个禁用
|
||||||
multiple: true,
|
multiple: true,
|
||||||
// 遮罩层
|
// 遮罩层
|
||||||
@ -166,6 +167,7 @@ export default {
|
|||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.ids = selection.map((item) => item.{primaryKey});
|
this.ids = selection.map((item) => item.{primaryKey});
|
||||||
|
this.single = selection.length!=1
|
||||||
this.multiple = !selection.length;
|
this.multiple = !selection.length;
|
||||||
},
|
},
|
||||||
/** 搜索按钮操作 */
|
/** 搜索按钮操作 */
|
||||||
@ -190,26 +192,33 @@ export default {
|
|||||||
/** 修改按钮操作 */
|
/** 修改按钮操作 */
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
this.reset();
|
this.reset();
|
||||||
this.open = true;
|
const {primaryKey} = row.{primaryKey} || this.ids;
|
||||||
this.title = "编辑";
|
get{ModelTypeName}({primaryKey}).then((res) => {
|
||||||
//TODO 业务代码
|
if(res.code == 200){
|
||||||
console.log(JSON.stringify(row));
|
this.form = res.data;
|
||||||
|
this.open = true;
|
||||||
// TODO 给表单赋值
|
this.title = "修改数据";
|
||||||
this.form = {
|
}
|
||||||
{VueViewEditFromBindContent}
|
});
|
||||||
};
|
|
||||||
},
|
},
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm: function () {
|
submitForm: function () {
|
||||||
this.$refs["form"].validate((valid) => {
|
this.$refs["form"].validate((valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
console.log(JSON.stringify(this.form));
|
console.log(JSON.stringify(this.form));
|
||||||
// TODO 记得改成表的主键
|
|
||||||
if (this.form.{primaryKey} != undefined) {
|
if (this.form.{primaryKey} != undefined) {
|
||||||
//TODO 编辑业务代码
|
update{ModelTypeName}(this.form).then((res) => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
//TODO 新增业务代码
|
add{ModelTypeName}(this.form).then((res) => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -225,9 +234,7 @@ export default {
|
|||||||
name: row.name,
|
name: row.name,
|
||||||
sortId: row.sortId,
|
sortId: row.sortId,
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
handleImport() {},
|
|
||||||
handleExport() {},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user