智能圖像處理平臺:圖片管理

接著我們講圖片管理,先實現圖片基礎的增刪改查,再去考慮圖像處理。

主要是,我們需要完成查詢時,查詢的圖片的上傳者的角色等級小于等于我們當前登陸賬號。

后端controller:

package com.llpp.controller;import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.llpp.entity.Image;
import com.llpp.entity.User;
import com.llpp.service.impl.ImageServiceImpl;
import com.llpp.service.impl.RedisService;
import com.llpp.tool.PrimaryKey;
import com.llpp.tool.Result;
import com.llpp.vo.ImageVO;
import lombok.RequiredArgsConstructor;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Optional;/*** @Author 21326* @Date 2025 2025/2/25 22:23*/
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/image")
public class ImageController {private final RedisService redisService;private final ImageServiceImpl imageService;@GetMapping("/getPage")public Result getPage(Page<ImageVO> page, ImageVO image, HttpServletRequest request) {String token = request.getHeader("authorization");token = token.substring(token.indexOf(" ") + 1);String user = redisService.getValueOrDefault(token, "").toString();image.setRoleId(JSONUtil.toBean(user, User.class).getRoleId());return Result.data(imageService.getPage(page, image));}@PostMapping("/rowSave")public Result rowSave(@RequestBody Image image, HttpServletRequest request) {return Optional.ofNullable(image).filter(i -> !StringUtils.isEmpty(i.getUrl())).filter(i -> !StringUtils.isEmpty(i.getName())).map(i -> {String token = request.getHeader("authorization");token = token.substring(token.indexOf(" ") + 1);String user = redisService.getValueOrDefault(token, "").toString();User info = JSONUtil.toBean(user, User.class);i.setStatus(0);i.setUserId(info.getId());i.setId(new PrimaryKey().nextId());i.setCreateTime(LocalDateTime.now());return Result.status(imageService.save(i));}).orElse(Result.fail("參數異常"));}@PostMapping("/rowEdit")public Result rowEdit(@RequestBody Image image) {return Optional.ofNullable(image).filter(i -> Objects.nonNull(i.getId())).map(i -> Result.status(imageService.updateById(i))).orElse(Result.fail("參數異常"));}@PostMapping("/rowDel")public Result rowDel(@RequestBody Image image) {return Optional.ofNullable(image).filter(i -> Objects.nonNull(i.getId())).map(i -> Result.status(imageService.removeById(i.getId()))).orElse(Result.fail("參數異常"));}
}

service:

@Service
public class ImageServiceImpl extends ServiceImpl<ImageMapper, Image> implements IImageService {@Overridepublic IPage<ImageVO> getPage(IPage<ImageVO> page, ImageVO image) {return baseMapper.getPage(page, image);}
}

mapper:

package com.llpp.mapper;import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.llpp.entity.Image;
import com.llpp.vo.ImageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;/*** @Author 21326* @Date 2025 2025/1/31 20:44*/
@Mapper
public interface ImageMapper extends BaseMapper<Image> {IPage<ImageVO> getPage(IPage<ImageVO> page, @Param("image") ImageVO imageVO);
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapperPUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.llpp.mapper.ImageMapper"><select id="getPage" resultType="com.llpp.vo.ImageVO">SELECT i.id,i.deleted,i.status,i.remark,i.name,i.url,i.result,i.create_time,u.username,r.name AS role_nameFROM image iLEFT JOIN user u ON i.user_id = u.idLEFT JOIN role r ON u.role_id = r.idWHERE i.deleted=0AND u.deleted=0AND r.deleted=0AND u.role_id &gt;= #{image.roleId}AND r.id &gt;= #{image.roleId}<if test="image.id != null">AND i.id = #{image.id}</if><if test="image.status != null">AND i.status = #{image.status}</if><if test="image.startTime != null">AND i.create_time &gt;= #{image.startTime}</if><if test="image.endTime != null">AND i.create_time &lt;= #{image.endTime}</if><if test="image.name != null and image.name !=''">AND i.name LIKE CONCAT('%',#{image.name},'%')</if><if test="image.remark != null and image.remark !=''">AND i.remark LIKE CONCAT('%',#{image.remark},'%')</if><if test="image.username != null and image.username !=''">AND u.username LIKE CONCAT('%',#{image.username},'%')</if><if test="image.roleName != null and image.roleName !=''">AND r.name LIKE CONCAT('%',#{image.roleName},'%')</if></select>
</mapper>

image.js:

import request from '@/router/axios';
import {baseUrl} from '@/config/env';export const getPage = (current, size, params) => {return request({url: baseUrl + '/image/getPage',method: 'get',params: {current,size,...params}})
}export const rowSave = (form) => {return request({url: baseUrl + '/image/rowSave',method: 'post',data: form})
}export const rowEdit = (row) => {return request({url: baseUrl + '/image/rowEdit',method: 'post',data: row})
}export const rowDel = (row) => {return request({url: baseUrl + '/image/rowDel',method: 'post',data: row})
}

image.vue:

<template><basic-container><avue-crud :option="option":search="search":page="page"v-model="form":table-loading="loading":data="tableData"ref="crud"@row-update="rowUpdate"@row-save="rowSave"@row-del="rowDel"@search-change="searchChange"@search-reset="searchReset"@current-change="currentChange"@size-change="sizeChange"@refresh-change="refreshChange"@on-load="onLoad"></avue-crud></basic-container>
</template><script>
import {getPage, rowDel, rowEdit, rowSave} from "@/api/image/image";export default {name: "image",data() {return {option: {height: 'auto',stripe: true,tip: false,searchShow: true,searchMenuSpan: 6,border: true,index: false,viewBtn: true,addBtn: true,delBtn: true,editBtn: true,column: [{label: '圖片編號',prop: 'id',search: true,width: 120,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,},{label: '圖片名稱',prop: 'name',search: true,span: 24,rules: [{required: true, message: '請輸入圖片名稱', trigger: 'blur'}]},{label: '上傳用戶',prop: 'username',search: true,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,},{label: '上傳時間',prop: 'createTime',type: 'datetime',format: 'yyyy-MM-dd HH:mm:ss',valueFormat: 'yyyy-MM-dd HH:mm:ss',search: true,searchRange: true,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,startPlaceholder: '時間日期開始范圍自定義',endPlaceholder: '時間日期結束范圍自定義',},{label: '用戶角色',prop: 'roleName',search: true,width: 70,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,}, {label: '狀態',prop: 'status',type: 'select',search: true,width: 70,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,props: {label: 'label',value: 'value'},dicData: [{label: '已處理', value: 1},{label: '未處理', value: 0}],},{label: '備注',prop: 'remark',search: true,span: 24,},{label: '圖片詳情',prop: 'url',type: 'upload',width: 100,span: 24,listType: 'picture-img',fileSize: 3584,dataType: 'string',action: '/api/file/upload',propsHttp: {res: 'data',url: 'url',},},{label: '處理結果',prop: 'result',type: 'upload',width: 100,span: 24,addDisplay: false,editDisplay: false,viewDisplay: true,listType: 'picture-img',fileSize: 3584,dataType: 'string',action: '/api/file/upload',propsHttp: {res: 'data',url: 'url',},},]},form: {},search: {},page: {total: 0,currentPage: 1,pageSize: 10,pageSizes: [5, 10, 15, 20, 50, 100, 150, 200]},query: {},loading: false,tableData: []}},created() {this.onLoad();},methods: {onLoad(page, params = {}) {this.loading = true;if (this.query.createTime != undefined && this.query.createTime != null && this.query.createTime.length > 0) {this.query.startTime = this.query.createTime[0];this.query.endTime = this.query.createTime[1]this.query.createTime = null;}getPage(this.page.currentPage, this.page.pageSize, Object.assign(params, this.query)).then(res => {const data = res.data.data;this.page.total = data.total;this.tableData = data.records;this.loading = false;})},rowSave(form, done, loading) {rowSave(form).then(res => {if (res.data.code == 200) {this.$message.success(res.data.msg);done();} else {this.$message.error(res.data.msg);loading();}}).then(() => {this.onLoad();}).catch(err => {loading();})},rowUpdate(row, index, done, loading) {rowEdit(row).then(res => {if (res.data.code == 200) {this.$message.success(res.data.msg);done();} else {this.$message.error(res.data.msg);loading();}}).then(() => {this.onLoad();}).catch(err => {loading();})},rowDel(row, done, loading) {rowDel(row).then(res => {if (res.data.code == 200) {this.$message.success(res.data.msg);done();} else {this.$message.error(res.data.msg);loading();}}).then(() => {this.onLoad();}).catch(err => {loading();})},searchReset() {this.query = {}this.onLoad(this.page)},searchChange(params, done) {this.query = paramsthis.onLoad(this.page, params)done()},currentChange(currentPage) {this.page.currentPage = currentPage},sizeChange(pageSize) {this.page.pageSize = pageSize},refreshChange(refresh) {if (refresh) {this.onLoad(this.page, this.query)}},}
}
</script><style scoped></style>

效果展示:

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/72123.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/72123.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/72123.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

大模型知識蒸餾技術(8)——知識蒸餾應用場景

版權聲明 本文原創作者:谷哥的小弟作者博客地址:http://blog.csdn.net/lfdfhl1. 知識蒸餾概述 知識蒸餾是一種將大型復雜模型(教師模型)的知識遷移到小型簡單模型(學生模型)的技術。其核心原理是通過教師模型的輸出(通常是softmax后的概率分布)來指導學生模型的訓練,…

LeetCode:131. 分割回文串(DP Java)

目錄 131. 分割回文串 題目描述&#xff1a; 實現代碼與解析&#xff1a; 動態規劃 原理思路&#xff1a; 131. 分割回文串 題目描述&#xff1a; 給你一個字符串 s&#xff0c;請你將 s 分割成一些子串&#xff0c;使每個子串都是 回文串 。返回 s 所有可能的分割方案。…

INT202 Complexity of Algroithms 算法的復雜度

文章目錄 1. 前言1.1 算法&#xff08;Algorithms&#xff09;和數據結構&#xff08;Data Structure&#xff09;1.2 什么是好的算法&#xff1f;1.3 算法分析1.3.1 實驗分析&#xff08;Experimental Analysis&#xff09;1.3.2 理論分析1.3.2.1 偽代碼&#xff08;Pseudo-co…

BDF報告翻譯簡介后:關于A φ方法criterion引理1如何由范數導出內積

關于A φ方法criterion 引理1 如何由范數導出內積 在數學中&#xff0c;特別是在泛函分析中&#xff0c;給定一個范數&#xff0c;可以定義一個與之相關的內積。這個過程不是總是可能的&#xff0c;但當一個賦范向量空間是完備的且滿足平行四邊形恒等式時&#xff0c;可以導出…

初識uniApp

詳細思考一下uniApp這個跨平臺開發框架。首先&#xff0c;我對uniApp還不是很了解&#xff0c;所以需要從基本概念開始&#xff0c;逐步深入。 什么是uniApp&#xff1f; 我記得uniApp是基于Vue.js的&#xff0c;可能是一個用來開發多個平臺的應用的框架。用戶可能想了解它是什…

olmOCR:使用VLM解析PDF

在PDF解析中&#xff0c;目前主流的開源工具包括Minuer、GOT OCR等。主要都是通過飛槳等OCR套件組裝的一套pipeline&#xff0c;或者直接通過VLM解析圖像。 #一、 olmOCR是使用VLM進行的端到端的PDF文檔解析 二、document-anchoring 與上述的不同在于&#xff0c;olmOCR使用…

Nginx 代理配置導致瀏覽器應用網頁頁面加載失敗的分析與解決

Nginx 代理配置導致應用頁面加載失敗的分析與解決 前期部署信息&#xff1a; 部署DM數據庫DEM時&#xff0c;配置了nginx代理&#xff0c;conf配置內容如下&#xff1a; charset utf-8;client_max_body_size 128M;listen 4567;server_name 192.168.1.156;root /opt/h5/;index…

Windows 11【1001問】查看Windows 11 版本的18種方法

隨著技術的飛速發展&#xff0c;操作系統作為連接硬件與軟件的核心橋梁&#xff0c;其版本管理和更新變得尤為重要。對于用戶而言&#xff0c;了解自己設備上運行的具體Windows 11版本不僅有助于優化系統性能&#xff0c;還能確保安全性和兼容性。然而&#xff0c;不同場景和需…

企業jsapi_ticket,java舉例

在企業微信開發中&#xff0c;使用 Java 獲取 jsapi_ticket 并生成簽名的步驟如下。以下是完整的 Java 示例代碼。 1. 獲取 jsapi_ticket 的流程 獲取 access_token。 使用 access_token 獲取 jsapi_ticket。 使用 jsapi_ticket 生成簽名&#xff08;signature&#xff09;。…

【Godot4.3】自定義簡易菜單欄節點ETDMenuBar

概述 Godot中的菜單創建是一個復雜的災難性工作&#xff0c;往往無從下手&#xff0c;我也是不止一次嘗試簡化菜單的創建。 從自己去年的發明“簡易樹形數據”用于簡化Tree控件獲得靈感&#xff0c;于是嘗試編寫了用于表示菜單數據的EasyMenuData類&#xff0c;以及對應的純文…

大數據與金融科技:革新金融行業的動力引擎

大數據與金融科技&#xff1a;革新金融行業的動力引擎 在今天的金融行業&#xff0c;大數據與金融科技的結合正在以驚人的速度推動著金融服務的創新與變革。通過精準的數據分析與智能化決策&#xff0c;金融機構能夠更高效地進行風險管理、客戶服務、資產管理等一系列關鍵操作…

二、IDE集成DeepSeek保姆級教學(使用篇)

各位看官老爺好&#xff0c;如果還沒有安裝DeepSeek請查閱前一篇 一、IDE集成DeepSeek保姆級教學(安裝篇) 一、DeepSeek在CodeGPT中使用教學 1.1、Edit Code 編輯代碼 選中代碼片段 —> 右鍵 —> CodeGPT —> Edit Code, 輸入自然語言可編輯代碼&#xff0c;點擊S…

Rohm發布TOLL封裝650V GaN HEMT,引領汽車用GaN器件大規模生產新浪潮

Rohm震撼發布TOLL封裝650V GaN HEMT&#xff0c;引領汽車用GaN器件大規模生產新浪潮。在創新的TOLL&#xff08;TO LeadLess&#xff09;封裝技術的懷抱中&#xff0c;Rohm精心孕育出650V GaN HEMT這一瑰寶&#xff0c;此技術正如一股強勁東風&#xff0c;日益吹拂于高功率處理…

Spring Boot 3.x 基于 Redis 實現郵箱驗證碼認證

文章目錄 依賴配置開啟 QQ 郵箱 SMTP 服務配置文件代碼實現驗證碼服務郵件服務接口實現執行流程 依賴配置 <dependencies> <!-- Spring Boot Starter Web --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spr…

PHP的學習

PHP的基礎前提【HTML、CSS】 第一步先進行VS cood的下載&#xff1a;Visual Studio Code - Code Editing. Redefined 【選擇適合自己的電腦的版本eg:我就是64位的win】

XML 編輯器:全面指南與最佳實踐

XML 編輯器:全面指南與最佳實踐 引言 XML(可擴展標記語言)編輯器是處理XML文件的關鍵工具,對于開發人員、系統管理員以及任何需要處理XML數據的人來說至關重要。本文將全面介紹XML編輯器的概念、功能、選擇標準以及最佳實踐,旨在幫助讀者了解如何選擇和使用合適的XML編輯…

《Effective Objective-C》閱讀筆記(下)

目錄 內存管理 理解引用計數 引用計數工作原理 自動釋放池 保留環 以ARC簡化引用計數 使用ARC時必須遵循的方法命名規則 變量的內存管理語義 ARC如何清理實例變量 在dealloc方法中只釋放引用并解除監聽 編寫“異常安全代碼”時留意內存管理問題 以弱引用避免保留環 …

ORM Bee V2.5.2.x 發布,支持 CQRS; sql 性能分析;更新 MongoDB ORM分片

Bee, 一個具有分片功能的 ORM 框架. Bee Hibernate/MyBatis plus Sharding JDBC Jpa Spring data GraphQL App ORM (Android, 鴻蒙) 小巧玲瓏&#xff01;僅 940K, 還不到 1M, 但卻是功能強大&#xff01; V2.5.2 (2025?LTS 版) 開發中... **2.5.2.1 新年 ** 支持 Mong…

springboot之HTML與圖片生成

背景 后臺需要根據字段動態生成HTML&#xff0c;并生成圖片&#xff0c;發送郵件到給定郵箱 依賴 <!-- freemarker模板引擎--> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-freemarker</artifa…

《從0到1:用Python在鴻蒙系統開發安防圖像分類AI功能》

在人工智能與移動應用深度融合的當下,類目標簽AI功能成為眾多行業提升效率和用戶體驗的關鍵技術。本文聚焦于HarmonyOS NEXT API 12及以上版本,以圖像分類在智能家居安防領域的應用為例,為開發者詳細闡述如何利用Python開發類目標簽AI功能,助力鴻蒙技術在該領域的創新應用。…