bobol
11 months ago
30 changed files with 2069 additions and 235 deletions
@ -0,0 +1,684 @@ |
|||||
|
<template> |
||||
|
<div class="app-container"> |
||||
|
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" class="my-custom-form"> |
||||
|
<el-row> |
||||
|
#foreach($column in $columns) |
||||
|
#if($column.query) |
||||
|
#set($dictType=$column.dictType) |
||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
||||
|
#set($parentheseIndex=$column.columnComment.indexOf("(")) |
||||
|
#if($parentheseIndex != -1) |
||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
||||
|
#else |
||||
|
#set($comment=$column.columnComment) |
||||
|
#end |
||||
|
#if($column.htmlType == "input") |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="${comment}" prop="${column.javaField}" label-width="auto"> |
||||
|
<el-input |
||||
|
v-model="queryParams.${column.javaField}" |
||||
|
placeholder="请输入${comment}" |
||||
|
clearable |
||||
|
@keyup.enter="handleQuery" |
||||
|
/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && $dictType) |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="${comment}" prop="${column.javaField}" label-width="auto"> |
||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable> |
||||
|
<el-option |
||||
|
v-for="dict in ${dictType}" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
:value="dict.value" |
||||
|
/> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif(($column.htmlType == "select" || $column.htmlType == "radio") && !$dictType) |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="${comment}" prop="${column.javaField}" label-width="auto"> |
||||
|
<el-select v-model="queryParams.${column.javaField}" placeholder="请选择${comment}" clearable> |
||||
|
<el-option label="请选择字典生成" value="" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "datetime" && $column.queryType != "BETWEEN") |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="${comment}" prop="${column.javaField}" label-width="auto"> |
||||
|
<el-date-picker clearable |
||||
|
v-model="queryParams.${column.javaField}" |
||||
|
type="date" |
||||
|
value-format="YYYY-MM-DD" |
||||
|
placeholder="请选择${comment}"> |
||||
|
</el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
||||
|
<el-col :span="4"> |
||||
|
<el-form-item label="${comment}" style="width: 308px" label-width="auto"> |
||||
|
<el-date-picker |
||||
|
v-model="daterange${AttrName}" |
||||
|
value-format="YYYY-MM-DD" |
||||
|
type="daterange" |
||||
|
range-separator="-" |
||||
|
start-placeholder="开始日期" |
||||
|
end-placeholder="结束日期" |
||||
|
></el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
<el-form-item class="childTextAlignLeft"> |
||||
|
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button> |
||||
|
<el-button icon="Refresh" @click="resetQuery">重置</el-button> |
||||
|
</el-form-item> |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="primary" |
||||
|
plain |
||||
|
icon="Plus" |
||||
|
@click="handleAdd" |
||||
|
v-hasPermi="['${moduleName}:${businessName}:add']" |
||||
|
>新增</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="success" |
||||
|
plain |
||||
|
icon="Edit" |
||||
|
:disabled="single" |
||||
|
@click="handleUpdate" |
||||
|
v-hasPermi="['${moduleName}:${businessName}:edit']" |
||||
|
>修改</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="danger" |
||||
|
plain |
||||
|
icon="Delete" |
||||
|
:disabled="multiple" |
||||
|
@click="handleDelete" |
||||
|
v-hasPermi="['${moduleName}:${businessName}:remove']" |
||||
|
>删除</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button |
||||
|
type="warning" |
||||
|
plain |
||||
|
icon="Download" |
||||
|
@click="handleExport" |
||||
|
v-hasPermi="['${moduleName}:${businessName}:export']" |
||||
|
>导出</el-button> |
||||
|
</el-col> |
||||
|
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar> |
||||
|
</el-row> |
||||
|
|
||||
|
<el-table v-loading="loading" :data="${businessName}List" @selection-change="handleSelectionChange" :max-height="tableHeight" :border="true" :column-width-draggable="true"> |
||||
|
<el-table-column type="selection" width="55" align="center" fixed="left"/> |
||||
|
#foreach($column in $columns) |
||||
|
#set($javaField=$column.javaField) |
||||
|
#set($parentheseIndex=$column.columnComment.indexOf("(")) |
||||
|
#if($parentheseIndex != -1) |
||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
||||
|
#else |
||||
|
#set($comment=$column.columnComment) |
||||
|
#end |
||||
|
#if($column.pk) |
||||
|
<el-table-column label="${comment}" align="center" :width="120" prop="${javaField}" /> |
||||
|
#elseif($column.list && $column.htmlType == "datetime") |
||||
|
<el-table-column label="${comment}" align="center" :width="120" prop="${javaField}" width="180"> |
||||
|
<template #default="scope"> |
||||
|
<span>{{ parseTime(scope.row.${javaField}, '{y}-{m}-{d}') }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && $column.htmlType == "imageUpload") |
||||
|
<el-table-column label="${comment}" align="center" :width="120" prop="${javaField}" width="100"> |
||||
|
<template #default="scope"> |
||||
|
<image-preview :src="scope.row.${javaField}" :width="50" :height="50"/> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && "" != $column.dictType) |
||||
|
<el-table-column label="${comment}" align="center" :width="120" prop="${javaField}"> |
||||
|
<template #default="scope"> |
||||
|
#if($column.htmlType == "checkbox") |
||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField} ? scope.row.${javaField}.split(',') : []"/> |
||||
|
#else |
||||
|
<dict-tag :options="${column.dictType}" :value="scope.row.${javaField}"/> |
||||
|
#end |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && "" != $javaField) |
||||
|
<el-table-column label="${comment}" align="center" :width="120" prop="${javaField}" /> |
||||
|
#end |
||||
|
#end |
||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" :width="200" :fixed="fixedColumns?'right':false"> |
||||
|
<template #header> |
||||
|
<div class="fixed-column-header" style="text-align: center;display: block;" @dblclick="toggleFixedColumns"> |
||||
|
<span style="text-align: center;display: block;">操作<img style="width:10px;margin-left:5px" v-show="fixedColumns" :src="lock" alt="Image"/></span> |
||||
|
</div> |
||||
|
</template> |
||||
|
<template #default="scope"> |
||||
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['${moduleName}:${businessName}:edit']">修改</el-button> |
||||
|
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['${moduleName}:${businessName}:remove']">删除</el-button> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<pagination |
||||
|
v-show="total>0" |
||||
|
:total="total" |
||||
|
v-model:page="queryParams.pageNum" |
||||
|
v-model:limit="queryParams.pageSize" |
||||
|
@pagination="getList" |
||||
|
/> |
||||
|
|
||||
|
<!-- 添加或修改${functionName}对话框 --> |
||||
|
<el-dialog :title="title" v-model="open" width="60%" append-to-body :close-on-click-modal="true"> |
||||
|
<el-form ref="${businessName}Ref" :model="form" :rules="rules" label-width="120px" class="my-custom-form"> |
||||
|
<el-row> |
||||
|
#foreach($column in $columns) |
||||
|
#set($field=$column.javaField) |
||||
|
#if($column.insert && !$column.pk) |
||||
|
#if(($column.usableColumn) || (!$column.superColumn)) |
||||
|
#set($parentheseIndex=$column.columnComment.indexOf("(")) |
||||
|
#if($parentheseIndex != -1) |
||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
||||
|
#else |
||||
|
#set($comment=$column.columnComment) |
||||
|
#end |
||||
|
#set($dictType=$column.dictType) |
||||
|
#if($column.htmlType == "input") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-input v-model="form.${field}" placeholder="请输入${comment}" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "imageUpload") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<image-upload v-model="form.${field}"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "fileUpload") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<file-upload v-model="form.${field}"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "editor") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}"> |
||||
|
<editor v-model="form.${field}" :min-height="192"/> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "select" && $dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}"> |
||||
|
<el-option |
||||
|
v-for="dict in ${dictType}" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long") |
||||
|
:value="parseInt(dict.value)" |
||||
|
#else |
||||
|
:value="dict.value" |
||||
|
#end |
||||
|
></el-option> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "select" && !$dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-select v-model="form.${field}" placeholder="请选择${comment}"> |
||||
|
<el-option label="请选择字典生成" value="" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "checkbox" && "" != $dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-checkbox-group v-model="form.${field}"> |
||||
|
<el-checkbox |
||||
|
v-for="dict in ${dictType}" |
||||
|
:key="dict.value" |
||||
|
:label="dict.value"> |
||||
|
{{dict.label}} |
||||
|
</el-checkbox> |
||||
|
</el-checkbox-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "checkbox" && $dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-checkbox-group v-model="form.${field}"> |
||||
|
<el-checkbox>请选择字典生成</el-checkbox> |
||||
|
</el-checkbox-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "radio" && "" != $dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-radio-group v-model="form.${field}"> |
||||
|
<el-radio |
||||
|
v-for="dict in ${dictType}" |
||||
|
:key="dict.value" |
||||
|
#if($column.javaType == "Integer" || $column.javaType == "Long") |
||||
|
:label="parseInt(dict.value)" |
||||
|
#else |
||||
|
:label="dict.value" |
||||
|
#end |
||||
|
>{{dict.label}}</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "radio" && $dictType) |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-radio-group v-model="form.${field}"> |
||||
|
<el-radio label="1">请选择字典生成</el-radio> |
||||
|
</el-radio-group> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "datetime") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-date-picker clearable |
||||
|
v-model="form.${field}" |
||||
|
type="date" |
||||
|
value-format="YYYY-MM-DD" |
||||
|
placeholder="请选择${comment}"> |
||||
|
</el-date-picker> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#elseif($column.htmlType == "textarea") |
||||
|
<el-col :span="12"> |
||||
|
<el-form-item label="${comment}" prop="${field}"> |
||||
|
<el-input v-model="form.${field}" type="textarea" placeholder="请输入内容" /> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
#end |
||||
|
#if($table.sub) |
||||
|
<el-divider content-position="center">${subTable.functionName}信息</el-divider> |
||||
|
<el-row :gutter="10" class="mb8"> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="primary" icon="Plus" @click="handleAdd${subClassName}">添加</el-button> |
||||
|
</el-col> |
||||
|
<el-col :span="1.5"> |
||||
|
<el-button type="danger" icon="Delete" @click="handleDelete${subClassName}">删除</el-button> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-table :data="${subclassName}List" :row-class-name="row${subClassName}Index" @selection-change="handle${subClassName}SelectionChange" ref="${subclassName}"> |
||||
|
<el-table-column type="selection" width="50" align="center" /> |
||||
|
<el-table-column label="序号" align="center" prop="index" width="50"/> |
||||
|
#foreach($column in $subTable.columns) |
||||
|
#set($javaField=$column.javaField) |
||||
|
#set($parentheseIndex=$column.columnComment.indexOf("(")) |
||||
|
#if($parentheseIndex != -1) |
||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
||||
|
#else |
||||
|
#set($comment=$column.columnComment) |
||||
|
#end |
||||
|
#if($column.pk || $javaField == ${subTableFkclassName}) |
||||
|
#elseif($column.list && $column.htmlType == "input") |
||||
|
<el-table-column label="$comment" prop="${javaField}" width="150"> |
||||
|
<template #default="scope"> |
||||
|
<el-input v-model="scope.row.$javaField" placeholder="请输入$comment" /> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && $column.htmlType == "datetime") |
||||
|
<el-table-column label="$comment" prop="${javaField}" width="240"> |
||||
|
<template #default="scope"> |
||||
|
<el-date-picker clearable |
||||
|
v-model="scope.row.$javaField" |
||||
|
type="date" |
||||
|
value-format="YYYY-MM-DD" |
||||
|
placeholder="请选择$comment"> |
||||
|
</el-date-picker> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" != $column.dictType) |
||||
|
<el-table-column label="$comment" prop="${javaField}" width="150"> |
||||
|
<template #default="scope"> |
||||
|
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment"> |
||||
|
<el-option |
||||
|
v-for="dict in $column.dictType" |
||||
|
:key="dict.value" |
||||
|
:label="dict.label" |
||||
|
:value="dict.value" |
||||
|
></el-option> |
||||
|
</el-select> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#elseif($column.list && ($column.htmlType == "select" || $column.htmlType == "radio") && "" == $column.dictType) |
||||
|
<el-table-column label="$comment" prop="${javaField}" width="150"> |
||||
|
<template #default="scope"> |
||||
|
<el-select v-model="scope.row.$javaField" placeholder="请选择$comment"> |
||||
|
<el-option label="请选择字典生成" value="" /> |
||||
|
</el-select> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
#end |
||||
|
#end |
||||
|
</el-table> |
||||
|
#end |
||||
|
</el-row> |
||||
|
</el-form> |
||||
|
<template #footer> |
||||
|
<div class="dialog-footer"> |
||||
|
<el-button type="primary" @click="submitForm">确 定</el-button> |
||||
|
<el-button @click="cancel">取 消</el-button> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
<style lang="scss" > |
||||
|
@import "@/assets/styles/self-defined.scss"; |
||||
|
</style> |
||||
|
<script setup name="${BusinessName}"> |
||||
|
import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}"; |
||||
|
import lock from "@/assets/icons/svg/lock.svg"; |
||||
|
const { proxy } = getCurrentInstance(); |
||||
|
#if(${dicts} != '') |
||||
|
#set($dictsNoSymbol=$dicts.replace("'", "")) |
||||
|
const { ${dictsNoSymbol} } = proxy.useDict(${dicts}); |
||||
|
#end |
||||
|
|
||||
|
const ${businessName}List = ref([]); |
||||
|
#if($table.sub) |
||||
|
const ${subclassName}List = ref([]); |
||||
|
#end |
||||
|
const open = ref(false); |
||||
|
const loading = ref(true); |
||||
|
const showSearch = ref(true); |
||||
|
const ids = ref([]); |
||||
|
#if($table.sub) |
||||
|
const checked${subClassName} = ref([]); |
||||
|
#end |
||||
|
const single = ref(true); |
||||
|
const multiple = ref(true); |
||||
|
const total = ref(0); |
||||
|
const title = ref(""); |
||||
|
const tableHeight = ref("0px"); |
||||
|
const collapseVisible = ref(false); |
||||
|
const fixedColumns = ref(false); |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
||||
|
const daterange${AttrName} = ref([]); |
||||
|
#end |
||||
|
#end |
||||
|
|
||||
|
const data = reactive({ |
||||
|
form: {}, |
||||
|
queryParams: { |
||||
|
pageNum: 1, |
||||
|
pageSize: 10, |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.query) |
||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end |
||||
|
#end |
||||
|
#end |
||||
|
}, |
||||
|
rules: { |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.required) |
||||
|
#set($parentheseIndex=$column.columnComment.indexOf("(")) |
||||
|
#if($parentheseIndex != -1) |
||||
|
#set($comment=$column.columnComment.substring(0, $parentheseIndex)) |
||||
|
#else |
||||
|
#set($comment=$column.columnComment) |
||||
|
#end |
||||
|
$column.javaField: [ |
||||
|
{ required: true, message: "$comment不能为空", trigger: #if($column.htmlType == "select" || $column.htmlType == "radio")"change"#else"blur"#end } |
||||
|
]#if($foreach.count != $columns.size()),#end |
||||
|
#end |
||||
|
#end |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const { queryParams, form, rules } = toRefs(data); |
||||
|
|
||||
|
/** 查询${functionName}列表 */ |
||||
|
function getList() { |
||||
|
loading.value = true; |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
||||
|
queryParams.value.params = {}; |
||||
|
#break |
||||
|
#end |
||||
|
#end |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
||||
|
if (null != daterange${AttrName} && '' != daterange${AttrName}) { |
||||
|
queryParams.value.params["begin${AttrName}"] = daterange${AttrName}.value[0]; |
||||
|
queryParams.value.params["end${AttrName}"] = daterange${AttrName}.value[1]; |
||||
|
} |
||||
|
#end |
||||
|
#end |
||||
|
list${BusinessName}(queryParams.value).then(response => { |
||||
|
${businessName}List.value = response.rows; |
||||
|
total.value = response.total; |
||||
|
loading.value = false; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
// 取消按钮 |
||||
|
function cancel() { |
||||
|
open.value = false; |
||||
|
reset(); |
||||
|
} |
||||
|
|
||||
|
// 表单重置 |
||||
|
function reset() { |
||||
|
form.value = { |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "checkbox") |
||||
|
$column.javaField: []#if($foreach.count != $columns.size()),#end |
||||
|
#else |
||||
|
$column.javaField: null#if($foreach.count != $columns.size()),#end |
||||
|
#end |
||||
|
#end |
||||
|
}; |
||||
|
#if($table.sub) |
||||
|
${subclassName}List.value = []; |
||||
|
#end |
||||
|
proxy.resetForm("${businessName}Ref"); |
||||
|
} |
||||
|
|
||||
|
/** 搜索按钮操作 */ |
||||
|
function handleQuery() { |
||||
|
queryParams.value.pageNum = 1; |
||||
|
getList(); |
||||
|
} |
||||
|
|
||||
|
/** 重置按钮操作 */ |
||||
|
function resetQuery() { |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "datetime" && $column.queryType == "BETWEEN") |
||||
|
#set($AttrName=$column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)}) |
||||
|
daterange${AttrName}.value = []; |
||||
|
#end |
||||
|
#end |
||||
|
proxy.resetForm("queryRef"); |
||||
|
handleQuery(); |
||||
|
} |
||||
|
|
||||
|
// 多选框选中数据 |
||||
|
function handleSelectionChange(selection) { |
||||
|
ids.value = selection.map(item => item.${pkColumn.javaField}); |
||||
|
single.value = selection.length != 1; |
||||
|
multiple.value = !selection.length; |
||||
|
} |
||||
|
|
||||
|
/** 新增按钮操作 */ |
||||
|
function handleAdd() { |
||||
|
reset(); |
||||
|
open.value = true; |
||||
|
title.value = "添加${functionName}"; |
||||
|
} |
||||
|
|
||||
|
/** 修改按钮操作 */ |
||||
|
function handleUpdate(row) { |
||||
|
reset(); |
||||
|
const _${pkColumn.javaField} = row.${pkColumn.javaField} || ids.value |
||||
|
get${BusinessName}(_${pkColumn.javaField}).then(response => { |
||||
|
form.value = response.data; |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "checkbox") |
||||
|
form.value.$column.javaField = form.value.${column.javaField}.split(","); |
||||
|
#end |
||||
|
#end |
||||
|
#if($table.sub) |
||||
|
${subclassName}List.value = response.data.${subclassName}List; |
||||
|
#end |
||||
|
open.value = true; |
||||
|
title.value = "修改${functionName}"; |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 提交按钮 */ |
||||
|
function submitForm() { |
||||
|
proxy.#[[$]]#refs["${businessName}Ref"].validate(valid => { |
||||
|
if (valid) { |
||||
|
#foreach ($column in $columns) |
||||
|
#if($column.htmlType == "checkbox") |
||||
|
form.value.$column.javaField = form.value.${column.javaField}.join(","); |
||||
|
#end |
||||
|
#end |
||||
|
#if($table.sub) |
||||
|
form.value.${subclassName}List = ${subclassName}List.value; |
||||
|
#end |
||||
|
if (form.value.${pkColumn.javaField} != null) { |
||||
|
update${BusinessName}(form.value).then(response => { |
||||
|
proxy.#[[$modal]]#.msgSuccess("修改成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} else { |
||||
|
add${BusinessName}(form.value).then(response => { |
||||
|
proxy.#[[$modal]]#.msgSuccess("新增成功"); |
||||
|
open.value = false; |
||||
|
getList(); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** 删除按钮操作 */ |
||||
|
function handleDelete(row) { |
||||
|
const _${pkColumn.javaField}s = row.${pkColumn.javaField} || ids.value; |
||||
|
proxy.#[[$modal]]#.confirm('是否确认删除${functionName}编号为"' + _${pkColumn.javaField}s + '"的数据项?').then(function() { |
||||
|
return del${BusinessName}(_${pkColumn.javaField}s); |
||||
|
}).then(() => { |
||||
|
getList(); |
||||
|
proxy.#[[$modal]]#.msgSuccess("删除成功"); |
||||
|
}).catch(() => {}); |
||||
|
} |
||||
|
|
||||
|
#if($table.sub) |
||||
|
/** ${subTable.functionName}序号 */ |
||||
|
function row${subClassName}Index({ row, rowIndex }) { |
||||
|
row.index = rowIndex + 1; |
||||
|
} |
||||
|
|
||||
|
/** ${subTable.functionName}添加按钮操作 */ |
||||
|
function handleAdd${subClassName}() { |
||||
|
let obj = {}; |
||||
|
#foreach($column in $subTable.columns) |
||||
|
#if($column.pk || $column.javaField == ${subTableFkclassName}) |
||||
|
#elseif($column.list && "" != $javaField) |
||||
|
obj.$column.javaField = ""; |
||||
|
#end |
||||
|
#end |
||||
|
${subclassName}List.value.push(obj); |
||||
|
} |
||||
|
|
||||
|
/** ${subTable.functionName}删除按钮操作 */ |
||||
|
function handleDelete${subClassName}() { |
||||
|
if (checked${subClassName}.value.length == 0) { |
||||
|
proxy.#[[$modal]]#.msgError("请先选择要删除的${subTable.functionName}数据"); |
||||
|
} else { |
||||
|
const ${subclassName}s = ${subclassName}List.value; |
||||
|
const checked${subClassName}s = checked${subClassName}.value; |
||||
|
${subclassName}List.value = ${subclassName}s.filter(function(item) { |
||||
|
return checked${subClassName}s.indexOf(item.index) == -1 |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** 复选框选中数据 */ |
||||
|
function handle${subClassName}SelectionChange(selection) { |
||||
|
checked${subClassName}.value = selection.map(item => item.index) |
||||
|
} |
||||
|
|
||||
|
#end |
||||
|
/** 导出按钮操作 */ |
||||
|
function handleExport() { |
||||
|
proxy.download('${moduleName}/${businessName}/export', { |
||||
|
...queryParams.value |
||||
|
}, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`) |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function toggleFixedColumns() { |
||||
|
fixedColumns.value = !fixedColumns.value; |
||||
|
} |
||||
|
|
||||
|
onMounted(()=>{ |
||||
|
calculateTableHeight(); |
||||
|
window.addEventListener('resize', calculateTableHeight); |
||||
|
window.onresize = () => { |
||||
|
return (() => { |
||||
|
calculateTableHeight(); |
||||
|
})() |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
onUnmounted(() => { |
||||
|
window.removeEventListener('resize', calculateTableHeight); |
||||
|
}); |
||||
|
watch( |
||||
|
[collapseVisible,showSearch], |
||||
|
() => { |
||||
|
calculateTableHeight(); |
||||
|
} |
||||
|
); |
||||
|
const calculateTableHeight = () => { |
||||
|
nextTick(() => { |
||||
|
const heightForm = proxy.$refs.queryRef?.$el.clientHeight || 0; |
||||
|
const windowHeight = window.innerHeight; |
||||
|
const paginationHeight = 60; |
||||
|
const tableHeaderHeight = 40; |
||||
|
const tableMargin = 20; |
||||
|
const remainingHeight = windowHeight - paginationHeight - tableHeaderHeight - tableMargin - heightForm - 100; |
||||
|
tableHeight.value = remainingHeight + 'px'; |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
function toggleCollapse() { |
||||
|
collapseVisible.value = !collapseVisible.value; |
||||
|
if(collapseVisible.value){ |
||||
|
editName.value = "折叠筛选项"; |
||||
|
}else{ |
||||
|
editName.value = "更多筛选项" |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
getList(); |
||||
|
</script> |
@ -0,0 +1,131 @@ |
|||||
|
package com.lzbi.draft.controller; |
||||
|
import io.swagger.annotations.ApiImplicitParam; |
||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import java.util.List; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.PutMapping; |
||||
|
import org.springframework.web.bind.annotation.DeleteMapping; |
||||
|
import org.springframework.web.bind.annotation.PathVariable; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
import com.lzbi.common.annotation.Log; |
||||
|
import com.lzbi.common.core.controller.BaseController; |
||||
|
import com.lzbi.common.core.domain.AjaxResult; |
||||
|
import com.lzbi.common.enums.BusinessType; |
||||
|
import com.lzbi.draft.domain. DcBusiTargetBillMaster; |
||||
|
import com.lzbi.draft.service.DcBusiTargetBillMasterService; |
||||
|
import com.lzbi.common.utils.poi.ExcelUtil; |
||||
|
import com.lzbi.common.core.page.TableDataInfo; |
||||
|
|
||||
|
/** |
||||
|
* 统计指标录入Controller |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2023-12-14 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/draft/targetBillMaster") |
||||
|
public class DcBusiTargetBillMasterController extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private DcBusiTargetBillMasterService dcBusiTargetBillMasterService; |
||||
|
|
||||
|
/** |
||||
|
* 查询统计指标录入列表 |
||||
|
*/ |
||||
|
@ApiOperation("查询统计指标录入列表") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "DcBusiTargetBillMaster", value = "", dataType = "DcBusiTargetBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:list')") |
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(DcBusiTargetBillMaster DcBusiTargetBillMaster) |
||||
|
{ |
||||
|
startPage(); |
||||
|
List< DcBusiTargetBillMaster> list = dcBusiTargetBillMasterService.selectDcBusiTargetBillMasterList(DcBusiTargetBillMaster); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 导出统计指标录入列表 |
||||
|
*/ |
||||
|
@ApiOperation("导出统计指标录入列表") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "DcBusiTargetBillMaster", value = "", dataType = "DcBusiTargetBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:export')") |
||||
|
@Log(title = "统计指标录入", businessType = BusinessType.EXPORT) |
||||
|
@PostMapping("/export") |
||||
|
public void export(HttpServletResponse response,DcBusiTargetBillMaster DcBusiTargetBillMaster) |
||||
|
{ |
||||
|
List<DcBusiTargetBillMaster> list = dcBusiTargetBillMasterService.selectDcBusiTargetBillMasterList(DcBusiTargetBillMaster); |
||||
|
ExcelUtil<DcBusiTargetBillMaster> util = new ExcelUtil<DcBusiTargetBillMaster>(DcBusiTargetBillMaster.class); |
||||
|
util.exportExcel(response, list, "统计指标录入数据"); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 获取统计指标录入详细信息 |
||||
|
*/ |
||||
|
@ApiOperation("获取统计指标录入详细信息") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "id", value = "", dataType = "Long", dataTypeClass = Long.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:query')") |
||||
|
@GetMapping(value = "/{id}") |
||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) |
||||
|
{ |
||||
|
return success(dcBusiTargetBillMasterService.selectDcBusiTargetBillMasterById(id)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增统计指标录入 |
||||
|
*/ |
||||
|
@ApiOperation("新增统计指标录入") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "DcBusiTargetBillMaster", value = "", dataType = "DcBusiTargetBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:add')") |
||||
|
@Log(title = "统计指标录入", businessType = BusinessType.INSERT) |
||||
|
@PostMapping |
||||
|
public AjaxResult add(@RequestBody DcBusiTargetBillMaster DcBusiTargetBillMaster) |
||||
|
{ |
||||
|
return toAjax(dcBusiTargetBillMasterService.insertDcBusiTargetBillMaster(DcBusiTargetBillMaster)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改统计指标录入 |
||||
|
*/ |
||||
|
|
||||
|
@ApiOperation("修改统计指标录入") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "DcBusiTargetBillMaster", value = "", dataType = "DcBusiTargetBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:edit')") |
||||
|
@Log(title = "统计指标录入", businessType = BusinessType.UPDATE) |
||||
|
@PutMapping |
||||
|
public AjaxResult edit(@RequestBody DcBusiTargetBillMaster DcBusiTargetBillMaster) |
||||
|
{ |
||||
|
return toAjax(dcBusiTargetBillMasterService.updateDcBusiTargetBillMaster(DcBusiTargetBillMaster)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除统计指标录入 |
||||
|
*/ |
||||
|
@ApiOperation("删除统计指标录入") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "ids", value = "", dataType = "Long", dataTypeClass =Long.class), |
||||
|
}) |
||||
|
@PreAuthorize("@ss.hasPermi('draft:targetCollect:remove')") |
||||
|
@Log(title = "统计指标录入", businessType = BusinessType.DELETE) |
||||
|
@DeleteMapping("/{ids}") |
||||
|
public AjaxResult remove(@PathVariable Long[] ids) |
||||
|
{ |
||||
|
return toAjax(dcBusiTargetBillMasterService.deleteDcBusiTargetBillMasterByIds(ids)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,274 @@ |
|||||
|
package com.lzbi.draft.controller; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.alibaba.fastjson2.JSONArray; |
||||
|
import com.alibaba.fastjson2.JSONObject; |
||||
|
import com.lzbi.code.domain.DcBaseCoderuleDefineDao; |
||||
|
import com.lzbi.code.domain.DcBusiCoderuleConfigDao; |
||||
|
import com.lzbi.code.service.CodeNoGenerater; |
||||
|
import com.lzbi.code.service.DcBaseCoderuleDefineService; |
||||
|
import com.lzbi.common.core.controller.BaseController; |
||||
|
import com.lzbi.common.core.domain.AjaxResult; |
||||
|
import com.lzbi.common.core.domain.entity.SysDept; |
||||
|
import com.lzbi.common.core.domain.model.LoginUser; |
||||
|
import com.lzbi.common.core.page.TableDataInfo; |
||||
|
import com.lzbi.common.utils.SecurityUtils; |
||||
|
import com.lzbi.common.utils.StringUtils; |
||||
|
import com.lzbi.draft.domain.*; |
||||
|
import com.lzbi.draft.service.DcBusiBillModelMasterService; |
||||
|
import com.lzbi.draft.service.DcBusiTargetBillMasterService; |
||||
|
import com.lzbi.system.service.ISysDeptService; |
||||
|
import io.swagger.annotations.ApiImplicitParam; |
||||
|
import io.swagger.annotations.ApiImplicitParams; |
||||
|
import io.swagger.annotations.ApiOperation; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.Optional; |
||||
|
|
||||
|
/** |
||||
|
* 参数采集(录入)单据主Controller |
||||
|
* |
||||
|
* @author win |
||||
|
* @date 2023-11-28 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("/draft/targetCollect") |
||||
|
public class DcBusiTargetCollectBill extends BaseController |
||||
|
{ |
||||
|
@Autowired |
||||
|
private DcBusiBillModelMasterService dcBusiBillModelMasterService; |
||||
|
@Autowired |
||||
|
private DcBusiTargetBillMasterService dcBusiTargetBillMasterService; |
||||
|
|
||||
|
@Autowired |
||||
|
private DcBaseCoderuleDefineService dcBaseCoderuleDefineService; |
||||
|
@Autowired |
||||
|
private CodeNoGenerater codeNoGenerater; |
||||
|
@Autowired |
||||
|
private ISysDeptService sysDeptService; |
||||
|
/** |
||||
|
* 查询参数采集(录入) |
||||
|
* 根据 |
||||
|
*/ |
||||
|
// @PreAuthorize("@ss.hasPermi('param:paramData:list')")
|
||||
|
@GetMapping("/list") |
||||
|
public TableDataInfo list(DcBusiTargetBillMaster dcBusiTargetBillMasterDao) |
||||
|
{ |
||||
|
startPage(); |
||||
|
//List<DcBusiTargetBillMaster> list = dcBusiTargetBillMasterService.selectDcBusiTargetBillMasterDaoList(dcBusiTargetBillMasterDao);
|
||||
|
return getDataTable(null); |
||||
|
} |
||||
|
/** |
||||
|
* 根据根据公司查询模版,现根据用户名进行过滤 |
||||
|
* 根据 |
||||
|
*/ |
||||
|
@ApiOperation("根据根据公司查询模版,现根据用户名进行过滤") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "companyId", value = "", dataType = "Long", dataTypeClass = Long.class), |
||||
|
}) |
||||
|
//@PreAuthorize("@ss.hasPermi('param:paramData:list')")
|
||||
|
@GetMapping("/userModellist/{companyId}") |
||||
|
public TableDataInfo getUserModellist(@PathVariable Long companyId) |
||||
|
{ |
||||
|
DcBusiBillModelMaster dcBusiBillModelMaster=new DcBusiBillModelMaster(); |
||||
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
||||
|
dcBusiBillModelMaster.setCreatedBy(loginUser.getUsername()); |
||||
|
dcBusiBillModelMaster.setCompanyId(Optional.ofNullable(companyId).orElse(null)); |
||||
|
dcBusiBillModelMaster.setModelType("T"); |
||||
|
//dcBusiBillModelMaster.setDeptId(loginUser.getDeptId());
|
||||
|
//dcBusiBillModelMaster.setRoleId(loginUser.getUser().getRoleId());
|
||||
|
startPage(); |
||||
|
List<DcBusiBillModelMaster> list = dcBusiBillModelMasterService.selectDcBusiBillModelMasterList(dcBusiBillModelMaster); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
@GetMapping("/userModellist") |
||||
|
public TableDataInfo getUserModellist(DeptQueryParams deptQueryParams) |
||||
|
{ startPage(); |
||||
|
List<DcBusiBillModelMaster> list; |
||||
|
if(StringUtils.isNotNull(deptQueryParams)){ |
||||
|
DcBusiBillModelMaster dcBusiBillModelMaster=new DcBusiBillModelMaster(); |
||||
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
||||
|
dcBusiBillModelMaster.setCreatedBy(loginUser.getUsername()); |
||||
|
dcBusiBillModelMaster.setModelType("T"); |
||||
|
if(Optional.ofNullable(deptQueryParams.getOrgType()).orElse("").equals("1002")){ |
||||
|
dcBusiBillModelMaster.setCompanyId(Optional.ofNullable(deptQueryParams.getDeptId()).orElse(0L)); |
||||
|
}else{ |
||||
|
dcBusiBillModelMaster.setOrgId(Optional.ofNullable(deptQueryParams.getDeptId()).orElse(0L)); |
||||
|
} |
||||
|
list = dcBusiBillModelMasterService.selectDcBusiBillModelMasterList(dcBusiBillModelMaster); |
||||
|
}else{ |
||||
|
list=new ArrayList<>(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
@GetMapping("/userModelById/{mid}") |
||||
|
public AjaxResult getUserModelById(@PathVariable Long mid) |
||||
|
{ |
||||
|
DcBusiBillModelMaster dcBusiBillModelMaster = dcBusiBillModelMasterService.selectDcBusiBillModelMasterById(mid); |
||||
|
return AjaxResult.success(dcBusiBillModelMaster); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 根据根据公司查询模版,现根据角色ID进行过滤 |
||||
|
* 根据 |
||||
|
*/ |
||||
|
@ApiOperation("根据根据公司查询模版,现根据角色ID进行过滤") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "companyId", value = "", dataType = "Long", dataTypeClass = Long.class), |
||||
|
}) |
||||
|
//@PreAuthorize("@ss.hasPermi('param:paramData:list')")
|
||||
|
@GetMapping("/roleModellist/{companyId}") |
||||
|
public TableDataInfo getRoleModellist(@PathVariable Long companyId) |
||||
|
{ |
||||
|
DcBusiBillModelMaster dcBusiBillModelMaster=new DcBusiBillModelMaster(); |
||||
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
||||
|
dcBusiBillModelMaster.setCompanyId(Optional.ofNullable(companyId).orElse(null)); |
||||
|
dcBusiBillModelMaster.setRoleId(loginUser.getUser().getRoleId()); |
||||
|
dcBusiBillModelMaster.setModelType("T"); |
||||
|
startPage(); |
||||
|
List<DcBusiBillModelMaster> list = dcBusiBillModelMasterService.selectDcBusiBillModelMasterList(dcBusiBillModelMaster); |
||||
|
return getDataTable(list); |
||||
|
} |
||||
|
@ApiOperation("根据单据模版编号获取模版内容信息") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "modelNo", value = "", dataType = "String", dataTypeClass = String.class), |
||||
|
}) |
||||
|
@GetMapping("/getBillModelDetail/{modelNo}") |
||||
|
public AjaxResult getBillModelDetail(@PathVariable String modelNo){ |
||||
|
List<DcBusiBillModelSub> list=new ArrayList<>(); |
||||
|
return AjaxResult.success(); |
||||
|
} |
||||
|
@ApiOperation("保存配置模版") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "dcBusiTargetBillMaster", value = "", dataType = "DcBusiParamBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PostMapping("/saveBillModel") |
||||
|
public AjaxResult saveBillModel(@RequestBody DcBusiTargetBillMaster dcBusiParamBillMaster){ |
||||
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
||||
|
String billModelNo=Optional.ofNullable(getBillModelNo()).orElse(StringUtils.leftPad(String.valueOf(dcBusiParamBillMaster.getCompanyId()),4)+"#"+DateUtil.formatDateTime(DateUtil.date())); |
||||
|
DcBusiBillModelMaster dcBusiBillModelMaster=new DcBusiBillModelMaster(); |
||||
|
dcBusiBillModelMaster.setCreatedTime(DateUtil.date()); |
||||
|
dcBusiBillModelMaster.setCreatedBy(loginUser.getUsername()); |
||||
|
dcBusiBillModelMaster.setBillModelPoint(dcBusiParamBillMaster.getCountTimes()); |
||||
|
dcBusiBillModelMaster.setRoleId(loginUser.getUser().getRoleId()); |
||||
|
dcBusiBillModelMaster.setDeptId(loginUser.getDeptId()); |
||||
|
dcBusiBillModelMaster.setModelType("T"); |
||||
|
long deptId=dcBusiParamBillMaster.getCompanyId(); |
||||
|
SysDept sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiBillModelMaster.setCompanyId(deptId); |
||||
|
dcBusiBillModelMaster.setCompanyName(sysDept.getDeptName()); |
||||
|
deptId=dcBusiParamBillMaster.getOragnizeId(); |
||||
|
dcBusiBillModelMaster.setOrgId(deptId); |
||||
|
sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiBillModelMaster.setOrgName(sysDept.getDeptName()); |
||||
|
dcBusiBillModelMaster.setDataState("0"); |
||||
|
dcBusiBillModelMaster.setUseState("1"); |
||||
|
dcBusiBillModelMaster.setFieldCode(dcBusiParamBillMaster.getFieldCode()); |
||||
|
dcBusiBillModelMaster.setFieldName(dcBusiParamBillMaster.getFieldName()); |
||||
|
dcBusiBillModelMaster.setBillModelNo(billModelNo); |
||||
|
dcBusiBillModelMaster.setBillModelName(dcBusiParamBillMaster.getBiilModelName()); |
||||
|
List<DcBusiBillModelSub> dcBusiBillModelSubList=new ArrayList<>(); |
||||
|
JSONArray jsonArray=Optional.ofNullable(JSONArray.from(dcBusiParamBillMaster.getSubDatas())).orElse(new JSONArray()); |
||||
|
jsonArray.forEach(item -> { |
||||
|
JSONObject jsb = JSONObject.from(item); |
||||
|
DcBusiBillModelSub modelSub=new DcBusiBillModelSub(); |
||||
|
modelSub.setBillModelNo(billModelNo); |
||||
|
modelSub.setAssetCode(jsb.getString("assetCode")); |
||||
|
modelSub.setAssetName(jsb.getString("assetName")); |
||||
|
//modelSub.setAssetId(item.get);
|
||||
|
modelSub.setAssetUnitCode(jsb.getString("targetCode")); |
||||
|
modelSub.setAssetUnitName(jsb.getString("targetName")); |
||||
|
modelSub.setAssetUnitType("T"); |
||||
|
modelSub.setAUnit(jsb.getString("targetUint")); |
||||
|
dcBusiBillModelSubList.add(modelSub); |
||||
|
}); |
||||
|
dcBusiBillModelMaster.setDcBusiBillModelSubList(dcBusiBillModelSubList); |
||||
|
return AjaxResult.success(dcBusiBillModelMasterService.insertDcBusiBillModelMaster(dcBusiBillModelMaster)); |
||||
|
} |
||||
|
@ApiOperation("保存参数采集数据-直接对象方式") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "dcBusiParamBillMaster", value = "", dataType = "DcBusiParamBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PostMapping("/saveBillCollectObj") |
||||
|
public AjaxResult saveBillCollectByObj(@RequestBody DcBusiTargetBillMaster dcBusiTargetBillMaster){ |
||||
|
dcBusiTargetBillMaster.setId(null); |
||||
|
dcBusiTargetBillMaster.setCreatedBy(SecurityUtils.getLoginUser().getUsername()); |
||||
|
dcBusiTargetBillMaster.setCreatedTime(DateUtil.date()); |
||||
|
long deptId=dcBusiTargetBillMaster.getCompanyId(); |
||||
|
SysDept sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiTargetBillMaster.setCompanyId(deptId); |
||||
|
dcBusiTargetBillMaster.setCompanyName(sysDept.getDeptName()); |
||||
|
deptId=dcBusiTargetBillMaster.getOragnizeId(); |
||||
|
dcBusiTargetBillMaster.setOragnizeId(deptId); |
||||
|
sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiTargetBillMaster.setOrganizeName(sysDept.getDeptName()); |
||||
|
return AjaxResult.success(dcBusiTargetBillMasterService.insertDcBusiTargetBillMaster(dcBusiTargetBillMaster)); |
||||
|
} |
||||
|
@ApiOperation("保存参数采集数据-subDatas数组方式") |
||||
|
@ApiImplicitParams({ |
||||
|
@ApiImplicitParam(name = "dcBusiTargetBillMaster", value = "", dataType = "DcBusiTargetBillMaster", dataTypeClass = DcBusiTargetBillMaster.class), |
||||
|
}) |
||||
|
@PostMapping("/saveBillCollectArray") |
||||
|
/*subDatas为动态数据列,值是分开的索要对每个列值进行处理*/ |
||||
|
public AjaxResult saveBillCollectBy(@RequestBody DcBusiTargetBillMaster dcBusiTargetBillMaster){ |
||||
|
List<DcBusiTargetBillSub> dcBusiTargetBillSubList =new ArrayList<>(); |
||||
|
String billNo=dcBusiTargetBillMaster.getBillNo(); |
||||
|
String fieldCode=dcBusiTargetBillMaster.getFieldCode(); |
||||
|
String fieldName=dcBusiTargetBillMaster.getFieldName(); |
||||
|
String countDate=dcBusiTargetBillMaster.getCountDate(); |
||||
|
dcBusiTargetBillMaster.setBillIncomeDate(countDate); |
||||
|
dcBusiTargetBillMaster.setCreatedBy(SecurityUtils.getLoginUser().getUsername()); |
||||
|
dcBusiTargetBillMaster.setCreatedTime(DateUtil.date()); |
||||
|
long deptId=dcBusiTargetBillMaster.getCompanyId(); |
||||
|
SysDept sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiTargetBillMaster.setCompanyId(deptId); |
||||
|
dcBusiTargetBillMaster.setCompanyName(sysDept.getDeptName()); |
||||
|
deptId=dcBusiTargetBillMaster.getOragnizeId(); |
||||
|
dcBusiTargetBillMaster.setOragnizeId(deptId); |
||||
|
sysDept = Optional.ofNullable(sysDeptService.selectDeptById(deptId)).orElse(new SysDept()) ; |
||||
|
dcBusiTargetBillMaster.setOrganizeName(sysDept.getDeptName()); |
||||
|
JSONArray jsonArray=Optional.ofNullable(JSONArray.from(dcBusiTargetBillMaster.getSubDatas())).orElse(new JSONArray()); |
||||
|
jsonArray.forEach(item->{ |
||||
|
JSONObject jsb = JSONObject.from(item); |
||||
|
for(int i=1;i<31;i++){ |
||||
|
String fname="val_"+String.valueOf(i); |
||||
|
Double value=jsb.getDouble(fname); |
||||
|
if(StringUtils.isNotNull(value)){ |
||||
|
DcBusiTargetBillSub dcBusiTargetBillSub=new DcBusiTargetBillSub(); |
||||
|
//基本数据
|
||||
|
dcBusiTargetBillSub.setBillNo(billNo); |
||||
|
dcBusiTargetBillSub.setId(null); |
||||
|
dcBusiTargetBillSub.setTargetCode(jsb.getString("targetCode")); |
||||
|
dcBusiTargetBillSub.setAssetCode(jsb.getString("assetCode")); |
||||
|
dcBusiTargetBillSub.setAssetName(jsb.getString("assetName")); |
||||
|
//dcBusiTargetBillSub.setCountDate(jsb.getString("countDate"));
|
||||
|
dcBusiTargetBillSub.setCountDate(countDate); |
||||
|
dcBusiTargetBillSub.setTargetUint(jsb.getString("targetUint")); |
||||
|
dcBusiTargetBillSub.setTargetName(jsb.getString("targetName")); |
||||
|
dcBusiTargetBillSub.setFieldCode(fieldCode); |
||||
|
dcBusiTargetBillSub.setFieldName(fieldName); |
||||
|
dcBusiTargetBillSub.setCountDay(i); |
||||
|
dcBusiTargetBillSub.setTargetValue(value); |
||||
|
dcBusiTargetBillSubList.add(dcBusiTargetBillSub); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
}); |
||||
|
dcBusiTargetBillMaster.setDcBusiTargetBillSubList(dcBusiTargetBillSubList); |
||||
|
return AjaxResult.success(dcBusiTargetBillMasterService.insertDcBusiTargetBillMaster(dcBusiTargetBillMaster)); |
||||
|
} |
||||
|
private String getBillModelNo(){ |
||||
|
DcBusiCoderuleConfigDao ruleIdByBusicode =Optional.ofNullable(dcBaseCoderuleDefineService.getRuleIdByBusicode("BILL_MODEL_NO")).orElse(new DcBusiCoderuleConfigDao()) ; |
||||
|
|
||||
|
DcBaseCoderuleDefineDao ruleDao = dcBaseCoderuleDefineService.selectDcBaseCoderuleDefineDaoById(ruleIdByBusicode.getRuleId()); |
||||
|
return codeNoGenerater.getCode(ruleDao); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,100 @@ |
|||||
|
package com.lzbi.draft.domain; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
import com.alibaba.fastjson2.JSONArray; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.experimental.Accessors; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import lombok.Data; |
||||
|
import com.lzbi.common.annotation.Excel; |
||||
|
import com.lzbi.module.base.BaseModuleEntity; |
||||
|
|
||||
|
/** |
||||
|
* 统计指标录入对象 dc_busi_target_bill_master |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2023-12-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
@Accessors(chain = true) |
||||
|
@ApiModel(value = "指标采集(录入)单据主表",description = "") |
||||
|
@TableName("dc_busi_target_bill_master") |
||||
|
public class DcBusiTargetBillMaster extends BaseModuleEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
private Long id; |
||||
|
|
||||
|
/** 单据编号 */ |
||||
|
@Excel(name = "单据编号") |
||||
|
@ApiModelProperty(name = "单据编号",notes = "") |
||||
|
private String billNo; |
||||
|
|
||||
|
/** 采集时间 */ |
||||
|
@Excel(name = "采集时间") |
||||
|
@ApiModelProperty(name = "采集时间",notes = "") |
||||
|
private String billIncomeDate; |
||||
|
|
||||
|
/** 单据类型 */ |
||||
|
@Excel(name = "单据类型") |
||||
|
@ApiModelProperty(name = "单据类型",notes = "") |
||||
|
private String billType; |
||||
|
|
||||
|
/** 审核类型 */ |
||||
|
@Excel(name = "审核类型") |
||||
|
@ApiModelProperty(name = "审核类型",notes = "") |
||||
|
private String checkType; |
||||
|
|
||||
|
/** 审核状态 */ |
||||
|
@Excel(name = "审核状态") |
||||
|
@ApiModelProperty(name = "审核状态",notes = "") |
||||
|
private String checkStatus; |
||||
|
|
||||
|
/** 公司ID */ |
||||
|
@Excel(name = "公司ID") |
||||
|
@ApiModelProperty(name = "公司ID",notes = "") |
||||
|
private Long companyId; |
||||
|
|
||||
|
/** 公司名称 */ |
||||
|
@Excel(name = "公司名称") |
||||
|
@ApiModelProperty(name = "公司名称",notes = "") |
||||
|
private String companyName; |
||||
|
|
||||
|
/** 组织机构名称 */ |
||||
|
@Excel(name = "组织机构名称") |
||||
|
@ApiModelProperty(name = "组织机构名称",notes = "") |
||||
|
private String organizeName; |
||||
|
|
||||
|
/** 组织机构ID */ |
||||
|
@Excel(name = "组织机构ID") |
||||
|
@ApiModelProperty(name = "组织机构ID",notes = "") |
||||
|
private Long oragnizeId; |
||||
|
|
||||
|
/** 指标数据采集(录入)明细信息 */ |
||||
|
private List<DcBusiTargetBillSub> dcBusiTargetBillSubList; |
||||
|
@ApiModelProperty(name = "单据模版名称",notes = "") |
||||
|
private String biilModelName ; |
||||
|
@ApiModelProperty(name = "模版编码",notes = "") |
||||
|
private String billModelNo ; |
||||
|
@ApiModelProperty(name = "统计月份",notes = "") |
||||
|
private String countDate ; |
||||
|
@ApiModelProperty(name = "统计日期",notes = "") |
||||
|
private String countTimes; |
||||
|
@ApiModelProperty(name = "专业编码",notes = "") |
||||
|
private String fieldCode; |
||||
|
@ApiModelProperty(name = "专业名称",notes = "") |
||||
|
private String fieldName; |
||||
|
@ApiModelProperty(name = "data数组数据未转换",notes = "") |
||||
|
private JSONArray subDatas; |
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
package com.lzbi.draft.domain; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import lombok.experimental.Accessors; |
||||
|
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
import com.lzbi.common.annotation.Excel; |
||||
|
import com.lzbi.module.base.BaseModuleEntity; |
||||
|
|
||||
|
/** |
||||
|
* 指标数据采集(录入)明细对象 dc_busi_target_bill_sub |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2023-12-14 |
||||
|
*/ |
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
@Accessors(chain = true) |
||||
|
@ApiModel(value = "指标数据采集(录入)明细表",description = "") |
||||
|
@TableName("dc_busi_target_bill_sub") |
||||
|
public class DcBusiTargetBillSub extends BaseModuleEntity |
||||
|
{ |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** 主键 */ |
||||
|
@ApiModelProperty(name = "主键",notes = "") |
||||
|
private Long id; |
||||
|
|
||||
|
/** 单据编码 */ |
||||
|
@Excel(name = "单据编码") |
||||
|
@ApiModelProperty(name = "单据编码",notes = "") |
||||
|
private String billNo; |
||||
|
|
||||
|
/** 指标名称 */ |
||||
|
@Excel(name = "指标名称") |
||||
|
@ApiModelProperty(name = "指标名称",notes = "") |
||||
|
private String targetName; |
||||
|
|
||||
|
/** 指标编码 */ |
||||
|
@Excel(name = "指标编码") |
||||
|
@ApiModelProperty(name = "指标编码",notes = "") |
||||
|
private String targetCode; |
||||
|
|
||||
|
/** 指标单位 */ |
||||
|
@Excel(name = "指标单位") |
||||
|
@ApiModelProperty(name = "指标单位",notes = "") |
||||
|
private String targetUint; |
||||
|
|
||||
|
/** 指标值 */ |
||||
|
@Excel(name = "指标值") |
||||
|
@ApiModelProperty(name = "指标值",notes = "") |
||||
|
private Double targetValue; |
||||
|
|
||||
|
/** 统计日期 */ |
||||
|
@Excel(name = "统计日期") |
||||
|
@ApiModelProperty(name = "统计日期",notes = "") |
||||
|
private String countDate; |
||||
|
|
||||
|
/** 天 */ |
||||
|
@Excel(name = "天") |
||||
|
@ApiModelProperty(name = "天",notes = "") |
||||
|
private Integer countDay; |
||||
|
|
||||
|
/** 所属专业编码 */ |
||||
|
@Excel(name = "所属专业编码") |
||||
|
@ApiModelProperty(name = "所属专业编码",notes = "") |
||||
|
private String fieldCode; |
||||
|
|
||||
|
/** 所属专业名称 */ |
||||
|
@Excel(name = "所属专业名称") |
||||
|
@ApiModelProperty(name = "所属专业名称",notes = "") |
||||
|
private String fieldName; |
||||
|
|
||||
|
/** 统计单元编码 */ |
||||
|
@Excel(name = "统计单元编码") |
||||
|
@ApiModelProperty(name = "统计单元编码",notes = "") |
||||
|
private String assetCode; |
||||
|
|
||||
|
/** 统计单元名称 */ |
||||
|
@Excel(name = "统计单元名称") |
||||
|
@ApiModelProperty(name = "统计单元名称",notes = "") |
||||
|
private String assetName; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,21 @@ |
|||||
|
package com.lzbi.draft.domain; |
||||
|
|
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @auth create by Administrator |
||||
|
* @date 2023/12/14 |
||||
|
* DeptQueryParams |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DeptQueryParams { |
||||
|
@ApiModelProperty("页码") |
||||
|
private Integer pageNum; |
||||
|
@ApiModelProperty("页长") |
||||
|
private Integer pageSize; |
||||
|
@ApiModelProperty("部门ID") |
||||
|
private Long deptId; |
||||
|
@ApiModelProperty("部门类型") |
||||
|
private String orgType; |
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package com.lzbi.draft.mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.lzbi.draft.domain.DcBusiTargetBillMaster; |
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.lzbi.draft.domain.DcBusiTargetBillSub; |
||||
|
|
||||
|
/** |
||||
|
* 统计指标录入Mapper接口 |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2023-12-14 |
||||
|
*/ |
||||
|
|
||||
|
public interface DcBusiTargetBillMasterMapper extends BaseMapper<DcBusiTargetBillMaster> |
||||
|
{ |
||||
|
/** |
||||
|
* 查询统计指标录入 |
||||
|
* |
||||
|
* @param id 统计指标录入主键 |
||||
|
* @return 统计指标录入 |
||||
|
*/ |
||||
|
public DcBusiTargetBillMaster selectDcBusiTargetBillMasterById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 查询统计指标录入列表 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 统计指标录入集合 |
||||
|
*/ |
||||
|
public List<DcBusiTargetBillMaster> selectDcBusiTargetBillMasterList(DcBusiTargetBillMaster dcBusiTargetBillMaster); |
||||
|
|
||||
|
/** |
||||
|
* 新增统计指标录入 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int insertDcBusiTargetBillMaster(DcBusiTargetBillMaster dcBusiTargetBillMaster); |
||||
|
|
||||
|
/** |
||||
|
* 修改统计指标录入 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int updateDcBusiTargetBillMaster(DcBusiTargetBillMaster dcBusiTargetBillMaster); |
||||
|
|
||||
|
/** |
||||
|
* 删除统计指标录入 |
||||
|
* |
||||
|
* @param id 统计指标录入主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteDcBusiTargetBillMasterById(Long id); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除统计指标录入 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteDcBusiTargetBillMasterByIds(Long[] ids); |
||||
|
public List<String> selectDcBusiTargetBillMasterBillNoByIds(Long[] ids); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除指标数据采集(录入)明细 |
||||
|
* |
||||
|
* @param ids 需要删除的数据主键集合 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteDcBusiTargetBillSubByBillNos(List<String> ids); |
||||
|
|
||||
|
/** |
||||
|
* 批量新增指标数据采集(录入)明细 |
||||
|
* |
||||
|
* @param dcBusiTargetBillSubList 指标数据采集(录入)明细列表 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int batchDcBusiTargetBillSub(List<DcBusiTargetBillSub> dcBusiTargetBillSubList); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 通过统计指标录入主键删除指标数据采集(录入)明细信息 |
||||
|
* |
||||
|
* @param id 统计指标录入ID |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
public int deleteDcBusiTargetBillSubByBillNo(String billNo); |
||||
|
} |
@ -0,0 +1,133 @@ |
|||||
|
package com.lzbi.draft.service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import com.lzbi.common.utils.DateUtils; |
||||
|
import com.lzbi.common.utils.StringUtils; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import java.util.ArrayList; |
||||
|
import com.lzbi.common.utils.DateUtils; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import com.lzbi.draft.domain.DcBusiTargetBillSub; |
||||
|
import com.lzbi.draft.domain.DcBusiTargetBillMaster; |
||||
|
import com.lzbi.draft.mapper.DcBusiTargetBillMasterMapper; |
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
/** |
||||
|
* 统计指标录入Service业务层处理 |
||||
|
* |
||||
|
* @author zhousq |
||||
|
* @date 2023-12-14 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class DcBusiTargetBillMasterService extends ServiceImpl<DcBusiTargetBillMasterMapper, DcBusiTargetBillMaster> implements IService<DcBusiTargetBillMaster> |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* 查询统计指标录入 |
||||
|
* |
||||
|
* @param id 统计指标录入主键 |
||||
|
* @return 统计指标录入 |
||||
|
*/ |
||||
|
public DcBusiTargetBillMaster selectDcBusiTargetBillMasterById(Long id) |
||||
|
{ |
||||
|
return baseMapper.selectDcBusiTargetBillMasterById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 查询统计指标录入列表 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 统计指标录入 |
||||
|
*/ |
||||
|
public List<DcBusiTargetBillMaster> selectDcBusiTargetBillMasterList(DcBusiTargetBillMaster dcBusiTargetBillMaster) |
||||
|
{ |
||||
|
return baseMapper.selectDcBusiTargetBillMasterList(dcBusiTargetBillMaster); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增统计指标录入 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Transactional |
||||
|
|
||||
|
public int insertDcBusiTargetBillMaster(DcBusiTargetBillMaster dcBusiTargetBillMaster) |
||||
|
{ |
||||
|
dcBusiTargetBillMaster.setCreatedTime(DateUtils.getNowDate()); |
||||
|
int rows = baseMapper.insertDcBusiTargetBillMaster(dcBusiTargetBillMaster); |
||||
|
insertDcBusiTargetBillSub(dcBusiTargetBillMaster); |
||||
|
return rows; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 修改统计指标录入 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Transactional |
||||
|
|
||||
|
public int updateDcBusiTargetBillMaster(DcBusiTargetBillMaster dcBusiTargetBillMaster) |
||||
|
{ |
||||
|
dcBusiTargetBillMaster.setUpdatedTime(DateUtils.getNowDate()); |
||||
|
baseMapper.deleteDcBusiTargetBillSubByBillNo(dcBusiTargetBillMaster.getBillNo()); |
||||
|
insertDcBusiTargetBillSub(dcBusiTargetBillMaster); |
||||
|
return baseMapper.updateDcBusiTargetBillMaster(dcBusiTargetBillMaster); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 批量删除统计指标录入 |
||||
|
* |
||||
|
* @param ids 需要删除的统计指标录入主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Transactional |
||||
|
|
||||
|
public int deleteDcBusiTargetBillMasterByIds(Long[] ids) |
||||
|
{ |
||||
|
|
||||
|
List<String> strings = baseMapper.selectDcBusiTargetBillMasterBillNoByIds(ids); |
||||
|
baseMapper.deleteDcBusiTargetBillSubByBillNos(strings); |
||||
|
return baseMapper.deleteDcBusiTargetBillMasterByIds(ids); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 删除统计指标录入信息 |
||||
|
* |
||||
|
* @param id 统计指标录入主键 |
||||
|
* @return 结果 |
||||
|
*/ |
||||
|
@Transactional |
||||
|
|
||||
|
public int deleteDcBusiTargetBillMasterById(Long id) |
||||
|
{ |
||||
|
DcBusiTargetBillMaster dcBusiTargetBillMaster = baseMapper.selectDcBusiTargetBillMasterById(id); |
||||
|
baseMapper.deleteDcBusiTargetBillSubByBillNo(dcBusiTargetBillMaster.getBillNo()); |
||||
|
return baseMapper.deleteDcBusiTargetBillMasterById(id); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 新增指标数据采集(录入)明细信息 |
||||
|
* |
||||
|
* @param dcBusiTargetBillMaster 统计指标录入对象 |
||||
|
*/ |
||||
|
public void insertDcBusiTargetBillSub(DcBusiTargetBillMaster dcBusiTargetBillMaster) |
||||
|
{ |
||||
|
List<DcBusiTargetBillSub> dcBusiTargetBillSubDaoList = dcBusiTargetBillMaster.getDcBusiTargetBillSubList(); |
||||
|
String billNo = dcBusiTargetBillMaster.getBillNo(); |
||||
|
if (StringUtils.isNotNull(dcBusiTargetBillSubDaoList)) |
||||
|
{ |
||||
|
List<DcBusiTargetBillSub> list = new ArrayList<DcBusiTargetBillSub>(); |
||||
|
for (DcBusiTargetBillSub dcBusiTargetBillSubDao : dcBusiTargetBillSubDaoList) |
||||
|
{ |
||||
|
dcBusiTargetBillSubDao.setBillNo(billNo); |
||||
|
list.add(dcBusiTargetBillSubDao); |
||||
|
} |
||||
|
if (list.size() > 0) |
||||
|
{ |
||||
|
baseMapper.batchDcBusiTargetBillSub(list); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,181 @@ |
|||||
|
<?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.lzbi.draft.mapper.DcBusiTargetBillMasterMapper"> |
||||
|
|
||||
|
<resultMap type="com.lzbi.draft.domain.DcBusiTargetBillMaster" id="DcBusiTargetBillMasterResult"> |
||||
|
<result property="id" column="id" /> |
||||
|
<result property="billNo" column="bill_no" /> |
||||
|
<result property="billIncomeDate" column="bill_income_date" /> |
||||
|
<result property="billType" column="bill_type" /> |
||||
|
<result property="checkType" column="check_type" /> |
||||
|
<result property="checkStatus" column="check_status" /> |
||||
|
<result property="tenantId" column="tenant_id" /> |
||||
|
<result property="revision" column="revision" /> |
||||
|
<result property="createdBy" column="created_by" /> |
||||
|
<result property="createdTime" column="created_time" /> |
||||
|
<result property="updatedBy" column="updated_by" /> |
||||
|
<result property="updatedTime" column="updated_time" /> |
||||
|
<result property="deleteBy" column="delete_by" /> |
||||
|
<result property="deleteTime" column="delete_time" /> |
||||
|
<result property="companyId" column="company_id" /> |
||||
|
<result property="companyName" column="company_name" /> |
||||
|
<result property="organizeName" column="organize_name" /> |
||||
|
<result property="oragnizeId" column="oragnize_id" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<resultMap id="DcBusiTargetBillMasterDcBusiTargetBillSubResult" type="DcBusiTargetBillMaster" extends="DcBusiTargetBillMasterResult"> |
||||
|
<collection property="dcBusiTargetBillSubList" notNullColumn="sub_id" javaType="java.util.List" resultMap="DcBusiTargetBillSubResult" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<resultMap type="DcBusiTargetBillSub" id="DcBusiTargetBillSubResult"> |
||||
|
<result property="id" column="sub_id" /> |
||||
|
<result property="billNo" column="sub_bill_no" /> |
||||
|
<result property="targetName" column="sub_target_name" /> |
||||
|
<result property="targetCode" column="sub_target_code" /> |
||||
|
<result property="targetUint" column="sub_target_uint" /> |
||||
|
<result property="targetValue" column="sub_target_value" /> |
||||
|
<result property="countDate" column="sub_count_date" /> |
||||
|
<result property="countDay" column="sub_count_day" /> |
||||
|
<result property="fieldCode" column="sub_field_code" /> |
||||
|
<result property="fieldName" column="sub_field_name" /> |
||||
|
<result property="assetCode" column="sub_asset_code" /> |
||||
|
<result property="assetName" column="sub_asset_name" /> |
||||
|
<result property="tenantId" column="sub_tenant_id" /> |
||||
|
<result property="revision" column="sub_revision" /> |
||||
|
<result property="createdBy" column="sub_created_by" /> |
||||
|
<result property="createdTime" column="sub_created_time" /> |
||||
|
<result property="updatedBy" column="sub_updated_by" /> |
||||
|
<result property="updatedTime" column="sub_updated_time" /> |
||||
|
<result property="deleteBy" column="sub_delete_by" /> |
||||
|
<result property="deleteTime" column="sub_delete_time" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
<sql id="selectDcBusiTargetBillMasterVo"> |
||||
|
select id, bill_no, bill_income_date, bill_type, check_type, check_status, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, company_id, company_name, organize_name, oragnize_id from dc_busi_target_bill_master |
||||
|
</sql> |
||||
|
|
||||
|
<select id="selectDcBusiTargetBillMasterList" parameterType="DcBusiTargetBillMaster" resultMap="DcBusiTargetBillMasterResult"> |
||||
|
<include refid="selectDcBusiTargetBillMasterVo"/> |
||||
|
<where> |
||||
|
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if> |
||||
|
<if test="billIncomeDate != null and billIncomeDate != ''"> and bill_income_date = #{billIncomeDate}</if> |
||||
|
<if test="billType != null and billType != ''"> and bill_type = #{billType}</if> |
||||
|
<if test="checkType != null and checkType != ''"> and check_type = #{checkType}</if> |
||||
|
<if test="checkStatus != null and checkStatus != ''"> and check_status = #{checkStatus}</if> |
||||
|
<if test="companyId != null "> and company_id = #{companyId}</if> |
||||
|
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if> |
||||
|
<if test="organizeName != null and organizeName != ''"> and organize_name like concat('%', #{organizeName}, '%')</if> |
||||
|
<if test="oragnizeId != null "> and oragnize_id = #{oragnizeId}</if> |
||||
|
</where> |
||||
|
</select> |
||||
|
|
||||
|
<select id="selectDcBusiTargetBillMasterById" parameterType="Long" resultMap="DcBusiTargetBillMasterDcBusiTargetBillSubResult"> |
||||
|
select a.id, a.bill_no, a.bill_income_date, a.bill_type, a.check_type, a.check_status, a.tenant_id, a.revision, a.created_by, a.created_time, a.updated_by, a.updated_time, a.delete_by, a.delete_time, a.company_id, a.company_name, a.organize_name, a.oragnize_id, |
||||
|
b.id as sub_id, b.bill_no as sub_bill_no, b.target_name as sub_target_name, b.target_code as sub_target_code, b.target_uint as sub_target_uint, b.target_value as sub_target_value, b.count_date as sub_count_date, b.count_day as sub_count_day, b.field_code as sub_field_code, b.field_name as sub_field_name, b.asset_code as sub_asset_code, b.asset_name as sub_asset_name, b.tenant_id as sub_tenant_id, b.revision as sub_revision, b.created_by as sub_created_by, b.created_time as sub_created_time, b.updated_by as sub_updated_by, b.updated_time as sub_updated_time, b.delete_by as sub_delete_by, b.delete_time as sub_delete_time |
||||
|
from dc_busi_target_bill_master a |
||||
|
left join dc_busi_target_bill_sub b on b.bill_no = a.id |
||||
|
where a.id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="insertDcBusiTargetBillMaster" parameterType="DcBusiTargetBillMaster" useGeneratedKeys="true" keyProperty="id"> |
||||
|
insert into dc_busi_target_bill_master |
||||
|
<trim prefix="(" suffix=")" suffixOverrides=","> |
||||
|
<if test="billNo != null">bill_no,</if> |
||||
|
<if test="billIncomeDate != null">bill_income_date,</if> |
||||
|
<if test="billType != null">bill_type,</if> |
||||
|
<if test="checkType != null">check_type,</if> |
||||
|
<if test="checkStatus != null">check_status,</if> |
||||
|
<if test="tenantId != null">tenant_id,</if> |
||||
|
<if test="revision != null">revision,</if> |
||||
|
<if test="createdBy != null">created_by,</if> |
||||
|
<if test="createdTime != null">created_time,</if> |
||||
|
<if test="updatedBy != null">updated_by,</if> |
||||
|
<if test="updatedTime != null">updated_time,</if> |
||||
|
<if test="deleteBy != null">delete_by,</if> |
||||
|
<if test="deleteTime != null">delete_time,</if> |
||||
|
<if test="companyId != null">company_id,</if> |
||||
|
<if test="companyName != null">company_name,</if> |
||||
|
<if test="organizeName != null">organize_name,</if> |
||||
|
<if test="oragnizeId != null">oragnize_id,</if> |
||||
|
</trim> |
||||
|
<trim prefix="values (" suffix=")" suffixOverrides=","> |
||||
|
<if test="billNo != null">#{billNo},</if> |
||||
|
<if test="billIncomeDate != null">#{billIncomeDate},</if> |
||||
|
<if test="billType != null">#{billType},</if> |
||||
|
<if test="checkType != null">#{checkType},</if> |
||||
|
<if test="checkStatus != null">#{checkStatus},</if> |
||||
|
<if test="tenantId != null">#{tenantId},</if> |
||||
|
<if test="revision != null">#{revision},</if> |
||||
|
<if test="createdBy != null">#{createdBy},</if> |
||||
|
<if test="createdTime != null">#{createdTime},</if> |
||||
|
<if test="updatedBy != null">#{updatedBy},</if> |
||||
|
<if test="updatedTime != null">#{updatedTime},</if> |
||||
|
<if test="deleteBy != null">#{deleteBy},</if> |
||||
|
<if test="deleteTime != null">#{deleteTime},</if> |
||||
|
<if test="companyId != null">#{companyId},</if> |
||||
|
<if test="companyName != null">#{companyName},</if> |
||||
|
<if test="organizeName != null">#{organizeName},</if> |
||||
|
<if test="oragnizeId != null">#{oragnizeId},</if> |
||||
|
</trim> |
||||
|
</insert> |
||||
|
|
||||
|
<update id="updateDcBusiTargetBillMaster" parameterType="DcBusiTargetBillMaster"> |
||||
|
update dc_busi_target_bill_master |
||||
|
<trim prefix="SET" suffixOverrides=","> |
||||
|
<if test="billNo != null">bill_no = #{billNo},</if> |
||||
|
<if test="billIncomeDate != null">bill_income_date = #{billIncomeDate},</if> |
||||
|
<if test="billType != null">bill_type = #{billType},</if> |
||||
|
<if test="checkType != null">check_type = #{checkType},</if> |
||||
|
<if test="checkStatus != null">check_status = #{checkStatus},</if> |
||||
|
<if test="tenantId != null">tenant_id = #{tenantId},</if> |
||||
|
<if test="revision != null">revision = #{revision},</if> |
||||
|
<if test="createdBy != null">created_by = #{createdBy},</if> |
||||
|
<if test="createdTime != null">created_time = #{createdTime},</if> |
||||
|
<if test="updatedBy != null">updated_by = #{updatedBy},</if> |
||||
|
<if test="updatedTime != null">updated_time = #{updatedTime},</if> |
||||
|
<if test="deleteBy != null">delete_by = #{deleteBy},</if> |
||||
|
<if test="deleteTime != null">delete_time = #{deleteTime},</if> |
||||
|
<if test="companyId != null">company_id = #{companyId},</if> |
||||
|
<if test="companyName != null">company_name = #{companyName},</if> |
||||
|
<if test="organizeName != null">organize_name = #{organizeName},</if> |
||||
|
<if test="oragnizeId != null">oragnize_id = #{oragnizeId},</if> |
||||
|
</trim> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="deleteDcBusiTargetBillMasterById" parameterType="Long"> |
||||
|
delete from dc_busi_target_bill_master where id = #{id} |
||||
|
</delete> |
||||
|
<select id="selectDcBusiTargetBillMasterBillNoByIds" parameterType="String" resultType="String"> |
||||
|
select bill_no from dc_busi_target_bill_master where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</select> |
||||
|
<delete id="deleteDcBusiTargetBillMasterByIds" parameterType="String"> |
||||
|
delete from dc_busi_target_bill_master where id in |
||||
|
<foreach item="id" collection="array" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteDcBusiTargetBillSubByBillNos" parameterType="collection"> |
||||
|
delete from dc_busi_target_bill_sub where bill_no in |
||||
|
<foreach item="billNo" collection="list" open="(" separator="," close=")"> |
||||
|
#{billNo} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="deleteDcBusiTargetBillSubByBillNo" parameterType="String"> |
||||
|
delete from dc_busi_target_bill_sub where bill_no = #{billNo} |
||||
|
</delete> |
||||
|
|
||||
|
<insert id="batchDcBusiTargetBillSub"> |
||||
|
insert into dc_busi_target_bill_sub( id, bill_no, target_name, target_code, target_uint, target_value, count_date, count_day, field_code, field_name, asset_code, asset_name, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time) values |
||||
|
<foreach item="item" index="index" collection="list" separator=","> |
||||
|
( #{item.id}, #{item.billNo}, #{item.targetName}, #{item.targetCode}, #{item.targetUint}, #{item.targetValue}, #{item.countDate}, #{item.countDay}, #{item.fieldCode}, #{item.fieldName}, #{item.assetCode}, #{item.assetName}, #{item.tenantId}, #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}) |
||||
|
</foreach> |
||||
|
</insert> |
||||
|
</mapper> |
Loading…
Reference in new issue