¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '../../utils/request' |
| | | |
| | | // æ¥è¯¢ |
| | | export function fetchList (data) { |
| | | return request.post('/business/companyDocuments/page', data, { |
| | | trim: true |
| | | }) |
| | | } |
| | | |
| | | // å建 |
| | | export function create (data) { |
| | | return request.post('/business/companyDocuments/create', data) |
| | | } |
| | | |
| | | // ä¿®æ¹ |
| | | export function updateById (data) { |
| | | return request.post('/business/companyDocuments/updateById', data) |
| | | } |
| | | |
| | | // å é¤ |
| | | export function deleteById (id) { |
| | | return request.get(`/business/companyDocuments/delete/${id}`) |
| | | } |
| | | |
| | | // æ¹éå é¤ |
| | | export function deleteByIdInBatch (ids) { |
| | | return request.get('/business/companyDocuments/delete/batch', { |
| | | params: { |
| | | ids |
| | | } |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <GlobalWindow |
| | | :title="title" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <el-form :model="form" ref="form" :rules="rules"> |
| | | <el-form-item label="èµæåç§°" prop="name"> |
| | | <el-input v-model="form.name" placeholder="请è¾å
¥èµæåç§°" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="èµæç±»å" prop="categoryId"> |
| | | <el-input v-model="form.categoryId" placeholder="请è¾å
¥è´£ä»»é¨é¨ç¼ç (å
³ècompany)" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="责任é¨é¨" prop="companyId"> |
| | | <el-input v-model="form.companyId" placeholder="请è¾å
¥è´£ä»»é¨é¨ç¼ç (å
³ècompany)" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="æåºç " prop="sortnum"> |
| | | <el-input v-model="form.sortnum" placeholder="请è¾å
¥æåºç " v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="éä»¶å°å" prop="fileurl"> |
| | | <el-input v-model="form.fileurl" placeholder="请è¾å
¥éä»¶å°å" v-trim/> |
| | | </el-form-item> |
| | | <el-form-item label="éä»¶æè¿°" prop="content"> |
| | | <el-input type="textarea" v-model="form.content" placeholder="请è¾å
¥éä»¶æè¿°" v-trim/> |
| | | </el-form-item> |
| | | </el-form> |
| | | </GlobalWindow> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | export default { |
| | | name: 'OperaCompanyDocumentsWindow', |
| | | extends: BaseOpera, |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | return { |
| | | // è¡¨åæ°æ® |
| | | form: { |
| | | id: null, |
| | | creator: '', |
| | | createDate: '', |
| | | editor: '', |
| | | editDate: '', |
| | | isdeleted: '', |
| | | name: '', |
| | | remark: '', |
| | | status: '', |
| | | sortnum: '', |
| | | fileurl: '', |
| | | fileName: '', |
| | | fileSize: '', |
| | | categoryId: '', |
| | | companyId: '', |
| | | content: '' |
| | | }, |
| | | // éªè¯è§å |
| | | rules: { |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | api: '/business/companyDocuments', |
| | | 'field.id': 'id' |
| | | }) |
| | | } |
| | | } |
| | | </script> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="file"> |
| | | <div class="file_list"> |
| | | <div class="file_list_item" :style="{width: width, height: height}" v-for="(item, index) in list" :key="index"> |
| | | <div class="dele" @click="deleItem(index)"> |
| | | <i class="el-icon-close"></i> |
| | | </div> |
| | | <img :src="item.url" v-if="fileType(item.url) === 'img'" /> |
| | | <video controls autoplay :src="item.url" v-else></video> |
| | | </div> |
| | | <div class="file_list_item" :style="{width: width, height: height, cursor: 'pointer'}" @click="$refs.file.click()"> |
| | | <i class="el-icon-plus"></i> |
| | | </div> |
| | | </div> |
| | | <div style="display: block;"> |
| | | <input type="file" ref="file" :accept="accept" @change="getFile" /> |
| | | <!-- <progress id="progressBar" value="0" max="100" ></progress>--> |
| | | <!-- <span id="status">0%</span>--> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import axios from 'axios' |
| | | export default { |
| | | props: { |
| | | width: { |
| | | type: String, |
| | | default: '90px' |
| | | }, |
| | | height: { |
| | | type: String, |
| | | default: '90px' |
| | | }, |
| | | list: { |
| | | type: Array, |
| | | // eslint-disable-next-line vue/require-valid-default-prop |
| | | default: [] |
| | | }, |
| | | accept: { |
| | | type: String, |
| | | default: '' |
| | | }, |
| | | folder: { |
| | | type: String, |
| | | default: '' |
| | | } |
| | | }, |
| | | data () { |
| | | return { |
| | | loading:null, |
| | | uuid: null, |
| | | timer: null, |
| | | message:'å¼å§ä¸ä¼ ', |
| | | uploadImgUrl: process.env.VUE_APP_API_PREFIX + '/public/upload', |
| | | uploadProgressUrl: process.env.VUE_APP_API_PREFIX + '/public' |
| | | } |
| | | }, |
| | | |
| | | methods: { |
| | | fileType (url) { |
| | | if (url.indexOf('.mp4') !== -1) { |
| | | return 'video' |
| | | } else { |
| | | return 'img' |
| | | } |
| | | }, |
| | | getFile (e) { |
| | | if (e.target && e.target.files.length > 0) { |
| | | var that = this |
| | | const config = { |
| | | onUploadProgress: function (progressEvent) { |
| | | console.log(progressEvent) |
| | | const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total) |
| | | // document.getElementById('progressBar').value = percentCompleted |
| | | // document.getElementById('status').textContent = 'åå¤' + percentCompleted + '%' |
| | | that.loading.setText('ä¸ä¼ ä¸ã ' + percentCompleted + ' ã%') |
| | | }, |
| | | headers: { |
| | | 'Content-Type': 'multipart/form-data' |
| | | } |
| | | } |
| | | this.loading = this.$loading({ |
| | | lock: true, |
| | | text: 'ä¸ä¼ ä¸ï¼è¯·çå¾
', |
| | | spinner: 'el-icon-loading', |
| | | customClass: 'loadingclz', |
| | | background: 'rgba(0, 0, 0, 0.7)' |
| | | }) |
| | | this.$emit('loading') |
| | | const formdate = new FormData() |
| | | this.uuid = this.generateUUID().replaceAll('-', '') |
| | | formdate.append('file', e.target.files[0]) |
| | | formdate.append('folder', this.folder) |
| | | formdate.append('uuid', this.uuid) |
| | | axios.post(this.uploadImgUrl, formdate, config) |
| | | .then(res => { |
| | | if(res.data.data == null || res.data.data.imgaddr == null){ |
| | | this.$message.error('æ°æ®ä¸ä¼ 失败ï¼') |
| | | }else{ |
| | | this.$emit('success', res.data.data) |
| | | } |
| | | }) |
| | | .catch(e => { |
| | | if(this.timer){ |
| | | clearInterval(this.timer) |
| | | } |
| | | this.$message.error(e) |
| | | }) |
| | | .finally(() => { |
| | | if(this.timer){ |
| | | clearInterval(this.timer) |
| | | } |
| | | that.loading.close() |
| | | this.$refs.file.value = null |
| | | }) |
| | | this.startProgress() |
| | | } |
| | | }, |
| | | startProgress () { |
| | | }, |
| | | generateUUID () { |
| | | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { |
| | | const r = (Math.random() * 16) | 0 |
| | | const v = c === 'x' ? r : (r & 0x3) | 0x8 |
| | | return v.toString(16) |
| | | }) |
| | | }, |
| | | deleItem (index) { |
| | | this.$emit('dele', index) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | <style> |
| | | .loadingclz { |
| | | .el-loading-text{ |
| | | font-size: 18px !important; |
| | | color: #2977f8 !important; |
| | | } |
| | | .el-loading-spinner i { |
| | | color: #2977f8 !important; |
| | | } |
| | | } |
| | | </style> |
| | | <style lang="scss" scoped> |
| | | .file { |
| | | /*width: 100%;*/ |
| | | /*height: 90px;*/ |
| | | padding: 10px; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | position: relative; |
| | | margin-bottom: 10px; |
| | | /* margin-right: 20px; */ |
| | | /* margin: 10px 0;*/ |
| | | input { |
| | | opacity: 0; |
| | | } |
| | | .file_list { |
| | | width: 100%; |
| | | height: 100%; |
| | | display: flex; |
| | | align-items: center; |
| | | flex-wrap: wrap; |
| | | .file_list_item { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | overflow: hidden; |
| | | border-radius: 5px; |
| | | border: 1px solid #d5d5d5; |
| | | margin-left: 15px; |
| | | position: relative; |
| | | &:first-child { |
| | | margin: 0 !important; |
| | | } |
| | | .dele { |
| | | position: absolute; |
| | | right: 0; |
| | | top: 0; |
| | | width: 20px; |
| | | height: 20px; |
| | | background: red; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | cursor: pointer; |
| | | .el-icon-close { |
| | | color: #ffffff; |
| | | font-size: 19px; |
| | | } |
| | | } |
| | | .el-icon-plus { |
| | | font-size: 30px; |
| | | color: black; |
| | | } |
| | | img { |
| | | width: 100%; |
| | | } |
| | | video { |
| | | width: 100%; |
| | | height: 100%; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </style> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <TableLayout :permissions="['business:companydocuments:query']"> |
| | | <!-- æç´¢è¡¨å --> |
| | | <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline> |
| | | <el-form-item label="èµæåç§°" prop="name"> |
| | | <el-input v-model="searchForm.name" placeholder="请è¾å
¥èµæåç§°" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="管çé¨é¨" prop="companyName"> |
| | | <el-input v-model="searchForm.companyName" clearable placeholder="请è¾å
¥ç®¡çé¨é¨" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="èµæç±»å" prop="categoryId"> |
| | | <el-input v-model="searchForm.categoryId" clearable placeholder="è¯·éæ©èµæç±»å" @keypress.enter.native="search"></el-input> |
| | | </el-form-item> |
| | | <section> |
| | | <el-button type="primary" @click="search">æç´¢</el-button> |
| | | <el-button @click="reset">éç½®</el-button> |
| | | </section> |
| | | </el-form> |
| | | <!-- è¡¨æ ¼åå页 --> |
| | | <template v-slot:table-wrap> |
| | | <ul class="toolbar" v-permissions="['business:companydocuments:create', 'business:companydocuments:delete']"> |
| | | <li><el-button type="primary" @click="$refs.operaCompanyDocumentsWindow.open('æ°å¢èµæ')" icon="el-icon-plus" v-permissions="['business:companydocuments:create']">æ°å»º</el-button></li> |
| | | <li><el-button @click="deleteByIdInBatch" icon="el-icon-delete" v-permissions="['business:companydocuments:delete']">å é¤</el-button></li> |
| | | </ul> |
| | | <el-table |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | stripe |
| | | @selection-change="handleSelectionChange" |
| | | > |
| | | <el-table-column type="selection" width="55"></el-table-column> |
| | | <el-table-column prop="name" label="èµæåç§°" min-width="150px"></el-table-column> |
| | | <el-table-column prop="categoryName" label="èµæç±»å" min-width="100px"></el-table-column> |
| | | <el-table-column prop="content" label="éä»¶æè¿°" min-width="200px"></el-table-column> |
| | | <el-table-column prop="companyName" label="管çé¨é¨" min-width="150px"></el-table-column> |
| | | <el-table-column prop="sortnum" label="æåºç (ååº)" min-width="100px"></el-table-column> |
| | | <el-table-column prop="createDate" label="å建æ¶é´" min-width="150px"></el-table-column> |
| | | <el-table-column prop="creatorName" label="å建人" min-width="100px"></el-table-column> |
| | | <!-- <el-table-column prop="fileName" label="éä»¶åç§°" min-width="100px"></el-table-column> |
| | | <el-table-column prop="fileSize" label="é件大å°" min-width="100px"></el-table-column>--> |
| | | <el-table-column |
| | | v-if="containPermissions(['business:companydocuments:update', 'business:companydocuments:delete'])" |
| | | label="æä½" |
| | | min-width="120" |
| | | fixed="right" |
| | | > |
| | | <template slot-scope="{row}"> |
| | | <el-button type="text" @click="$refs.operaCompanyDocumentsWindow.open('ç¼è¾èµæ', row)" icon="el-icon-edit" v-permissions="['business:companydocuments:update']">ç¼è¾</el-button> |
| | | <el-button type="text" v-if="row.fileurlFull" @click="download(row)" icon="el-icon-download" v-permissions="['business:companydocuments:download']">ä¸è½½</el-button> |
| | | <el-button type="text" @click="deleteById(row)" icon="el-icon-delete" v-permissions="['business:companydocuments:delete']">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <pagination |
| | | @size-change="handleSizeChange" |
| | | @current-change="handlePageChange" |
| | | :pagination="tableData.pagination" |
| | | > |
| | | </pagination> |
| | | </template> |
| | | <!-- æ°å»º/ä¿®æ¹ --> |
| | | <OperaCompanyDocumentsWindow ref="operaCompanyDocumentsWindow" @success="handlePageChange"/> |
| | | </TableLayout> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseTable from '@/components/base/BaseTable' |
| | | import TableLayout from '@/layouts/TableLayout' |
| | | import Pagination from '@/components/common/Pagination' |
| | | import OperaCompanyDocumentsWindow from '@/components/business/OperaCompanyDocumentsWindow' |
| | | export default { |
| | | name: 'CompanyDocuments', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaCompanyDocumentsWindow }, |
| | | data () { |
| | | return { |
| | | // æç´¢ |
| | | searchForm: { |
| | | name: '', |
| | | categoryId: '', |
| | | companyId: '' |
| | | } |
| | | } |
| | | }, |
| | | created () { |
| | | this.config({ |
| | | module: 'èµæç®¡ç', |
| | | api: '/business/companyDocuments', |
| | | 'field.id': 'id', |
| | | 'field.main': 'id' |
| | | }) |
| | | this.search() |
| | | }, |
| | | methods:{ |
| | | download(row){ |
| | | if(row.fileurlFull){ |
| | | window.open(row.fileurlFull) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | |
| | | @click="exportExcel">导åº</el-button> |
| | | </li> |
| | | </ul> |
| | | <el-table |
| | | :height="tableHeightNew" |
| | | <el-table :height="tableHeightNew+10" |
| | | v-loading="isWorking.search" |
| | | :data="tableData.list" |
| | | stripe |
| | |
| | | export default { |
| | | name: 'InoutRecord', |
| | | extends: BaseTable, |
| | | components: { TableLayout, Pagination, OperaInoutRecordWindow }, |
| | | components: { TableLayout, Pagination, OperaInoutRecordWindow }, |
| | | data () { |
| | | return { |
| | | // æç´¢ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:companydocuments:create', 'æ°å»ºéæ£åºåé
置类åä¿¡æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:companydocuments:delete', 'å é¤éæ£åºåé
置类åä¿¡æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:companydocuments:update', 'ä¿®æ¹éæ£åºåé
置类åä¿¡æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:companydocuments:query', 'æ¥è¯¢éæ£åºåé
置类åä¿¡æ¯è¡¨', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | INSERT INTO `SYSTEM_PERMISSION`(`CODE`, `NAME`, `REMARK`, `FIXED`, `CREATE_USER`, `CREATE_TIME`, `UPDATE_USER`, `UPDATE_TIME`, `DELETED`) VALUES ('business:companydocuments:exportExcel', '导åºéæ£åºåé
置类åä¿¡æ¯è¡¨(Excel)', '', 0, 1, CURRENT_TIMESTAMP, NULL, NULL, 0); |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.business; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.dao.business.model.CompanyDocuments; |
| | | import com.doumee.service.business.CompanyDocumentsService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | @Api(tags = "鿣åºåé
置类åä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping("/business/companyDocuments") |
| | | public class CompanyDocumentsController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompanyDocumentsService companyDocumentsService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("business:companydocuments:create") |
| | | public ApiResponse create(@RequestBody CompanyDocuments companyDocuments) { |
| | | return ApiResponse.success(companyDocumentsService.create(companyDocuments)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("business:companydocuments:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | companyDocumentsService.deleteById(id,this.getLoginUser(null)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("business:companydocuments:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | companyDocumentsService.deleteByIdInBatch(idList,this.getLoginUser(null)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("business:companydocuments:update") |
| | | public ApiResponse updateById(@RequestBody CompanyDocuments companyDocuments) { |
| | | companyDocumentsService.updateById(companyDocuments); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("business:companydocuments:query") |
| | | public ApiResponse<PageData<CompanyDocuments>> findPage (@RequestBody PageWrap<CompanyDocuments> pageWrap) { |
| | | return ApiResponse.success(companyDocumentsService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @RequiresPermissions("business:companydocuments:exportExcel") |
| | | public void exportExcel (@RequestBody PageWrap<CompanyDocuments> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(CompanyDocuments.class).export(companyDocumentsService.findPage(pageWrap).getRecords(), "鿣åºåé
置类åä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @RequiresPermissions("business:companydocuments:query") |
| | | public ApiResponse findById(@PathVariable Integer id) { |
| | | return ApiResponse.success(companyDocumentsService.findById(id)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.cloud.admin; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.config.annotation.CloudRequiredPermission; |
| | | import com.doumee.core.annotation.excel.ExcelExporter; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.dao.business.model.CompanyDocuments; |
| | | import com.doumee.service.business.CompanyDocumentsService; |
| | | import com.doumee.service.business.third.model.ApiResponse; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | @Api(tags = "鿣åºåé
置类åä¿¡æ¯è¡¨") |
| | | @RestController |
| | | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/companyDocuments") |
| | | public class CompanyDocumentsCloudController extends BaseController { |
| | | |
| | | @Autowired |
| | | private CompanyDocumentsService companyDocumentsService; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @CloudRequiredPermission("business:companydocuments:create") |
| | | public ApiResponse create(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody CompanyDocuments companyDocuments) { |
| | | companyDocuments.setLoginUserInfo(this.getLoginUser(token)); |
| | | return ApiResponse.success(companyDocumentsService.create(companyDocuments)); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDå é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @CloudRequiredPermission("business:companydocuments:delete") |
| | | public ApiResponse deleteById(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@PathVariable Integer id) { |
| | | companyDocumentsService.deleteById(id,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @CloudRequiredPermission("business:companydocuments:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | companyDocumentsService.deleteByIdInBatch(idList,this.getLoginUser(token)); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @CloudRequiredPermission("business:companydocuments:update") |
| | | public ApiResponse updateById(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody CompanyDocuments companyDocuments) { |
| | | companyDocuments.setLoginUserInfo(this.getLoginUser(token)); |
| | | companyDocumentsService.updateById(companyDocuments); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @CloudRequiredPermission("business:companydocuments:query") |
| | | public ApiResponse<PageData<CompanyDocuments>> findPage (@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody PageWrap<CompanyDocuments> pageWrap) { |
| | | return ApiResponse.success(companyDocumentsService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("导åºExcel") |
| | | @PostMapping("/exportExcel") |
| | | @CloudRequiredPermission("business:companydocuments:exportExcel") |
| | | public void exportExcel (@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@RequestBody PageWrap<CompanyDocuments> pageWrap, HttpServletResponse response) { |
| | | ExcelExporter.build(CompanyDocuments.class).export(companyDocumentsService.findPage(pageWrap).getRecords(), "鿣åºåé
置类åä¿¡æ¯è¡¨", response); |
| | | } |
| | | |
| | | @ApiOperation("æ ¹æ®IDæ¥è¯¢") |
| | | @GetMapping("/{id}") |
| | | @CloudRequiredPermission("business:companydocuments:query") |
| | | public ApiResponse findById(@RequestHeader(Constants.HEADER_USER_TOKEN) String token,@PathVariable Integer id) { |
| | | return ApiResponse.success(companyDocumentsService.findById(id)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.doumee.dao.business.model.CompanyDocuments; |
| | | |
| | | /** |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | public interface CompanyDocumentsMapper extends BaseMapper<CompanyDocuments> { |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.dao.business.model; |
| | | |
| | | import com.doumee.core.annotation.excel.ExcelColumn; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import lombok.Data; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 鿣åºåé
置类åä¿¡æ¯è¡¨ |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | @Data |
| | | @ApiModel("鿣åºåé
置类åä¿¡æ¯è¡¨") |
| | | @TableName("`company_documents`") |
| | | public class CompanyDocuments extends LoginUserModel { |
| | | |
| | | @TableId(type = IdType.AUTO) |
| | | @ApiModelProperty(value = "主é®", example = "1") |
| | | @ExcelColumn(name="主é®") |
| | | private Integer id; |
| | | |
| | | @ApiModelProperty(value = "å建人ç¼ç ", example = "1") |
| | | @ExcelColumn(name="å建人ç¼ç ") |
| | | private Integer creator; |
| | | |
| | | @ApiModelProperty(value = "å建æ¶é´") |
| | | @ExcelColumn(name="å建æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date createDate; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°äººç¼ç ", example = "1") |
| | | @ExcelColumn(name="æ´æ°äººç¼ç ") |
| | | private Integer editor; |
| | | |
| | | @ApiModelProperty(value = "æ´æ°æ¶é´") |
| | | @ExcelColumn(name="æ´æ°æ¶é´") |
| | | @JsonFormat(pattern = "yyyy-MM-dd") |
| | | private Date editDate; |
| | | |
| | | @ApiModelProperty(value = "æ¯å¦å é¤0å¦ 1æ¯", example = "1") |
| | | @ExcelColumn(name="æ¯å¦å é¤0å¦ 1æ¯") |
| | | private Integer isdeleted; |
| | | |
| | | @ApiModelProperty(value = "åç§°") |
| | | @ExcelColumn(name="åç§°") |
| | | private String name; |
| | | |
| | | @ApiModelProperty(value = "夿³¨") |
| | | @ExcelColumn(name="夿³¨") |
| | | private String remark; |
| | | |
| | | @ApiModelProperty(value = "ç¶æ 0å¯ç¨ 1ç¦ç¨", example = "1") |
| | | @ExcelColumn(name="ç¶æ 0å¯ç¨ 1ç¦ç¨") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty(value = "æåºç ", example = "1") |
| | | @ExcelColumn(name="æåºç ") |
| | | private Integer sortnum; |
| | | |
| | | @ApiModelProperty(value = "éä»¶å°å") |
| | | @ExcelColumn(name="éä»¶å°å") |
| | | private String fileurl; |
| | | |
| | | @ApiModelProperty(value = "éä»¶åç§°") |
| | | @ExcelColumn(name="éä»¶åç§°") |
| | | private String fileName; |
| | | |
| | | @ApiModelProperty(value = "é件大å°ï¼bytes)", example = "1") |
| | | @ExcelColumn(name="é件大å°ï¼bytes)") |
| | | private Long fileSize; |
| | | |
| | | @ApiModelProperty(value = "åç±»ç¼ç ï¼å
³ècategoryï¼", example = "1") |
| | | @ExcelColumn(name="åç±»ç¼ç ï¼å
³ècategoryï¼") |
| | | private Integer categoryId; |
| | | |
| | | @ApiModelProperty(value = "责任é¨é¨ç¼ç (å
³ècompany)", example = "1") |
| | | @ExcelColumn(name="责任é¨é¨ç¼ç (å
³ècompany)") |
| | | private Integer companyId; |
| | | |
| | | @ApiModelProperty(value = "éä»¶æè¿°") |
| | | @ExcelColumn(name="éä»¶æè¿°") |
| | | private String content; |
| | | |
| | | } |
| | |
| | | @ExcelColumn(name="å®å
¨åå§åéåï¼å¤ä¸ªè±æéå·éå¼") |
| | | private String memberNames; |
| | | |
| | | @ApiModelProperty(value = "ç±»å 0鿣åºå 1éæ£ç±»å", example = "1") |
| | | @ExcelColumn(name="ç±»å 0鿣åºå 1éæ£ç±»å") |
| | | @ApiModelProperty(value = "ç±»å 0鿣åºå 1éæ£ç±»å 2æ£æ¥ç±»å", example = "1") |
| | | @ExcelColumn(name="ç±»å 0鿣åºå 1éæ£ç±»å 2æ£æ¥ç±»å") |
| | | private Integer type; |
| | | @ApiModelProperty(value = "ç¨æ·ç¼ç éå", example = "1") |
| | | @TableField(exist = false) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service.business; |
| | | |
| | | import com.doumee.dao.business.model.CompanyDocuments; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.LoginUserModel; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 鿣åºåé
置类åä¿¡æ¯è¡¨Serviceå®ä¹ |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | public interface CompanyDocumentsService { |
| | | |
| | | /** |
| | | * å建 |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | * @return Integer |
| | | */ |
| | | Integer create(CompanyDocuments companyDocuments); |
| | | |
| | | /** |
| | | * 主é®å é¤ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | void deleteById(Integer id, LoginUserInfo user); |
| | | |
| | | /** |
| | | * å é¤ |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | */ |
| | | void delete(CompanyDocuments companyDocuments); |
| | | |
| | | /** |
| | | * æ¹é主é®å é¤ |
| | | * |
| | | * @param ids 主é®é |
| | | */ |
| | | void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user); |
| | | |
| | | /** |
| | | * 䏻鮿´æ° |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | */ |
| | | void updateById(CompanyDocuments companyDocuments); |
| | | |
| | | /** |
| | | * æ¹é䏻鮿´æ° |
| | | * |
| | | * @param companyDocumentss å®ä½é |
| | | */ |
| | | void updateByIdInBatch(List<CompanyDocuments> companyDocumentss); |
| | | |
| | | /** |
| | | * 䏻鮿¥è¯¢ |
| | | * |
| | | * @param id ä¸»é® |
| | | * @return CompanyDocuments |
| | | */ |
| | | CompanyDocuments findById(Integer id); |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢åæ¡è®°å½ |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | * @return CompanyDocuments |
| | | */ |
| | | CompanyDocuments findOne(CompanyDocuments companyDocuments); |
| | | |
| | | /** |
| | | * æ¡ä»¶æ¥è¯¢ |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | * @return List<CompanyDocuments> |
| | | */ |
| | | List<CompanyDocuments> findList(CompanyDocuments companyDocuments); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param pageWrap å页对象 |
| | | * @return PageData<CompanyDocuments> |
| | | */ |
| | | PageData<CompanyDocuments> findPage(PageWrap<CompanyDocuments> pageWrap); |
| | | |
| | | /** |
| | | * æ¡ä»¶ç»è®¡ |
| | | * |
| | | * @param companyDocuments å®ä½å¯¹è±¡ |
| | | * @return long |
| | | */ |
| | | long count(CompanyDocuments companyDocuments); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.service.business.impl; |
| | | |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.CompanyDocumentsMapper; |
| | | import com.doumee.dao.business.model.CompanyDocuments; |
| | | import com.doumee.service.business.CompanyDocumentsService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.doumee.service.business.third.model.LoginUserInfo; |
| | | import com.doumee.service.business.third.model.PageData; |
| | | import com.doumee.service.business.third.model.PageWrap; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 鿣åºåé
置类åä¿¡æ¯è¡¨Serviceå®ç° |
| | | * @author æ±è¹è¹ |
| | | * @date 2025/06/27 16:01 |
| | | */ |
| | | @Service |
| | | public class CompanyDocumentsServiceImpl implements CompanyDocumentsService { |
| | | |
| | | @Autowired |
| | | private CompanyDocumentsMapper companyDocumentsMapper; |
| | | |
| | | @Override |
| | | public Integer create(CompanyDocuments companyDocuments) { |
| | | companyDocumentsMapper.insert(companyDocuments); |
| | | return companyDocuments.getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteById(Integer id, LoginUserInfo user) { |
| | | companyDocumentsMapper.deleteById(id); |
| | | } |
| | | |
| | | @Override |
| | | public void delete(CompanyDocuments companyDocuments) { |
| | | UpdateWrapper<CompanyDocuments> deleteWrapper = new UpdateWrapper<>(companyDocuments); |
| | | companyDocumentsMapper.delete(deleteWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public void deleteByIdInBatch(List<Integer> ids, LoginUserInfo user) { |
| | | if (CollectionUtils.isEmpty(ids)) { |
| | | return; |
| | | } |
| | | companyDocumentsMapper.deleteBatchIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public void updateById(CompanyDocuments companyDocuments) { |
| | | companyDocumentsMapper.updateById(companyDocuments); |
| | | } |
| | | |
| | | @Override |
| | | public void updateByIdInBatch(List<CompanyDocuments> companyDocumentss) { |
| | | if (CollectionUtils.isEmpty(companyDocumentss)) { |
| | | return; |
| | | } |
| | | for (CompanyDocuments companyDocuments: companyDocumentss) { |
| | | this.updateById(companyDocuments); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public CompanyDocuments findById(Integer id) { |
| | | return companyDocumentsMapper.selectById(id); |
| | | } |
| | | |
| | | @Override |
| | | public CompanyDocuments findOne(CompanyDocuments companyDocuments) { |
| | | QueryWrapper<CompanyDocuments> wrapper = new QueryWrapper<>(companyDocuments); |
| | | return companyDocumentsMapper.selectOne(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<CompanyDocuments> findList(CompanyDocuments companyDocuments) { |
| | | QueryWrapper<CompanyDocuments> wrapper = new QueryWrapper<>(companyDocuments); |
| | | return companyDocumentsMapper.selectList(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public PageData<CompanyDocuments> findPage(PageWrap<CompanyDocuments> pageWrap) { |
| | | IPage<CompanyDocuments> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | QueryWrapper<CompanyDocuments> queryWrapper = new QueryWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | if (pageWrap.getModel().getId() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getId, pageWrap.getModel().getId()); |
| | | } |
| | | if (pageWrap.getModel().getCreator() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getCreator, pageWrap.getModel().getCreator()); |
| | | } |
| | | if (pageWrap.getModel().getCreateDate() != null) { |
| | | queryWrapper.lambda().ge(CompanyDocuments::getCreateDate, Utils.Date.getStart(pageWrap.getModel().getCreateDate())); |
| | | queryWrapper.lambda().le(CompanyDocuments::getCreateDate, Utils.Date.getEnd(pageWrap.getModel().getCreateDate())); |
| | | } |
| | | if (pageWrap.getModel().getEditor() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getEditor, pageWrap.getModel().getEditor()); |
| | | } |
| | | if (pageWrap.getModel().getEditDate() != null) { |
| | | queryWrapper.lambda().ge(CompanyDocuments::getEditDate, Utils.Date.getStart(pageWrap.getModel().getEditDate())); |
| | | queryWrapper.lambda().le(CompanyDocuments::getEditDate, Utils.Date.getEnd(pageWrap.getModel().getEditDate())); |
| | | } |
| | | if (pageWrap.getModel().getIsdeleted() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getIsdeleted, pageWrap.getModel().getIsdeleted()); |
| | | } |
| | | if (pageWrap.getModel().getName() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getName, pageWrap.getModel().getName()); |
| | | } |
| | | if (pageWrap.getModel().getRemark() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getRemark, pageWrap.getModel().getRemark()); |
| | | } |
| | | if (pageWrap.getModel().getStatus() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getStatus, pageWrap.getModel().getStatus()); |
| | | } |
| | | if (pageWrap.getModel().getSortnum() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getSortnum, pageWrap.getModel().getSortnum()); |
| | | } |
| | | if (pageWrap.getModel().getFileurl() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getFileurl, pageWrap.getModel().getFileurl()); |
| | | } |
| | | if (pageWrap.getModel().getFileName() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getFileName, pageWrap.getModel().getFileName()); |
| | | } |
| | | if (pageWrap.getModel().getFileSize() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getFileSize, pageWrap.getModel().getFileSize()); |
| | | } |
| | | if (pageWrap.getModel().getCategoryId() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getCategoryId, pageWrap.getModel().getCategoryId()); |
| | | } |
| | | if (pageWrap.getModel().getCompanyId() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | } |
| | | if (pageWrap.getModel().getContent() != null) { |
| | | queryWrapper.lambda().eq(CompanyDocuments::getContent, pageWrap.getModel().getContent()); |
| | | } |
| | | for(PageWrap.SortData sortData: pageWrap.getSorts()) { |
| | | if (sortData.getDirection().equalsIgnoreCase(PageWrap.DESC)) { |
| | | queryWrapper.orderByDesc(sortData.getProperty()); |
| | | } else { |
| | | queryWrapper.orderByAsc(sortData.getProperty()); |
| | | } |
| | | } |
| | | return PageData.from(companyDocumentsMapper.selectPage(page, queryWrapper)); |
| | | } |
| | | |
| | | @Override |
| | | public long count(CompanyDocuments companyDocuments) { |
| | | QueryWrapper<CompanyDocuments> wrapper = new QueryWrapper<>(companyDocuments); |
| | | return companyDocumentsMapper.selectCount(wrapper); |
| | | } |
| | | } |