From f1b087d45ded835ccd6c875086b1f2e2b847f15a Mon Sep 17 00:00:00 2001 From: inleft <inleft@qq.com> Date: Wed, 09 Feb 2022 18:27:16 +0800 Subject: [PATCH] 表单调整 --- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/service/impl/BlogArticleServiceImpl.java | 76 +---- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleController.java | 44 +- _web/src/views/main/blogarticle/editForm.vue | 203 ++++----------- _web/src/views/main/blogarticle/addForm.vue | 190 ++++--------- snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java | 50 +-- _web/src/views/main/blogarticle/index.vue | 196 +++++---------- 6 files changed, 234 insertions(+), 525 deletions(-) diff --git a/_web/src/views/main/blogarticle/addForm.vue b/_web/src/views/main/blogarticle/addForm.vue index 979c70d..a1bcffc 100644 --- a/_web/src/views/main/blogarticle/addForm.vue +++ b/_web/src/views/main/blogarticle/addForm.vue @@ -1,6 +1,6 @@ <template> <a-modal - title="新增blog文章主体" + title="新增blog文章" :width="900" :visible="visible" :confirmLoading="confirmLoading" @@ -23,23 +23,24 @@ :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入文章文件id" v-decorator="['articleFileId', {rules: [{required: false, message: '请输入文章文件id!'}]}]" /> + <a-input placeholder="请输入文章文件id" v-decorator="['articleFileId', {rules: [{required: true, message: '请输入文章文件id!'}]}]" /> </a-form-item> <a-form-item - label="文件类型 1:markdown 2:html" + label="文件类型" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-radio-group placeholder="请选择文件类型" v-decorator="['articleFileType']" > + <a-radio v-for="(item,index) in articleFileTypeData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> + </a-form-item> + <a-form-item + label="文章分类" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入文件类型 1:markdown 2:html" v-decorator="['articleFileType', {rules: [{required: true, message: '请输入文件类型 1:markdown 2:html!'}]}]" /> - </a-form-item> - <a-form-item - label="文章分类id 0:没有分类" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入文章分类id 0:没有分类" v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类id 0:没有分类!'}]}]" /> + <a-input placeholder="请输入文章分类" v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类!'}]}]" /> </a-form-item> <a-form-item label="文章引言" @@ -47,119 +48,66 @@ :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入文章引言" v-decorator="['introduce', {rules: [{required: true, message: '请输入文章引言!'}]}]" /> + <a-textarea placeholder="请输入文章引言" v-decorator="['introduce']" :auto-size="{ minRows: 3, maxRows: 6 }"/> </a-form-item> <a-form-item - label="封面文件地址(id)" + label="封面文件" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入封面文件地址(id)" v-decorator="['coverFileId', {rules: [{required: true, message: '请输入封面文件地址(id)!'}]}]" /> + <a-input placeholder="请输入封面文件" v-decorator="['coverFileId']" /> </a-form-item> <a-form-item - label="上次编辑时间" + label="是否置顶" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-select style="width: 100%" placeholder="请选择是否置顶" v-decorator="['isTop', {rules: [{ required: true, message: '请选择是否置顶!' }]}]"> + <a-select-option v-for="(item,index) in isTopData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + <a-form-item + label="置顶值" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-date-picker style="width: 100%" placeholder="请选择上次编辑时间" v-decorator="['lastEditorDate',{rules: [{ required: true, message: '请选择上次编辑时间!' }]}]" @change="lastEditorDateOnChange"/> + <a-input placeholder="请输入置顶值" v-decorator="['topValue']" /> </a-form-item> <a-form-item - label="发布时间" + label="公开状态" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-radio-group placeholder="请选择公开状态" v-decorator="['authStatus']" > + <a-radio v-for="(item,index) in authStatusData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> + </a-form-item> + <a-form-item + label="授权密码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-date-picker style="width: 100%" placeholder="请选择发布时间" v-decorator="['publishDate',{rules: [{ required: true, message: '请选择发布时间!' }]}]" @change="publishDateOnChange"/> + <a-input placeholder="请输入授权密码" v-decorator="['authPassword']" /> </a-form-item> <a-form-item - label="是否置顶 0:否 1:是" + label="编辑状态" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-radio-group placeholder="请选择编辑状态" v-decorator="['editorStatus']" > + <a-radio v-for="(item,index) in editorStatusData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> + </a-form-item> + <a-form-item + label="是否启用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入是否置顶 0:否 1:是" v-decorator="['isTop', {rules: [{required: true, message: '请输入是否置顶 0:否 1:是!'}]}]" /> - </a-form-item> - <a-form-item - label="置顶值(越小越靠前)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入置顶值(越小越靠前)" v-decorator="['topValue', {rules: [{required: true, message: '请输入置顶值(越小越靠前)!'}]}]" /> - </a-form-item> - <a-form-item - label="公开状态 1:公开 2:私密 3:密码授权" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入公开状态 1:公开 2:私密 3:密码授权" v-decorator="['authStatus', {rules: [{required: true, message: '请输入公开状态 1:公开 2:私密 3:密码授权!'}]}]" /> - </a-form-item> - <a-form-item - label="授权密码(在密码授权状态时)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入授权密码(在密码授权状态时)" v-decorator="['authPassword', {rules: [{required: true, message: '请输入授权密码(在密码授权状态时)!'}]}]" /> - </a-form-item> - <a-form-item - label="编辑状态 0:草稿 1:发布" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入编辑状态 0:草稿 1:发布" v-decorator="['editorStatus', {rules: [{required: true, message: '请输入编辑状态 0:草稿 1:发布!'}]}]" /> - </a-form-item> - <a-form-item - label="归档年份(以初次发布时间为准)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档年份(以初次发布时间为准)" v-decorator="['separateYear', {rules: [{required: true, message: '请输入归档年份(以初次发布时间为准)!'}]}]" /> - </a-form-item> - <a-form-item - label="归档月份" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档月份" v-decorator="['separateMonth', {rules: [{required: true, message: '请输入归档月份!'}]}]" /> - </a-form-item> - <a-form-item - label="归档日" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档日" v-decorator="['separateDay', {rules: [{required: true, message: '请输入归档日!'}]}]" /> - </a-form-item> - <a-form-item - label="是否启用 0:否 1:是" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入是否启用 0:否 1:是" v-decorator="['isEnable', {rules: [{required: true, message: '请输入是否启用 0:否 1:是!'}]}]" /> - </a-form-item> - <a-form-item - label="更新时间" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-date-picker style="width: 100%" placeholder="请选择更新时间" v-decorator="['updateDate',{rules: [{ required: true, message: '请选择更新时间!' }]}]" @change="updateDateOnChange"/> - </a-form-item> - <a-form-item - label="创建时间" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-date-picker style="width: 100%" placeholder="请选择创建时间" v-decorator="['createDate',{rules: [{ required: true, message: '请选择创建时间!' }]}]" @change="createDateOnChange"/> + <a-input placeholder="请输入是否启用" v-decorator="['isEnable']" /> </a-form-item> </a-form> </a-spin> @@ -179,10 +127,10 @@ xs: { span: 24 }, sm: { span: 15 } }, - lastEditorDateDateString: '', - publishDateDateString: '', - updateDateDateString: '', - createDateDateString: '', + articleFileTypeData: [], + isTopData: [], + authStatusData: [], + editorStatusData: [], visible: false, confirmLoading: false, form: this.$form.createForm(this) @@ -192,6 +140,14 @@ // 初始化方法 add (record) { this.visible = true + const articleFileTypeOption = this.$options + this.articleFileTypeData = articleFileTypeOption.filters['dictData']('blog_file_type') + const isTopOption = this.$options + this.isTopData = isTopOption.filters['dictData']('blog_yes_or_no') + const authStatusOption = this.$options + this.authStatusData = authStatusOption.filters['dictData']('blog_auth_status') + const editorStatusOption = this.$options + this.editorStatusData = editorStatusOption.filters['dictData']('blog_editor_status') }, /** * 提交表单 @@ -206,10 +162,6 @@ values[key] = JSON.stringify(values[key]) } } - values.lastEditorDate = this.lastEditorDateDateString || null - values.publishDate = this.publishDateDateString || null - values.updateDate = this.updateDateDateString || null - values.createDate = this.createDateDateString || null blogArticleAdd(values).then((res) => { if (res.success) { this.$message.success('新增成功') @@ -227,27 +179,7 @@ } }) }, - lastEditorDateOnChange(date, dateString) { - this.lastEditorDateDateString = dateString - }, - publishDateOnChange(date, dateString) { - this.publishDateDateString = dateString - }, - updateDateOnChange(date, dateString) { - this.updateDateDateString = dateString - }, - createDateOnChange(date, dateString) { - this.createDateDateString = dateString - }, handleCancel () { - this.lastEditorDateDateString ='' - this.form.getFieldDecorator('lastEditorDate', { initialValue: null }) - this.publishDateDateString ='' - this.form.getFieldDecorator('publishDate', { initialValue: null }) - this.updateDateDateString ='' - this.form.getFieldDecorator('updateDate', { initialValue: null }) - this.createDateDateString ='' - this.form.getFieldDecorator('createDate', { initialValue: null }) this.form.resetFields() this.visible = false } diff --git a/_web/src/views/main/blogarticle/editForm.vue b/_web/src/views/main/blogarticle/editForm.vue index 1ae1364..78532f0 100644 --- a/_web/src/views/main/blogarticle/editForm.vue +++ b/_web/src/views/main/blogarticle/editForm.vue @@ -1,6 +1,6 @@ <template> <a-modal - title="编辑blog文章主体" + title="编辑blog文章" :width="900" :visible="visible" :confirmLoading="confirmLoading" @@ -27,20 +27,21 @@ <a-input placeholder="请输入文章文件id" v-decorator="['articleFileId', {rules: [{required: true, message: '请输入文章文件id!'}]}]" /> </a-form-item> <a-form-item - label="文件类型 1:markdown 2:html" + label="文件类型" :labelCol="labelCol" :wrapperCol="wrapperCol" - has-feedback > - <a-input placeholder="请输入文件类型 1:markdown 2:html" v-decorator="['articleFileType', {rules: [{required: true, message: '请输入文件类型 1:markdown 2:html!'}]}]" /> + <a-radio-group placeholder="请选择文件类型" v-decorator="['articleFileType']" > + <a-radio v-for="(item,index) in articleFileTypeData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> </a-form-item> <a-form-item - label="文章分类id 0:没有分类" + label="文章分类" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入文章分类id 0:没有分类" v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类id 0:没有分类!'}]}]" /> + <a-input placeholder="请输入文章分类" v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类!'}]}]" /> </a-form-item> <a-form-item label="文章引言" @@ -48,119 +49,66 @@ :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入文章引言" v-decorator="['introduce', {rules: [{required: true, message: '请输入文章引言!'}]}]" /> + <a-textarea placeholder="请输入文章引言" v-decorator="['introduce']" :auto-size="{ minRows: 3, maxRows: 6 }"/> </a-form-item> <a-form-item - label="封面文件地址(id)" + label="封面文件" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入封面文件地址(id)" v-decorator="['coverFileId', {rules: [{required: true, message: '请输入封面文件地址(id)!'}]}]" /> + <a-input placeholder="请输入封面文件" v-decorator="['coverFileId']" /> </a-form-item> <a-form-item - label="上次编辑时间" + label="是否置顶" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-select style="width: 100%" placeholder="请选择是否置顶" v-decorator="['isTop', {rules: [{ required: true, message: '请选择是否置顶!' }]}]"> + <a-select-option v-for="(item,index) in isTopData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> + </a-form-item> + <a-form-item + label="置顶值" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-date-picker style="width: 100%" placeholder="请选择上次编辑时间" v-decorator="['lastEditorDate',{rules: [{ required: true, message: '请选择上次编辑时间!' }]}]" @change="lastEditorDateOnChange"/> + <a-input placeholder="请输入置顶值" v-decorator="['topValue']" /> </a-form-item> <a-form-item - label="发布时间" + label="公开状态" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-radio-group placeholder="请选择公开状态" v-decorator="['authStatus']" > + <a-radio v-for="(item,index) in authStatusData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> + </a-form-item> + <a-form-item + label="授权密码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-date-picker style="width: 100%" placeholder="请选择发布时间" v-decorator="['publishDate',{rules: [{ required: true, message: '请选择发布时间!' }]}]" @change="publishDateOnChange"/> + <a-input placeholder="请输入授权密码" v-decorator="['authPassword']" /> </a-form-item> <a-form-item - label="是否置顶 0:否 1:是" + label="编辑状态" + :labelCol="labelCol" + :wrapperCol="wrapperCol" + > + <a-radio-group placeholder="请选择编辑状态" v-decorator="['editorStatus']" > + <a-radio v-for="(item,index) in editorStatusData" :key="index" :value="item.code">{{ item.name }}</a-radio> + </a-radio-group> + </a-form-item> + <a-form-item + label="是否启用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback > - <a-input placeholder="请输入是否置顶 0:否 1:是" v-decorator="['isTop', {rules: [{required: true, message: '请输入是否置顶 0:否 1:是!'}]}]" /> - </a-form-item> - <a-form-item - label="置顶值(越小越靠前)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入置顶值(越小越靠前)" v-decorator="['topValue', {rules: [{required: true, message: '请输入置顶值(越小越靠前)!'}]}]" /> - </a-form-item> - <a-form-item - label="公开状态 1:公开 2:私密 3:密码授权" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入公开状态 1:公开 2:私密 3:密码授权" v-decorator="['authStatus', {rules: [{required: true, message: '请输入公开状态 1:公开 2:私密 3:密码授权!'}]}]" /> - </a-form-item> - <a-form-item - label="授权密码(在密码授权状态时)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入授权密码(在密码授权状态时)" v-decorator="['authPassword', {rules: [{required: true, message: '请输入授权密码(在密码授权状态时)!'}]}]" /> - </a-form-item> - <a-form-item - label="编辑状态 0:草稿 1:发布" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入编辑状态 0:草稿 1:发布" v-decorator="['editorStatus', {rules: [{required: true, message: '请输入编辑状态 0:草稿 1:发布!'}]}]" /> - </a-form-item> - <a-form-item - label="归档年份(以初次发布时间为准)" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档年份(以初次发布时间为准)" v-decorator="['separateYear', {rules: [{required: true, message: '请输入归档年份(以初次发布时间为准)!'}]}]" /> - </a-form-item> - <a-form-item - label="归档月份" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档月份" v-decorator="['separateMonth', {rules: [{required: true, message: '请输入归档月份!'}]}]" /> - </a-form-item> - <a-form-item - label="归档日" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入归档日" v-decorator="['separateDay', {rules: [{required: true, message: '请输入归档日!'}]}]" /> - </a-form-item> - <a-form-item - label="是否启用 0:否 1:是" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-input placeholder="请输入是否启用 0:否 1:是" v-decorator="['isEnable', {rules: [{required: true, message: '请输入是否启用 0:否 1:是!'}]}]" /> - </a-form-item> - <a-form-item - label="更新时间" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-date-picker style="width: 100%" placeholder="请选择更新时间" v-decorator="['updateDate',{rules: [{ required: true, message: '请选择更新时间!' }]}]" @change="updateDateOnChange"/> - </a-form-item> - <a-form-item - label="创建时间" - :labelCol="labelCol" - :wrapperCol="wrapperCol" - has-feedback - > - <a-date-picker style="width: 100%" placeholder="请选择创建时间" v-decorator="['createDate',{rules: [{ required: true, message: '请选择创建时间!' }]}]" @change="createDateOnChange"/> + <a-input placeholder="请输入是否启用" v-decorator="['isEnable']" /> </a-form-item> </a-form> </a-spin> @@ -168,7 +116,6 @@ </template> <script> - import moment from 'moment' import { blogArticleEdit } from '@/api/modular/main/blogarticle/blogArticleManage' export default { data () { @@ -181,20 +128,27 @@ xs: { span: 24 }, sm: { span: 15 } }, - lastEditorDateDateString: '', - publishDateDateString: '', - updateDateDateString: '', - createDateDateString: '', + articleFileTypeData: [], + isTopData: [], + authStatusData: [], + editorStatusData: [], visible: false, confirmLoading: false, form: this.$form.createForm(this) } }, methods: { - moment, // 初始化方法 edit (record) { this.visible = true + const articleFileTypeOption = this.$options + this.articleFileTypeData = articleFileTypeOption.filters['dictData']('blog_file_type') + const isTopOption = this.$options + this.isTopData = isTopOption.filters['dictData']('blog_yes_or_no') + const authStatusOption = this.$options + this.authStatusData = authStatusOption.filters['dictData']('blog_auth_status') + const editorStatusOption = this.$options + this.editorStatusData = editorStatusOption.filters['dictData']('blog_editor_status') setTimeout(() => { this.form.setFieldsValue( { @@ -210,33 +164,10 @@ authStatus: record.authStatus, authPassword: record.authPassword, editorStatus: record.editorStatus, - separateYear: record.separateYear, - separateMonth: record.separateMonth, - separateDay: record.separateDay, isEnable: record.isEnable } ) }, 100) - // 时间单独处理 - if (record.lastEditorDate) { - this.form.getFieldDecorator('lastEditorDate', { initialValue: moment(record.lastEditorDate, 'YYYY-MM-DD') }) - this.lastEditorDateDateString = moment(record.lastEditorDate).format('YYYY-MM-DD') - } - // 时间单独处理 - if (record.publishDate) { - this.form.getFieldDecorator('publishDate', { initialValue: moment(record.publishDate, 'YYYY-MM-DD') }) - this.publishDateDateString = moment(record.publishDate).format('YYYY-MM-DD') - } - // 时间单独处理 - if (record.updateDate) { - this.form.getFieldDecorator('updateDate', { initialValue: moment(record.updateDate, 'YYYY-MM-DD') }) - this.updateDateDateString = moment(record.updateDate).format('YYYY-MM-DD') - } - // 时间单独处理 - if (record.createDate) { - this.form.getFieldDecorator('createDate', { initialValue: moment(record.createDate, 'YYYY-MM-DD') }) - this.createDateDateString = moment(record.createDate).format('YYYY-MM-DD') - } }, handleSubmit () { const { form: { validateFields } } = this @@ -248,10 +179,6 @@ values[key] = JSON.stringify(values[key]) } } - values.lastEditorDate = this.lastEditorDateDateString || null - values.publishDate = this.publishDateDateString || null - values.updateDate = this.updateDateDateString || null - values.createDate = this.createDateDateString || null blogArticleEdit(values).then((res) => { if (res.success) { this.$message.success('编辑成功') @@ -269,27 +196,7 @@ } }) }, - lastEditorDateOnChange(date, dateString) { - this.lastEditorDateDateString = dateString - }, - publishDateOnChange(date, dateString) { - this.publishDateDateString = dateString - }, - updateDateOnChange(date, dateString) { - this.updateDateDateString = dateString - }, - createDateOnChange(date, dateString) { - this.createDateDateString = dateString - }, handleCancel () { - this.lastEditorDateDateString ='' - this.form.getFieldDecorator('lastEditorDate', { initialValue: null }) - this.publishDateDateString ='' - this.form.getFieldDecorator('publishDate', { initialValue: null }) - this.updateDateDateString ='' - this.form.getFieldDecorator('updateDate', { initialValue: null }) - this.createDateDateString ='' - this.form.getFieldDecorator('createDate', { initialValue: null }) this.form.resetFields() this.visible = false } diff --git a/_web/src/views/main/blogarticle/index.vue b/_web/src/views/main/blogarticle/index.vue index 331c2ed..7afb31d 100644 --- a/_web/src/views/main/blogarticle/index.vue +++ b/_web/src/views/main/blogarticle/index.vue @@ -10,19 +10,16 @@ </a-form-item> </a-col> <a-col :md="8" :sm="24"> - <a-form-item label="文章文件id"> - <a-input v-model="queryParam.articleFileId" allow-clear placeholder="请输入文章文件id"/> + <a-form-item label="文件类型"> + <a-select style="width: 100%" v-model="queryParam.articleFileType" placeholder="请选择文件类型"> + <a-select-option v-for="(item,index) in articleFileTypeData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> </a-form-item> </a-col> <template v-if="advanced"> <a-col :md="8" :sm="24"> - <a-form-item label="文件类型 1:markdown 2:html"> - <a-input v-model="queryParam.articleFileType" allow-clear placeholder="请输入文件类型 1:markdown 2:html"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="文章分类id 0:没有分类"> - <a-input v-model="queryParam.articleTypeId" allow-clear placeholder="请输入文章分类id 0:没有分类"/> + <a-form-item label="文章分类"> + <a-input v-model="queryParam.articleTypeId" allow-clear placeholder="请输入文章分类"/> </a-form-item> </a-col> <a-col :md="8" :sm="24"> @@ -31,68 +28,29 @@ </a-form-item> </a-col> <a-col :md="8" :sm="24"> - <a-form-item label="封面文件地址(id)"> - <a-input v-model="queryParam.coverFileId" allow-clear placeholder="请输入封面文件地址(id)"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="上次编辑时间"> - <a-date-picker style="width: 100%" placeholder="请选择上次编辑时间" v-model="queryParam.lastEditorDateDate" @change="onChangelastEditorDate"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> <a-form-item label="发布时间"> <a-date-picker style="width: 100%" placeholder="请选择发布时间" v-model="queryParam.publishDateDate" @change="onChangepublishDate"/> </a-form-item> </a-col> <a-col :md="8" :sm="24"> - <a-form-item label="是否置顶 0:否 1:是"> - <a-input v-model="queryParam.isTop" allow-clear placeholder="请输入是否置顶 0:否 1:是"/> + <a-form-item label="是否置顶"> + <a-select style="width: 100%" v-model="queryParam.isTop" placeholder="请选择是否置顶"> + <a-select-option v-for="(item,index) in isTopData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> </a-form-item> </a-col> <a-col :md="8" :sm="24"> - <a-form-item label="置顶值(越小越靠前)"> - <a-input v-model="queryParam.topValue" allow-clear placeholder="请输入置顶值(越小越靠前)"/> + <a-form-item label="公开状态"> + <a-select style="width: 100%" v-model="queryParam.authStatus" placeholder="请选择公开状态"> + <a-select-option v-for="(item,index) in authStatusData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> </a-form-item> </a-col> <a-col :md="8" :sm="24"> - <a-form-item label="公开状态 1:公开 2:私密 3:密码授权"> - <a-input v-model="queryParam.authStatus" allow-clear placeholder="请输入公开状态 1:公开 2:私密 3:密码授权"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="授权密码(在密码授权状态时)"> - <a-input v-model="queryParam.authPassword" allow-clear placeholder="请输入授权密码(在密码授权状态时)"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="编辑状态 0:草稿 1:发布"> - <a-input v-model="queryParam.editorStatus" allow-clear placeholder="请输入编辑状态 0:草稿 1:发布"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="归档年份(以初次发布时间为准)"> - <a-input v-model="queryParam.separateYear" allow-clear placeholder="请输入归档年份(以初次发布时间为准)"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="归档月份"> - <a-input v-model="queryParam.separateMonth" allow-clear placeholder="请输入归档月份"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="归档日"> - <a-input v-model="queryParam.separateDay" allow-clear placeholder="请输入归档日"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="是否启用 0:否 1:是"> - <a-input v-model="queryParam.isEnable" allow-clear placeholder="请输入是否启用 0:否 1:是"/> - </a-form-item> - </a-col> - <a-col :md="8" :sm="24"> - <a-form-item label="更新时间"> - <a-date-picker style="width: 100%" placeholder="请选择更新时间" v-model="queryParam.updateDateDate" @change="onChangeupdateDate"/> + <a-form-item label="编辑状态"> + <a-select style="width: 100%" v-model="queryParam.editorStatus" placeholder="请选择编辑状态"> + <a-select-option v-for="(item,index) in editorStatusData" :key="index" :value="item.code">{{ item.name }}</a-select-option> + </a-select> </a-form-item> </a-col> <a-col :md="8" :sm="24"> @@ -125,7 +83,7 @@ :rowSelection="options.rowSelection" > <template class="table-operator" slot="operator" v-if="hasPerm('blogArticle:add')" > - <a-button type="primary" v-if="hasPerm('blogArticle:add')" icon="plus" @click="$refs.addForm.add()">新增blog文章主体</a-button> + <a-button type="primary" v-if="hasPerm('blogArticle:add')" icon="plus" @click="$refs.addForm.add()">新增blog文章</a-button> <a-button type="danger" :disabled="selectedRowKeys.length < 1" v-if="hasPerm('blogArticle:delete')" @click="batchDelete"><a-icon type="delete"/>批量删除</a-button> <x-down v-if="hasPerm('blogArticle:export')" @@ -133,6 +91,21 @@ @batchExport="batchExport" /> </template> + <span slot="titleScopedSlots" slot-scope="text"> + <ellipsis :length="10" tooltip>{{ text }}</ellipsis> + </span> + <span slot="articleFileTypeScopedSlots" slot-scope="text"> + {{ 'blog_file_type' | dictType(text) }} + </span> + <span slot="isTopScopedSlots" slot-scope="text"> + {{ 'blog_yes_or_no' | dictType(text) }} + </span> + <span slot="authStatusScopedSlots" slot-scope="text"> + {{ 'blog_auth_status' | dictType(text) }} + </span> + <span slot="editorStatusScopedSlots" slot-scope="text"> + {{ 'blog_editor_status' | dictType(text) }} + </span> <span slot="action" slot-scope="text, record"> <a v-if="hasPerm('blogArticle:edit')" @click="$refs.editForm.edit(record)">编辑</a> <a-divider type="vertical" v-if="hasPerm('blogArticle:edit') & hasPerm('blogArticle:delete')"/> @@ -147,13 +120,14 @@ </div> </template> <script> - import { STable, XDown } from '@/components' + import { STable, XDown, Ellipsis } from '@/components' import moment from 'moment' import { blogArticlePage, blogArticleDelete, blogArticleExport } from '@/api/modular/main/blogarticle/blogArticleManage' import addForm from './addForm.vue' import editForm from './editForm.vue' export default { components: { + Ellipsis, STable, addForm, editForm, @@ -170,32 +144,19 @@ { title: '文章标题', align: 'center', - dataIndex: 'title' + dataIndex: 'title', + scopedSlots: { customRender: 'titleScopedSlots' } }, { - title: '文章文件id', + title: '文件类型', align: 'center', - dataIndex: 'articleFileId' + dataIndex: 'articleFileType', + scopedSlots: { customRender: 'articleFileTypeScopedSlots' } }, { - title: '文件类型 1:markdown 2:html', - align: 'center', - dataIndex: 'articleFileType' - }, - { - title: '文章分类id 0:没有分类', + title: '文章分类', align: 'center', dataIndex: 'articleTypeId' - }, - { - title: '文章引言', - align: 'center', - dataIndex: 'introduce' - }, - { - title: '封面文件地址(id)', - align: 'center', - dataIndex: 'coverFileId' }, { title: '上次编辑时间', @@ -208,54 +169,37 @@ dataIndex: 'publishDate' }, { - title: '是否置顶 0:否 1:是', + title: '是否置顶', align: 'center', - dataIndex: 'isTop' + dataIndex: 'isTop', + scopedSlots: { customRender: 'isTopScopedSlots' } }, { - title: '置顶值(越小越靠前)', + title: '置顶值', align: 'center', dataIndex: 'topValue' }, { - title: '公开状态 1:公开 2:私密 3:密码授权', + title: '公开状态', align: 'center', - dataIndex: 'authStatus' + dataIndex: 'authStatus', + scopedSlots: { customRender: 'authStatusScopedSlots' } }, { - title: '授权密码(在密码授权状态时)', + title: '授权密码', align: 'center', dataIndex: 'authPassword' }, { - title: '编辑状态 0:草稿 1:发布', + title: '编辑状态', align: 'center', - dataIndex: 'editorStatus' + dataIndex: 'editorStatus', + scopedSlots: { customRender: 'editorStatusScopedSlots' } }, { - title: '归档年份(以初次发布时间为准)', - align: 'center', - dataIndex: 'separateYear' - }, - { - title: '归档月份', - align: 'center', - dataIndex: 'separateMonth' - }, - { - title: '归档日', - align: 'center', - dataIndex: 'separateDay' - }, - { - title: '是否启用 0:否 1:是', + title: '是否启用', align: 'center', dataIndex: 'isEnable' - }, - { - title: '更新时间', - align: 'center', - dataIndex: 'updateDate' }, { title: '创建时间', @@ -270,6 +214,10 @@ return res.data }) }, + articleFileTypeData: [], + isTopData: [], + authStatusData: [], + editorStatusData: [], selectedRowKeys: [], selectedRows: [], options: { @@ -290,6 +238,14 @@ scopedSlots: { customRender: 'action' } }) } + const articleFileTypeOption = this.$options + this.articleFileTypeData = articleFileTypeOption.filters['dictData']('blog_file_type') + const isTopOption = this.$options + this.isTopData = isTopOption.filters['dictData']('blog_yes_or_no') + const authStatusOption = this.$options + this.authStatusData = authStatusOption.filters['dictData']('blog_auth_status') + const editorStatusOption = this.$options + this.editorStatusData = editorStatusOption.filters['dictData']('blog_editor_status') }, methods: { moment, @@ -297,25 +253,11 @@ * 查询参数组装 */ switchingDate () { - const queryParamlastEditorDate = this.queryParam.lastEditorDateDate - if (queryParamlastEditorDate != null) { - this.queryParam.lastEditorDate = moment(queryParamlastEditorDate).format('YYYY-MM-DD') - if (queryParamlastEditorDate.length < 1) { - delete this.queryParam.lastEditorDate - } - } const queryParampublishDate = this.queryParam.publishDateDate if (queryParampublishDate != null) { this.queryParam.publishDate = moment(queryParampublishDate).format('YYYY-MM-DD') if (queryParampublishDate.length < 1) { delete this.queryParam.publishDate - } - } - const queryParamupdateDate = this.queryParam.updateDateDate - if (queryParamupdateDate != null) { - this.queryParam.updateDate = moment(queryParamupdateDate).format('YYYY-MM-DD') - if (queryParamupdateDate.length < 1) { - delete this.queryParam.updateDate } } const queryParamcreateDate = this.queryParam.createDateDate @@ -357,14 +299,8 @@ toggleAdvanced () { this.advanced = !this.advanced }, - onChangelastEditorDate(date, dateString) { - this.lastEditorDateDateString = dateString - }, onChangepublishDate(date, dateString) { this.publishDateDateString = dateString - }, - onChangeupdateDate(date, dateString) { - this.updateDateDateString = dateString }, onChangecreateDate(date, dateString) { this.createDateDateString = dateString diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleController.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleController.java index 773878f..d207ead 100644 --- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleController.java +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/controller/BlogArticleController.java @@ -40,10 +40,10 @@ import java.util.List; /** - * blog文章主体控制器 + * blog文章控制器 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @RestController public class BlogArticleController { @@ -52,82 +52,82 @@ private BlogArticleService blogArticleService; /** - * 查询blog文章主体 + * 查询blog文章 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @GetMapping("/blogArticle/page") - @BusinessLog(title = "blog文章主体_查询", opType = LogAnnotionOpTypeEnum.QUERY) + @BusinessLog(title = "blog文章_查询", opType = LogAnnotionOpTypeEnum.QUERY) public ResponseData page(BlogArticleParam blogArticleParam) { return new SuccessResponseData(blogArticleService.page(blogArticleParam)); } /** - * 添加blog文章主体 + * 添加blog文章 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @PostMapping("/blogArticle/add") - @BusinessLog(title = "blog文章主体_增加", opType = LogAnnotionOpTypeEnum.ADD) + @BusinessLog(title = "blog文章_增加", opType = LogAnnotionOpTypeEnum.ADD) public ResponseData add(@RequestBody @Validated(BlogArticleParam.add.class) BlogArticleParam blogArticleParam) { blogArticleService.add(blogArticleParam); return new SuccessResponseData(); } /** - * 删除blog文章主体,可批量删除 + * 删除blog文章,可批量删除 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @PostMapping("/blogArticle/delete") - @BusinessLog(title = "blog文章主体_删除", opType = LogAnnotionOpTypeEnum.DELETE) + @BusinessLog(title = "blog文章_删除", opType = LogAnnotionOpTypeEnum.DELETE) public ResponseData delete(@RequestBody @Validated(BlogArticleParam.delete.class) List<BlogArticleParam> blogArticleParamList) { blogArticleService.delete(blogArticleParamList); return new SuccessResponseData(); } /** - * 编辑blog文章主体 + * 编辑blog文章 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @PostMapping("/blogArticle/edit") - @BusinessLog(title = "blog文章主体_编辑", opType = LogAnnotionOpTypeEnum.EDIT) + @BusinessLog(title = "blog文章_编辑", opType = LogAnnotionOpTypeEnum.EDIT) public ResponseData edit(@RequestBody @Validated(BlogArticleParam.edit.class) BlogArticleParam blogArticleParam) { blogArticleService.edit(blogArticleParam); return new SuccessResponseData(); } /** - * 查看blog文章主体 + * 查看blog文章 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @GetMapping("/blogArticle/detail") - @BusinessLog(title = "blog文章主体_查看", opType = LogAnnotionOpTypeEnum.DETAIL) + @BusinessLog(title = "blog文章_查看", opType = LogAnnotionOpTypeEnum.DETAIL) public ResponseData detail(@Validated(BlogArticleParam.detail.class) BlogArticleParam blogArticleParam) { return new SuccessResponseData(blogArticleService.detail(blogArticleParam)); } /** - * blog文章主体列表 + * blog文章列表 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @GetMapping("/blogArticle/list") - @BusinessLog(title = "blog文章主体_列表", opType = LogAnnotionOpTypeEnum.QUERY) + @BusinessLog(title = "blog文章_列表", opType = LogAnnotionOpTypeEnum.QUERY) public ResponseData list(BlogArticleParam blogArticleParam) { return new SuccessResponseData(blogArticleService.list(blogArticleParam)); } @@ -136,11 +136,11 @@ * 导出系统用户 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:22 */ @Permission @GetMapping("/blogArticle/export") - @BusinessLog(title = "blog文章主体_导出", opType = LogAnnotionOpTypeEnum.EXPORT) + @BusinessLog(title = "blog文章_导出", opType = LogAnnotionOpTypeEnum.EXPORT) public void export(BlogArticleParam blogArticleParam) { blogArticleService.export(blogArticleParam); } diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java index 27b37d7..cd50c20 100644 --- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/param/BlogArticleParam.java @@ -24,7 +24,6 @@ */ package vip.xiaonuo.modular.blogarticle.param; -import com.baomidou.mybatisplus.core.toolkit.AES; import lombok.Data; import vip.xiaonuo.core.pojo.base.param.BaseParam; @@ -32,20 +31,14 @@ import javax.validation.constraints.NotNull; /** -* blog文章主体参数类 +* blog文章参数类 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:21:14 */ @Data public class BlogArticleParam extends BaseParam { - public static void main(String[] args) { - String data = "Root+redis"; - String randomKey = "inleftKey1234567"; - String result = AES.encrypt(data, randomKey); - System.out.println(result); - } /** * 主键 */ @@ -65,105 +58,90 @@ private Long articleFileId; /** - * 文件类型 1:markdown 2:html + * 文件类型 */ - @NotNull(message = "文件类型 1:markdown 2:html不能为空,请检查articleFileType参数", groups = {add.class, edit.class}) private Integer articleFileType; /** - * 文章分类id 0:没有分类 + * 文章分类 */ - @NotNull(message = "文章分类id 0:没有分类不能为空,请检查articleTypeId参数", groups = {add.class, edit.class}) + @NotNull(message = "文章分类不能为空,请检查articleTypeId参数", groups = {add.class, edit.class}) private Long articleTypeId; /** * 文章引言 */ - @NotBlank(message = "文章引言不能为空,请检查introduce参数", groups = {add.class, edit.class}) private String introduce; /** - * 封面文件地址(id) + * 封面文件 */ - @NotNull(message = "封面文件地址(id)不能为空,请检查coverFileId参数", groups = {add.class, edit.class}) private Long coverFileId; /** * 上次编辑时间 */ - @NotNull(message = "上次编辑时间不能为空,请检查lastEditorDate参数", groups = {add.class, edit.class}) private String lastEditorDate; /** * 发布时间 */ - @NotNull(message = "发布时间不能为空,请检查publishDate参数", groups = {add.class, edit.class}) private String publishDate; /** - * 是否置顶 0:否 1:是 + * 是否置顶 */ - @NotNull(message = "是否置顶 0:否 1:是不能为空,请检查isTop参数", groups = {add.class, edit.class}) + @NotNull(message = "是否置顶不能为空,请检查isTop参数", groups = {add.class, edit.class}) private Integer isTop; /** - * 置顶值(越小越靠前) + * 置顶值 */ - @NotNull(message = "置顶值(越小越靠前)不能为空,请检查topValue参数", groups = {add.class, edit.class}) private Integer topValue; /** - * 公开状态 1:公开 2:私密 3:密码授权 + * 公开状态 */ - @NotNull(message = "公开状态 1:公开 2:私密 3:密码授权不能为空,请检查authStatus参数", groups = {add.class, edit.class}) private Integer authStatus; /** - * 授权密码(在密码授权状态时) + * 授权密码 */ - @NotBlank(message = "授权密码(在密码授权状态时)不能为空,请检查authPassword参数", groups = {add.class, edit.class}) private String authPassword; /** - * 编辑状态 0:草稿 1:发布 + * 编辑状态 */ - @NotNull(message = "编辑状态 0:草稿 1:发布不能为空,请检查editorStatus参数", groups = {add.class, edit.class}) private Integer editorStatus; /** - * 归档年份(以初次发布时间为准) + * 归档年份 */ - @NotNull(message = "归档年份(以初次发布时间为准)不能为空,请检查separateYear参数", groups = {add.class, edit.class}) private Integer separateYear; /** * 归档月份 */ - @NotNull(message = "归档月份不能为空,请检查separateMonth参数", groups = {add.class, edit.class}) private Integer separateMonth; /** * 归档日 */ - @NotNull(message = "归档日不能为空,请检查separateDay参数", groups = {add.class, edit.class}) private Integer separateDay; /** - * 是否启用 0:否 1:是 + * 是否启用 */ - @NotNull(message = "是否启用 0:否 1:是不能为空,请检查isEnable参数", groups = {add.class, edit.class}) private Integer isEnable; /** * 更新时间 */ - @NotNull(message = "更新时间不能为空,请检查updateDate参数", groups = {add.class, edit.class}) private String updateDate; /** * 创建时间 */ - @NotNull(message = "创建时间不能为空,请检查createDate参数", groups = {add.class, edit.class}) private String createDate; } diff --git a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/service/impl/BlogArticleServiceImpl.java b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/service/impl/BlogArticleServiceImpl.java index d55be1c..4ff0baa 100644 --- a/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/service/impl/BlogArticleServiceImpl.java +++ b/snowy-main/src/main/java/vip/xiaonuo/modular/blogarticle/service/impl/BlogArticleServiceImpl.java @@ -26,12 +26,10 @@ import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import vip.xiaonuo.core.consts.CommonConstant; -import vip.xiaonuo.core.enums.CommonStatusEnum; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import vip.xiaonuo.core.exception.ServiceException; import vip.xiaonuo.core.factory.PageFactory; import vip.xiaonuo.core.pojo.page.PageResult; @@ -41,16 +39,14 @@ import vip.xiaonuo.modular.blogarticle.mapper.BlogArticleMapper; import vip.xiaonuo.modular.blogarticle.param.BlogArticleParam; import vip.xiaonuo.modular.blogarticle.service.BlogArticleService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; + import java.util.List; /** - * blog文章主体service接口实现类 + * blog文章service接口实现类 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:46 */ @Service public class BlogArticleServiceImpl extends ServiceImpl<BlogArticleMapper, BlogArticle> implements BlogArticleService { @@ -62,79 +58,39 @@ // 根据文章标题 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getTitle())) { - queryWrapper.lambda().eq(BlogArticle::getTitle, blogArticleParam.getTitle()); + queryWrapper.lambda().like(BlogArticle::getTitle, blogArticleParam.getTitle()); } - // 根据文章文件id 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getArticleFileId())) { - queryWrapper.lambda().eq(BlogArticle::getArticleFileId, blogArticleParam.getArticleFileId()); - } - // 根据文件类型 1:markdown 2:html 查询 + // 根据文件类型 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getArticleFileType())) { queryWrapper.lambda().eq(BlogArticle::getArticleFileType, blogArticleParam.getArticleFileType()); } - // 根据文章分类id 0:没有分类 查询 + // 根据文章分类 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getArticleTypeId())) { queryWrapper.lambda().eq(BlogArticle::getArticleTypeId, blogArticleParam.getArticleTypeId()); } // 根据文章引言 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getIntroduce())) { - queryWrapper.lambda().eq(BlogArticle::getIntroduce, blogArticleParam.getIntroduce()); - } - // 根据封面文件地址(id) 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getCoverFileId())) { - queryWrapper.lambda().eq(BlogArticle::getCoverFileId, blogArticleParam.getCoverFileId()); - } - // 根据上次编辑时间 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getLastEditorDate())) { - queryWrapper.lambda().eq(BlogArticle::getLastEditorDate, blogArticleParam.getLastEditorDate()); + queryWrapper.lambda().like(BlogArticle::getIntroduce, blogArticleParam.getIntroduce()); } // 根据发布时间 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getPublishDate())) { - queryWrapper.lambda().eq(BlogArticle::getPublishDate, blogArticleParam.getPublishDate()); + queryWrapper.lambda().ge(BlogArticle::getPublishDate, blogArticleParam.getPublishDate()); } - // 根据是否置顶 0:否 1:是 查询 + // 根据是否置顶 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getIsTop())) { queryWrapper.lambda().eq(BlogArticle::getIsTop, blogArticleParam.getIsTop()); } - // 根据置顶值(越小越靠前) 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getTopValue())) { - queryWrapper.lambda().eq(BlogArticle::getTopValue, blogArticleParam.getTopValue()); - } - // 根据公开状态 1:公开 2:私密 3:密码授权 查询 + // 根据公开状态 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getAuthStatus())) { queryWrapper.lambda().eq(BlogArticle::getAuthStatus, blogArticleParam.getAuthStatus()); } - // 根据授权密码(在密码授权状态时) 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getAuthPassword())) { - queryWrapper.lambda().eq(BlogArticle::getAuthPassword, blogArticleParam.getAuthPassword()); - } - // 根据编辑状态 0:草稿 1:发布 查询 + // 根据编辑状态 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getEditorStatus())) { queryWrapper.lambda().eq(BlogArticle::getEditorStatus, blogArticleParam.getEditorStatus()); } - // 根据归档年份(以初次发布时间为准) 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getSeparateYear())) { - queryWrapper.lambda().eq(BlogArticle::getSeparateYear, blogArticleParam.getSeparateYear()); - } - // 根据归档月份 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getSeparateMonth())) { - queryWrapper.lambda().eq(BlogArticle::getSeparateMonth, blogArticleParam.getSeparateMonth()); - } - // 根据归档日 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getSeparateDay())) { - queryWrapper.lambda().eq(BlogArticle::getSeparateDay, blogArticleParam.getSeparateDay()); - } - // 根据是否启用 0:否 1:是 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getIsEnable())) { - queryWrapper.lambda().eq(BlogArticle::getIsEnable, blogArticleParam.getIsEnable()); - } - // 根据更新时间 查询 - if (ObjectUtil.isNotEmpty(blogArticleParam.getUpdateDate())) { - queryWrapper.lambda().eq(BlogArticle::getUpdateDate, blogArticleParam.getUpdateDate()); - } // 根据创建时间 查询 if (ObjectUtil.isNotEmpty(blogArticleParam.getCreateDate())) { - queryWrapper.lambda().eq(BlogArticle::getCreateDate, blogArticleParam.getCreateDate()); + queryWrapper.lambda().ge(BlogArticle::getCreateDate, blogArticleParam.getCreateDate()); } } return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); @@ -174,10 +130,10 @@ } /** - * 获取blog文章主体 + * 获取blog文章 * * @author inleft - * @date 2022-01-22 16:53:06 + * @date 2022-02-09 18:20:46 */ private BlogArticle queryBlogArticle(BlogArticleParam blogArticleParam) { BlogArticle blogArticle = this.getById(blogArticleParam.getId()); -- Gitblit v1.9.1