基于ruoyi+vue+elementUI实现列表,新增,附件上传,tab+springBoot+mybatis+oracle序列+批量新增
页面效果
列表页面
新增页面
详情页面
代码实现
列表+新增页面
<template>
<div class="app-container">
<!-- 搜索栏-->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="72px">
<el-form-item label="名称" prop="fullname">
<el-input v-model="queryParams.fullname" placeholder="请输入名称" clearable @keyup.enter.native="handleQuery" />
</el-form-item>
。。。
<el-form-item label="有效状态" prop="usedstatus">
<el-select v-model="queryParams.usedstatus" placeholder="请选择有效状态" clearable>
<el-option v-for="dict in dict.type.t_csinfo_basic_usedstatus" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
。。。
<el-form-item label="日期">
<el-date-picker v-model="daterangeCreatetime" 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="['customer:csinfo: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="['customer:csinfo: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="['customer:csinfo: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="['customer:csinfo:export']">导出
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<!-- 列表栏-->
<el-table v-loading="loading" :data="csinfoList" border stripe @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" width="50" align="center" />
<el-table-column label="名称" align="center">
<template slot-scope="scope">
<!-- <router-link to="/test">{{ scope.row.fullname }}</router-link> -->
<el-link type="primary" :underline="false">
<a @click="handleDetail(scope.row.basicidPk, scope.row.fullname)">{{ scope.row.fullname }}</a>
</el-link>
</template>
</el-table-column>
。。。
<el-table-column label="有效状态" align="center" prop="usedstatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.t_csinfo_basic_usedstatus" :value="scope.row.usedstatus" />
</template>
</el-table-column>
。。。
<el-table-column label="日期" align="center" prop="createtime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="营业执照附件" align="center">
<template slot-scope="scope">
<el-button v-if="scope.row.params.yyzzwdname && scope.row.params.yyzzwdname.length > 0" size="medium"
icon="el-icon-s-order" type="info" circle @click="downYyzz(scope.row)"></el-button>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['customer:csinfo:edit']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['customer:csinfo:remove']">删除
</el-button>
<!-- <el-button size="mini" type="text" icon="el-icon-search" @click="handleDetail(scope.row.basicidPk)">查看
</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" append-to-body width="1200px">
<el-form ref="form" :model="form" :rules="rules" label-width="130px">
<el-collapse v-model="activeName">
<el-collapse-item name="basicInfo">
<template slot="title">
<span class="cs-title">基本信息</span>
</template>
<el-row>
<el-col :span="12">
<el-form-item label="父名称" prop="parentname">
<el-input v-model="form.params.parentname" placeholder="请选择父" suffix-icon="el-icon-more"
:readonly="true" @click.native="handleSelectClick" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="父CRM代码" prop="parentcrmcode">
<el-input v-model="form.params.parentcrmcode" placeholder="父CRM代码" :disabled="true" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="名称" prop="fullname">
<el-input v-model="form.fullname" placeholder="请输入名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="登记号" prop="taxregisterno">
<el-input v-model="form.taxregisterno" placeholder="请输入税务登记号" />
</el-form-item>
</el-col>
</el-row>
。。。
</el-collapse-item>
<el-collapse-item name="businessInfo">
<template slot="title">
<span class="cs-title">分类信息</span>
</template>
<el-row>
<el-col :span="8">
<el-form-item label="内公司">
<el-switch v-model="form.isinnergroupcompany" active-color="#1890ff" inactive-color="#DCDFE6"
active-value="1" inactive-value="0"></el-switch>
</el-form-item>
</el-col>
。。。
</el-collapse-item>
<el-collapse-item name="zhuceInfo">
<template slot="title">
<span class="cs-title">注册信息</span>
</template>
。。。
</el-collapse-item>
<!-- 附件信息 -->
<el-collapse-item name="fileInfo">
<template slot="title">
<span class="cs-title">附件信息</span>
</template>
<el-row>
<el-col :span="8">
<el-form-item label="营业执照">
<el-upload class="upload-demo" ref="yyzzupload" :limit="1" accept=".pdf,.jpg,.png"
:headers="upload.headers" :http-request="yyzzHttpUploadFile" :file-list="upload.yyzzFileList"
:on-remove="fileRemove" :on-change="yyzzFileChange" :action="upload.url"
:before-upload="yyzzBeforeAvatarUpload" :before-remove="beforeRemove" :auto-upload="false"
:on-exceed="overUploadNum" list-type="text">
<el-button slot="trigger" size="small" type="primary">上传营业执照</el-button>
<div slot="tip" class="el-upload__tip">只能上传一份 pdf/jpg/png 格式的营业执照</div>
</el-upload>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="授权附件">
<el-upload class="upload-demo" ref="sqfjupload" :limit="1" accept=".pdf,.jpg,.png"
:headers="upload.headers" :http-request="sqfjHttpUploadFile" :file-list="upload.sqfjFileList"
:on-remove="fileRemove" :on-change="sqfjFileChange" :action="upload.url"
:before-upload="sqfjBeforeAvatarUpload" :before-remove="beforeRemove" :auto-upload="false"
:on-exceed="overUploadNum" list-type="text">
<el-button slot="trigger" size="small" type="primary">上传授权附件</el-button>
<div slot="tip" class="el-upload__tip">只能上传一份 pdf/jpg/png 格式的授权附件</div>
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
</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>
<!-- 选择界面 -->
<el-dialog :visible.sync="selectOpen" append-to-body width="800px">
<!-- <csinfo-select-list ref="refCsinfoSelectList" /> -->
</el-dialog>
</div>
</template>
<!--js事件-->
<script>
import { listCsinfo, getCsinfo, delCsinfo, addCsinfoAndFile } from "@/api/customer/csinfo";
import { updateWdYxbz } from "@/api/customer/wdxx";
import { getToken } from "@/utils/auth";
export default {
name: "Csinfo",
dicts: ['t_csinfo_basic_bysinesstype', 'yes_no', 't_csinfo_basic_usedstatus', 't_csinfo_basic_glb'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 基本信息表格数据
csinfoList: [],
//建档时间
daterangeCreatetime: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
//是否显示选择页
selectOpen: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
crmcode: null,
。。。
},
// 表单参数
form: {
params: {}
},
// 表单校验
rules: {
fullname: [
{ required: true, message: "名称不能为空", trigger: "blur" }
],
。。。
},
//文件数据
formData: '',
upload: {
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer" + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/file/upload",
// 营业执照的文件列表
yyzzFileList: [],
// 授权附件的文件列表
sqfjFileList: []
},
//手风琴
activeName: ['basicInfo', 'businessInfo', 'zhuceInfo', 'fileInfo']
};
},
created() {
this.getList();
},
methods: {
/** 查询基本信息列表 */
getList() {
this.loading = true;
this.queryParams.params = {};
if (null != this.daterangeCreatetime && '' != this.daterangeCreatetime) {
this.queryParams.params["beginCreatetime"] = this.daterangeCreatetime[0];
this.queryParams.params["endCreatetime"] = this.daterangeCreatetime[1];
}
listCsinfo(this.queryParams).then(response => {
this.csinfoList = response.rows;
this.total = response.total;
this.loading = false;
});
},
handleSelectClick() {
this.selectOpen = true;
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 编辑页表单重置
reset() {
this.form = {
basicidPk: null,
crmcode: null,
。。。
params: {
}
};
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.basicidPk)
this.single = selection.length !== 1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加信息";
this.upload.yyzzFileList = [];
this.upload.sqfjFileList = [];
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const basicidPk = row.basicidPk || this.ids
getCsinfo(basicidPk).then(response => {
this.form = response.data;
console.log("this.form", this.form);
//附件信息
this.upload.yyzzFileList = response.yyzzList;
this.upload.sqfjFileList = response.sqfjList;
this.open = true;
this.title = "修改信息";
});
},
/** 附件相关 */
/** 文件预上传格式限制 */
yyzzBeforeAvatarUpload(file) {
// const isJPG = file.type === 'image/jpeg'
// const isPng = file.type === 'image/png'
// const isLt2M = file.size / 1024 / 1024 < 2
//
// if (!isJPG && !isPng) {
// this.$message.error('上传图片只能是 JPG或png 格式!')
// }
// if (!isLt2M) {
// this.$message.error('上传图片大小不能超过 2MB!')
// }
// return (isJPG || isPng) && isLt2M
},
sqfjBeforeAvatarUpload(file) {
},
// 文件移除之前
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`);
},
/** 文件移除时 */
fileRemove(file, fileList) {
if (file.wdbmpk) {
//后台更新文档状态为不可用
updateWdYxbz(file.wdbmpk).then(() => {
// this.$modal.msgSuccess("删除成功");
});
}
this.$modal.msgSuccess("删除成功");
},
// 营业执照文件改变时
yyzzFileChange(file, fileList) {
this.upload.yyzzFileList = fileList
},
// 授权附件文件改变时
sqfjFileChange(file, fileList) {
this.upload.sqfjFileList = fileList
},
yyzzHttpUploadFile(file) {
this.formData.append('yyzzfiles', file.file); // append增加数据
},
sqfjHttpUploadFile(file) {
this.formData.append('sqfjfiles', file.file); // append增加数据
},
// 超过上传限制
overUploadNum(file, fileList) {
return this.$confirm("只允许上传一个文件");
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
let tipMsg = "";
if (this.form.basicidPk != null) {
tipMsg = "修改成功";
} else {
tipMsg = "新增成功";
}
this.formData = new FormData();
//处理不上传问题
this.formData.append('yyzzfiles', "");
this.formData.append('sqfjfiles', "");
this.$refs.yyzzupload.submit();
this.$refs.sqfjupload.submit();
this.formData.append("csinfo", JSON.stringify(this.form));
addCsinfoAndFile(this.formData).then(response => {
this.$modal.msgSuccess(tipMsg);
this.open = false;
this.getList();
});
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const basicidPks = row.basicidPk || this.ids;
this.$modal.confirm('是否确认删除信息编号为"' + basicidPks + '"的数据项?').then(function () {
return delCsinfo(basicidPks);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
this.download('customer/csinfo/export', {
...this.queryParams
}, `信息_${new Date().getTime()}.xlsx`)
},
//查看按钮操作
handleDetail(basicidPk, fullName) {
this.$router.push({
path: '/customer/csinfo-tab/index/' + basicidPk,
query: { pageNum: this.queryParams.pageNum, csName: fullName }
});
},
// 营业执照下载
downYyzz(row) {
const yyzzName = row.params.yyzzwdname[0];
const yyzzUrl = row.params.yyzzwdaddress[0];
const a = document.createElement('a');
a.setAttribute('download', yyzzName);
a.setAttribute('target', '_blank');
a.setAttribute('href', yyzzUrl);
a.click();
a.remove();
},
}
};
</script>
<!--样式栏-->
<style rel="stylesheet/scss" lang="scss">
.cs-title {
font-size: 16px;
color: #1890ff;
font-weight: bold;
}
</style>
详情tab页面
<!-- 详情tab -->
<template>
<el-card>
<el-descriptions :title="title"></el-descriptions>
<el-tabs v-loading="loading" type="card" v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="工商信息" name="businessform">
<csinfo-edit-form ref="refBusinessInfo" :businessInfo="businessInfo" :upload="upload" />
</el-tab-pane>
<el-tab-pane label="联系人信息" name="contactsform">
<csinfo-contacts-table ref="refContactsInfo" :contactsList="contactsList"
@handleContactsDelete="handleContactsDelete" />
</el-tab-pane>
<el-tab-pane label="开户行信息" name="bankform">
<csinfo-bank-table ref="refBankInfo" :bankList="bankList" @handleBankDelete="handleBankDelete" />
</el-tab-pane>
</el-tabs>
<el-form label-width="100px">
<el-form-item style="text-align: center;margin-left:-100px;margin-top:10px;">
<el-button type="primary" @click="submitForm()">提交</el-button>
<el-button @click="close()">关闭</el-button>
</el-form-item>
</el-form>
</el-card>
</template>
<script>
import { getCsInfoAndChildList, editCsInfoAndChildTableInfo } from "@/api/customer/csinfo";
import csinfoEditForm from "./csinfoEditForm";
import csinfoBankTable from "./csinfoBankTable";
import csinfoContactsTable from "./csinfoContactsTable";
import { getToken } from "@/utils/auth";
export default {
name: "CsinfoTab",
components: {
csinfoEditForm,
csinfoBankTable,
csinfoContactsTable,
},
data() {
return {
title:"",
activeName: 'contactsform',
//loading
loading: true,
// 工商信息
businessInfo: {
params: {}
},
// 银行信息表表格数据
bankList: [],
//联系人信息
contactsList: [],
upload: {
// 是否禁用上传
isUploading: false,
// 设置上传的请求头部
headers: { Authorization: "Bearer" + getToken() },
// 上传的地址
url: process.env.VUE_APP_BASE_API + "/file/upload",
// 营业执照的文件列表
yyzzFileList: [],
// 授权附件的文件列表
sqfjFileList: []
},
};
},
created() {
this.title=this.$route.query.csName||"信息";
const basicidPk = this.$route.params && this.$route.params.basicidPk;
if (basicidPk) {
// 获取详细信息
getCsInfoAndChildList(basicidPk).then(res => {
this.businessInfo = res.basicInfo;
this.upload.yyzzFileList = res.yyzzList;
this.upload.sqfjFileList = res.sqfjList;
this.bankList = res.bankList;
this.contactsList = res.contactsList;
this.loading = false;
});
}
},
methods: {
//供银行信息子页面调用
handleBankDelete(curBankList) {
this.bankList = curBankList;
},
//供联系人信息子页面调用
handleContactsDelete(curContactsList) {
this.contactsList = curContactsList;
},
//tab点击
handleClick(tab, event) {
// console.log(tab, event);
},
/** 提交按钮 */
submitForm() {
this.loading = true;
const businessForm = this.$refs.refBusinessInfo.$refs.refbusinessInfoForm;
Promise.all([businessForm].map(this.getFormPromise)).then(res => {
const validateResult = res.every(item => !!item);
if (validateResult) {
const csInfoTable = Object.assign({}, businessForm.model);
const contactvalid = this.contactsList.every((contactInfo) => {
return contactInfo.linkman && contactInfo.yxbz;
});
if (!contactvalid) {
this.$modal.msgError("联系人信息校验未通过");
this.loading = false;
return;
}
const bankvalid = this.bankList.every((bankInfo) => {
return bankInfo.bankname && bankInfo.bankaccount && bankInfo.contactnum && bankInfo.jbhflag;
});
if (!bankvalid) {
this.$modal.msgError("开户行信息校验未通过");
this.loading = false;
return;
}
csInfoTable.bankList = this.bankList;
csInfoTable.contactsList = this.contactsList;
editCsInfoAndChildTableInfo(csInfoTable).then(res => {
this.loading = false;
this.$modal.msgSuccess(res.msg);
// if (res.code === 200) {
// this.close();
// }
}).catch((res) => {
this.loading = false;
});
} else {
this.$modal.msgError("表单校验未通过,请重新检查提交内容");
}
});
},
getFormPromise(form) {
return new Promise(resolve => {
form.validate(res => {
resolve(res);
});
});
},
/** 关闭按钮 */
close() {
const obj = { path: "/customer/csinfo", query: { t: Date.now(), pageNum: this.$route.query.pageNum } };
this.$tab.closeOpenPage(obj);
}
},
};
</script>
详情页csinfoEditForm.vue
<!-- 基本信息 -->
<template>
<el-form ref="refbusinessInfoForm" :model="businessInfo" label-width="150px">
<!-- <el-form ref="form" :model="form" :rules="rules" label-width="130px"> -->
<el-collapse v-model="activeName">
<el-collapse-item name="basicInfo">
<template slot="title">
<span class="cs-title">基本信息</span>
</template>
<el-row>
<el-col :span="12">
<el-form-item label="父名称" prop="parentname">
<el-input v-model="businessInfo.params.parentname" suffix-icon="el-icon-more" :readonly="true"
placeholder="请选择父" @click.native="handleSelectClick" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="父CRM代码" prop="parentcrmcode">
<el-input v-model="businessInfo.params.parentcrmcode" :disabled="true" placeholder="父CRM代码" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="名称" prop="fullname">
<el-input v-model="businessInfo.fullname" placeholder="请输入名称" />
</el-form-item>
</el-col>
。。。
</el-row>
。。。
</el-collapse-item>
<!-- 附件信息 -->
<el-collapse-item name="fileInfo">
<template slot="title">
<span class="cs-title">附件信息</span>
</template>
<el-row>
<el-col :span="8">
<el-form-item label="营业执照">
<el-upload class="upload-demo" :limit="1" accept=".pdf,.jpg,.png" :file-list="upload.yyzzFileList"
:action="upload.url" list-type="text" :disabled="true">
</el-upload>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="授权附件">
<el-upload class="upload-demo" :limit="1" accept=".pdf,.jpg,.png" :file-list="upload.sqfjFileList"
:action="upload.url" list-type="text" :disabled="true">
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
<!-- </el-form> -->
</el-form>
</template>
<script>
export default {
name: "businessInfo",
dicts: ['t_csinfo_basic_bysinesstype', 'yes_no', 't_csinfo_basic_usedstatus', 't_csinfo_basic_glb'],
props: {
businessInfo: {
type: Object,
default: null,
},
upload: {
type: Object,
default: null,
},
},
data() {
return {
rules: {
fullname: [
{ required: true, message: "请输入名称", trigger: "blur" }
],
artificialperson: [
{ required: true, message: "请输入法定代表人", trigger: "blur" }
],
regcapital: [
{ required: true, message: "请输入注册资本", trigger: "blur" }
],
regcapitalunit: [
{ required: true, message: "请输入注册币种", trigger: "blur" }
]
},
//手风琴
activeName: ['basicInfo', 'businessInfo', 'zhuceInfo', 'fileInfo']
};
},
};
</script>
子tab联系人
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
</el-button>
</el-col>
</el-row>
<el-table :data="curContactsList" :row-class-name="rowIndexHandle" @selection-change="handleSelectionChange" border stripe>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="联系人姓名" align="center" prop="linkman">
<template slot-scope="scope">
<el-input v-model="scope.row.linkman" placeholder="请输入联系人姓名" />
</template>
</el-table-column>
。。。
<el-table-column label="有效标志" align="center" prop="yxbz">
<template slot-scope="scope">
<el-select v-model="scope.row.yxbz" placeholder="请选择有效标志">
<el-option v-for="dict in dict.type.yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="memo">
<template slot-scope="scope">
<el-input v-model="scope.row.memo" placeholder="请输入备注" />
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
name: "Csinfocontacts",
dicts: ['yes_no'],
props: {
contactsList: {
type: Array,
default: []
},
},
data() {
return {
// 非多个禁用
multiple: true,
//选中的index
checkedIndexEntry: [],
//当前页面的list
curContactsList: this.contactsList,
};
},
watch: {
//监听bankList,父页面修改后,子页面同步修改
contactsList(newVal, oldVal) {
this.curContactsList = newVal;
}
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.multiple = !selection.length
this.checkedIndexEntry = selection.map(item => item.index)
},
//序号处理
rowIndexHandle({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 新增按钮操作 */
handleAdd() {
let obj = {};
obj.linkman = "";
obj.tel = "";
obj.mobile = "";
obj.fax = "";
obj.email = "";
obj.memo = "";
obj.zw = "";
obj.yxbz = "";
//父页面
this.contactsList.push(obj);
},
/** 删除按钮操作 */
handleDelete() {
//当前页面数据传回父页面
this.$modal.confirm('确认删除选中的联系人信息吗?').then(() => {
//选中的删除
const curContactsList = this.curContactsList;
const checkedIndexEntry = this.checkedIndexEntry;
this.curContactsList = curContactsList.filter(function (item) {
return checkedIndexEntry.indexOf(item.index) == -1
});
this.$emit('handleContactsDelete', this.curContactsList);
}).catch(() => { });
},
}
};
</script>
子tab银行信息
<template>
<div class="app-container">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
</el-button>
</el-col>
</el-row>
<el-table :data="curBankList" border stripe :row-class-name="rowIndexHandle" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="序号" type="index" width="50" align="center">
<template slot-scope="scope">
<span>{{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}</span>
</template>
</el-table-column> -->
<el-table-column label="开户行全称" align="center" prop="bankname">
<template slot-scope="scope">
<el-input v-model="scope.row.bankname" placeholder="请输入开户行全称" />
</template>
</el-table-column>
。。。。
<el-table-column label="备注" align="center" prop="remark">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入备注" />
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
export default {
name: "Tcsinfobank",
dicts: ['t_csinfo_bank_cpaccountflag', 't_csinfo_bank_fkfs', 'yes_no'],
props: {
bankList: {
type: Array,
default: []
},
},
data() {
return {
// 非多个禁用
multiple: true,
//选中的index
checkedIndexEntry: [],
//当前页面的list
curBankList: this.bankList,
};
},
watch: {
//监听bankList,父页面修改后,子页面同步修改
bankList(newVal, oldVal) {
this.curBankList = newVal;
}
},
methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.multiple = !selection.length
this.checkedIndexEntry = selection.map(item => item.index)
},
//序号处理
rowIndexHandle({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 新增按钮操作 */
handleAdd() {
let obj = {};
// obj.basicidpk = "";
obj.bankname = "";
obj.bankaccount = "";
obj.contactnum = "";
obj.cpaccountflag = "";
obj.fkfs = "";
obj.jbhflag = "";
obj.bankaddress = "";
obj.remark = "";
//父页面
this.bankList.push(obj);
// this.bankList.unshift(obj);
},
/** 删除按钮操作 */
handleDelete() {
//当前页面数据传回父页面
this.$modal.confirm('确认删除选中的银行信息吗?').then(() => {
//选中的删除
const curBankList = this.curBankList;
const checkedIndexEntry = this.checkedIndexEntry;
this.curBankList = curBankList.filter(function (item) {
return checkedIndexEntry.indexOf(item.index) == -1
});
this.$emit('handleBankDelete', this.curBankList);
}).catch(() => { });
},
}
};
</script>
后台交互的JS
csinfo.js
import request from '@/utils/request'
// 查询基本信息列表
export function listCsinfo(query) {
return request({
url: '/customer/csinfo/list',
method: 'get',
params: query
})
}
// 查询基本信息详细
export function getCsinfo(basicidPk) {
return request({
url: '/customer/csinfo/' + basicidPk,
method: 'get'
})
}
// 查询和银行等信息
export function getCsInfoAndChildList(basicidPk) {
return request({
url: '/customer/csinfo/getCsInfoAndChildList/' + basicidPk,
method: 'get'
})
}
// 新增基本信息
export function addCsinfo(data) {
return request({
url: '/customer/csinfo',
method: 'post',
data: data
})
}
// 新增信息和附件信息
export function addCsinfoAndFile(data) {
return request({
url: '/customer/csinfo/addCsinfoAndFile',
method: 'post',
data: data
})
}
// 修改基本信息
export function updateCsinfo(data) {
return request({
url: '/customer/csinfo',
method: 'put',
data: data
})
}
// 修改和银行等信息
export function editCsInfoAndChildTableInfo(data) {
return request({
url: '/customer/csinfo/editCsInfoAndChildTableInfo',
method: 'put',
data: data
})
}
// 删除基本信息
export function delCsinfo(basicidPk) {
return request({
url: '/customer/csinfo/' + basicidPk,
method: 'delete'
})
}
wdxx.js
import request from '@/utils/request'
// 查询附件列表
export function listWdxx(query) {
return request({
url: '/customer/wdxx/list',
method: 'get',
params: query
})
}
// 查询附件详细
export function getWdxx(wdbmPk) {
return request({
url: '/customer/wdxx/' + wdbmPk,
method: 'get'
})
}
//更新附件有效标志
export function updateWdYxbz(wdbmPk) {
return request({
url: '/customer/wdxx/updateWdYxbz/' + wdbmPk,
method: 'put'
})
}
// 新增附件
export function addWdxx(data) {
return request({
url: '/customer/wdxx',
method: 'post',
data: data
})
}
// 修改附件
export function updateWdxx(data) {
return request({
url: '/customer/wdxx',
method: 'put',
data: data
})
}
// 删除附件
export function delWdxx(wdbmPk) {
return request({
url: '/customer/wdxx/' + wdbmPk,
method: 'delete'
})
}
详情页是页签形式,需要加路由router\index.js
此处加在公共路由处,自己可以加权限,放在权限路由处
{
path: '/customer/csinfo-tab',
component: Layout,
hidden: true,
children: [{
path: 'index/:basicidPk(\\d+)',
component: () => import('@/views/customer/csinfo/csinfoTab'),
name: 'CsinfoTab',
meta: {
title: '详细信息',
activeMenu: '/customer/csinfo'
}
}]
},
后端SpringBoot代码
controller
基础信息
/**
* 基本信息Controller
*
* @author yhh
* @date 2022-05-11
*/
@RestController
@RequestMapping("/csinfo")
public class TCsinfoBasicController extends CustomerBaseController
{
@Autowired
private ITCsinfoBasicService tCsinfoBasicService;
@Autowired
private ITCsinfoBankService tCsinfoBankService;
@Autowired
private ITCsinfoContactsService itCsinfoContactsService;
@Autowired
private IPubWdxxService iPubWdxxService;
@Autowired
private RemoteFileService remoteFileService;
@Autowired
private IPubXlhbService iPubXlhbService;
/**
* 查询基本信息列表+附件信息
*
*/
@RequiresPermissions("customer:csinfo:list")
@GetMapping("/list")
public TableDataInfo list(TCsinfoBasic tCsinfoBasic) {
startPage();
List<TCsinfoBasic> list = tCsinfoBasicService.selectTCsinfoBasicList(tCsinfoBasic);
//把业务标识拿出来
List<String> idList = list.stream().map(csinfo -> String.valueOf(csinfo.getBasicidPk())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(idList)) {
//查有效的营业执照附件
List<PubWdxx> PubWdxxList = iPubWdxxService.selectPubWdxxListByYwIds(CommConstValue.YES, PubWdxxConstValue.WDLB_YYZZ, idList);
if (!CollectionUtils.isEmpty(PubWdxxList)) {
ArrayListMultimap<String, Object> wdNameMap = ArrayListMultimap.create();
ArrayListMultimap<String, Object> wdAddressMap = ArrayListMultimap.create();
PubWdxxList.forEach(pubWdxx -> {
wdNameMap.put(pubWdxx.getId(), pubWdxx.getWdmc());
wdAddressMap.put(pubWdxx.getId(), pubWdxx.getWdAddress());
});
//把基本信息里加上附件信息
list.forEach(csinfo -> {
Map<String, Object> wdxxMap = new HashMap<>();
wdxxMap.put("yyzzwdname", wdNameMap.get(csinfo.getBasicidPk().toString()));
wdxxMap.put("yyzzwdaddress", wdAddressMap.get(csinfo.getBasicidPk().toString()));
csinfo.setParams(wdxxMap);
});
}
}
return getDataTable(list);
}
/**
* 添加信息+附件信息
* @author YHH
* * @param csinfo
* @param yyzzfiles
* param sqxxfiles
* @return
*/
@PostMapping("/addCsinfoAndFile")
public AjaxResult addCsinfoAndFile(@RequestParam("csinfo") String csinfo, @RequestParam(value = "yyzzfiles", required = false) MultipartFile[] yyzzfiles,
@RequestParam(value = "sqfjfiles", required = false) MultipartFile[] sqfjfiles) {
//先插入主表
TCsinfoBasic tCsinfoBasic = JSONObject.parseObject(csinfo, TCsinfoBasic.class);
//校验
// if (StringUtils.isBlank(tCsinfoBasic.getIsinnergroupcompany())) {
// return AjaxResult.error("必填信息不能为空");
// }
if (tCsinfoBasic.getBasicidPk() != null) {
//更新
tCsinfoBasic = tCsinfoBasic.buildOperateInfo(tCsinfoBasic);
tCsinfoBasicService.updateTCsinfoBasic(tCsinfoBasic);
}
else {
tCsinfoBasic = tCsinfoBasic.buildCreateInfo(tCsinfoBasic);
//生成crm编号是否集团内公司 1是 init1 0否 init2
String xlhmPk = "";
if ("1".equals(tCsinfoBasic.getIsinnergroupcompany())) {
xlhmPk = "init1";
}
else {
xlhmPk = "init2";
}
String vnowByByXlhmPk = iPubXlhbService.getVnowByByXlhmPk(xlhmPk);
tCsinfoBasic.setCrmcode(vnowByByXlhmPk);
//更新加一
iPubXlhbService.IncreVnowByXlhmPk(xlhmPk);
//设置有效状态
tCsinfoBasic.setUsedstatus(CommConstValue.YES);
tCsinfoBasicService.insertTCsinfoBasic(tCsinfoBasic);
}
//营业执照附件信息
uploadFile(yyzzfiles, String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_YYZZ);
//授权附件信息
uploadFile(sqfjfiles, String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_SQFJ);
return AjaxResult.success();
}
/**
* 上传附件信息
* @param files
* @param basicIdPk
* @param wdlb
*/
private void uploadFile(MultipartFile[] files, String basicIdPk, String wdlb) {
if (files != null && files.length > 0) {
ArrayList<PubWdxx> fileList = new ArrayList<>();
for (MultipartFile newFile : files) {
// 获取文件名称
// String fileName = newFile.getOriginalFilename();
R<SysFile> returnData = remoteFileService.upload(newFile);
SysFile sysFile = returnData.getData();
if (sysFile == null) {
continue;
}
// 将主表自增主键、文件名,文件路径保存至文件表数据库中
PubWdxx pubWdxx = new PubWdxx();
pubWdxx.setId(basicIdPk);
pubWdxx.setWdmc(sysFile.getName());
pubWdxx.setSize(String.valueOf(newFile.getSize()));
pubWdxx.setCjr(SecurityUtils.getUsername());
pubWdxx.setCjsj(DateUtils.getNowDate());
pubWdxx.setWdAddress(sysFile.getUrl());
pubWdxx.setLb(wdlb);
//有效标识为1
pubWdxx.setYxbz(CommConstValue.YES);
fileList.add(pubWdxx);
}
iPubWdxxService.batchInsertPubWdxx(fileList);
}
}
/**
* 导出基本信息列表
*/
@RequiresPermissions("customer:csinfo:export")
@Log(title = "基本信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, TCsinfoBasic tCsinfoBasic) {
List<TCsinfoBasic> list = tCsinfoBasicService.selectTCsinfoBasicList(tCsinfoBasic);
ExcelUtil<TCsinfoBasic> util = new ExcelUtil<TCsinfoBasic>(TCsinfoBasic.class);
util.exportExcel(response, list, "信息");
}
/**
* 获取详细信息+附件信息
* @author YHH
*/
@RequiresPermissions("customer:csinfo:query")
@GetMapping(value = "/{basicidPk}")
public AjaxResult getInfo(@PathVariable("basicidPk") Long basicidPk) {
TCsinfoBasic tCsinfoBasic = tCsinfoBasicService.selectTCsinfoBasicByBasicidPk(basicidPk);
if (tCsinfoBasic == null) {
return AjaxResult.error("未找到相关信息");
}
//查父信息
if (tCsinfoBasic.getParentPk() != null) {
TCsinfoBasic parentCsinfo = tCsinfoBasicService.selectTCsinfoBasicByBasicidPk(tCsinfoBasic.getParentPk());
Map<String, Object> parentCsinfoMap = new HashMap<>();
parentCsinfoMap.put("parentname", parentCsinfo.getFullname());
parentCsinfoMap.put("parentcrmcode", parentCsinfo.getCrmcode());
tCsinfoBasic.setParams(parentCsinfoMap);
}
AjaxResult ajaxResult = AjaxResult.success(tCsinfoBasic);
//查营业执照附件信息
ArrayList<Map<String, String>> wdxxList = getFileList(String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_YYZZ);
ajaxResult.put("yyzzList", wdxxList);
//查授权附件信息
ArrayList<Map<String, String>> sqfjWdxxList = getFileList(String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_SQFJ);
ajaxResult.put("sqfjList", sqfjWdxxList);
return ajaxResult;
}
/**
* 查单个客户的附件信息
* @param basicIdPk
* @param wdlb
* @return
*/
private ArrayList<Map<String, String>> getFileList(String basicIdPk, String wdlb) {
List<PubWdxx> pubWdxxList = iPubWdxxService.selectPubWdxxListByYwIds(CommConstValue.YES, wdlb, Lists.newArrayList(basicIdPk));
ArrayList<Map<String, String>> wdxxList = new ArrayList<>();
if (!CollectionUtils.isEmpty(pubWdxxList)) {
pubWdxxList.forEach(wdxx -> {
Map<String, String> wdxxMap = new HashMap<>();
wdxxMap.put("wdbmpk", wdxx.getWdbmPk());
wdxxMap.put("name", wdxx.getWdmc());
wdxxMap.put("url", wdxx.getWdAddress());
wdxxList.add(wdxxMap);
});
}
return wdxxList;
}
/**
* 新增基本信息
*/
@RequiresPermissions("customer:csinfo:add")
@Log(title = "基本信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TCsinfoBasic tCsinfoBasic) {
return toAjax(tCsinfoBasicService.insertTCsinfoBasic(tCsinfoBasic));
}
/**
* 修改基本信息
*/
@RequiresPermissions("customer:csinfo:edit")
@Log(title = "基本信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TCsinfoBasic tCsinfoBasic) {
return toAjax(tCsinfoBasicService.updateTCsinfoBasic(tCsinfoBasic));
}
/**
* 删除基本信息
*/
@RequiresPermissions("customer:csinfo:remove")
@Log(title = "基本信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{basicidPks}")
public AjaxResult remove(@PathVariable Long[] basicidPks) {
return toAjax(tCsinfoBasicService.deleteTCsinfoBasicByBasicidPks(basicidPks));
}
联合子表相关操作///
/**
* 获取基本信息和银行、联系方式列表信息
*/
@GetMapping(value = "/getCsInfoAndChildList/{basicidPk}")
public AjaxResult getCsInfoAndChildList(@PathVariable("basicidPk") Long basicidPk) {
if (basicidPk == null) {
return AjaxResult.error("标识不能为空!");
}
TCsinfoBasic tCsinfoBasic = tCsinfoBasicService.selectTCsinfoBasicByBasicidPk(basicidPk);
//查父信息
if (tCsinfoBasic != null && tCsinfoBasic.getParentPk() != null) {
TCsinfoBasic parentCsinfo = tCsinfoBasicService.selectTCsinfoBasicByBasicidPk(tCsinfoBasic.getParentPk());
Map<String, Object> parentCsinfoMap = new HashMap<>();
parentCsinfoMap.put("parentname", parentCsinfo.getFullname());
parentCsinfoMap.put("parentcrmcode", parentCsinfo.getCrmcode());
tCsinfoBasic.setParams(parentCsinfoMap);
}
AjaxResult ajaxResult = AjaxResult.success();
ajaxResult.put("basicInfo", tCsinfoBasic);
//查营业执照附件信息
ArrayList<Map<String, String>> wdxxList = getFileList(String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_YYZZ);
ajaxResult.put("yyzzList", wdxxList);
//查授权附件信息
ArrayList<Map<String, String>> sqfjWdxxList = getFileList(String.valueOf(tCsinfoBasic.getBasicidPk()), PubWdxxConstValue.WDLB_SQFJ);
ajaxResult.put("sqfjList", sqfjWdxxList);
//银行
List<TCsinfoBank> bankList = tCsinfoBankService.selectTCsinfoBankListByCsid(basicidPk);
ajaxResult.put("bankList", bankList);
//联系人
List<TCsinfoContacts> contactsList = itCsinfoContactsService.selectTCsinfoContactsListByCsid(basicidPk.toString());
ajaxResult.put("contactsList", contactsList);
return ajaxResult;
}
/**
* 修改基本信息
*/
@Log(title = "和相关信息的修改", businessType = BusinessType.UPDATE)
@PutMapping("/editCsInfoAndChildTableInfo")
public AjaxResult editCsInfoAndChildTableInfo(@RequestBody Map map) {
//基本信息
TCsinfoBasic tCsinfoBasic = new TCsinfoBasic();
BeanUtil.copyProperties(map, tCsinfoBasic, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
tCsinfoBasic = tCsinfoBasic.buildOperateInfo(tCsinfoBasic);
//银行信息
String bankListStr = JSON.toJSONString(map.get("bankList"));
List<TCsinfoBank> bankList = JSONObject.parseArray(bankListStr, TCsinfoBank.class);
//校验 【名称+账号 有效标志】【 账号 联行号 有效标识】都要唯一
if (!CollectionUtils.isEmpty(bankList)) {
Set<String> repeatSet = new HashSet<>();
Set<String> repeatSet2 = new HashSet<>();
boolean validPass = true;
for (TCsinfoBank bankinfo : bankList) {
String repeat1 = bankinfo.getBankname() + bankinfo.getBankaccount() + bankinfo.getYxbz();
String repeat2 = bankinfo.getBankaccount() + bankinfo.getContactnum() + bankinfo.getYxbz();
if (repeatSet.contains(repeat1)) {
validPass = false;
break;
}
else {
repeatSet.add(repeat1);
}
if (repeatSet2.contains(repeat2)) {
validPass = false;
break;
}
else {
repeatSet2.add(repeat2);
}
}
if (!validPass) {
return AjaxResult.error("【开户行,银行账号,银联号,默认使用】4项信息不能重复");
}
tCsinfoBankService.reInsertTCsinfoBankList(bankList, tCsinfoBasic);
}
//更新基本信息
tCsinfoBasicService.updateTCsinfoBasic(tCsinfoBasic);
//联系人信息
String contactsListStr = JSON.toJSONString(map.get("contactsList"));
List<TCsinfoContacts> contactsList = JSONObject.parseArray(contactsListStr, TCsinfoContacts.class);
if (!CollectionUtils.isEmpty(contactsList)) {
itCsinfoContactsService.reInsertTCsinfoContactsList(contactsList, tCsinfoBasic);
}
return toAjax(true);
}
}
serviceImpl实现类
基础信息
package com.general.customer.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.general.customer.mapper.TCsinfoBasicMapper;
import com.general.customer.domain.TCsinfoBasic;
import com.general.customer.service.ITCsinfoBasicService;
/**
* 基本信息Service业务层处理
*
* @author yhh
* @date 2022-05-11
*/
@Service
public class TCsinfoBasicServiceImpl implements ITCsinfoBasicService
{
@Autowired
private TCsinfoBasicMapper tCsinfoBasicMapper;
/**
* 查询基本信息
*
* @param basicidPk 基本信息主键
* @return 基本信息
*/
@Override
public TCsinfoBasic selectTCsinfoBasicByBasicidPk(Long basicidPk)
{
return tCsinfoBasicMapper.selectTCsinfoBasicByBasicidPk(basicidPk);
}
/**
* 查询基本信息列表
*
* @param tCsinfoBasic 基本信息
* @return 基本信息
*/
@Override
public List<TCsinfoBasic> selectTCsinfoBasicList(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.selectTCsinfoBasicList(tCsinfoBasic);
}
/**
* 新增基本信息
*
* @param tCsinfoBasic 基本信息
* @return 结果
*/
@Override
public int insertTCsinfoBasic(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.insertTCsinfoBasic(tCsinfoBasic);
}
/**
* 修改基本信息
*
* @param tCsinfoBasic 基本信息
* @return 结果
*/
@Override
public int updateTCsinfoBasic(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.updateTCsinfoBasic(tCsinfoBasic);
}
/**
* 批量删除基本信息
*
* @param basicidPks 需要删除的基本信息主键
* @return 结果
*/
@Override
public int deleteTCsinfoBasicByBasicidPks(Long[] basicidPks)
{
return tCsinfoBasicMapper.deleteTCsinfoBasicByBasicidPks(basicidPks);
}
/**
* 删除基本信息信息
*
* @param basicidPk 基本信息主键
* @return 结果
*/
@Override
public int deleteTCsinfoBasicByBasicidPk(Long basicidPk)
{
return tCsinfoBasicMapper.deleteTCsinfoBasicByBasicidPk(basicidPk);
}
}
附件信息
package com.general.customer.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.general.customer.mapper.PubWdxxMapper;
import com.general.customer.domain.PubWdxx;
import com.general.customer.service.IPubWdxxService;
/**
* 附件Service业务层处理
*
* @author yhh
* @date 2022-05-24
*/
@Service
public class PubWdxxServiceImpl implements IPubWdxxService
{
@Autowired
private PubWdxxMapper pubWdxxMapper;
/**
* 查询附件
*
* @param wdbmPk 附件主键
* @return 附件
*/
@Override
public PubWdxx selectPubWdxxByWdbmPk(String wdbmPk) {
return pubWdxxMapper.selectPubWdxxByWdbmPk(wdbmPk);
}
/**
* 查询附件列表
*
* @param pubWdxx 附件
* @return 附件
*/
@Override
public List<PubWdxx> selectPubWdxxList(PubWdxx pubWdxx) {
return pubWdxxMapper.selectPubWdxxList(pubWdxx);
}
/**
* 新增附件
*
* @param pubWdxx 附件
* @return 结果
*/
@Override
public int insertPubWdxx(PubWdxx pubWdxx) {
return pubWdxxMapper.insertPubWdxx(pubWdxx);
}
/**
* 修改附件
*
* @param pubWdxx 附件
* @return 结果
*/
@Override
public int updatePubWdxx(PubWdxx pubWdxx) {
return pubWdxxMapper.updatePubWdxx(pubWdxx);
}
/**
* 批量删除附件
*
* @param wdbmPks 需要删除的附件主键
* @return 结果
*/
@Override
public int deletePubWdxxByWdbmPks(String[] wdbmPks) {
return pubWdxxMapper.deletePubWdxxByWdbmPks(wdbmPks);
}
/**
* 删除附件信息
*
* @param wdbmPk 附件主键
* @return 结果
*/
@Override
public int deletePubWdxxByWdbmPk(String wdbmPk) {
return pubWdxxMapper.deletePubWdxxByWdbmPk(wdbmPk);
}
/**
* 批量添加附件信息
* @param pubWdxxList
*/
@Override
public int batchInsertPubWdxx(List<PubWdxx> pubWdxxList) {
return pubWdxxMapper.batchInsertPubWdxx(pubWdxxList);
}
/**
* 根据业务标识查所有附件信息
* @param yxbz 有效标志 1是 0否
* @param fjlb 附件类别
* @param idList 主键s
* @return
*/
@Override
public List<PubWdxx> selectPubWdxxListByYwIds(String yxbz, String fjlb, List<String> idList) {
return pubWdxxMapper.selectPubWdxxListByYwIds(yxbz, fjlb, idList);
}
/**
* 更新附件有效标识
* @author YHH
* @param wdbmPk
* @param yxbs
* @return
*/
@Override
public int updateWdYxbz(String wdbmPk, String yxbs) {
return pubWdxxMapper.updateWdYxbz(wdbmPk, yxbs);
}
}
联系人信息
package com.general.customer.service.impl;
import java.util.List;
import com.general.common.core.utils.DateUtils;
import com.general.common.core.utils.uuid.UUID;
import com.general.customer.domain.TCsinfoBank;
import com.general.customer.domain.TCsinfoBasic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.general.customer.mapper.TCsinfoContactsMapper;
import com.general.customer.domain.TCsinfoContacts;
import com.general.customer.service.ITCsinfoContactsService;
/**
* 联系人Service业务层处理
*
* @author yhh
* @date 2022-05-19
*/
@Service
public class TCsinfoContactsServiceImpl implements ITCsinfoContactsService
{
@Autowired
private TCsinfoContactsMapper tCsinfoContactsMapper;
/**
* 查询联系人
*
* @param contactsid 联系人主键
* @return 联系人
*/
@Override
public TCsinfoContacts selectTCsinfoContactsByContactsid(String contactsid) {
return tCsinfoContactsMapper.selectTCsinfoContactsByContactsid(contactsid);
}
/**
* 查询联系人列表
*
* @param tCsinfoContacts 联系人
* @return 联系人
*/
@Override
public List<TCsinfoContacts> selectTCsinfoContactsList(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.selectTCsinfoContactsList(tCsinfoContacts);
}
/**
* 新增联系人
*
* @param tCsinfoContacts 联系人
* @return 结果
*/
@Override
public int insertTCsinfoContacts(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.insertTCsinfoContacts(tCsinfoContacts);
}
/**
* 修改联系人
*
* @param tCsinfoContacts 联系人
* @return 结果
*/
@Override
public int updateTCsinfoContacts(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.updateTCsinfoContacts(tCsinfoContacts);
}
/**
* 批量删除联系人
*
* @param contactsids 需要删除的联系人主键
* @return 结果
*/
@Override
public int deleteTCsinfoContactsByContactsids(String[] contactsids) {
return tCsinfoContactsMapper.deleteTCsinfoContactsByContactsids(contactsids);
}
/**
* 删除联系人信息
*
* @param contactsid 联系人主键
* @return 结果
*/
@Override
public int deleteTCsinfoContactsByContactsid(String contactsid) {
return tCsinfoContactsMapper.deleteTCsinfoContactsByContactsid(contactsid);
}
/**
* 根据主键查联系人信息
* @author YHH
* @param basicidPk
*/
public List<TCsinfoContacts> selectTCsinfoContactsListByCsid(String basicidPk) {
return tCsinfoContactsMapper.selectTCsinfoContactsListByCsid(basicidPk);
}
/**
* 删除联系人信息,重新插入
* @author YHH
* @param contactsList
* @param tCsinfoBasic
*/
public void reInsertTCsinfoContactsList(List<TCsinfoContacts> contactsList, TCsinfoBasic tCsinfoBasic) {
//删除联系人信息
tCsinfoContactsMapper.deleteTCsinfoContactsByByCsId(tCsinfoBasic.getBasicidPk().toString());
//完善银行list数据
contactsList.forEach(contactsInfo -> {
contactsInfo.setContactsid(UUID.randomUUID().toString());
contactsInfo.setBasicidpk(tCsinfoBasic.getBasicidPk().toString());
contactsInfo.setCreator(tCsinfoBasic.getLastupdateuser());
contactsInfo.setCreateTime(DateUtils.getNowDate());
contactsInfo.setLastupdateuser(tCsinfoBasic.getLastupdateuser());
contactsInfo.setLastupdatetime(DateUtils.getNowDate());
});
tCsinfoContactsMapper.batchInsertContactsList(contactsList);
}
}
银行信息
package com.general.customer.service.impl;
import java.util.List;
import com.general.common.core.utils.DateUtils;
import com.general.customer.domain.TCsinfoBasic;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.general.customer.mapper.TCsinfoBankMapper;
import com.general.customer.domain.TCsinfoBank;
import com.general.customer.service.ITCsinfoBankService;
/**
* 银行信息表Service业务层处理
*
* @author yhh
* @date 2022-05-12
*/
@Service
public class TCsinfoBankServiceImpl implements ITCsinfoBankService
{
@Autowired
private TCsinfoBankMapper tCsinfoBankMapper;
/**
* 查询银行信息表
*
* @param bankPk 银行信息表主键
* @return 银行信息表
*/
@Override
public TCsinfoBank selectTCsinfoBankByBankPk(Long bankPk) {
return tCsinfoBankMapper.selectTCsinfoBankByBankPk(bankPk);
}
/**
* 查询银行信息表列表
*
* @param tCsinfoBank 银行信息表
* @return 银行信息表
*/
@Override
public List<TCsinfoBank> selectTCsinfoBankList(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.selectTCsinfoBankList(tCsinfoBank);
}
/**
* 根据ID,查询银行信息表列表
*
* @param csId id
* @return 银行信息表集合
*/
public List<TCsinfoBank> selectTCsinfoBankListByCsid(Long csId) {
return tCsinfoBankMapper.selectTCsinfoBankListByCsid(csId);
}
/**
* 新增银行信息表
*
* @param tCsinfoBank 银行信息表
* @return 结果
*/
@Override
public int insertTCsinfoBank(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.insertTCsinfoBank(tCsinfoBank);
}
/**
* 修改银行信息表
*
* @param tCsinfoBank 银行信息表
* @return 结果
*/
@Override
public int updateTCsinfoBank(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.updateTCsinfoBank(tCsinfoBank);
}
/**
* 批量删除银行信息表
*
* @param bankPks 需要删除的银行信息表主键
* @return 结果
*/
@Override
public int deleteTCsinfoBankByBankPks(Long[] bankPks) {
return tCsinfoBankMapper.deleteTCsinfoBankByBankPks(bankPks);
}
/**
* 删除银行信息表信息
*
* @param bankPk 银行信息表主键
* @return 结果
*/
@Override
public int deleteTCsinfoBankByBankPk(Long bankPk) {
return tCsinfoBankMapper.deleteTCsinfoBankByBankPk(bankPk);
}
/**
* 批量插入银行信息,先删后增
* @author YHH
* @param bankList
* @param tCsinfoBasic
*/
public void reInsertTCsinfoBankList(List<TCsinfoBank> bankList, TCsinfoBasic tCsinfoBasic) {
//删除银行信息
tCsinfoBankMapper.deleteTCsinfoBankByCsId(tCsinfoBasic.getBasicidPk());
//完善银行list数据
bankList.forEach(bankInfo -> {
bankInfo.setBasicidpk(tCsinfoBasic.getBasicidPk());
bankInfo.setLastupdatetime(DateUtils.getNowDate());
});
//重新批量插入
tCsinfoBankMapper.batchInsertTCsinfoBankList(bankList);
}
}
mybatis–>Mapper+XML
基础信息
package com.general.customer.mapper;
import java.util.List;
import com.general.customer.domain.TCsinfoBasic;
/**
* 基本信息Mapper接口
*
* @author yhh
* @date 2022-05-11
*/
public interface TCsinfoBasicMapper
{
/**
* 查询基本信息
*
* @param basicidPk 基本信息主键
* @return 基本信息
*/
public TCsinfoBasic selectTCsinfoBasicByBasicidPk(Long basicidPk);
/**
* 查询基本信息列表
*
* @param tCsinfoBasic 基本信息
* @return 基本信息集合
*/
public List<TCsinfoBasic> selectTCsinfoBasicList(TCsinfoBasic tCsinfoBasic);
/**
* 新增基本信息
*
* @param tCsinfoBasic 基本信息
* @return 结果
*/
public int insertTCsinfoBasic(TCsinfoBasic tCsinfoBasic);
/**
* 修改基本信息
*
* @param tCsinfoBasic 基本信息
* @return 结果
*/
public int updateTCsinfoBasic(TCsinfoBasic tCsinfoBasic);
/**
* 删除基本信息
*
* @param basicidPk 基本信息主键
* @return 结果
*/
public int deleteTCsinfoBasicByBasicidPk(Long basicidPk);
/**
* 批量删除基本信息
*
* @param basicidPks 需要删除的数据主键集合
* @return 结果
*/
public int deleteTCsinfoBasicByBasicidPks(Long[] basicidPks);
}
<?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.general.customer.mapper.TCsinfoBasicMapper">
<resultMap type="TCsinfoBasic" id="TCsinfoBasicResult">
<result property="basicidPk" column="basicid_pk"/>
...
</resultMap>
<sql id="selectTCsinfoBasicVo">
select basicid_pk,
。。。
from t_csinfo_basic
</sql>
<select id="selectTCsinfoBasicList" parameterType="TCsinfoBasic" resultMap="TCsinfoBasicResult">
<include refid="selectTCsinfoBasicVo"/>
<where>
<if test="crmcode != null and crmcode != ''">and crmcode = #{crmcode}</if>
<if test="fullname != null and fullname != ''">and fullname like concat(concat('%', #{fullname}), '%')</if>
。。。
<if test="glb != null and glb != ''">and glb = #{glb}</if>
and usedstatus='1'
</where>
order by createtime desc
</select>
<select id="selectTCsinfoBasicByBasicidPk" parameterType="Long" resultMap="TCsinfoBasicResult">
<include refid="selectTCsinfoBasicVo"/>
where basicid_pk = #{basicidPk}
</select>
<insert id="insertTCsinfoBasic" parameterType="TCsinfoBasic">
<selectKey keyProperty="basicidPk" resultType="long" order="BEFORE">
SELECT seq_t_csinfo_basic.NEXTVAL as basicidPk FROM DUAL
</selectKey>
insert into t_csinfo_basic
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="basicidPk != null">basicid_pk,</if>
<if test="crmcode != null">crmcode,</if>
<if test="fullname != null">fullname,</if>
。。。
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
。。。
</trim>
</insert>
<update id="updateTCsinfoBasic" parameterType="TCsinfoBasic">
update t_csinfo_basic
<trim prefix="SET" suffixOverrides=",">
...
<if test="eid != null">eid = #{eid},</if>
</trim>
where basicid_pk = #{basicidPk}
</update>
<delete id="deleteTCsinfoBasicByBasicidPk" parameterType="Long">
delete
from t_csinfo_basic
where basicid_pk = #{basicidPk}
</delete>
<delete id="deleteTCsinfoBasicByBasicidPks" parameterType="String">
update t_csinfo_basic set usedstatus='0' where basicid_pk in
<foreach item="basicidPk" collection="array" open="(" separator="," close=")">
#{basicidPk}
</foreach>
</delete>
</mapper>
附件信息
package com.general.customer.mapper;
import java.util.List;
import com.general.customer.domain.PubWdxx;
import org.apache.ibatis.annotations.Param;
/**
* 附件Mapper接口
*
* @author yhh
* @date 2022-05-24
*/
public interface PubWdxxMapper
{
/**
* 查询附件
*
* @param wdbmPk 附件主键
* @return 附件
*/
public PubWdxx selectPubWdxxByWdbmPk(String wdbmPk);
/**
* 查询附件列表
*
* @param pubWdxx 附件
* @return 附件集合
*/
public List<PubWdxx> selectPubWdxxList(PubWdxx pubWdxx);
/**
* 新增附件
*
* @param pubWdxx 附件
* @return 结果
*/
public int insertPubWdxx(PubWdxx pubWdxx);
/**
* 修改附件
*
* @param pubWdxx 附件
* @return 结果
*/
public int updatePubWdxx(PubWdxx pubWdxx);
/**
* 修改附件有效标识
* @param wdbmPk
* @param yxbz
* @return
*/
public int updateWdYxbz(@Param("wdbmPk") String wdbmPk, @Param("yxbz") String yxbz);
/**
* 删除附件
*
* @param wdbmPk 附件主键
* @return 结果
*/
public int deletePubWdxxByWdbmPk(String wdbmPk);
/**
* 批量删除附件
*
* @param wdbmPks 需要删除的数据主键集合
* @return 结果
*/
public int deletePubWdxxByWdbmPks(String[] wdbmPks);
/**
* 批量添加附件信息
* @param pubWdxxList
*/
public int batchInsertPubWdxx(List<PubWdxx> pubWdxxList);
/**
* 根据业务标识查所有附件信息
* @param yxbz 有效标志 1是 0否
* @param fjlb 附件类别
* @param idList 主键s
* @return
*/
public List<PubWdxx> selectPubWdxxListByYwIds(@Param("yxbz") String yxbz, @Param("fjlb") String fjlb, @Param("idList") List<String> idList);
}
<?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.general.customer.mapper.PubWdxxMapper">
<resultMap type="PubWdxx" id="PubWdxxResult">
<result property="wdbmPk" column="wdbm_pk"/>
...
</resultMap>
<sql id="selectPubWdxxVo">
select wdbm_pk,
...
from pub_wdxx
</sql>
<select id="selectPubWdxxList" parameterType="PubWdxx" resultMap="PubWdxxResult">
<include refid="selectPubWdxxVo"/>
<where>
<if test="wdbmPk != null and wdbmPk != ''">and wdbm_pk = #{wdbmPk}</if>
<if test="wdmc != null and wdmc != ''">and wdmc = #{wdmc}</if>
...
</where>
</select>
<select id="selectPubWdxxByWdbmPk" parameterType="String" resultMap="PubWdxxResult">
<include refid="selectPubWdxxVo"/>
where wdbm_pk = #{wdbmPk}
</select>
<!-- 根据业务id查附件list-->
<select id="selectPubWdxxListByYwIds" parameterType="list" resultMap="PubWdxxResult">
<include refid="selectPubWdxxVo"/>
<where>
<if test="yxbz != null and yxbz != ''">and yxbz = #{yxbz}</if>
<if test="fjlb != null and fjlb != ''">and lb = #{fjlb}</if>
<if test="idList != null and idList.size()>0">and id in
<foreach collection="idList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
<insert id="insertPubWdxx" parameterType="PubWdxx">
insert into pub_wdxx
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="wdbmPk != null">wdbm_pk,</if>
。。。
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="wdbmPk != null">#{wdbmPk},</if>
。。。
</trim>
</insert>
<insert id="batchInsertPubWdxx">
insert all
<foreach item="item" index="index" collection="list">
into pub_wdxx( wdbm_pk, id, wdmc, size_,
wd, cjr, cjsj, xgr, xgsj, lb, wd_address, yxbz, wd_address_old
) values (sys_guid(), #{item.id,jdbcType=VARCHAR}, #{item.wdmc,jdbcType=VARCHAR},
#{item.size,jdbcType=VARCHAR}, #{item.wd,jdbcType=BLOB}, #{item.cjr,jdbcType=VARCHAR},
#{item.cjsj,jdbcType=DATE}, #{item.xgr,jdbcType=NUMERIC}, #{item.xgsj,jdbcType=DATE},
#{item.lb,jdbcType=CHAR}, #{item.wdAddress,jdbcType=VARCHAR}, #{item.yxbz,jdbcType=CHAR},
#{item.wdAddressOld,jdbcType=VARCHAR})
</foreach>
SELECT 1 FROM DUAL
</insert>
<update id="updatePubWdxx" parameterType="PubWdxx">
update pub_wdxx
<trim prefix="SET" suffixOverrides=",">
<if test="id != null">id = #{id},</if>
。。。
</trim>
where wdbm_pk = #{wdbmPk}
</update>
<!-- 更新有效标识-->
<update id="updateWdYxbz">
update pub_wdxx
set yxbz=#{yxbz}
where wdbm_pk = #{wdbmPk}
</update>
<delete id="deletePubWdxxByWdbmPk" parameterType="String">
delete
from pub_wdxx
where wdbm_pk = #{wdbmPk}
</delete>
<delete id="deletePubWdxxByWdbmPks" parameterType="String">
delete from pub_wdxx where wdbm_pk in
<foreach item="wdbmPk" collection="array" open="(" separator="," close=")">
#{wdbmPk}
</foreach>
</delete>
</mapper>
联系人信息
package com.general.customer.mapper;
import java.util.List;
import com.general.customer.domain.TCsinfoBank;
import com.general.customer.domain.TCsinfoContacts;
import org.apache.ibatis.annotations.Param;
/**
* 联系人Mapper接口
*
* @author yhh
* @date 2022-05-19
*/
public interface TCsinfoContactsMapper
{
/**
* 查询联系人
*
* @param contactsid 联系人主键
* @return 联系人
*/
public TCsinfoContacts selectTCsinfoContactsByContactsid(String contactsid);
/**
* 查询联系人列表
*
* @param tCsinfoContacts 联系人
* @return 联系人集合
*/
public List<TCsinfoContacts> selectTCsinfoContactsList(TCsinfoContacts tCsinfoContacts);
/**
* 新增联系人
*
* @param tCsinfoContacts 联系人
* @return 结果
*/
public int insertTCsinfoContacts(TCsinfoContacts tCsinfoContacts);
/**
* 修改联系人
*
* @param tCsinfoContacts 联系人
* @return 结果
*/
public int updateTCsinfoContacts(TCsinfoContacts tCsinfoContacts);
/**
* 删除联系人
*
* @param contactsid 联系人主键
* @return 结果
*/
public int deleteTCsinfoContactsByContactsid(String contactsid);
/**
* 批量删除联系人
*
* @param contactsids 需要删除的数据主键集合
* @return 结果
*/
public int deleteTCsinfoContactsByContactsids(String[] contactsids);
/**
* 根据主键查联系人信息
* @author YHH
* @param basicidPk
*/
public List<TCsinfoContacts> selectTCsinfoContactsListByCsid(@Param("basicidPk") String basicidPk);
/**
* 根据主键删除联系人所有信息
* @author YHH
* @param basicidPk
*/
public void deleteTCsinfoContactsByByCsId(@Param("basicidPk") String basicidPk);
/**
* 批量插入银行信息
* @author YHH
* @param contactsList
* @return
*/
public int batchInsertContactsList(List<TCsinfoContacts> contactsList);
}
<?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.general.customer.mapper.TCsinfoContactsMapper">
<resultMap type="TCsinfoContacts" id="TCsinfoContactsResult">
<result property="contactsid" column="contactsid"/>
。。。
</resultMap>
<sql id="selectTCsinfoContactsVo">
select contactsid,
basicidpk,
...
from t_csinfo_contacts
</sql>
<select id="selectTCsinfoContactsList" parameterType="TCsinfoContacts" resultMap="TCsinfoContactsResult">
<include refid="selectTCsinfoContactsVo"/>
<where>
....
<if test="yxbz != null and yxbz != ''">and yxbz = #{yxbz}</if>
</where>
</select>
<select id="selectTCsinfoContactsByContactsid" parameterType="String" resultMap="TCsinfoContactsResult">
<include refid="selectTCsinfoContactsVo"/>
where contactsid = #{contactsid}
</select>
<select id="selectTCsinfoContactsListByCsid" parameterType="String" resultMap="TCsinfoContactsResult">
<include refid="selectTCsinfoContactsVo"/>
where basicidpk = #{basicidPk}
</select>
<insert id="insertTCsinfoContacts" parameterType="TCsinfoContacts" useGeneratedKeys="false">
insert into t_csinfo_contacts
<trim prefix="(" suffix=")" suffixOverrides=",">
...
<if test="yxbz != null">yxbz,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
...
<if test="yxbz != null">#{yxbz},</if>
</trim>
</insert>
<insert id="batchInsertContactsList">
insert all
<foreach item="item" index="index" collection="list">
into t_csinfo_contacts( contactsid, basicidpk, linkman, tel,
mobile, fax, email, memo, zw, xh, creator, createtime, lastupdateuser, lastupdatetime,yxbz
) values (sys_guid(), #{item.basicidpk,jdbcType=VARCHAR}, #{item.linkman,jdbcType=VARCHAR},
#{item.tel,jdbcType=VARCHAR}, #{item.mobile,jdbcType=VARCHAR}, #{item.fax,jdbcType=VARCHAR},
#{item.email,jdbcType=VARCHAR}, #{item.memo,jdbcType=NUMERIC}, #{item.zw,jdbcType=VARCHAR},
#{item.xh,jdbcType=NUMERIC}, #{item.creator,jdbcType=VARCHAR}, #{item.createtime,jdbcType=DATE},
#{item.lastupdateuser,jdbcType=VARCHAR},#{item.lastupdatetime,jdbcType=DATE},#{item.yxbz,jdbcType=CHAR})
</foreach>
SELECT 1 FROM DUAL
</insert>
<update id="updateTCsinfoContacts" parameterType="TCsinfoContacts">
update t_csinfo_contacts
<trim prefix="SET" suffixOverrides=",">
<if test="basicidpk != null">basicidpk = #{basicidpk},</if>
...
<if test="yxbz != null">yxbz = #{yxbz},</if>
</trim>
where contactsid = #{contactsid}
</update>
<delete id="deleteTCsinfoContactsByContactsid" parameterType="String">
delete
from t_csinfo_contacts
where contactsid = #{contactsid}
</delete>
<delete id="deleteTCsinfoContactsByContactsids" parameterType="String">
delete from t_csinfo_contacts where contactsid in
<foreach item="contactsid" collection="array" open="(" separator="," close=")">
#{contactsid}
</foreach>
</delete>
<delete id="deleteTCsinfoContactsByByCsId" parameterType="String">
delete
from t_csinfo_contacts
where basicidpk = #{basicidPk}
</delete>
</mapper>
银行信息
package com.general.customer.mapper;
import java.util.List;
import com.general.customer.domain.TCsinfoBank;
import org.apache.ibatis.annotations.Param;
/**
* 银行信息表Mapper接口
*
* @author yhh
* @date 2022-05-12
*/
public interface TCsinfoBankMapper
{
/**
* 查询银行信息表
*
* @param bankPk 银行信息表主键
* @return 银行信息表
*/
public TCsinfoBank selectTCsinfoBankByBankPk(Long bankPk);
/**
* 查询银行信息表列表
*
* @param tCsinfoBank 银行信息表
* @return 银行信息表集合
*/
public List<TCsinfoBank> selectTCsinfoBankList(TCsinfoBank tCsinfoBank);
/**
* 根据ID,查询银行信息表列表
*
* @param csId id
* @return 银行信息表集合
*/
public List<TCsinfoBank> selectTCsinfoBankListByCsid(@Param("csId") Long csId);
/**
* 新增银行信息表
*
* @param tCsinfoBank 银行信息表
* @return 结果
*/
public int insertTCsinfoBank(TCsinfoBank tCsinfoBank);
/**
* 修改银行信息表
*
* @param tCsinfoBank 银行信息表
* @return 结果
*/
public int updateTCsinfoBank(TCsinfoBank tCsinfoBank);
/**
* 删除银行信息表
*
* @param bankPk 银行信息表主键
* @return 结果
*/
public int deleteTCsinfoBankByBankPk(Long bankPk);
/**
* 批量删除银行信息表
*
* @param bankPks 需要删除的数据主键集合
* @return 结果
*/
public int deleteTCsinfoBankByBankPks(Long[] bankPks);
/**
* 根据主键删除银行信息
* @author YHH
* @param basicidPk 主键
* @return 结果
*/
public int deleteTCsinfoBankByCsId(@Param("basicidPk") Long basicidPk);
/**
* 批量插入银行信息
* @author YHH
* @param bankList
* @return
*/
public int batchInsertTCsinfoBankList(List<TCsinfoBank> bankList);
}
<?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.general.customer.mapper.TCsinfoBankMapper">
<resultMap type="TCsinfoBank" id="TCsinfoBankResult">
<result property="bankPk" column="bank_pk"/>
...
<result property="cpaccountflag" column="cpaccountflag"/>
</resultMap>
<sql id="selectTCsinfoBankVo">
select bank_pk,
basicidpk,
...
from t_csinfo_bank
</sql>
<select id="selectTCsinfoBankList" parameterType="TCsinfoBank" resultMap="TCsinfoBankResult">
<include refid="selectTCsinfoBankVo"/>
<where>
<if test="bankname != null and bankname != ''">and bankname like concat(concat('%', #{bankname}), '%')</if>
<if test="bankaccount != null and bankaccount != ''">and bankaccount like concat(concat('%', #{bankaccount}), '%')</if>
<if test="bankaddress != null and bankaddress != ''">and bankaddress like concat(concat('%', #{bankaddress}), '%')</if>
<if test="contactnum != null and contactnum != ''">and contactnum = #{contactnum}</if>
</where>
</select>
<select id="selectTCsinfoBankListByCsid" parameterType="Long" resultMap="TCsinfoBankResult">
<include refid="selectTCsinfoBankVo"/>
where basicidpk = #{csId}
</select>
<select id="selectTCsinfoBankByBankPk" parameterType="Long" resultMap="TCsinfoBankResult">
<include refid="selectTCsinfoBankVo"/>
where bank_pk = #{bankPk}
</select>
<insert id="insertTCsinfoBank" parameterType="TCsinfoBank">
<selectKey keyProperty="bankPk" resultType="long" order="BEFORE">
SELECT seq_t_csinfo_bank.NEXTVAL as bankPk FROM DUAL
</selectKey>
insert into t_csinfo_bank
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bankPk != null">bank_pk,</if>
。。。
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bankPk != null">#{bankPk},</if>
。。。
</trim>
</insert>
<insert id="batchInsertTCsinfoBankList" useGeneratedKeys="false">
insert into t_csinfo_bank(
bank_pk,basicidpk,bankname,bankaccount,bankaddress,remark,bshared,owerdep,lastupdatetime,creator,createtime,businessid,contactnum,wdpk,wdmc,
yxbz,customerflag,supplierflag,jbhflag,log,fkfs,shbz,cpaccountflag)
select seq_t_csinfo_bank.nextval,t.* from (
<foreach item="item" index="index" collection="list" separator="union all">
select
#{item.basicidpk,jdbcType=NUMERIC} as basicidpk,#{item.bankname,jdbcType=VARCHAR} as bankname,#{item.bankaccount,jdbcType=VARCHAR} as bankaccount,
#{item.bankaddress,jdbcType=VARCHAR} as bankaddress,#{item.remark,jdbcType=VARCHAR} as remark,#{item.bshared,jdbcType=VARCHAR} as
bshared,#{item.owerdep,jdbcType=VARCHAR} as owerdep,
#{item.lastupdatetime,jdbcType=DATE} as lastupdatetime, #{item.creator,jdbcType=VARCHAR} as creator,#{item.createtime,jdbcType=DATE} as
createtime,#{item.businessid,jdbcType=VARCHAR} as businessid,
#{item.contactnum,jdbcType=VARCHAR } as contactnum,#{item.wdpk,jdbcType=VARCHAR } as wdpk,#{item.wdmc,jdbcType=VARCHAR } as wdmc,#{item.yxbz,jdbcType=CHAR } as yxbz,
#{item.customerflag,jdbcType=CHAR } as customerflag,#{item.supplierflag,jdbcType=CHAR } as supplierflag,#{item.jbhflag,jdbcType=CHAR } as
jbhflag,#{item.log,jdbcType=VARCHAR } as log,
#{item.fkfs,jdbcType=VARCHAR } as fkfs,#{item.shbz,jdbcType=VARCHAR } as shbz,#{item.cpaccountflag,jdbcType=CHAR} as cpaccountflag
from dual
</foreach>
)t
</insert>
<update id="updateTCsinfoBank" parameterType="TCsinfoBank">
update t_csinfo_bank
<trim prefix="SET" suffixOverrides=",">
<if test="basicidpk != null">basicidpk = #{basicidpk},</if>
。。。
</trim>
where bank_pk = #{bankPk}
</update>
<delete id="deleteTCsinfoBankByBankPk" parameterType="Long">
delete
from t_csinfo_bank
where bank_pk = #{bankPk}
</delete>
<delete id="deleteTCsinfoBankByBankPks" parameterType="String">
delete from t_csinfo_bank where bank_pk in
<foreach item="bankPk" collection="array" open="(" separator="," close=")">
#{bankPk}
</foreach>
</delete>
<delete id="deleteTCsinfoBankByCsId" parameterType="Long">
delete
from t_csinfo_bank
where basicidpk = #{basicidPk}
</delete>
</mapper>