This commit is contained in:
parent
702297f5c3
commit
db6893113d
|
|
@ -0,0 +1,53 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询接口类名列表
|
||||||
|
export function listApiclass(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询接口类名详细
|
||||||
|
export function getApiclass(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增接口类名
|
||||||
|
export function addApiclass(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改接口类名
|
||||||
|
export function updateApiclass(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除接口类名
|
||||||
|
export function delApiclass(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 导出接口类名
|
||||||
|
export function exportApiclass(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/apiclass/export',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,323 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="模块id" prop="mId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.mId"
|
||||||
|
placeholder="请输入模块id"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类名" prop="cName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.cName"
|
||||||
|
placeholder="请输入类名"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类描述" prop="cDescribe">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.cDescribe"
|
||||||
|
placeholder="请输入类描述"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterangeCreateTime"
|
||||||
|
size="small"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:apiclass:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:apiclass:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:apiclass:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:apiclass:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="apiclassList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="类id" align="center" prop="id" />
|
||||||
|
<el-table-column label="模块id" align="center" prop="mId" />
|
||||||
|
<el-table-column label="类名" align="center" prop="cName" />
|
||||||
|
<el-table-column label="类描述" align="center" prop="cDescribe" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<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="['system:apiclass:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:apiclass: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-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="模块id" prop="mId">
|
||||||
|
<el-input v-model="form.mId" placeholder="请输入模块id" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类名" prop="cName">
|
||||||
|
<el-input v-model="form.cName" placeholder="请输入类名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="类描述" prop="cDescribe">
|
||||||
|
<el-input v-model="form.cDescribe" placeholder="请输入类描述" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listApiclass, getApiclass, delApiclass, addApiclass, updateApiclass, exportApiclass } from "@/api/system/apiclass";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Apiclass",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 接口类名表格数据
|
||||||
|
apiclassList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 创建时间时间范围
|
||||||
|
daterangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
mId: null,
|
||||||
|
cName: null,
|
||||||
|
cDescribe: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
mId: [
|
||||||
|
{ required: true, message: "模块id不能为空}", trigger: "blur" },
|
||||||
|
],
|
||||||
|
cName: [
|
||||||
|
{ required: true, message: "类名不能为空}", trigger: "blur" },
|
||||||
|
],
|
||||||
|
cDescribe: [
|
||||||
|
{ required: true, message: "类描述不能为空}", trigger: "blur" },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询接口类名列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listApiclass(this.addCreateDateRange(this.queryParams,this.daterangeCreateTime)).then(response =>{
|
||||||
|
this.apiclassList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
mId: null,
|
||||||
|
cName: null,
|
||||||
|
cDescribe: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.daterangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加接口类名";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getApiclass(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改接口类名";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateApiclass(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addApiclass(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$confirm('是否确认删除接口类名编号为"' + ids + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return delApiclass(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm('是否确认导出所有接口类名数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportApiclass(queryParams);
|
||||||
|
}).then(response => {
|
||||||
|
this.download(response.msg);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
package com.hchyun.web.controller.system;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
|
||||||
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
|
import com.hchyun.common.core.controller.HcyBaseController;
|
||||||
|
import com.hchyun.common.utils.ServerResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
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.hchyun.common.annotation.Log;
|
||||||
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
|
import com.hchyun.common.enums.BusinessType;
|
||||||
|
import com.hchyun.system.entity.Apiclass;
|
||||||
|
import com.hchyun.system.service.ApiclassService;
|
||||||
|
import com.hchyun.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口类名Controller
|
||||||
|
*
|
||||||
|
* @author hchyun
|
||||||
|
* @date 2021-01-24
|
||||||
|
*/
|
||||||
|
@Api(value = "接口类名管理",tags = "接口类名管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/system/apiclass")
|
||||||
|
public class ApiclassController extends HcyBaseController {
|
||||||
|
protected final Logger logger = LoggerFactory.getLogger(ApiclassController.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiclassService apiclassService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询接口类名列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("查询接口类名列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Serializable list(Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
ServerResult<List<Apiclass>> serverResult = apiclassService.selectApiclassList(apiclass);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return getDataTable(serverResult.getData());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.info(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出接口类名列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("导出接口类名列表")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:export')")
|
||||||
|
@Log(title = "接口类名", businessType = BusinessType.EXPORT)
|
||||||
|
@GetMapping("/export")
|
||||||
|
public AjaxResult export(Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
ServerResult<List<Apiclass>> serverResult = apiclassService.selectApiclassList(apiclass);
|
||||||
|
ExcelUtil<Apiclass> util = new ExcelUtil<Apiclass>(Apiclass. class);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return util.exportExcel(serverResult.getData(), "apiclass");
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取接口类名详细信息
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取接口类名详细信息")
|
||||||
|
@ApiImplicitParam(name = "id" , value = "接口类名id" , required = true, dataType = "Long" , paramType = "path")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
try {
|
||||||
|
ServerResult<Apiclass> serverResult = apiclassService.selectApiclassById(id);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return AjaxResult.success(serverResult.getData());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.info(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增接口类名
|
||||||
|
*/
|
||||||
|
@ApiOperation("新增接口类名")
|
||||||
|
@ApiImplicitParam(name = "apiclass" , value = "新增接口类名信息" , dataType = "Apiclass")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:add')")
|
||||||
|
@Log(title = "接口类名", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody Apiclass apiclass) {
|
||||||
|
if (apiclass.getmId() == null || apiclass.getmId()<0) {
|
||||||
|
return AjaxResult.error("模块id不能为空!");
|
||||||
|
}
|
||||||
|
if (apiclass.getcName() == null || apiclass.getcName().equals("")) {
|
||||||
|
return AjaxResult.error("类名不能为空!");
|
||||||
|
}
|
||||||
|
if (apiclass.getcDescribe() == null || apiclass.getcDescribe().equals("")) {
|
||||||
|
return AjaxResult.error("类描述不能为空!");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ServerResult<Integer> serverResult = apiclassService.insertApiclass(apiclass);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改接口类名
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改接口类名")
|
||||||
|
@ApiImplicitParam(name = "apiclass" , value = "修改接口类名信息" , dataType = "Apiclass")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:edit')")
|
||||||
|
@Log(title = "接口类名", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
|
||||||
|
if (apiclass.getmId() == null || apiclass.getmId()<0) {
|
||||||
|
return AjaxResult.error("模块id不能为空!");
|
||||||
|
}
|
||||||
|
if (apiclass.getcName() == null || apiclass.getcName().equals("")) {
|
||||||
|
return AjaxResult.error("类名不能为空!");
|
||||||
|
}
|
||||||
|
if (apiclass.getcDescribe() == null || apiclass.getcDescribe().equals("")) {
|
||||||
|
return AjaxResult.error("类描述不能为空!");
|
||||||
|
}
|
||||||
|
ServerResult<Integer> serverResult = apiclassService.updateApiclass(apiclass);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除接口类名
|
||||||
|
*/
|
||||||
|
@ApiOperation("删除接口类名")
|
||||||
|
@ApiImplicitParam(name = "ids" , value = "接口类名ids" , required = true, dataType = "Long" , paramType = "path")
|
||||||
|
@PreAuthorize("@ss.hasPermi('system:apiclass:remove')")
|
||||||
|
@Log(title = "接口类名", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
|
try {
|
||||||
|
if (ids.length<0){
|
||||||
|
return AjaxResult.error("id不能为空!");
|
||||||
|
}
|
||||||
|
ServerResult<Integer> serverResult = apiclassService.deleteApiclassByIds(ids);
|
||||||
|
if (serverResult.isStart()) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,15 +2,11 @@ package com.hchyun.web.controller.system;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
import com.hchyun.common.constant.ReturnConstants;
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
import com.hchyun.common.core.controller.HcyBaseController;
|
import com.hchyun.common.core.controller.HcyBaseController;
|
||||||
import com.hchyun.common.utils.ServerResult;
|
import com.hchyun.common.utils.ServerResult;
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
@ -37,7 +33,6 @@ import com.hchyun.common.core.page.TableDataInfo;
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-01-24
|
* @date 2021-01-24
|
||||||
*/
|
*/
|
||||||
@Api(value = "模块管理管理",tags = "模块管理管理")
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/module")
|
@RequestMapping("/system/module")
|
||||||
public class ModuleController extends HcyBaseController {
|
public class ModuleController extends HcyBaseController {
|
||||||
|
|
@ -49,7 +44,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 查询模块管理列表
|
* 查询模块管理列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("查询模块管理列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:list')")
|
@PreAuthorize("@ss.hasPermi('system:module:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public Serializable list(Module module) {
|
public Serializable list(Module module) {
|
||||||
|
|
@ -70,7 +64,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 导出模块管理列表
|
* 导出模块管理列表
|
||||||
*/
|
*/
|
||||||
@ApiOperation("导出模块管理列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:export')")
|
@PreAuthorize("@ss.hasPermi('system:module:export')")
|
||||||
@Log(title = "模块管理", businessType = BusinessType.EXPORT)
|
@Log(title = "模块管理", businessType = BusinessType.EXPORT)
|
||||||
@GetMapping("/export")
|
@GetMapping("/export")
|
||||||
|
|
@ -92,8 +85,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 获取模块管理详细信息
|
* 获取模块管理详细信息
|
||||||
*/
|
*/
|
||||||
@ApiOperation("获取模块管理详细信息")
|
|
||||||
@ApiImplicitParam(name = "id" , value = "模块管理id" , required = true, dataType = "Long" , paramType = "path")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:query')")
|
@PreAuthorize("@ss.hasPermi('system:module:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
|
@ -113,8 +104,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 新增模块管理
|
* 新增模块管理
|
||||||
*/
|
*/
|
||||||
@ApiOperation("新增模块管理")
|
|
||||||
@ApiImplicitParam(name = "module" , value = "新增模块管理信息" , dataType = "Module")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:add')")
|
@PreAuthorize("@ss.hasPermi('system:module:add')")
|
||||||
@Log(title = "模块管理", businessType = BusinessType.INSERT)
|
@Log(title = "模块管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
|
|
@ -141,8 +130,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 修改模块管理
|
* 修改模块管理
|
||||||
*/
|
*/
|
||||||
@ApiOperation("修改模块管理")
|
|
||||||
@ApiImplicitParam(name = "module" , value = "修改模块管理信息" , dataType = "Module")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:edit')")
|
@PreAuthorize("@ss.hasPermi('system:module:edit')")
|
||||||
@Log(title = "模块管理", businessType = BusinessType.UPDATE)
|
@Log(title = "模块管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
|
|
@ -170,8 +157,6 @@ public class ModuleController extends HcyBaseController {
|
||||||
/**
|
/**
|
||||||
* 删除模块管理
|
* 删除模块管理
|
||||||
*/
|
*/
|
||||||
@ApiOperation("删除模块管理")
|
|
||||||
@ApiImplicitParam(name = "ids" , value = "模块管理ids" , required = true, dataType = "Long" , paramType = "path")
|
|
||||||
@PreAuthorize("@ss.hasPermi('system:module:remove')")
|
@PreAuthorize("@ss.hasPermi('system:module:remove')")
|
||||||
@Log(title = "模块管理", businessType = BusinessType.DELETE)
|
@Log(title = "模块管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
|
|
|
||||||
|
|
@ -76,14 +76,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
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) && $column.isInsert == 1)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName,</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) 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) && $column.isInsert == 1)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">#{$column.javaField},</if>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
@ -94,7 +94,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
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 && $column.isInsert == 1)
|
||||||
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
|
<if test="$column.javaField != null#if($column.javaType == 'String' && $column.required) and $column.javaField != ''#end">$column.columnName = #{$column.javaField},</if>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
package com.hchyun.system.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.hchyun.system.entity.Apiclass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口类名Mapper接口
|
||||||
|
*
|
||||||
|
* @author hchyun
|
||||||
|
* @date 2021-01-24
|
||||||
|
*/
|
||||||
|
public interface ApiclassDao
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询接口类名
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 接口类名
|
||||||
|
*/
|
||||||
|
Apiclass selectApiclassById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询接口类名列表
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 接口类名集合
|
||||||
|
*/
|
||||||
|
List<Apiclass> selectApiclassList(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int insertApiclass(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int updateApiclass(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除接口类名
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
int deleteApiclassById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除接口类名
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteApiclassByIds(Long[] ids);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,90 @@
|
||||||
|
package com.hchyun.system.entity;
|
||||||
|
|
||||||
|
import com.hchyun.common.annotation.Excel;
|
||||||
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口类名对象 sys_apiclass
|
||||||
|
*
|
||||||
|
* @author hchyun
|
||||||
|
* @date 2021-01-24
|
||||||
|
*/
|
||||||
|
@ApiModel("接口类名")
|
||||||
|
public class Apiclass extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 类id */
|
||||||
|
@ApiModelProperty("类id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 模块id */
|
||||||
|
@Excel(name = "模块id")
|
||||||
|
@ApiModelProperty("模块id")
|
||||||
|
private Long mId;
|
||||||
|
|
||||||
|
/** 类名 */
|
||||||
|
@Excel(name = "类名")
|
||||||
|
@ApiModelProperty("类名")
|
||||||
|
private String cName;
|
||||||
|
|
||||||
|
/** 类描述 */
|
||||||
|
@Excel(name = "类描述")
|
||||||
|
@ApiModelProperty("类描述")
|
||||||
|
private String cDescribe;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
public void setmId(Long mId)
|
||||||
|
{
|
||||||
|
this.mId = mId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getmId()
|
||||||
|
{
|
||||||
|
return mId;
|
||||||
|
}
|
||||||
|
public void setcName(String cName)
|
||||||
|
{
|
||||||
|
this.cName = cName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getcName()
|
||||||
|
{
|
||||||
|
return cName;
|
||||||
|
}
|
||||||
|
public void setcDescribe(String cDescribe)
|
||||||
|
{
|
||||||
|
this.cDescribe = cDescribe;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getcDescribe()
|
||||||
|
{
|
||||||
|
return cDescribe;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("mId", getmId())
|
||||||
|
.append("cName", getcName())
|
||||||
|
.append("cDescribe", getcDescribe())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,6 @@ package com.hchyun.system.entity;
|
||||||
|
|
||||||
import com.hchyun.common.annotation.Excel;
|
import com.hchyun.common.annotation.Excel;
|
||||||
import com.hchyun.common.core.entity.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
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;
|
||||||
|
|
||||||
|
|
@ -13,23 +11,19 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
* @author hchyun
|
* @author hchyun
|
||||||
* @date 2021-01-24
|
* @date 2021-01-24
|
||||||
*/
|
*/
|
||||||
@ApiModel("模块管理")
|
|
||||||
public class Module extends BaseEntity
|
public class Module extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 模块id */
|
/** 模块id */
|
||||||
@ApiModelProperty("模块id")
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 模块名称 */
|
/** 模块名称 */
|
||||||
@Excel(name = "模块名称")
|
@Excel(name = "模块名称")
|
||||||
@ApiModelProperty("模块名称")
|
|
||||||
private String mName;
|
private String mName;
|
||||||
|
|
||||||
/** 模块描述 */
|
/** 模块描述 */
|
||||||
@Excel(name = "模块描述")
|
@Excel(name = "模块描述")
|
||||||
@ApiModelProperty("模块描述")
|
|
||||||
private String mDescribe;
|
private String mDescribe;
|
||||||
|
|
||||||
public void setId(Long id)
|
public void setId(Long id)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.hchyun.system.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hchyun.common.utils.ServerResult;
|
||||||
|
import com.hchyun.system.entity.Apiclass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口类名Service接口
|
||||||
|
*
|
||||||
|
* @author hchyun
|
||||||
|
* @date 2021-01-24
|
||||||
|
*/
|
||||||
|
public interface ApiclassService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询接口类名
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 接口类名
|
||||||
|
*/
|
||||||
|
ServerResult<Apiclass> selectApiclassById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询接口类名列表
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 接口类名集合
|
||||||
|
*/
|
||||||
|
ServerResult<List<Apiclass>> selectApiclassList(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
ServerResult<Integer> insertApiclass(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
ServerResult<Integer> updateApiclass(Apiclass apiclass);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除接口类名
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的接口类名ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
ServerResult<Integer> deleteApiclassByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除接口类名信息
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
ServerResult<Integer> deleteApiclassById(Long id);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,159 @@
|
||||||
|
package com.hchyun.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
|
import com.hchyun.common.utils.DateUtils;
|
||||||
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
import com.hchyun.common.utils.DateUtils;
|
||||||
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
|
import com.hchyun.common.utils.ServerResult;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.hchyun.system.dao.ApiclassDao;
|
||||||
|
import com.hchyun.system.entity.Apiclass;
|
||||||
|
import com.hchyun.system.service.ApiclassService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接口类名Service业务层处理
|
||||||
|
*
|
||||||
|
* @author hchyun
|
||||||
|
* @date 2021-01-24
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ApiclassServiceImpl implements ApiclassService {
|
||||||
|
private Logger logger = LoggerFactory.getLogger(ApiclassServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiclassDao apiclassDao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询接口类名
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 接口类名
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<Apiclass> selectApiclassById(Long id) {
|
||||||
|
try {
|
||||||
|
Apiclass apiclass = apiclassDao.selectApiclassById(id);
|
||||||
|
if (apiclass != null){
|
||||||
|
return new ServerResult<Apiclass>(true,apiclass);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<Apiclass>(false, ReturnConstants.RESULT_EMPTY);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<Apiclass>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询接口类名列表
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 接口类名
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<List<Apiclass>> selectApiclassList(Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
List<Apiclass> apiclassList = apiclassDao.selectApiclassList(apiclass);
|
||||||
|
if (apiclassList.size()>0){
|
||||||
|
return new ServerResult<List<Apiclass>>(true,apiclassList);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<List<Apiclass>>(false,ReturnConstants.RESULT_EMPTY);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<List<Apiclass>>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<Integer> insertApiclass(Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
apiclass.setCreateBy(SecurityUtils.getUserId());
|
||||||
|
Integer renewal = apiclassDao.insertApiclass(apiclass);
|
||||||
|
if (renewal >0){
|
||||||
|
return new ServerResult<Integer>(true,renewal);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改接口类名
|
||||||
|
*
|
||||||
|
* @param apiclass 接口类名
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<Integer> updateApiclass(Apiclass apiclass) {
|
||||||
|
try {
|
||||||
|
apiclass.setUpdateBy(SecurityUtils.getUserId());
|
||||||
|
Integer renewal = apiclassDao.updateApiclass(apiclass);
|
||||||
|
if (renewal >0){
|
||||||
|
return new ServerResult<Integer>(true,renewal);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除接口类名
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的接口类名ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<Integer> deleteApiclassByIds(Long[] ids) {
|
||||||
|
try {
|
||||||
|
Integer renewal = apiclassDao.deleteApiclassByIds(ids);
|
||||||
|
if (renewal >0){
|
||||||
|
return new ServerResult<Integer>(true,renewal);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除接口类名信息
|
||||||
|
*
|
||||||
|
* @param id 接口类名ID
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ServerResult<Integer> deleteApiclassById(Long id) {
|
||||||
|
try {
|
||||||
|
Integer renewal = apiclassDao.deleteApiclassById(id);
|
||||||
|
if (renewal >0){
|
||||||
|
return new ServerResult<Integer>(true,renewal);
|
||||||
|
}else {
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.SYS_FAILL);
|
||||||
|
}
|
||||||
|
}catch (RuntimeException e){
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return new ServerResult<Integer>(false,ReturnConstants.DB_EX);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
<?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.hchyun.system.dao.ApiclassDao">
|
||||||
|
|
||||||
|
<resultMap type="Apiclass" id="ApiclassResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="mId" column="m_id" />
|
||||||
|
<result property="cName" column="c_name" />
|
||||||
|
<result property="cDescribe" column="c_describe" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectApiclassVo">
|
||||||
|
select id, m_id, c_name, c_describe, create_time, create_by, update_time, update_by from sys_apiclass
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectApiclassList" parameterType="Apiclass" resultMap="ApiclassResult">
|
||||||
|
<include refid="selectApiclassVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="mId != null "> and m_id = #{mId}</if>
|
||||||
|
<if test="cName != null and cName != ''"> and c_name like concat('%', #{cName}, '%')</if>
|
||||||
|
<if test="cDescribe != null and cDescribe != ''"> and c_describe like concat('%', #{cDescribe}, '%')</if>
|
||||||
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectApiclassById" parameterType="Long" resultMap="ApiclassResult">
|
||||||
|
<include refid="selectApiclassVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertApiclass" parameterType="Apiclass" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into sys_apiclass
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="mId != null">m_id,</if>
|
||||||
|
<if test="cName != null and cName != ''">c_name,</if>
|
||||||
|
<if test="cDescribe != null and cDescribe != ''">c_describe,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="mId != null">#{mId},</if>
|
||||||
|
<if test="cName != null and cName != ''">#{cName},</if>
|
||||||
|
<if test="cDescribe != null and cDescribe != ''">#{cDescribe},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateApiclass" parameterType="Apiclass">
|
||||||
|
update sys_apiclass
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="mId != null">m_id = #{mId},</if>
|
||||||
|
<if test="cName != null and cName != ''">c_name = #{cName},</if>
|
||||||
|
<if test="cDescribe != null and cDescribe != ''">c_describe = #{cDescribe},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteApiclassById" parameterType="Long">
|
||||||
|
delete from sys_apiclass where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteApiclassByIds" parameterType="String">
|
||||||
|
delete from sys_apiclass where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue