🍊作者:计算机编程-吉哥
🍊简介:专业从事JavaWeb程序开发,微信小程序开发,定制化项目、 源码、代码讲解、文档撰写、ppt制作。做自己喜欢的事,生活就是快乐的。
🍊心愿:点赞 👍 收藏 ⭐评论 📝
🍅 文末获取源码联系👇🏻 精彩专栏推荐订阅 👇🏻 不然下次找不到哟~
Java毕业设计项目~热门选题推荐《1000套》
目录
springboot、mybatisplus、vue、elementui、html、css、js、mysql、jdk1.8
14张
idea、navicat
管理员、用户

5.3 论坛信息
5.4 环保健康
5.5 环境保护
5.6 公告信息
5.7 个人中心
5.8 濒危生物留言管理
5.9 论坛管理
5.10 环保健康类型管理
-
- CREATE TABLE `binweishengwu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `binweishengwu_name` varchar(200) DEFAULT NULL COMMENT '动物 Search111',
- `address_types` int(11) DEFAULT NULL COMMENT '所在地区 Search111',
- `binweishengwu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
- `binweishengwu_size` varchar(200) DEFAULT NULL COMMENT '现存数量',
- `zan_number` int(11) DEFAULT NULL COMMENT '赞',
- `cai_number` int(11) DEFAULT NULL COMMENT '踩',
- `binweishengwu_content` text COMMENT '介绍',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物';
-
-
- CREATE TABLE `binweishengwu_collection` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `binweishengwu_collection_types` int(11) DEFAULT NULL COMMENT '类型',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='濒危生物收藏';
-
-
- CREATE TABLE `binweishengwu_liuyan` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `binweishengwu_id` int(11) DEFAULT NULL COMMENT '濒危生物',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `binweishengwu_liuyan_text` text COMMENT '留言内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
- `reply_text` text COMMENT '回复内容',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='濒危生物留言';
-
-
- CREATE TABLE `config` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `name` varchar(100) NOT NULL COMMENT '配置参数名称',
- `value` varchar(100) DEFAULT NULL COMMENT '配置参数值',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='配置文件';
-
-
-
- CREATE TABLE `dictionary` (
- `id` int(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `dic_code` varchar(200) DEFAULT NULL COMMENT '字段',
- `dic_name` varchar(200) DEFAULT NULL COMMENT '字段名',
- `code_index` int(11) DEFAULT NULL COMMENT '编码',
- `index_name` varchar(200) DEFAULT NULL COMMENT '编码名字 Search111 ',
- `super_id` int(11) DEFAULT NULL COMMENT '父字段id',
- `beizhu` varchar(200) DEFAULT NULL COMMENT '备注',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8 COMMENT='字典表';
-
-
- CREATE TABLE `forum` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `forum_name` varchar(200) DEFAULT NULL COMMENT '帖子标题 Search111 ',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `users_id` int(11) DEFAULT NULL COMMENT '管理员',
- `forum_content` text COMMENT '发布内容',
- `super_ids` int(11) DEFAULT NULL COMMENT '父id',
- `forum_state_types` int(11) DEFAULT NULL COMMENT '帖子状态',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '发帖时间',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '修改时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show2',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8 COMMENT='论坛';
-
-
-
- CREATE TABLE `huanbaojiankang` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanbaojiankang_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
- `huanbaojiankang_types` int(11) DEFAULT NULL COMMENT '环保健康类型 Search111',
- `huanbaojiankang_photo` varchar(200) DEFAULT NULL COMMENT '封面',
- `zan_number` int(11) DEFAULT NULL COMMENT '赞',
- `cai_number` int(11) DEFAULT NULL COMMENT '踩',
- `huanbaojiankang_content` text COMMENT '介绍',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环保健康';
-
-
-
- CREATE TABLE `huanbaojiankang_collection` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `huanbaojiankang_collection_types` int(11) DEFAULT NULL COMMENT '类型',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 COMMENT='环保健康收藏';
-
-
- CREATE TABLE `huanbaojiankang_liuyan` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanbaojiankang_id` int(11) DEFAULT NULL COMMENT '环保健康',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `huanbaojiankang_liuyan_text` text COMMENT '留言内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
- `reply_text` text COMMENT '回复内容',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='环保健康留言';
-
-
-
- CREATE TABLE `huanjingbaohu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanjingbaohu_name` varchar(200) DEFAULT NULL COMMENT '名称 Search111',
- `address_types` int(11) DEFAULT NULL COMMENT '地区 Search111',
- `huanjingbaohu_photo` varchar(200) DEFAULT NULL COMMENT '图片',
- `huanjingbaohu_size` varchar(200) DEFAULT NULL COMMENT '大小',
- `zan_number` int(11) DEFAULT NULL COMMENT '赞',
- `cai_number` int(11) DEFAULT NULL COMMENT '踩',
- `huanjingbaohu_content` text COMMENT '介绍',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环境保护';
-
-
- CREATE TABLE `huanjingbaohu_collection` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `huanjingbaohu_collection_types` int(11) DEFAULT NULL COMMENT '类型',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '收藏时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show3 photoShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='环境保护收藏';
-
-
- CREATE TABLE `huanjingbaohu_liuyan` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanjingbaohu_id` int(11) DEFAULT NULL COMMENT '环境保护',
- `yonghu_id` int(11) DEFAULT NULL COMMENT '用户',
- `huanjingbaohu_liuyan_text` text COMMENT '留言内容',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '留言时间',
- `reply_text` text COMMENT '回复内容',
- `update_time` timestamp NULL DEFAULT NULL COMMENT '回复时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='环境保护留言';
-
-
-
- CREATE TABLE `huanjingbaohufa` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `huanjingbaohufa_name` varchar(200) DEFAULT NULL COMMENT '标题 Search111',
- `huanjingbaohufa_types` int(11) DEFAULT NULL COMMENT '保护法类型 Search111',
- `huanjingbaohufa_photo` varchar(200) DEFAULT NULL COMMENT '封面',
- `huanjingbaohufa_content` text COMMENT '详情',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='濒危生物法';
-
-
-
- CREATE TABLE `news` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `news_name` varchar(200) DEFAULT NULL COMMENT '公告标题 Search111 ',
- `news_types` int(11) DEFAULT NULL COMMENT '公告类型 Search111 ',
- `news_photo` varchar(200) DEFAULT NULL COMMENT '公告图片',
- `insert_time` timestamp NULL DEFAULT NULL COMMENT '添加时间',
- `news_content` text COMMENT '公告详情',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间 show1 show2 nameShow',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='公告信息';
-
-
- CREATE TABLE `token` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `userid` bigint(20) NOT NULL COMMENT '用户id',
- `username` varchar(100) NOT NULL COMMENT '用户名',
- `tablename` varchar(100) DEFAULT NULL COMMENT '表名',
- `role` varchar(100) DEFAULT NULL COMMENT '角色',
- `token` varchar(200) NOT NULL COMMENT '密码',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- `expiratedtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='token表';
-
-
-
- CREATE TABLE `users` (
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(100) NOT NULL COMMENT '用户名',
- `password` varchar(100) NOT NULL COMMENT '密码',
- `role` varchar(100) DEFAULT '管理员' COMMENT '角色',
- `addtime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '新增时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='用户表';
-
-
-
- CREATE TABLE `yonghu` (
- `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
- `username` varchar(200) DEFAULT NULL COMMENT '账户',
- `password` varchar(200) DEFAULT NULL COMMENT '密码',
- `yonghu_name` varchar(200) DEFAULT NULL COMMENT '用户姓名 Search111 ',
- `yonghu_photo` varchar(200) DEFAULT NULL COMMENT '头像',
- `yonghu_phone` varchar(200) DEFAULT NULL COMMENT '手机号',
- `yonghu_email` varchar(200) DEFAULT NULL COMMENT '电子邮箱',
- `sex_types` int(11) DEFAULT NULL COMMENT '性别 Search111 ',
- `yonghu_delete` int(11) DEFAULT '1' COMMENT '假删',
- `create_time` timestamp NULL DEFAULT NULL COMMENT '创建时间',
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户';
-
-
- package com.controller;
-
- import java.io.File;
- import java.math.BigDecimal;
- import java.net.URL;
- import java.text.SimpleDateFormat;
- import com.alibaba.fastjson.JSONObject;
- import java.util.*;
- import org.springframework.beans.BeanUtils;
- import javax.servlet.http.HttpServletRequest;
- import org.springframework.web.context.ContextLoader;
- import javax.servlet.ServletContext;
- import com.service.TokenService;
- import com.utils.*;
- import java.lang.reflect.InvocationTargetException;
-
- import com.service.DictionaryService;
- import org.apache.commons.lang3.StringUtils;
- import com.annotation.IgnoreAuth;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.*;
- import com.baomidou.mybatisplus.mapper.EntityWrapper;
- import com.baomidou.mybatisplus.mapper.Wrapper;
- import com.entity.*;
- import com.entity.view.*;
- import com.service.*;
- import com.utils.PageUtils;
- import com.utils.R;
- import com.alibaba.fastjson.*;
-
- /**
- * 环保健康
- * 后端接口
- * @author 计算机编程-吉哥
- * @email
- */
- @RestController
- @Controller
- @RequestMapping("/huanbaojiankang")
- public class HuanbaojiankangController {
- private static final Logger logger = LoggerFactory.getLogger(HuanbaojiankangController.class);
-
- @Autowired
- private HuanbaojiankangService huanbaojiankangService;
-
-
- @Autowired
- private TokenService tokenService;
- @Autowired
- private DictionaryService dictionaryService;
-
- //级联表service
-
- @Autowired
- private YonghuService yonghuService;
-
-
- /**
- * 后端列表
- */
- @RequestMapping("/page")
- public R page(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永不会进入");
- else if("用户".equals(role))
- params.put("yonghuId",request.getSession().getAttribute("userId"));
- if(params.get("orderBy")==null || params.get("orderBy")==""){
- params.put("orderBy","id");
- }
- PageUtils page = huanbaojiankangService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(HuanbaojiankangView c:list){
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(c, request);
- }
- return R.ok().put("data", page);
- }
-
- /**
- * 后端详情
- */
- @RequestMapping("/info/{id}")
- public R info(@PathVariable("id") Long id, HttpServletRequest request){
- logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
- HuanbaojiankangEntity huanbaojiankang = huanbaojiankangService.selectById(id);
- if(huanbaojiankang !=null){
- //entity转view
- HuanbaojiankangView view = new HuanbaojiankangView();
- BeanUtils.copyProperties( huanbaojiankang , view );//把实体数据重构到view中
-
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
-
- }
-
- /**
- * 后端保存
- */
- @RequestMapping("/save")
- public R save(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
- logger.debug("save方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
-
- String role = String.valueOf(request.getSession().getAttribute("role"));
- if(false)
- return R.error(511,"永远不会进入");
-
- Wrapper
queryWrapper = new EntityWrapper() - .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
- .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
- .eq("zan_number", huanbaojiankang.getZanNumber())
- .eq("cai_number", huanbaojiankang.getCaiNumber())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
- if(huanbaojiankangEntity==null){
- huanbaojiankang.setInsertTime(new Date());
- huanbaojiankang.setCreateTime(new Date());
- huanbaojiankangService.insert(huanbaojiankang);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
- /**
- * 后端修改
- */
- @RequestMapping("/update")
- public R update(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
- logger.debug("update方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
- String role = String.valueOf(request.getSession().getAttribute("role"));
- //根据字段查询是否有相同数据
- Wrapper
queryWrapper = new EntityWrapper() - .notIn("id",huanbaojiankang.getId())
- .andNew()
- .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
- .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
- .eq("zan_number", huanbaojiankang.getZanNumber())
- .eq("cai_number", huanbaojiankang.getCaiNumber())
- ;
-
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
- if("".equals(huanbaojiankang.getHuanbaojiankangPhoto()) || "null".equals(huanbaojiankang.getHuanbaojiankangPhoto())){
- huanbaojiankang.setHuanbaojiankangPhoto(null);
- }
- if(huanbaojiankangEntity==null){
- huanbaojiankangService.updateById(huanbaojiankang);//根据id更新
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
-
-
- /**
- * 删除
- */
- @RequestMapping("/delete")
- public R delete(@RequestBody Integer[] ids){
- logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
- huanbaojiankangService.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
- }
-
-
- /**
- * 批量上传
- */
- @RequestMapping("/batchInsert")
- public R save( String fileName, HttpServletRequest request){
- logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
- Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- try {
- List
huanbaojiankangList = new ArrayList<>();//上传的东西 - Map
> seachFields= new HashMap<>();//要查询的字段 - Date date = new Date();
- int lastIndexOf = fileName.lastIndexOf(".");
- if(lastIndexOf == -1){
- return R.error(511,"该文件没有后缀");
- }else{
- String suffix = fileName.substring(lastIndexOf);
- if(!".xls".equals(suffix)){
- return R.error(511,"只支持后缀为xls的excel文件");
- }else{
- URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
- File file = new File(resource.getFile());
- if(!file.exists()){
- return R.error(511,"找不到上传文件,请联系管理员");
- }else{
- List
> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
- dataList.remove(0);//删除第一行,因为第一行是提示
- for(List
data:dataList){ - //循环
- HuanbaojiankangEntity huanbaojiankangEntity = new HuanbaojiankangEntity();
-
- huanbaojiankangList.add(huanbaojiankangEntity);
-
- }
-
- //查询是否重复
- huanbaojiankangService.insertBatch(huanbaojiankangList);
- return R.ok();
- }
- }
- }
- }catch (Exception e){
- e.printStackTrace();
- return R.error(511,"批量插入数据异常,请联系管理员");
- }
- }
-
-
- /**
- * 前端列表
- */
- @IgnoreAuth
- @RequestMapping("/list")
- public R list(@RequestParam Map
params, HttpServletRequest request) { - logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
-
- // 没有指定排序字段就默认id倒序
- if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
- params.put("orderBy","id");
- }
- PageUtils page = huanbaojiankangService.queryPage(params);
-
- //字典表数据转换
- List
list =(List)page.getList(); - for(HuanbaojiankangView c:list)
- dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
- return R.ok().put("data", page);
- }
-
- /**
- * 前端详情
- */
- @RequestMapping("/detail/{id}")
- public R detail(@PathVariable("id") Long id, HttpServletRequest request){
- logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
- HuanbaojiankangEntity huanbaojiankang = huanbaojiankangService.selectById(id);
- if(huanbaojiankang !=null){
-
-
- //entity转view
- HuanbaojiankangView view = new HuanbaojiankangView();
- BeanUtils.copyProperties( huanbaojiankang , view );//把实体数据重构到view中
-
- //修改对应字典表字段
- dictionaryService.dictionaryConvert(view, request);
- return R.ok().put("data", view);
- }else {
- return R.error(511,"查不到数据");
- }
- }
-
-
- /**
- * 前端保存
- */
- @RequestMapping("/add")
- public R add(@RequestBody HuanbaojiankangEntity huanbaojiankang, HttpServletRequest request){
- logger.debug("add方法:,,Controller:{},,huanbaojiankang:{}",this.getClass().getName(),huanbaojiankang.toString());
- Wrapper
queryWrapper = new EntityWrapper() - .eq("huanbaojiankang_name", huanbaojiankang.getHuanbaojiankangName())
- .eq("huanbaojiankang_types", huanbaojiankang.getHuanbaojiankangTypes())
- .eq("zan_number", huanbaojiankang.getZanNumber())
- .eq("cai_number", huanbaojiankang.getCaiNumber())
- ;
- logger.info("sql语句:"+queryWrapper.getSqlSegment());
- HuanbaojiankangEntity huanbaojiankangEntity = huanbaojiankangService.selectOne(queryWrapper);
- if(huanbaojiankangEntity==null){
- huanbaojiankang.setInsertTime(new Date());
- huanbaojiankang.setCreateTime(new Date());
- huanbaojiankangService.insert(huanbaojiankang);
- return R.ok();
- }else {
- return R.error(511,"表中有相同数据");
- }
- }
-
-
- }
- package com.service;
-
- import com.baomidou.mybatisplus.service.IService;
- import com.utils.PageUtils;
- import com.entity.HuanbaojiankangEntity;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
-
- /**
- * 环保健康 服务类
- */
- public interface HuanbaojiankangService extends IService
{ -
- /**
- * @param params 查询参数
- * @return 带分页的查询出来的数据
- */
- PageUtils queryPage(Map
params) ; - }
- package com.service.impl;
-
- import com.utils.StringUtil;
- import org.springframework.stereotype.Service;
- import java.lang.reflect.Field;
- import java.util.*;
- import com.baomidou.mybatisplus.plugins.Page;
- import com.baomidou.mybatisplus.service.impl.ServiceImpl;
- import org.springframework.transaction.annotation.Transactional;
- import com.utils.PageUtils;
- import com.utils.Query;
- import org.springframework.web.context.ContextLoader;
- import javax.servlet.ServletContext;
- import javax.servlet.http.HttpServletRequest;
- import com.dao.HuanbaojiankangDao;
- import com.entity.HuanbaojiankangEntity;
- import com.service.HuanbaojiankangService;
- import com.entity.view.HuanbaojiankangView;
-
- /**
- * 环保健康 服务实现类
- */
- @Service("huanbaojiankangService")
- @Transactional
- public class HuanbaojiankangServiceImpl extends ServiceImpl
implements HuanbaojiankangService { -
- @Override
- public PageUtils queryPage(Map
params) { - if(params != null && (params.get("limit") == null || params.get("page") == null)){
- params.put("page","1");
- params.put("limit","10");
- }
- Page
page =new Query(params).getPage(); - page.setRecords(baseMapper.selectListView(page,params));
- return new PageUtils(page);
- }
-
-
- }
- package com.dao;
-
- import com.entity.HuanbaojiankangEntity;
- import com.baomidou.mybatisplus.mapper.BaseMapper;
- import java.util.List;
- import java.util.Map;
- import com.baomidou.mybatisplus.plugins.pagination.Pagination;
-
- import org.apache.ibatis.annotations.Param;
- import com.entity.view.HuanbaojiankangView;
-
- /**
- * 环保健康 Dao 接口
- *
- * @author
- */
- public interface HuanbaojiankangDao extends BaseMapper
{ -
- List
selectListView(Pagination page,@Param("params")Map params) ; -
- }
- html>
- <html>
- <head lang="en">
- <meta charset="utf-8">
- <title>环保健康title>
- <meta name="keywords" content=""/>
- <meta name="description" content=""/>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
- <link rel="stylesheet" href="../../layui/css/layui.css">
- <link rel="stylesheet" href="../../xznstatic/css/common.css"/>
- <link rel="stylesheet" href="../../xznstatic/css/style.css"/>
- <script type="text/javascript" src="../../xznstatic/js/jquery-1.11.3.min.js">script>
- <script type="text/javascript" src="../../xznstatic/js/jquery.SuperSlide.2.1.1.js">script>
- <link rel="stylesheet" href="../../xznstatic/css/bootstrap.min.css" />
-
- <link rel="stylesheet" href="../../css/theme.css"/>
- head>
- <style>
- html::after {
- position: fixed;
- top: 0;
- right: 0;
- left: 0;
- bottom: 0;
- content: '';
- display: block;
- background-attachment: fixed;
- background-size: cover;
- background-position: center;
- }
-
- /*轮播图相关 start*/
- #swiper {
- overflow: hidden;
- }
-
- #swiper .layui-carousel-ind li {
- width: 20px;
- height: 10px;
- border-width: 0;
- border-style: solid;
- border-color: rgba(0, 0, 0, .3);
- border-radius: 6px;
- background-color: #f7f7f7;
- box-shadow: 0 0 6px rgba(255, 0, 0, .8);
- }
-
- #swiper .layui-carousel-ind li.layui-this {
- width: 30px;
- height: 10px;
- border-width: 0;
- border-style: solid;
- border-color: rgba(0, 0, 0, .3);
- border-radius: 6px;
- }
- /*轮播图相关 end*/
-
- /*列表*/
- .recommend {
- padding: 10px 0;
- display: flex;
- justify-content: center;
- background-repeat: no-repeat;
- background-position: center center;
- background-size: cover;
- }
-
- .recommend .box {
- width: 1002px;
- margin: 0 auto;
- }
-
- .recommend .box .title {
- padding: 10px 5px;
- display: flex;
- justify-content: space-between;
- align-items: center;
- box-sizing: border-box;
- }
-
- .recommend .box .title span {
- padding: 0 10px;
- font-size: 16px;
- line-height: 1.4;
- }
-
- .recommend .box .filter {
- padding: 0 10px;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- width: 100%;
- flex-wrap: wrap;
- }
-
- .recommend .box .filter .item-list {
- display: flex;
- align-items: center;
- }
-
- .recommend .box .filter .item-list .lable {
- font-size: 14px;
- color: #333;
- box-sizing: border-box;
- }
-
- .recommend .box .filter .item-list input {
- padding: 0 10px;
- box-sizing: border-box;
- outline: none;
- }
-
- .recommend .box .filter button {
- display: flex;
- padding: 0 10px;
- box-sizing: border-box;
- align-items: center;
- justify-content: center;
- outline: none;
- }
-
- .recommend .box .filter button i {
- margin-right: 4px;
- }
-
- .recommend .box .list {
- display: flex;
- flex-wrap: wrap;
- }
-
- .recommend .box .list .list-item {
- flex: 0 0 25%;
- padding: 0 5px;
- box-sizing: border-box;
- }
-
- .recommend .box .list .list-item .list-item-body {
- cursor: pointer;
- border: 1px solid rgba(0, 0, 0, 3);
- padding: 5px;
- box-sizing: border-box;
- }
-
- .recommend .box .list .list-item-body img {
- width: 100%;
- height: 100px;
- display: block;
- margin: 0 auto;
- }
-
- .recommend .box .list .list-item-body .info {
- display: flex;
- flex-wrap: wrap;
- }
-
- .recommend .box .list .list-item-body .info .price {
- padding-top: 5px;
- color: red;
- font-size: 14px;
- text-align: center;
- box-sizing: border-box;
- }
-
- .recommend .box .list .list-item-body .info .name {
- padding-top: 5px;
- color: red;
- font-size: 14px;
- text-align: center;
- box-sizing: border-box;
- }
-
- .recommend .box .list .list-item3 {
- flex: 0 0 33.33%;
- }
-
- .recommend .box .list .list-item5 {
- flex: 0 0 25%;
- }
-
- .recommend .box .news {
- display: flex;
- flex-wrap: wrap;
- padding: 0;
- width: 100%;
- }
-
- .recommend .box .news .list-item {
- flex: 0 0 50%;
- padding: 0 10px;
- box-sizing: border-box;
- }
-
- .recommend .box .news .list-item .list-item-body {
- cursor: pointer;
- border: 1px solid rgba(0, 0, 0, 3);
- padding: 10px;
- box-sizing: border-box;
- display: flex;
- }
-
- .recommend .box .news .list-item .list-item-body img {
- width: 120px;
- height: 100%;
- display: block;
- margin: 0 auto;
- }
-
- .recommend .box .news .list-item .list-item-body .item-info {
- flex: 1;
- display: flex;
- justify-content: space-between;
- flex-direction: column;
- padding-left: 10px;
- box-sizing: border-box;
- }
-
- .recommend .box .news .list-item .list-item-body .item-info .name {
- padding-top: 5px;
- color: red;
- font-size: 14px;
- box-sizing: border-box;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- }
-
- .recommend .box .news .list-item .list-item-body .item-info .time {
- padding-top: 5px;
- color: red;
- font-size: 14px;
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- box-sizing: border-box;
- }
-
- .recommend .box .news .list-item1 {
- flex: 0 0 100%;
- }
-
- .recommend .box .news .list-item3 {
- flex: 0 0 33.33%;
- }
-
- .index-pv1 .animation-box:hover {
- transform: perspective(1000px) translate3d(0px, 0px, 0px) scale(1.01) rotate(0deg) skew(-2deg, 0deg);
- transition: all 0.3s;
- }
-
-
- .layui-laypage .layui-laypage-count {
- padding: 0 10px;
- }
-
- .layui-laypage .layui-laypage-skip {
- padding-left: 10px;
- }
- style>
- <body>
- <div id="app">
- <div class="banner">
- <div class="layui-carousel" id="swiper"
- :style='{"boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"0 auto","borderColor":"rgba(0,0,0,.3)","borderRadius":"0px","borderWidth":"0","width":"100%","borderStyle":"solid"}'>
- <div carousel-item>
- <div v-for="(item,index) in swiperList" :key="index">
- <img style="width: 100%;height: 100%;object-fit:cover;" :src="item.img"/>
- div>
- div>
- div>
- div>
-
- <div class="recommend index-pv1"
- :style='{"padding":"10px 0 10px 0","boxShadow":"0 0 0px ","margin":"10px 0 0 0","borderColor":"rgba(0,0,0,.3)","backgroundColor":"rgba(255, 0, 0, 0)","borderRadius":"0","borderWidth":"0","borderStyle":"solid"}'>
- <div class="box" style='width:80%'>
- <div :style='{"padding":"0","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"0","borderColor":"rgba(0,0,0,1)","backgroundColor":"rgba(0,0,0,0)","borderRadius":"10px","borderWidth":"0","width":"100%","borderStyle":"solid","height":"auto"}'>
- <div style="display: inline-block;text-align: center;cursor: pointer;"
- class="thisTableType-search main_backgroundColor" index=""
- :style='searchForm.huanbaojiankangTypes==""?{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","color":"#fff","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}:{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","backgroundColor":"#fff","color":"#333","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}'>
- 环保健康类型全部
- div>
- <div v-for="(item,index) in huanbaojiankangTypesList" :key="item.codeIndex"
- class="thisTableType-search main_backgroundColor" :index="item.codeIndex"
- :style='searchForm.huanbaojiankangTypes==item.codeIndex?{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","color":"#fff","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}:{"padding":"0 10px","boxShadow":"0 0 6px rgba(0,0,0,.3)","margin":"0 10px 0 0","borderColor":"rgba(0,0,0,1)","backgroundColor":"#fff","color":"#333","borderRadius":"10px","borderWidth":"0","lineHeight":"34px","fontSize":"14px","borderStyle":"solid"}'
- style="display: inline-block;text-align: center;cursor: pointer;">
- {{item.indexName}}
- div>
- div>
-
- <div class="title sub_backgroundColor sub_borderColor"
- :style='{"padding":"10px 0 10px 0","margin":"10px 0 10px 0","borderRadius":"4px","borderWidth":"1px","borderStyle":"solid","justifyContent":"space-between","height":"54px"}'>
- <span :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"rgba(255,0,0,1)","backgroundColor":"rgba(0,0,0,0)","color":"rgba(11, 11, 11, 1)","borderRadius":"0 0 2px 0","borderWidth":"0","fontSize":"18px","borderStyle":"solid"}'>
- 环保健康
- span>
- <span :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"rgba(0,0,0,0)","backgroundColor":"rgba(0,0,0,0)","color":"rgba(255, 255, 255, 1)","borderRadius":"0","borderWidth":"0","fontSize":"16px","borderStyle":"solid"}'>
- 您现在的位置:环保健康
- span>
- div>
-
- <form class="layui-form filter main_backgroundColor"
- :style='{"padding":"0 10px","boxShadow":"0 0 0px rgba(255,0,0,.8)","margin":"10px 0 10px 0","borderColor":"rgba(0,0,0,.3)","borderRadius":"4px","alignItems":"center","borderWidth":"0","borderStyle":"solid","justifyContent":"flex-end","height":"64px"}'>
-
-
- <div class="item-list">
- <div class="lable"
- :style='{"padding":"0 10px","boxShadow":"0 0 6px rgba(255,0,0,0)","margin":"0","borderColor":"rgba(0,0,0,0)","backgroundColor":"transparent","color":"rgba(17, 16, 16, 1)","borderRadius":"0","textAlign":"right","borderWidth":"0","width":"auto","fontSize":"16px","borderStyle":"solid"}'>
- 标题
- div>
- <input type="text" v-model="searchForm.huanbaojiankangName"
- :style='{"boxShadow":"0 0 6px rgba(255,0,0,0)","borderColor":"#ccc","backgroundColor":"#fff","color":"rgba(135, 206, 250, 1)","borderRadius":"8px","textAlign":"center","borderWidth":"0","width":"140px","fontSize":"14px","borderStyle":"solid","height":"44px"}'
- placeholder="标题" autocomplete="off"
- class="layui-input">
- div>
-
-
- <button id="btn-search" :style='{"padding":"0 15px","boxShadow":"0 0 8px rgba(0,0,0,0)","margin":"0 0 0 10px","borderColor":"rgba(135, 206, 250, 1)","color":"#fff","borderRadius":"4px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="button" class="layui-btn layui-btn-normal sub_backgroundColor">
- <i v-if="true" class="layui-icon layui-icon-search">i>搜索
- button>
- <button v-if="isAuth('huanbaojiankang','新增')" @click="jump('../huanbaojiankang/add.html')" :style='{"padding":"0 15px","boxShadow":"0 0 8px rgba(0,0,0,0)","margin":"0 0 0 10px","borderColor":"rgba(135, 206, 250, 1)","backgroundColor":"rgba(135, 206, 250, 1)","color":"#fff","borderRadius":"4px","borderWidth":"0","width":"auto","fontSize":"14px","borderStyle":"solid","height":"40px"}' type="button" class="layui-btn btn-theme">
- <i v-if="true" class="layui-icon">i>添加
- button>
- form>
-
- <div class="travel-gallery-wrapper">
- <div class="row">
- <div v-for="(item,index) in dataList" v-bind:key="index" class="col-md-3 col-sm-6 col-xs-6 col-lg-3 single-box">
- <div @click="jumpCheck('../huanbaojiankang/detail.html?id='+item.id , item.aaaaaaaaaa == null?'':item.aaaaaaaaaa , item.shangxiaTypes == null?'':item.shangxiaTypes)">
- <div class="part-img">
- <img :src="item.huanbaojiankangPhoto?item.huanbaojiankangPhoto.split(',')[0]:''" style="height: 350px;width:100%;">
- div>
- <div class="part-txt">
- <a href="javascript:return false;" style="font-size: 24px"><i class="layui-icon layui-icon-link">i>a>
-
- <div class="title">
- <h3>{{item.huanbaojiankangName}}h3>
- <p v-if="item.huanbaojiankangNewMoney">
- {{item.huanbaojiankangNewMoney}} RMB
- p>
- <p v-else>
- {{item.huanbaojiankangValue}}
- p>
- div>
- div>
- div>
- div>
- div>
- div>
- div>
- div>
- <div class="pager" id="pager" :style="{textAlign:'center'}">div>
- div>
-
- <script src="../../xznstatic/js/bootstrap.min.js" type="text/javascript" charset="utf-8">script>
- <script src="../../layui/layui.js">script>
- <script src="../../js/vue.js">script>
- <script src="../../xznstatic/js/element.min.js">script>
- <link rel="stylesheet" href="../../xznstatic/css/element.min.css">
- <script src="../../js/config.js">script>
- <script src="../../modules/config.js">script>
- <script src="../../js/utils.js">script>
-
- <script type="text/javascript">
- var vue = new Vue({
- el: '#app',
- data: {
- swiperList: [],
- huanbaojiankangTypesList: [],
-
- //查询条件
- searchForm: {
- page: 1
- ,limit: 8
- ,huanbaojiankangName: ""
- ,huanbaojiankangTypes: ""
- ,huanbaojiankangPhoto: ""
- ,huanbaojiankangContent: ""
- },
-
-
- dataList: [],
- },
- filters: {
- subString: function(val) {
- if (val) {
- val = val.replace(/<[^<>]+>/g, '').replace(/undefined/g, '');
- if (val.length > 60) {
- val = val.substring(0, 60);
- val+='...';
- }
- return val;
- }
- return '';
- }
- },
- computed: {
- },
- methods: {
- isAuth(tablename, button) {
- return isFrontAuth(tablename, button);
- }
- ,jump(url) {
- jump(url);
- }
- ,jumpCheck(url,check1,check2) {
- if(check1 == "2" || check1 == 2){//级联表的逻辑删除字段[1:未删除 2:已删除]
- layui.layer.msg("已经被删除", {
- time: 2000,
- icon: 2
- });
- return false;
- }
- if(check2 == "2" || check2 == 2){//是否下架[1:上架 2:下架]
- layui.layer.msg("已经下架", {
- time: 2000,
- icon: 2
- });
- return false;
- }
- this.jump(url);
- }
- }
- });
-
- layui.use(['layer', 'element', 'carousel', 'laypage', 'http', 'jquery', 'laydate', 'tinymce'], function() {
- var layer = layui.layer;
- var element = layui.element;
- var carousel = layui.carousel;
- var laypage = layui.laypage;
- var http = layui.http;
- var laydate = layui.laydate;
- var tinymce = layui.tinymce;
- window.jQuery = window.$ = jquery = layui.jquery;
-
- // var id = http.getParam('id');
-
- // 获取轮播图 数据
- http.request('config/list', 'get', {
- page: 1,
- limit: 5
- }, function (res) {
- if (res.data.list.length > 0) {
- let swiperList = [];
- res.data.list.forEach(element => {
- if(element.value != null){
- swiperList.push({
- img: element.value
- });
- }
- });
- vue.swiperList = swiperList;
-
- vue.$nextTick(() => {
- carousel.render({
- elem: '#swiper',
- width: '100%',
- height: '450px',
- arrow: 'hover',
- anim: 'default',
- autoplay: 'true',
- interval: '3000',
- indicator: 'inside'
- });
- });
- }
- });
-
- //环保健康类型的动态搜素
- $(document).on("click", ".thisTableType-search", function (e) {
- vue.searchForm.huanbaojiankangTypes = $(this).attr('index');
- pageList();
- });
-
-
- //当前表的 环保健康类型 字段 字典表查询
- huanbaojiankangTypesSelect();
- //当前表的 环保健康类型 字段 字典表查询方法
- function huanbaojiankangTypesSelect() {
- http.request("dictionary/page?page=1&limit=100&sort=&order=&dicCode=huanbaojiankang_types", 'get', {}, function (res) {
- if(res.code == 0){
- vue.huanbaojiankangTypesList = res.data.list;
- }
- });
- }
-
-
- // 分页列表
- pageList();
-
- // 搜索按钮
- jquery('#btn-search').click(function (e) {
- pageList();
- });
-
- function pageList() {
- // 获取列表数据
- http.request('huanbaojiankang/list', 'get', vue.searchForm, function (res) {
- vue.dataList = res.data.list;
- // 分页
- laypage.render({
- elem: 'pager',
- count: res.data.total,
- limit: vue.searchForm.limit,
- groups: 3,
- layout: ["prev", "page", "next"],
- jump: function (obj, first) {
- vue.searchForm.page = obj.curr;//翻页
- //首次不执行
- if (!first) {
- http.request('huanbaojiankang/list', 'get', vue.searchForm, function (res1) {
- vue.dataList = res1.data.list;
- })
- }
- }
- });
- });
- }
- });
-
- window.xznSlide = function () {
- jQuery(".banner").slide({mainCell: ".bd ul", autoPlay: true, interTime: 5000});
- jQuery("#ifocus").slide({
- titCell: "#ifocus_btn li",
- mainCell: "#ifocus_piclist ul",
- effect: "leftLoop",
- delayTime: 200,
- autoPlay: true,
- triggerTime: 0
- });
- jQuery("#ifocus").slide({titCell: "#ifocus_btn li", mainCell: "#ifocus_tx ul", delayTime: 0, autoPlay: true});
- jQuery(".product_list").slide({
- mainCell: ".bd ul",
- autoPage: true,
- effect: "leftLoop",
- autoPlay: true,
- vis: 5,
- trigger: "click",
- interTime: 4000
- });
- };
- script>
- body>
- html>

你可能还有感兴趣的项目👇🏻👇🏻👇🏻
更多项目推荐:计算机毕业设计项目
如果大家有任何疑虑,请在下方咨询或评论