12 files added
3 files modified
New file |
| | |
| | | import { axios } from '@/utils/request' |
| | | |
| | | /** |
| | | * 查询blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypePage (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/page', |
| | | method: 'get', |
| | | params: parameter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * blog文章分类列表 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypeList (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/list', |
| | | method: 'get', |
| | | params: parameter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 添加blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypeAdd (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/add', |
| | | method: 'post', |
| | | data: parameter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 编辑blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypeEdit (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/edit', |
| | | method: 'post', |
| | | data: parameter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 删除blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypeDelete (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/delete', |
| | | method: 'post', |
| | | data: parameter |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * 导出blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | export function blogArticleTypeExport (parameter) { |
| | | return axios({ |
| | | url: '/blogArticleType/export', |
| | | method: 'get', |
| | | params: parameter, |
| | | responseType: 'blob' |
| | | }) |
| | | } |
| | |
| | | <template> |
| | | <a-modal |
| | | title="编辑blog文章" |
| | | :width="900" |
| | | :visible="visible" |
| | | :confirmLoading="confirmLoading" |
| | | @ok="handleSubmit" |
| | | @cancel="handleCancel" |
| | | > |
| | | <a-modal title="编辑blog文章" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" |
| | | @cancel="handleCancel"> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item> |
| | | <a-form-item |
| | | label="文章标题" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | has-feedback |
| | | > |
| | | <a-form-item v-show="false"> |
| | | <a-input v-decorator="['id']" /> |
| | | </a-form-item> |
| | | <a-form-item label="文章标题" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入文章标题" v-decorator="['title', {rules: [{required: true, message: '请输入文章标题!'}]}]" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="文章文件id" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | has-feedback |
| | | > |
| | | <a-input placeholder="请输入文章文件id" v-decorator="['articleFileId', {rules: [{required: true, message: '请输入文章文件id!'}]}]" /> |
| | | <a-form-item label="文章文件id" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入文章文件id" |
| | | v-decorator="['articleFileId', {rules: [{required: true, message: '请输入文章文件id!'}]}]" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | 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-form-item 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="请输入文章分类" v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类!'}]}]" /> |
| | | <a-form-item label="文章分类" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入文章分类" |
| | | v-decorator="['articleTypeId', {rules: [{required: true, message: '请输入文章分类!'}]}]" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="文章引言" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | has-feedback |
| | | > |
| | | <a-textarea placeholder="请输入文章引言" v-decorator="['introduce']" :auto-size="{ minRows: 3, maxRows: 6 }"/> |
| | | <a-form-item label="文章引言" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-textarea placeholder="请输入文章引言" v-decorator="['introduce']" :auto-size="{ minRows: 3, maxRows: 6 }" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="封面文件" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | has-feedback |
| | | > |
| | | <a-form-item label="封面文件" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入封面文件" v-decorator="['coverFileId']" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | 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-form-item 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-form-item label="置顶值" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入置顶值" v-decorator="['topValue']" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="公开状态" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-radio-group placeholder="请选择公开状态" v-decorator="['authStatus']" > |
| | | <a-form-item 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-form-item label="授权密码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入授权密码" v-decorator="['authPassword']" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="编辑状态" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-radio-group placeholder="请选择编辑状态" v-decorator="['editorStatus']" > |
| | | <a-form-item 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-form-item label="是否启用" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入是否启用" v-decorator="['isEnable']" /> |
| | | </a-form-item> |
| | | </a-form> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { blogArticleEdit } from '@/api/modular/main/blogarticle/blogArticleManage' |
| | | import { |
| | | blogArticleEdit |
| | | } from '@/api/modular/main/blogarticle/blogArticleManage' |
| | | export default { |
| | | data () { |
| | | data() { |
| | | return { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 } |
| | | xs: { |
| | | span: 24 |
| | | }, |
| | | sm: { |
| | | span: 5 |
| | | } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 15 } |
| | | xs: { |
| | | span: 24 |
| | | }, |
| | | sm: { |
| | | span: 15 |
| | | } |
| | | }, |
| | | articleFileTypeData: [], |
| | | isTopData: [], |
| | |
| | | }, |
| | | methods: { |
| | | // 初始化方法 |
| | | edit (record) { |
| | | edit(record) { |
| | | this.visible = true |
| | | const articleFileTypeOption = this.$options |
| | | this.articleFileTypeData = articleFileTypeOption.filters['dictData']('blog_file_type') |
| | |
| | | this.authStatusData = authStatusOption.filters['dictData']('blog_auth_status') |
| | | const editorStatusOption = this.$options |
| | | this.editorStatusData = editorStatusOption.filters['dictData']('blog_editor_status') |
| | | |
| | | this.form.getFieldDecorator('articleFileType', { |
| | | valuePropName: 'checked', |
| | | initialValue: record.articleFileType.toString() |
| | | }) |
| | | this.form.getFieldDecorator('authStatus', { |
| | | valuePropName: 'checked', |
| | | initialValue: record.authStatus.toString() |
| | | }) |
| | | this.form.getFieldDecorator('editorStatus', { |
| | | valuePropName: 'checked', |
| | | initialValue: record.editorStatus.toString() |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | this.form.setFieldsValue( |
| | | { |
| | | id: record.id, |
| | | title: record.title, |
| | | articleFileId: record.articleFileId, |
| | | articleFileType: record.articleFileType, |
| | | articleTypeId: record.articleTypeId, |
| | | introduce: record.introduce, |
| | | coverFileId: record.coverFileId, |
| | | isTop: record.isTop, |
| | | topValue: record.topValue, |
| | | authStatus: record.authStatus, |
| | | authPassword: record.authPassword, |
| | | editorStatus: record.editorStatus, |
| | | isEnable: record.isEnable |
| | | } |
| | | ) |
| | | this.form.setFieldsValue({ |
| | | id: record.id, |
| | | title: record.title, |
| | | articleFileId: record.articleFileId, |
| | | // articleFileType: record.articleFileType, |
| | | articleTypeId: record.articleTypeId, |
| | | introduce: record.introduce, |
| | | coverFileId: record.coverFileId, |
| | | isTop: record.isTop, |
| | | topValue: record.topValue, |
| | | // authStatus: record.authStatus, |
| | | authPassword: record.authPassword, |
| | | // editorStatus: record.editorStatus, |
| | | isEnable: record.isEnable |
| | | }) |
| | | |
| | | |
| | | }, 100) |
| | | }, |
| | | handleSubmit () { |
| | | const { form: { validateFields } } = this |
| | | handleSubmit() { |
| | | const { |
| | | form: { |
| | | validateFields |
| | | } |
| | | } = this |
| | | this.confirmLoading = true |
| | | validateFields((errors, values) => { |
| | | if (!errors) { |
| | | for (const key in values) { |
| | | if (typeof (values[key]) === 'object' && values[key] != null) { |
| | | if (typeof(values[key]) === 'object' && values[key] != null) { |
| | | values[key] = JSON.stringify(values[key]) |
| | | } |
| | | } |
| | |
| | | this.$emit('ok', values) |
| | | this.handleCancel() |
| | | } else { |
| | | this.$message.error('编辑失败')// + res.message |
| | | this.$message.error('编辑失败') // + res.message |
| | | } |
| | | }).finally((res) => { |
| | | this.confirmLoading = false |
| | |
| | | } |
| | | }) |
| | | }, |
| | | handleCancel () { |
| | | handleCancel() { |
| | | this.form.resetFields() |
| | | this.visible = false |
| | | } |
| | |
| | | <span slot="isTopScopedSlots" slot-scope="text"> |
| | | {{ 'blog_yes_or_no' | 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="isEnableScopedSlots" slot-scope="text"> |
| | | {{ 'blog_yes_or_no' | dictType(text) }} |
| | | </span> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a v-if="hasPerm('blogArticle:edit')" @click="$refs.editForm.edit(record)">编辑</a> |
| | |
| | | { |
| | | title: '是否启用', |
| | | align: 'center', |
| | | dataIndex: 'isEnable' |
| | | dataIndex: 'isEnable', |
| | | scopedSlots: { customRender: 'isEnableScopedSlots' } |
| | | }, |
| | | { |
| | | title: '创建时间', |
New file |
| | |
| | | <template> |
| | | <a-modal |
| | | title="新增blog文章分类" |
| | | :width="900" |
| | | :visible="visible" |
| | | :confirmLoading="confirmLoading" |
| | | @ok="handleSubmit" |
| | | @cancel="handleCancel" |
| | | > |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-form-item |
| | | label="分类名称" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | has-feedback |
| | | > |
| | | <a-input placeholder="请输入分类名称" v-decorator="['typeName', {rules: [{required: true, message: '请输入分类名称!'}]}]" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="公开类型" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-radio-group placeholder="请选择公开类型" v-decorator="['openType',{rules: [{ required: true, message: '请选择公开类型!' }]}]" > |
| | | <a-radio v-for="(item,index) in openTypeData" :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="请输入置顶值" v-decorator="['topValue']" /> |
| | | </a-form-item> |
| | | <a-form-item |
| | | label="是否启用" |
| | | :labelCol="labelCol" |
| | | :wrapperCol="wrapperCol" |
| | | > |
| | | <a-radio-group placeholder="请选择是否启用" v-decorator="['isEnable',{rules: [{ required: true, message: '请选择是否启用!' }]}]" > |
| | | <a-radio v-for="(item,index) in isEnableData" :key="index" :value="item.code">{{ item.name }}</a-radio> |
| | | </a-radio-group> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-spin> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { blogArticleTypeAdd } from '@/api/modular/main/blogarticletype/blogArticleTypeManage' |
| | | export default { |
| | | data () { |
| | | return { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 5 } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { span: 24 }, |
| | | sm: { span: 15 } |
| | | }, |
| | | openTypeData: [], |
| | | isEnableData: [], |
| | | visible: false, |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this) |
| | | } |
| | | }, |
| | | methods: { |
| | | // 初始化方法 |
| | | add (record) { |
| | | this.visible = true |
| | | const openTypeOption = this.$options |
| | | this.openTypeData = openTypeOption.filters['dictData']('blog_auth_status') |
| | | const isEnableOption = this.$options |
| | | this.isEnableData = isEnableOption.filters['dictData']('blog_yes_or_no') |
| | | }, |
| | | /** |
| | | * 提交表单 |
| | | */ |
| | | handleSubmit () { |
| | | const { form: { validateFields } } = this |
| | | this.confirmLoading = true |
| | | validateFields((errors, values) => { |
| | | if (!errors) { |
| | | for (const key in values) { |
| | | if (typeof (values[key]) === 'object' && values[key] != null) { |
| | | values[key] = JSON.stringify(values[key]) |
| | | } |
| | | } |
| | | blogArticleTypeAdd(values).then((res) => { |
| | | if (res.success) { |
| | | this.$message.success('新增成功') |
| | | this.confirmLoading = false |
| | | this.$emit('ok', values) |
| | | this.handleCancel() |
| | | } else { |
| | | this.$message.error('新增失败')// + res.message |
| | | } |
| | | }).finally((res) => { |
| | | this.confirmLoading = false |
| | | }) |
| | | } else { |
| | | this.confirmLoading = false |
| | | } |
| | | }) |
| | | }, |
| | | handleCancel () { |
| | | this.form.resetFields() |
| | | this.visible = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
New file |
| | |
| | | <template> |
| | | <a-modal title="编辑blog文章分类" :width="900" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit" |
| | | @cancel="handleCancel"> |
| | | <a-spin :spinning="confirmLoading"> |
| | | <a-form :form="form"> |
| | | <a-form-item v-show="false"> |
| | | <a-input v-decorator="['id']" /> |
| | | </a-form-item> |
| | | <a-form-item label="分类名称" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback> |
| | | <a-input placeholder="请输入分类名称" v-decorator="['typeName', {rules: [{required: true, message: '请输入分类名称!'}]}]" /> |
| | | </a-form-item> |
| | | <a-form-item label="公开类型" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-radio-group placeholder="请选择公开类型" |
| | | v-decorator="['openType',{rules: [{ required: true, message: '请选择公开类型!' }]}]"> |
| | | <a-radio v-for="(item,index) in openTypeData" :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="请输入置顶值" v-decorator="['topValue']" /> |
| | | </a-form-item> |
| | | <a-form-item label="是否启用" :labelCol="labelCol" :wrapperCol="wrapperCol"> |
| | | <a-radio-group placeholder="请选择是否启用" |
| | | v-decorator="['isEnable',{rules: [{ required: true, message: '请选择是否启用!' }]}]"> |
| | | <a-radio v-for="(item,index) in isEnableData" :key="index" :value="item.code">{{ item.name }}</a-radio> |
| | | </a-radio-group> |
| | | </a-form-item> |
| | | </a-form> |
| | | </a-spin> |
| | | </a-modal> |
| | | </template> |
| | | |
| | | <script> |
| | | import { |
| | | blogArticleTypeEdit |
| | | } from '@/api/modular/main/blogarticletype/blogArticleTypeManage' |
| | | export default { |
| | | data() { |
| | | return { |
| | | labelCol: { |
| | | xs: { |
| | | span: 24 |
| | | }, |
| | | sm: { |
| | | span: 5 |
| | | } |
| | | }, |
| | | wrapperCol: { |
| | | xs: { |
| | | span: 24 |
| | | }, |
| | | sm: { |
| | | span: 15 |
| | | } |
| | | }, |
| | | openTypeData: [], |
| | | isEnableData: [], |
| | | visible: false, |
| | | confirmLoading: false, |
| | | form: this.$form.createForm(this) |
| | | } |
| | | }, |
| | | methods: { |
| | | // 初始化方法 |
| | | edit(record) { |
| | | this.visible = true |
| | | |
| | | |
| | | |
| | | const openTypeOption = this.$options |
| | | this.openTypeData = openTypeOption.filters['dictData']('blog_auth_status') |
| | | const isEnableOption = this.$options |
| | | this.isEnableData = isEnableOption.filters['dictData']('blog_yes_or_no') |
| | | |
| | | this.form.getFieldDecorator('openType', { |
| | | valuePropName: 'checked', |
| | | initialValue: record.openType.toString() |
| | | }) |
| | | this.form.getFieldDecorator('isEnable', { |
| | | valuePropName: 'checked', |
| | | initialValue: record.isEnable.toString() |
| | | }) |
| | | |
| | | setTimeout(() => { |
| | | this.form.setFieldsValue({ |
| | | id: record.id, |
| | | typeName: record.typeName, |
| | | // openType: record.openType, |
| | | topValue: record.topValue, |
| | | // isEnable: record.isEnable |
| | | }) |
| | | |
| | | |
| | | }, 100) |
| | | |
| | | }, |
| | | handleSubmit() { |
| | | const { |
| | | form: { |
| | | validateFields |
| | | } |
| | | } = this |
| | | this.confirmLoading = true |
| | | validateFields((errors, values) => { |
| | | if (!errors) { |
| | | for (const key in values) { |
| | | if (typeof(values[key]) === 'object' && values[key] != null) { |
| | | values[key] = JSON.stringify(values[key]) |
| | | } |
| | | } |
| | | blogArticleTypeEdit(values).then((res) => { |
| | | if (res.success) { |
| | | this.$message.success('编辑成功') |
| | | this.confirmLoading = false |
| | | this.$emit('ok', values) |
| | | this.handleCancel() |
| | | } else { |
| | | this.$message.error('编辑失败') // + res.message |
| | | } |
| | | }).finally((res) => { |
| | | this.confirmLoading = false |
| | | }) |
| | | } else { |
| | | this.confirmLoading = false |
| | | } |
| | | }) |
| | | }, |
| | | handleCancel() { |
| | | this.form.resetFields() |
| | | this.visible = false |
| | | } |
| | | } |
| | | } |
| | | </script> |
New file |
| | |
| | | <template> |
| | | <div> |
| | | <a-card :bordered="false" :bodyStyle="tstyle"> |
| | | <div class="table-page-search-wrapper" v-if="hasPerm('blogArticleType:page')"> |
| | | <a-form layout="inline"> |
| | | <a-row :gutter="48"> |
| | | <a-col :md="8" :sm="24"> |
| | | <a-form-item label="分类名称"> |
| | | <a-input v-model="queryParam.typeName" allow-clear placeholder="请输入分类名称"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | <a-col :md="8" :sm="24"> |
| | | <a-form-item label="公开类型"> |
| | | <a-select style="width: 100%" v-model="queryParam.openType" placeholder="请选择公开类型"> |
| | | <a-select-option v-for="(item,index) in openTypeData" :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="是否启用"> |
| | | <a-select style="width: 100%" v-model="queryParam.isEnable" placeholder="请选择是否启用"> |
| | | <a-select-option v-for="(item,index) in isEnableData" :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-date-picker style="width: 100%" placeholder="请选择创建时间" v-model="queryParam.createDateDate" @change="onChangecreateDate"/> |
| | | </a-form-item> |
| | | </a-col> |
| | | </template> |
| | | <a-col :md="8" :sm="24" > |
| | | <span class="table-page-search-submitButtons"> |
| | | <a-button type="primary" @click="$refs.table.refresh(true)" >查询</a-button> |
| | | <a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button> |
| | | <a @click="toggleAdvanced" style="margin-left: 8px"> |
| | | {{ advanced ? '收起' : '展开' }} |
| | | <a-icon :type="advanced ? 'up' : 'down'"/> |
| | | </a> |
| | | </span> |
| | | </a-col> |
| | | </a-row> |
| | | </a-form> |
| | | </div> |
| | | </a-card> |
| | | <a-card :bordered="false"> |
| | | <s-table |
| | | ref="table" |
| | | :columns="columns" |
| | | :data="loadData" |
| | | :alert="options.alert" |
| | | :rowKey="(record) => record.id" |
| | | :rowSelection="options.rowSelection" |
| | | > |
| | | <template class="table-operator" slot="operator" v-if="hasPerm('blogArticleType:add')" > |
| | | <a-button type="primary" v-if="hasPerm('blogArticleType:add')" icon="plus" @click="$refs.addForm.add()">新增blog文章分类</a-button> |
| | | <a-button type="danger" :disabled="selectedRowKeys.length < 1" v-if="hasPerm('blogArticleType:delete')" @click="batchDelete"><a-icon type="delete"/>批量删除</a-button> |
| | | <x-down |
| | | v-if="hasPerm('blogArticleType:export')" |
| | | ref="batchExport" |
| | | @batchExport="batchExport" |
| | | /> |
| | | </template> |
| | | <span slot="openTypeScopedSlots" slot-scope="text"> |
| | | {{ 'blog_auth_status' | dictType(text) }} |
| | | </span> |
| | | <span slot="isEnableScopedSlots" slot-scope="text"> |
| | | {{ 'blog_yes_or_no' | dictType(text) }} |
| | | </span> |
| | | <span slot="action" slot-scope="text, record"> |
| | | <a v-if="hasPerm('blogArticleType:edit')" @click="$refs.editForm.edit(record)">编辑</a> |
| | | <a-divider type="vertical" v-if="hasPerm('blogArticleType:edit') & hasPerm('blogArticleType:delete')"/> |
| | | <a-popconfirm v-if="hasPerm('blogArticleType:delete')" placement="topRight" title="确认删除?" @confirm="() => singleDelete(record)"> |
| | | <a>删除</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | </s-table> |
| | | <add-form ref="addForm" @ok="handleOk" /> |
| | | <edit-form ref="editForm" @ok="handleOk" /> |
| | | </a-card> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import { STable, XDown } from '@/components' |
| | | import moment from 'moment' |
| | | import { blogArticleTypePage, blogArticleTypeDelete, blogArticleTypeExport } from '@/api/modular/main/blogarticletype/blogArticleTypeManage' |
| | | import addForm from './addForm.vue' |
| | | import editForm from './editForm.vue' |
| | | export default { |
| | | components: { |
| | | STable, |
| | | addForm, |
| | | editForm, |
| | | XDown |
| | | }, |
| | | data () { |
| | | return { |
| | | // 高级搜索 展开/关闭 |
| | | advanced: false, |
| | | // 查询参数 |
| | | queryParam: {}, |
| | | // 表头 |
| | | columns: [ |
| | | { |
| | | title: '分类名称', |
| | | align: 'center', |
| | | dataIndex: 'typeName' |
| | | }, |
| | | { |
| | | title: '公开类型', |
| | | align: 'center', |
| | | dataIndex: 'openType', |
| | | scopedSlots: { customRender: 'openTypeScopedSlots' } |
| | | }, |
| | | { |
| | | title: '是否启用', |
| | | align: 'center', |
| | | dataIndex: 'isEnable', |
| | | scopedSlots: { customRender: 'isEnableScopedSlots' } |
| | | }, |
| | | { |
| | | title: '置顶值', |
| | | align: 'center', |
| | | dataIndex: 'topValue' |
| | | }, |
| | | { |
| | | title: '更新时间', |
| | | align: 'center', |
| | | dataIndex: 'updateDate' |
| | | }, |
| | | { |
| | | title: '创建时间', |
| | | align: 'center', |
| | | dataIndex: 'createDate' |
| | | } |
| | | ], |
| | | tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' }, |
| | | // 加载数据方法 必须为 Promise 对象 |
| | | loadData: parameter => { |
| | | return blogArticleTypePage(Object.assign(parameter, this.switchingDate())).then((res) => { |
| | | return res.data |
| | | }) |
| | | }, |
| | | openTypeData: [], |
| | | isEnableData: [], |
| | | selectedRowKeys: [], |
| | | selectedRows: [], |
| | | options: { |
| | | alert: { show: true, clear: () => { this.selectedRowKeys = [] } }, |
| | | rowSelection: { |
| | | selectedRowKeys: this.selectedRowKeys, |
| | | onChange: this.onSelectChange |
| | | } |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | if (this.hasPerm('blogArticleType:edit') || this.hasPerm('blogArticleType:delete')) { |
| | | this.columns.push({ |
| | | title: '操作', |
| | | width: '150px', |
| | | dataIndex: 'action', |
| | | scopedSlots: { customRender: 'action' } |
| | | }) |
| | | } |
| | | const openTypeOption = this.$options |
| | | this.openTypeData = openTypeOption.filters['dictData']('blog_auth_status') |
| | | const isEnableOption = this.$options |
| | | this.isEnableData = isEnableOption.filters['dictData']('blog_yes_or_no') |
| | | }, |
| | | methods: { |
| | | moment, |
| | | /** |
| | | * 查询参数组装 |
| | | */ |
| | | switchingDate () { |
| | | const queryParamcreateDate = this.queryParam.createDateDate |
| | | if (queryParamcreateDate != null) { |
| | | this.queryParam.createDate = moment(queryParamcreateDate).format('YYYY-MM-DD') |
| | | if (queryParamcreateDate.length < 1) { |
| | | delete this.queryParam.createDate |
| | | } |
| | | } |
| | | const obj = JSON.parse(JSON.stringify(this.queryParam)) |
| | | return obj |
| | | }, |
| | | /** |
| | | * 单个删除 |
| | | */ |
| | | singleDelete (record) { |
| | | const param = [{ 'id': record.id }] |
| | | this.blogArticleTypeDelete(param) |
| | | }, |
| | | /** |
| | | * 批量删除 |
| | | */ |
| | | batchDelete () { |
| | | const paramIds = this.selectedRowKeys.map((d) => { |
| | | return { 'id': d } |
| | | }) |
| | | this.blogArticleTypeDelete(paramIds) |
| | | }, |
| | | blogArticleTypeDelete (record) { |
| | | blogArticleTypeDelete(record).then((res) => { |
| | | if (res.success) { |
| | | this.$message.success('删除成功') |
| | | this.$refs.table.clearRefreshSelected() |
| | | } else { |
| | | this.$message.error('删除失败') // + res.message |
| | | } |
| | | }) |
| | | }, |
| | | toggleAdvanced () { |
| | | this.advanced = !this.advanced |
| | | }, |
| | | onChangecreateDate(date, dateString) { |
| | | this.createDateDateString = dateString |
| | | }, |
| | | /** |
| | | * 批量导出 |
| | | */ |
| | | batchExport () { |
| | | const paramIds = this.selectedRowKeys.map((d) => { |
| | | return { 'id': d } |
| | | }) |
| | | blogArticleTypeExport(paramIds).then((res) => { |
| | | this.$refs.batchExport.downloadfile(res) |
| | | }) |
| | | }, |
| | | handleOk () { |
| | | this.$refs.table.refresh() |
| | | }, |
| | | onSelectChange (selectedRowKeys, selectedRows) { |
| | | this.selectedRowKeys = selectedRowKeys |
| | | this.selectedRows = selectedRows |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style lang="less"> |
| | | .table-operator { |
| | | margin-bottom: 18px; |
| | | } |
| | | button { |
| | | margin-right: 8px; |
| | | } |
| | | </style> |
| | |
| | | |
| | | private static final String UPDATE_TIME = "updateTime"; |
| | | |
| | | |
| | | //自定义 |
| | | private static final String CREATE_DATE = "createDate"; |
| | | |
| | | private static final String UPDATE_DATE = "updateDate"; |
| | | |
| | | @Override |
| | | public void insertFill(MetaObject metaObject) { |
| | | try { |
| | | |
| | | Object updateDate = metaObject.getValue(UPDATE_DATE); |
| | | if(ObjectUtil.isNull(updateDate)) { |
| | | setFieldValByName(UPDATE_DATE, new Date(), metaObject); |
| | | } |
| | | |
| | | Object createDate = metaObject.getValue(CREATE_DATE); |
| | | if(ObjectUtil.isNull(createDate)) { |
| | | setFieldValByName(CREATE_DATE, new Date(), metaObject); |
| | | } |
| | | |
| | | //为空则设置createUser(BaseEntity) |
| | | Object createUser = metaObject.getValue(CREATE_USER); |
| | | if(ObjectUtil.isNull(createUser)) { |
| | |
| | | if(ObjectUtil.isNull(createTime)) { |
| | | setFieldValByName(CREATE_TIME, new Date(), metaObject); |
| | | } |
| | | |
| | | } catch (ReflectionException e) { |
| | | log.warn(">>> CustomMetaObjectHandler处理过程中无相关字段,不做处理"); |
| | | } |
| | |
| | | @Override |
| | | public void updateFill(MetaObject metaObject) { |
| | | try { |
| | | setFieldValByName(UPDATE_DATE, new Date(), metaObject); |
| | | |
| | | //设置updateUser(BaseEntity) |
| | | setFieldValByName(UPDATE_USER, this.getUserUniqueId(), metaObject); |
| | | //设置updateTime(BaseEntity) |
| | | setFieldValByName(UPDATE_TIME, new Date(), metaObject); |
| | | |
| | | } catch (ReflectionException e) { |
| | | log.warn(">>> CustomMetaObjectHandler处理过程中无相关字段,不做处理"); |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.controller; |
| | | |
| | | import vip.xiaonuo.core.annotion.BusinessLog; |
| | | import vip.xiaonuo.core.annotion.Permission; |
| | | import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum; |
| | | import vip.xiaonuo.core.pojo.response.ResponseData; |
| | | import vip.xiaonuo.core.pojo.response.SuccessResponseData; |
| | | import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeParam; |
| | | import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * blog文章分类控制器 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @RestController |
| | | public class BlogArticleTypeController { |
| | | |
| | | @Resource |
| | | private BlogArticleTypeService blogArticleTypeService; |
| | | |
| | | /** |
| | | * 查询blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @GetMapping("/blogArticleType/page") |
| | | @BusinessLog(title = "blog文章分类_查询", opType = LogAnnotionOpTypeEnum.QUERY) |
| | | public ResponseData page(BlogArticleTypeParam blogArticleTypeParam) { |
| | | return new SuccessResponseData(blogArticleTypeService.page(blogArticleTypeParam)); |
| | | } |
| | | |
| | | /** |
| | | * 添加blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @PostMapping("/blogArticleType/add") |
| | | @BusinessLog(title = "blog文章分类_增加", opType = LogAnnotionOpTypeEnum.ADD) |
| | | public ResponseData add(@RequestBody @Validated(BlogArticleTypeParam.add.class) BlogArticleTypeParam blogArticleTypeParam) { |
| | | blogArticleTypeService.add(blogArticleTypeParam); |
| | | return new SuccessResponseData(); |
| | | } |
| | | |
| | | /** |
| | | * 删除blog文章分类,可批量删除 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @PostMapping("/blogArticleType/delete") |
| | | @BusinessLog(title = "blog文章分类_删除", opType = LogAnnotionOpTypeEnum.DELETE) |
| | | public ResponseData delete(@RequestBody @Validated(BlogArticleTypeParam.delete.class) List<BlogArticleTypeParam> blogArticleTypeParamList) { |
| | | blogArticleTypeService.delete(blogArticleTypeParamList); |
| | | return new SuccessResponseData(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @PostMapping("/blogArticleType/edit") |
| | | @BusinessLog(title = "blog文章分类_编辑", opType = LogAnnotionOpTypeEnum.EDIT) |
| | | public ResponseData edit(@RequestBody @Validated(BlogArticleTypeParam.edit.class) BlogArticleTypeParam blogArticleTypeParam) { |
| | | blogArticleTypeService.edit(blogArticleTypeParam); |
| | | return new SuccessResponseData(); |
| | | } |
| | | |
| | | /** |
| | | * 查看blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @GetMapping("/blogArticleType/detail") |
| | | @BusinessLog(title = "blog文章分类_查看", opType = LogAnnotionOpTypeEnum.DETAIL) |
| | | public ResponseData detail(@Validated(BlogArticleTypeParam.detail.class) BlogArticleTypeParam blogArticleTypeParam) { |
| | | return new SuccessResponseData(blogArticleTypeService.detail(blogArticleTypeParam)); |
| | | } |
| | | |
| | | /** |
| | | * blog文章分类列表 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @GetMapping("/blogArticleType/list") |
| | | @BusinessLog(title = "blog文章分类_列表", opType = LogAnnotionOpTypeEnum.QUERY) |
| | | public ResponseData list(BlogArticleTypeParam blogArticleTypeParam) { |
| | | return new SuccessResponseData(blogArticleTypeService.list(blogArticleTypeParam)); |
| | | } |
| | | |
| | | /** |
| | | * 导出系统用户 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Permission |
| | | @GetMapping("/blogArticleType/export") |
| | | @BusinessLog(title = "blog文章分类_导出", opType = LogAnnotionOpTypeEnum.EXPORT) |
| | | public void export(BlogArticleTypeParam blogArticleTypeParam) { |
| | | blogArticleTypeService.export(blogArticleTypeParam); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.entity; |
| | | |
| | | import cn.afterturn.easypoi.excel.annotation.Excel; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Data |
| | | @TableName("blog_article_type") |
| | | public class BlogArticleType { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(type = IdType.ASSIGN_ID) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 分类名称 |
| | | */ |
| | | @Excel(name = "分类名称") |
| | | private String typeName; |
| | | |
| | | /** |
| | | * 公开类型 |
| | | */ |
| | | @Excel(name = "公开类型") |
| | | private Integer openType; |
| | | |
| | | /** |
| | | * 是否启用 |
| | | */ |
| | | @Excel(name = "是否启用") |
| | | private Integer isEnable; |
| | | |
| | | @Excel(name = "置顶值(越小越靠前)") |
| | | private Integer topValue; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | @Excel(name = "更新时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) |
| | | @TableField(fill = FieldFill.INSERT_UPDATE) |
| | | private Date updateDate; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | @Excel(name = "创建时间", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20) |
| | | @TableField(fill = FieldFill.INSERT) |
| | | private Date createDate; |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.enums; |
| | | |
| | | import vip.xiaonuo.core.annotion.ExpEnumType; |
| | | import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum; |
| | | import vip.xiaonuo.core.factory.ExpEnumCodeFactory; |
| | | import vip.xiaonuo.sys.core.consts.SysExpEnumConstant; |
| | | |
| | | /** |
| | | * blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE) |
| | | public enum BlogArticleTypeExceptionEnum implements AbstractBaseExceptionEnum { |
| | | |
| | | /** |
| | | * 数据不存在 |
| | | */ |
| | | NOT_EXIST(1, "此数据不存在"); |
| | | |
| | | private final Integer code; |
| | | |
| | | private final String message; |
| | | BlogArticleTypeExceptionEnum(Integer code, String message) { |
| | | this.code = code; |
| | | this.message = message; |
| | | } |
| | | |
| | | @Override |
| | | public Integer getCode() { |
| | | return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code); |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return message; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType; |
| | | |
| | | /** |
| | | * blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | public interface BlogArticleTypeMapper extends BaseMapper<BlogArticleType> { |
| | | } |
New file |
| | |
| | | <?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="vip.xiaonuo.modular.blogarticletype.mapper.BlogArticleTypeMapper"> |
| | | |
| | | </mapper> |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.param; |
| | | |
| | | import lombok.Data; |
| | | import vip.xiaonuo.core.pojo.base.param.BaseParam; |
| | | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | |
| | | /** |
| | | * blog文章分类参数类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Data |
| | | public class BlogArticleTypeParam extends BaseParam { |
| | | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @NotNull(message = "主键不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class}) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 分类名称 |
| | | */ |
| | | @NotBlank(message = "分类名称不能为空,请检查typeName参数", groups = {add.class, edit.class}) |
| | | private String typeName; |
| | | |
| | | /** |
| | | * 公开类型 |
| | | */ |
| | | @NotNull(message = "公开类型不能为空,请检查openType参数", groups = {add.class, edit.class}) |
| | | private Integer openType; |
| | | |
| | | /** |
| | | * 置顶值 |
| | | */ |
| | | @NotNull(message = "置顶值,请检查topValue参数", groups = {add.class, edit.class}) |
| | | private Integer topValue; |
| | | |
| | | /** |
| | | * 是否启用 |
| | | */ |
| | | @NotNull(message = "是否启用不能为空,请检查isEnable参数", groups = {add.class, edit.class}) |
| | | private Integer isEnable; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private String updateDate; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private String createDate; |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import vip.xiaonuo.core.pojo.page.PageResult; |
| | | import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType; |
| | | import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeParam; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * blog文章分类service接口 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | public interface BlogArticleTypeService extends IService<BlogArticleType> { |
| | | |
| | | /** |
| | | * 查询blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | PageResult<BlogArticleType> page(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | /** |
| | | * blog文章分类列表 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | List<BlogArticleType> list(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | /** |
| | | * 添加blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | void add(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | /** |
| | | * 删除blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | void delete(List<BlogArticleTypeParam> blogArticleTypeParamList); |
| | | |
| | | /** |
| | | * 编辑blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | void edit(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | /** |
| | | * 查看blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | BlogArticleType detail(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | /** |
| | | * 导出blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | void export(BlogArticleTypeParam blogArticleTypeParam); |
| | | |
| | | } |
New file |
| | |
| | | /* |
| | | Copyright [2020] [https://www.xiaonuo.vip] |
| | | |
| | | Licensed under the Apache License, Version 2.0 (the "License"); |
| | | you may not use this file except in compliance with the License. |
| | | You may obtain a copy of the License at |
| | | |
| | | http://www.apache.org/licenses/LICENSE-2.0 |
| | | |
| | | Unless required by applicable law or agreed to in writing, software |
| | | distributed under the License is distributed on an "AS IS" BASIS, |
| | | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| | | See the License for the specific language governing permissions and |
| | | limitations under the License. |
| | | |
| | | Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: |
| | | |
| | | 1.请不要删除和修改根目录下的LICENSE文件。 |
| | | 2.请不要删除和修改Snowy源码头部的版权声明。 |
| | | 3.请保留源码和相关描述文件的项目出处,作者声明等。 |
| | | 4.分发源码时候,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/xiaonuobase/snowy |
| | | 6.若您的项目无法满足以上几点,可申请商业授权,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip |
| | | */ |
| | | package vip.xiaonuo.modular.blogarticletype.service.impl; |
| | | |
| | | 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 vip.xiaonuo.core.exception.ServiceException; |
| | | import vip.xiaonuo.core.factory.PageFactory; |
| | | import vip.xiaonuo.core.pojo.page.PageResult; |
| | | import vip.xiaonuo.core.util.PoiUtil; |
| | | import vip.xiaonuo.modular.blogarticletype.entity.BlogArticleType; |
| | | import vip.xiaonuo.modular.blogarticletype.enums.BlogArticleTypeExceptionEnum; |
| | | import vip.xiaonuo.modular.blogarticletype.mapper.BlogArticleTypeMapper; |
| | | import vip.xiaonuo.modular.blogarticletype.param.BlogArticleTypeParam; |
| | | import vip.xiaonuo.modular.blogarticletype.service.BlogArticleTypeService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * blog文章分类service接口实现类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | @Service |
| | | public class BlogArticleTypeServiceImpl extends ServiceImpl<BlogArticleTypeMapper, BlogArticleType> implements BlogArticleTypeService { |
| | | |
| | | @Override |
| | | public PageResult<BlogArticleType> page(BlogArticleTypeParam blogArticleTypeParam) { |
| | | QueryWrapper<BlogArticleType> queryWrapper = new QueryWrapper<>(); |
| | | if (ObjectUtil.isNotNull(blogArticleTypeParam)) { |
| | | |
| | | // 根据分类名称 查询 |
| | | if (ObjectUtil.isNotEmpty(blogArticleTypeParam.getTypeName())) { |
| | | queryWrapper.lambda().like(BlogArticleType::getTypeName, blogArticleTypeParam.getTypeName()); |
| | | } |
| | | // 根据公开类型 查询 |
| | | if (ObjectUtil.isNotEmpty(blogArticleTypeParam.getOpenType())) { |
| | | queryWrapper.lambda().eq(BlogArticleType::getOpenType, blogArticleTypeParam.getOpenType()); |
| | | } |
| | | // 根据是否启用 查询 |
| | | if (ObjectUtil.isNotEmpty(blogArticleTypeParam.getIsEnable())) { |
| | | queryWrapper.lambda().eq(BlogArticleType::getIsEnable, blogArticleTypeParam.getIsEnable()); |
| | | } |
| | | // 根据创建时间 查询 |
| | | if (ObjectUtil.isNotEmpty(blogArticleTypeParam.getCreateDate())) { |
| | | queryWrapper.lambda().eq(BlogArticleType::getCreateDate, blogArticleTypeParam.getCreateDate()); |
| | | } |
| | | } |
| | | return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public List<BlogArticleType> list(BlogArticleTypeParam blogArticleTypeParam) { |
| | | return this.list(); |
| | | } |
| | | |
| | | @Override |
| | | public void add(BlogArticleTypeParam blogArticleTypeParam) { |
| | | BlogArticleType blogArticleType = new BlogArticleType(); |
| | | BeanUtil.copyProperties(blogArticleTypeParam, blogArticleType); |
| | | this.save(blogArticleType); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void delete(List<BlogArticleTypeParam> blogArticleTypeParamList) { |
| | | blogArticleTypeParamList.forEach(blogArticleTypeParam -> { |
| | | this.removeById(blogArticleTypeParam.getId()); |
| | | }); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void edit(BlogArticleTypeParam blogArticleTypeParam) { |
| | | BlogArticleType blogArticleType = this.queryBlogArticleType(blogArticleTypeParam); |
| | | BeanUtil.copyProperties(blogArticleTypeParam, blogArticleType); |
| | | this.updateById(blogArticleType); |
| | | } |
| | | |
| | | @Override |
| | | public BlogArticleType detail(BlogArticleTypeParam blogArticleTypeParam) { |
| | | return this.queryBlogArticleType(blogArticleTypeParam); |
| | | } |
| | | |
| | | /** |
| | | * 获取blog文章分类 |
| | | * |
| | | * @author inleft |
| | | * @date 2022-02-15 15:17:15 |
| | | */ |
| | | private BlogArticleType queryBlogArticleType(BlogArticleTypeParam blogArticleTypeParam) { |
| | | BlogArticleType blogArticleType = this.getById(blogArticleTypeParam.getId()); |
| | | if (ObjectUtil.isNull(blogArticleType)) { |
| | | throw new ServiceException(BlogArticleTypeExceptionEnum.NOT_EXIST); |
| | | } |
| | | return blogArticleType; |
| | | } |
| | | |
| | | @Override |
| | | public void export(BlogArticleTypeParam blogArticleTypeParam) { |
| | | List<BlogArticleType> list = this.list(blogArticleTypeParam); |
| | | PoiUtil.exportExcelWithStream("SnowyBlogArticleType.xls", BlogArticleType.class, list); |
| | | } |
| | | |
| | | } |