IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> Java知识库 -> 博物馆中英文网站后台管理源码+springboot+视频搭建教程 -> 正文阅读

[Java知识库]博物馆中英文网站后台管理源码+springboot+视频搭建教程

个人私活做了一个关于博物馆相关网站和管理后台,可以中英文切换,架构springBoot+mysql+layui

项目部分截图

?

?

后台管理部分截图

?

?

?

代码架构

?部分代码,代码里有自己封装的代码生成工具,可快速做基本代码构架

package com.yingshi.controller;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yingshi.entity.Exhibition;
import com.yingshi.entity.vo.ExhibitionVo;
import com.yingshi.mapper.ExhibitionMapper;


/**
?* <p>
?* ?不要枯燥的重复工作,让更多的时间去创造价值!---4c4为你腾出更多的时间。
?* </p>
?*
?* @author www.4c4.cn
?* @since Fri Mar 04 11:29:17 CST 2022
?*/
@RestController
@RequestMapping("/exhibition")
public class ExhibitionController {
?? ?@Autowired
?? ?ExhibitionMapper exhibitionMapper;
?? ?
?? ?
?? ?/**
?? ? * 保存操作
?? ? * @return
?? ? */
?? ?@RequestMapping("/v1/save")
?? ?public Map<String, Object> save(Exhibition exhibition){
?? ??? ? //SimpleDateFormat ?format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
?? ??? ?if(exhibition.getStates() == null) {
?? ??? ??? ?exhibition.setStates(1);
?? ??? ? }
?? ??? ? exhibition.setCdate(new Date());
?? ??? ? Map<String, Object> map = new HashMap<String, Object>();
?? ??? ? exhibitionMapper.insert(exhibition);
?? ??? ? map.put("code", 0);
?? ??? ? return map;
?? ?}
?? ?
?? ?/**
?? ? * 分页查询
?? ? * @param page
?? ? * @param limit
?? ? * @return
?? ? */
?? ?@RequestMapping("/v1/getAll")
?? ?public Map<String, Object> getAll(Long page,Long limit,String title,String type,Integer state){
?? ??? ?Map<String, Object> map = new HashMap<String, Object>();
?? ??? ?if(page == null && limit == null){
?? ??? ??? ?map.put("msg","参数有误");
?? ??? ??? ?map.put("code",1);
?? ??? ??? ?return map;
?? ??? ?}
?? ??? ?Date date = new Date();
?? ??? ?SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
?? ??? ?String format = sdf.format(date);
?? ??? ?QueryWrapper<ExhibitionVo> queryWrapper = ?new QueryWrapper<>();
?? ??? ?if(title != null && title.length() > 0) {
?? ??? ??? ?queryWrapper.like("title", title);
?? ??? ?}
?? ??? ?if(type != null && type.length() > 0) {
?? ??? ??? ?queryWrapper.eq("e.type", type);
?? ??? ?}
?? ??? ?if(state != null ) {
?? ??? ??? ?queryWrapper.eq("e.states", state);
?? ??? ?}
?? ??? ??? ?
?? ??? ??? ?
?? ??? ??? ?/*
?? ??? ??? ? * if("1".equals(state)) {//预告 queryWrapper.lambda()
?? ??? ??? ? * .ge(Exhibition::getStime,format);
?? ??? ??? ? *?
?? ??? ??? ? * } if("2".equals(state)) {//正在 queryWrapper.lambda()
?? ??? ??? ? * .le(Exhibition::getStime,format) .ge(Exhibition::getEtime,format);
?? ??? ??? ? *?
?? ??? ??? ? * } if("3".equals(state)) { queryWrapper.lambda()
?? ??? ??? ? * //.le(Exhibition::getEtime,format) .le(Exhibition::getEtime,format); }
?? ??? ??? ? */
?? ??? ?
?? ??? ?
?? ??? ?queryWrapper.select().orderByDesc("cdate");
?? ??? ?Page<ExhibitionVo> pageObject = new Page<>(page , limit);
?? ??? ?IPage<ExhibitionVo> exhibitionPage = exhibitionMapper.findByPage(pageObject, queryWrapper);
?? ??? ?map.put("code", 0);
?? ??? ?map.put("msg","");
?? ??? ?map.put("count",exhibitionPage.getTotal() );
?? ??? ?map.put("newdate",format );
?? ??? ?map.put("count",exhibitionPage.getTotal() );
?? ??? ?map.put("data", exhibitionPage.getRecords());
?? ??? ?return map;
?? ?}
?? ?
?? ?
?? ?
?? ?/**
?? ? * 根据id更新数据
?? ? * @param name
?? ? * @param id
?? ? * @return
?? ? */
?? ?@RequestMapping("/v1/edit")
?? ?public Map<String, Object> edit(Exhibition exhibition){
?? ??? ?Map<String, Object> map = new HashMap<String, Object>();
?? ??? ?exhibitionMapper.updateById(exhibition);
?? ??? ?map.put("code", 0);
?? ??? ?map.put("msg","更新成功");
?? ??? ?return map;?? ??? ??
?? ?}
?? ?@RequestMapping("/v1/test")
?? ?public Map<String, Object> test(ExhibitionVo exhibition,Long page,Long limit,String title,String type){
?? ??? ?Map<String, Object> map = new HashMap<String, Object>();
?? ??? ?QueryWrapper<ExhibitionVo> queryWrapper = ?new QueryWrapper<>();
?? ??? ?
?? ??? ?if(title != null && title.length() > 0) {
?? ??? ??? ?queryWrapper.like("title", title);
?? ??? ?}
?? ??? ?if(type != null && type.length() > 0) {
?? ??? ??? ?queryWrapper.eq("type", type);
?? ??? ?}
?? ??? ?queryWrapper.select().orderByDesc("cdate");
?? ??? ?Page<ExhibitionVo> pageObject = new Page<>(page , limit);
?? ??? ?IPage<ExhibitionVo> exhibitionPage = exhibitionMapper.findByPage(pageObject, queryWrapper);
?? ??? ?map.put("code", 0);
?? ??? ?map.put("msg","");
?? ??? ?map.put("count",exhibitionPage.getTotal() );
?? ??? ?map.put("count",exhibitionPage.getTotal() );
?? ??? ?map.put("data", exhibitionPage.getRecords());
?? ??? ?
?? ??? ?return map;?? ??? ??
?? ?}
?? ?
?? ?/**
?? ? * 根据id删除数据
?? ? * @param id
?? ? * @return
?? ? */
?? ?@RequestMapping("/v1/dele")
?? ?public Map<String, Object> dele(Integer id){
?? ??? ?Map<String, Object> map = new HashMap<String, Object>();
?? ??? ?if(id == null){
?? ??? ??? ?map.put("msg","参数有误");
?? ??? ??? ?map.put("code",1);
?? ??? ??? ?return map;
?? ??? ?}
?? ??? ?exhibitionMapper.deleteById(id);
?? ??? ?map.put("code", 0);
?? ??? ?map.put("msg","删除成功");
?? ??? ?return map;
?? ?}
?? ?
?? ?/**
?? ? * 根据id查询数据
?? ? * @param id
?? ? * @return
?? ? */
?? ?@RequestMapping("/v1/getById")
?? ?public Map<String, Object> getById(Integer id){
?? ??? ?Map<String, Object> map = new HashMap<String, Object>();
?? ??? ?if(id == null){
?? ??? ??? ?map.put("msg","参数有误");
?? ??? ??? ?map.put("code",1);
?? ??? ??? ?return map;
?? ??? ?}
?? ??? ?Exhibition entity = exhibitionMapper.selectById(id);
?? ??? ?map.put("code", 0);
?? ??? ?map.put("data",entity);
?? ??? ?return map;?? ?
?? ?}
}
?























源码下载地址

?

  Java知识库 最新文章
计算距离春节还有多长时间
系统开发系列 之WebService(spring框架+ma
springBoot+Cache(自定义有效时间配置)
SpringBoot整合mybatis实现增删改查、分页查
spring教程
SpringBoot+Vue实现美食交流网站的设计与实
虚拟机内存结构以及虚拟机中销毁和新建对象
SpringMVC---原理
小李同学: Java如何按多个字段分组
打印票据--java
上一篇文章      下一篇文章      查看所有文章
加:2022-10-17 12:18:51  更:2022-10-17 12:21:42 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/18 7:18:28-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码