基于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">
<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>
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">
el-dialog>
div>
template>
<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) {
},
sqfjBeforeAvatarUpload(file) {
},
beforeRemove(file, fileList) {
return this.$confirm(`确定移除 ${file.name}?`);
},
fileRemove(file, fileList) {
if (file.wdbmpk) {
updateWdYxbz(file.wdbmpk).then(() => {
});
}
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);
},
sqfjHttpUploadFile(file) {
this.formData.append('sqfjfiles', file.file);
},
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页面
<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: 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;
},
handleClick(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);
}).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-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>
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,
checkedIndexEntry: [],
curContactsList: this.contactsList,
};
},
watch: {
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="开户行全称" 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,
checkedIndexEntry: [],
curBankList: this.bankList,
};
},
watch: {
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.bankname = "";
obj.bankaccount = "";
obj.contactnum = "";
obj.cpaccountflag = "";
obj.fkfs = "";
obj.jbhflag = "";
obj.bankaddress = "";
obj.remark = "";
this.bankList.push(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
基础信息
@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);
}
@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 (tCsinfoBasic.getBasicidPk() != null) {
tCsinfoBasic = tCsinfoBasic.buildOperateInfo(tCsinfoBasic);
tCsinfoBasicService.updateTCsinfoBasic(tCsinfoBasic);
}
else {
tCsinfoBasic = tCsinfoBasic.buildCreateInfo(tCsinfoBasic);
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();
}
private void uploadFile(MultipartFile[] files, String basicIdPk, String wdlb) {
if (files != null && files.length > 0) {
ArrayList<PubWdxx> fileList = new ArrayList<>();
for (MultipartFile newFile : files) {
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);
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, "信息");
}
@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;
}
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
public class TCsinfoBasicServiceImpl implements ITCsinfoBasicService
{
@Autowired
private TCsinfoBasicMapper tCsinfoBasicMapper;
@Override
public TCsinfoBasic selectTCsinfoBasicByBasicidPk(Long basicidPk)
{
return tCsinfoBasicMapper.selectTCsinfoBasicByBasicidPk(basicidPk);
}
@Override
public List<TCsinfoBasic> selectTCsinfoBasicList(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.selectTCsinfoBasicList(tCsinfoBasic);
}
@Override
public int insertTCsinfoBasic(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.insertTCsinfoBasic(tCsinfoBasic);
}
@Override
public int updateTCsinfoBasic(TCsinfoBasic tCsinfoBasic)
{
return tCsinfoBasicMapper.updateTCsinfoBasic(tCsinfoBasic);
}
@Override
public int deleteTCsinfoBasicByBasicidPks(Long[] basicidPks)
{
return tCsinfoBasicMapper.deleteTCsinfoBasicByBasicidPks(basicidPks);
}
@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
public class PubWdxxServiceImpl implements IPubWdxxService
{
@Autowired
private PubWdxxMapper pubWdxxMapper;
@Override
public PubWdxx selectPubWdxxByWdbmPk(String wdbmPk) {
return pubWdxxMapper.selectPubWdxxByWdbmPk(wdbmPk);
}
@Override
public List<PubWdxx> selectPubWdxxList(PubWdxx pubWdxx) {
return pubWdxxMapper.selectPubWdxxList(pubWdxx);
}
@Override
public int insertPubWdxx(PubWdxx pubWdxx) {
return pubWdxxMapper.insertPubWdxx(pubWdxx);
}
@Override
public int updatePubWdxx(PubWdxx pubWdxx) {
return pubWdxxMapper.updatePubWdxx(pubWdxx);
}
@Override
public int deletePubWdxxByWdbmPks(String[] wdbmPks) {
return pubWdxxMapper.deletePubWdxxByWdbmPks(wdbmPks);
}
@Override
public int deletePubWdxxByWdbmPk(String wdbmPk) {
return pubWdxxMapper.deletePubWdxxByWdbmPk(wdbmPk);
}
@Override
public int batchInsertPubWdxx(List<PubWdxx> pubWdxxList) {
return pubWdxxMapper.batchInsertPubWdxx(pubWdxxList);
}
@Override
public List<PubWdxx> selectPubWdxxListByYwIds(String yxbz, String fjlb, List<String> idList) {
return pubWdxxMapper.selectPubWdxxListByYwIds(yxbz, fjlb, idList);
}
@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
public class TCsinfoContactsServiceImpl implements ITCsinfoContactsService
{
@Autowired
private TCsinfoContactsMapper tCsinfoContactsMapper;
@Override
public TCsinfoContacts selectTCsinfoContactsByContactsid(String contactsid) {
return tCsinfoContactsMapper.selectTCsinfoContactsByContactsid(contactsid);
}
@Override
public List<TCsinfoContacts> selectTCsinfoContactsList(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.selectTCsinfoContactsList(tCsinfoContacts);
}
@Override
public int insertTCsinfoContacts(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.insertTCsinfoContacts(tCsinfoContacts);
}
@Override
public int updateTCsinfoContacts(TCsinfoContacts tCsinfoContacts) {
return tCsinfoContactsMapper.updateTCsinfoContacts(tCsinfoContacts);
}
@Override
public int deleteTCsinfoContactsByContactsids(String[] contactsids) {
return tCsinfoContactsMapper.deleteTCsinfoContactsByContactsids(contactsids);
}
@Override
public int deleteTCsinfoContactsByContactsid(String contactsid) {
return tCsinfoContactsMapper.deleteTCsinfoContactsByContactsid(contactsid);
}
public List<TCsinfoContacts> selectTCsinfoContactsListByCsid(String basicidPk) {
return tCsinfoContactsMapper.selectTCsinfoContactsListByCsid(basicidPk);
}
public void reInsertTCsinfoContactsList(List<TCsinfoContacts> contactsList, TCsinfoBasic tCsinfoBasic) {
tCsinfoContactsMapper.deleteTCsinfoContactsByByCsId(tCsinfoBasic.getBasicidPk().toString());
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
public class TCsinfoBankServiceImpl implements ITCsinfoBankService
{
@Autowired
private TCsinfoBankMapper tCsinfoBankMapper;
@Override
public TCsinfoBank selectTCsinfoBankByBankPk(Long bankPk) {
return tCsinfoBankMapper.selectTCsinfoBankByBankPk(bankPk);
}
@Override
public List<TCsinfoBank> selectTCsinfoBankList(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.selectTCsinfoBankList(tCsinfoBank);
}
public List<TCsinfoBank> selectTCsinfoBankListByCsid(Long csId) {
return tCsinfoBankMapper.selectTCsinfoBankListByCsid(csId);
}
@Override
public int insertTCsinfoBank(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.insertTCsinfoBank(tCsinfoBank);
}
@Override
public int updateTCsinfoBank(TCsinfoBank tCsinfoBank) {
return tCsinfoBankMapper.updateTCsinfoBank(tCsinfoBank);
}
@Override
public int deleteTCsinfoBankByBankPks(Long[] bankPks) {
return tCsinfoBankMapper.deleteTCsinfoBankByBankPks(bankPks);
}
@Override
public int deleteTCsinfoBankByBankPk(Long bankPk) {
return tCsinfoBankMapper.deleteTCsinfoBankByBankPk(bankPk);
}
public void reInsertTCsinfoBankList(List<TCsinfoBank> bankList, TCsinfoBasic tCsinfoBasic) {
tCsinfoBankMapper.deleteTCsinfoBankByCsId(tCsinfoBasic.getBasicidPk());
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;
public interface TCsinfoBasicMapper
{
public TCsinfoBasic selectTCsinfoBasicByBasicidPk(Long basicidPk);
public List<TCsinfoBasic> selectTCsinfoBasicList(TCsinfoBasic tCsinfoBasic);
public int insertTCsinfoBasic(TCsinfoBasic tCsinfoBasic);
public int updateTCsinfoBasic(TCsinfoBasic tCsinfoBasic);
public int deleteTCsinfoBasicByBasicidPk(Long basicidPk);
public int deleteTCsinfoBasicByBasicidPks(Long[] basicidPks);
}
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;
public interface PubWdxxMapper
{
public PubWdxx selectPubWdxxByWdbmPk(String wdbmPk);
public List<PubWdxx> selectPubWdxxList(PubWdxx pubWdxx);
public int insertPubWdxx(PubWdxx pubWdxx);
public int updatePubWdxx(PubWdxx pubWdxx);
public int updateWdYxbz(@Param("wdbmPk") String wdbmPk, @Param("yxbz") String yxbz);
public int deletePubWdxxByWdbmPk(String wdbmPk);
public int deletePubWdxxByWdbmPks(String[] wdbmPks);
public int batchInsertPubWdxx(List<PubWdxx> pubWdxxList);
public List<PubWdxx> selectPubWdxxListByYwIds(@Param("yxbz") String yxbz, @Param("fjlb") String fjlb, @Param("idList") List<String> idList);
}
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>
<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;
public interface TCsinfoContactsMapper
{
public TCsinfoContacts selectTCsinfoContactsByContactsid(String contactsid);
public List<TCsinfoContacts> selectTCsinfoContactsList(TCsinfoContacts tCsinfoContacts);
public int insertTCsinfoContacts(TCsinfoContacts tCsinfoContacts);
public int updateTCsinfoContacts(TCsinfoContacts tCsinfoContacts);
public int deleteTCsinfoContactsByContactsid(String contactsid);
public int deleteTCsinfoContactsByContactsids(String[] contactsids);
public List<TCsinfoContacts> selectTCsinfoContactsListByCsid(@Param("basicidPk") String basicidPk);
public void deleteTCsinfoContactsByByCsId(@Param("basicidPk") String basicidPk);
public int batchInsertContactsList(List<TCsinfoContacts> contactsList);
}
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;
public interface TCsinfoBankMapper
{
public TCsinfoBank selectTCsinfoBankByBankPk(Long bankPk);
public List<TCsinfoBank> selectTCsinfoBankList(TCsinfoBank tCsinfoBank);
public List<TCsinfoBank> selectTCsinfoBankListByCsid(@Param("csId") Long csId);
public int insertTCsinfoBank(TCsinfoBank tCsinfoBank);
public int updateTCsinfoBank(TCsinfoBank tCsinfoBank);
public int deleteTCsinfoBankByBankPk(Long bankPk);
public int deleteTCsinfoBankByBankPks(Long[] bankPks);
public int deleteTCsinfoBankByCsId(@Param("basicidPk") Long basicidPk);
public int batchInsertTCsinfoBankList(List<TCsinfoBank> bankList);
}
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>