@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="gerenjiankangguanlixitong" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="gerenjiankangguanlixitong" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.jlwl</groupId>
|
||||
<!-- 导入项目的名称 -->
|
||||
<artifactId>gerenjiankangguanlixitong</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>gerenjiankangguanlixitong</name>
|
||||
<description>个人健康管理系统小程序</description>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<fastjson.version>1.2.8</fastjson.version>
|
||||
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>2.1.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--访问静态资源-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--热部署-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.38</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring</artifactId>
|
||||
<version>1.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>2.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatisplus-spring-boot-starter</artifactId>
|
||||
<version>1.0.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.10.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
<version>2.0.1.Final</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.0.12</version>
|
||||
</dependency>
|
||||
|
||||
<!-- FastJson -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<scope>4.0</scope>
|
||||
<version>4.0</version>
|
||||
</dependency>-->
|
||||
|
||||
<!-- 百度人工智能 -->
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!-- poi高版本额外包 -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-examples</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-excelant</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-ooxml-schemas</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi-scratchpad</artifactId>
|
||||
<version>3.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.junit.vintage</groupId>
|
||||
<artifactId>junit-vintage-engine</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,356 @@
|
||||
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("/dictionary")
|
||||
public class DictionaryController {
|
||||
// 定义日志记录器
|
||||
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
|
||||
|
||||
// 定义表名常量
|
||||
private static final String TABLE_NAME = "dictionary";
|
||||
|
||||
// 自动注入DictionaryService
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
// 自动注入TokenService
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
// 自动注入ForumService
|
||||
@Autowired
|
||||
private ForumService forumService; // 论坛
|
||||
|
||||
// 自动注入GerentizhengService
|
||||
@Autowired
|
||||
private GerentizhengService gerentizhengService; // 体检记录
|
||||
|
||||
// 自动注入JiankangtieshiService
|
||||
@Autowired
|
||||
private JiankangtieshiService jiankangtieshiService; // 健康贴士
|
||||
|
||||
// 自动注入MeirijihuaService
|
||||
@Autowired
|
||||
private MeirijihuaService meirijihuaService; // 每日计划
|
||||
|
||||
// 自动注入MeishiService
|
||||
@Autowired
|
||||
private MeishiService meishiService; // 健康食谱
|
||||
|
||||
// 自动注入MeishiCollectionService
|
||||
@Autowired
|
||||
private MeishiCollectionService meishiCollectionService; // 健康食谱收藏
|
||||
|
||||
// 自动注入MeishiLiuyanService
|
||||
@Autowired
|
||||
private MeishiLiuyanService meishiLiuyanService; // 健康食谱留言
|
||||
|
||||
// 自动注入NewsService
|
||||
@Autowired
|
||||
private NewsService newsService; // 公告信息
|
||||
|
||||
// 自动注入YaopinService
|
||||
@Autowired
|
||||
private YaopinService yaopinService; // 药品信息
|
||||
|
||||
// 自动注入YonghuService
|
||||
@Autowired
|
||||
private YonghuService yonghuService; // 用户
|
||||
|
||||
// 自动注入YundongService
|
||||
@Autowired
|
||||
private YundongService yundongService; // 运动教程
|
||||
|
||||
// 自动注入YundongCollectionService
|
||||
@Autowired
|
||||
private YundongCollectionService yundongCollectionService; // 运动教程收藏
|
||||
|
||||
// 自动注入YundongLiuyanService
|
||||
@Autowired
|
||||
private YundongLiuyanService yundongLiuyanService; // 运动教程留言
|
||||
|
||||
// 自动注入UsersService
|
||||
@Autowired
|
||||
private UsersService usersService; // 管理员
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
@IgnoreAuth
|
||||
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
|
||||
// 检查参数
|
||||
CommonUtil.checkMap(params);
|
||||
// 调用服务层方法查询分页数据
|
||||
PageUtils page = dictionaryService.queryPage(params);
|
||||
|
||||
// 字典表数据转换
|
||||
List<DictionaryView> list = (List<DictionaryView>) page.getList();
|
||||
for (DictionaryView 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);
|
||||
// 根据ID查询字典实体
|
||||
DictionaryEntity dictionary = dictionaryService.selectById(id);
|
||||
if (dictionary != null) {
|
||||
// 实体转视图
|
||||
DictionaryView view = new DictionaryView();
|
||||
BeanUtils.copyProperties(dictionary, view); // 把实体数据重构到视图中
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view, request);
|
||||
// 返回查询结果
|
||||
return R.ok().put("data", view);
|
||||
} else {
|
||||
// 返回错误信息
|
||||
return R.error(511, "查不到数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("save方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
|
||||
|
||||
// 获取当前用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
if (false)
|
||||
return R.error(511, "永远不会进入");
|
||||
|
||||
// 构建查询条件
|
||||
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
|
||||
.eq("dic_code", dictionary.getDicCode())
|
||||
.eq("index_name", dictionary.getIndexName());
|
||||
if (dictionary.getDicCode().contains("_erji_types")) {
|
||||
queryWrapper.eq("super_id", dictionary.getSuperId());
|
||||
}
|
||||
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:" + queryWrapper.getSqlSegment());
|
||||
// 查询是否存在相同数据
|
||||
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
|
||||
if (dictionaryEntity == null) {
|
||||
// 设置创建时间
|
||||
dictionary.setCreateTime(new Date());
|
||||
// 插入新数据
|
||||
dictionaryService.insert(dictionary);
|
||||
// 字典表新增数据,把数据再重新查出,放入监听器中
|
||||
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
|
||||
ServletContext servletContext = request.getServletContext();
|
||||
Map<String, Map<Integer, String>> map = new HashMap<>();
|
||||
for (DictionaryEntity d : dictionaryEntities) {
|
||||
Map<Integer, String> m = map.get(d.getDicCode());
|
||||
if (m == null || m.isEmpty()) {
|
||||
m = new HashMap<>();
|
||||
}
|
||||
m.put(d.getCodeIndex(), d.getIndexName());
|
||||
map.put(d.getDicCode(), m);
|
||||
}
|
||||
servletContext.setAttribute("dictionaryMap", map);
|
||||
// 返回成功信息
|
||||
return R.ok();
|
||||
} else {
|
||||
// 返回错误信息
|
||||
return R.error(511, "表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端修改
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
// 记录日志
|
||||
logger.debug("update方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
|
||||
// 查询原先数据
|
||||
DictionaryEntity oldDictionaryEntity = dictionaryService.selectById(dictionary.getId());
|
||||
|
||||
// 获取当前用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if(false)
|
||||
// return R.error(511,"永远不会进入");
|
||||
|
||||
// 根据ID更新数据
|
||||
dictionaryService.updateById(dictionary);
|
||||
// 如果字典表修改数据的话,把数据再重新查出,放入监听器中
|
||||
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
|
||||
ServletContext servletContext = request.getServletContext();
|
||||
Map<String, Map<Integer, String>> map = new HashMap<>();
|
||||
for (DictionaryEntity d : dictionaryEntities) {
|
||||
Map<Integer, String> m = map.get(d.getDicCode());
|
||||
if (m == null || m.isEmpty()) {
|
||||
m = new HashMap<>();
|
||||
}
|
||||
m.put(d.getCodeIndex(), d.getIndexName());
|
||||
map.put(d.getDicCode(), m);
|
||||
}
|
||||
servletContext.setAttribute("dictionaryMap", map);
|
||||
// 返回成功信息
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
|
||||
// 查询要删除的数据
|
||||
List<DictionaryEntity> oldDictionaryList = dictionaryService.selectBatchIds(Arrays.asList(ids));
|
||||
// 批量删除数据
|
||||
dictionaryService.deleteBatchIds(Arrays.asList(ids));
|
||||
// 返回成功信息
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
@RequestMapping("/maxCodeIndex")
|
||||
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) {
|
||||
// 记录日志
|
||||
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
|
||||
// 设置排序字段
|
||||
List<String> descs = new ArrayList<>();
|
||||
descs.add("code_index");
|
||||
// 构建查询条件
|
||||
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
|
||||
.eq("dic_code", dictionary.getDicCode())
|
||||
.orderDesc(descs);
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:" + queryWrapper.getSqlSegment());
|
||||
// 查询列表
|
||||
List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);
|
||||
if (dictionaryEntityList.size() > 0) {
|
||||
// 返回最大codeIndex + 1
|
||||
return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1);
|
||||
} else {
|
||||
// 返回默认值1
|
||||
return R.ok().put("maxCodeIndex", 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上传
|
||||
*/
|
||||
@RequestMapping("/batchInsert")
|
||||
public R save(String fileName, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
|
||||
// 获取当前用户ID
|
||||
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
|
||||
// 设置日期格式
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
// 初始化字典实体列表
|
||||
List<DictionaryEntity> dictionaryList = new ArrayList<>(); // 上传的东西
|
||||
// 初始化要查询的字段
|
||||
Map<String, List<String>> 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 {
|
||||
// 读取xls文件
|
||||
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
|
||||
dataList.remove(0); // 删除第一行,因为第一行是提示
|
||||
for (List<String> data : dataList) {
|
||||
// 循环
|
||||
DictionaryEntity dictionaryEntity = new DictionaryEntity();
|
||||
// dictionaryEntity.setDicCode(data.get(0)); // 字段 要改的
|
||||
// dictionaryEntity.setDicName(data.get(0)); // 字段名 要改的
|
||||
// dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0))); // 编码 要改的
|
||||
// dictionaryEntity.setIndexName(data.get(0)); // 编码名字 要改的
|
||||
// dictionaryEntity.setSuperId(Integer.valueOf(data.get(0))); // 父字段id 要改的
|
||||
// dictionaryEntity.setBeizhu(data.get(0)); // 备注 要改的
|
||||
// dictionaryEntity.setCreateTime(date);// 时间
|
||||
dictionaryList.add(dictionaryEntity);
|
||||
|
||||
// 把要查询是否重复的字段放入map中
|
||||
}
|
||||
|
||||
// 查询是否重复
|
||||
dictionaryService.insertBatch(dictionaryList);
|
||||
// 返回成功信息
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 打印异常堆栈信息
|
||||
e.printStackTrace();
|
||||
// 返回错误信息
|
||||
return R.error(511, "批量插入数据异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,441 @@
|
||||
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("/meirijihua")
|
||||
public class MeirijihuaController {
|
||||
// 日志记录器
|
||||
private static final Logger logger = LoggerFactory.getLogger(MeirijihuaController.class);
|
||||
|
||||
// 表名常量
|
||||
private static final String TABLE_NAME = "meirijihua";
|
||||
|
||||
// 自动注入每日计划服务
|
||||
@Autowired
|
||||
private MeirijihuaService meirijihuaService;
|
||||
|
||||
// 自动注入Token服务
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
// 自动注入字典服务
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
// 自动注入论坛服务
|
||||
@Autowired
|
||||
private ForumService forumService;
|
||||
|
||||
// 自动注入体检记录服务
|
||||
@Autowired
|
||||
private GerentizhengService gerentizhengService;
|
||||
|
||||
// 自动注入健康贴士服务
|
||||
@Autowired
|
||||
private JiankangtieshiService jiankangtieshiService;
|
||||
|
||||
// 自动注入健康食谱服务
|
||||
@Autowired
|
||||
private MeishiService meishiService;
|
||||
|
||||
// 自动注入健康食谱收藏服务
|
||||
@Autowired
|
||||
private MeishiCollectionService meishiCollectionService;
|
||||
|
||||
// 自动注入健康食谱留言服务
|
||||
@Autowired
|
||||
private MeishiLiuyanService meishiLiuyanService;
|
||||
|
||||
// 自动注入公告信息服务
|
||||
@Autowired
|
||||
private NewsService newsService;
|
||||
|
||||
// 自动注入药品信息服务
|
||||
@Autowired
|
||||
private YaopinService yaopinService;
|
||||
|
||||
// 自动注入用户服务
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
|
||||
// 自动注入运动教程服务
|
||||
@Autowired
|
||||
private YundongService yundongService;
|
||||
|
||||
// 自动注入运动教程收藏服务
|
||||
@Autowired
|
||||
private YundongCollectionService yundongCollectionService;
|
||||
|
||||
// 自动注入运动教程留言服务
|
||||
@Autowired
|
||||
private YundongLiuyanService yundongLiuyanService;
|
||||
|
||||
// 自动注入管理员服务
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
*
|
||||
* @param params 请求参数
|
||||
* @param request HTTP请求对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> 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"));
|
||||
// 设置删除状态
|
||||
params.put("meirijihuaDeleteStart", 1);
|
||||
params.put("meirijihuaDeleteEnd", 1);
|
||||
// 检查参数
|
||||
CommonUtil.checkMap(params);
|
||||
// 查询分页数据
|
||||
PageUtils page = meirijihuaService.queryPage(params);
|
||||
|
||||
// 字典表数据转换
|
||||
List<MeirijihuaView> list = (List<MeirijihuaView>) page.getList();
|
||||
for (MeirijihuaView c : list) {
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c, request);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端详情
|
||||
*
|
||||
* @param id 每日计划ID
|
||||
* @param request HTTP请求对象
|
||||
* @return 每日计划详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
|
||||
// 根据ID查询每日计划
|
||||
MeirijihuaEntity meirijihua = meirijihuaService.selectById(id);
|
||||
if (meirijihua != null) {
|
||||
// entity转view
|
||||
MeirijihuaView view = new MeirijihuaView();
|
||||
BeanUtils.copyProperties(meirijihua, view);// 把实体数据重构到view中
|
||||
// 级联表 用户
|
||||
// 级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(meirijihua.getYonghuId());
|
||||
if (yonghu != null) {
|
||||
BeanUtils.copyProperties(yonghu, view, new String[]{"id", "createTime", "insertTime", "updateTime", "yonghuId"});// 把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view, request);
|
||||
return R.ok().put("data", view);
|
||||
} else {
|
||||
return R.error(511, "查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
*
|
||||
* @param meirijihua 每日计划实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody MeirijihuaEntity meirijihua, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("save方法:,,Controller:{},,meirijihua:{}", this.getClass().getName(), meirijihua.toString());
|
||||
|
||||
// 获取用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// 根据角色设置用户ID
|
||||
if (false)
|
||||
return R.error(511, "永远不会进入");
|
||||
else if ("用户".equals(role))
|
||||
meirijihua.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
|
||||
|
||||
// 构建查询条件
|
||||
Wrapper<MeirijihuaEntity> queryWrapper = new EntityWrapper<MeirijihuaEntity>()
|
||||
.eq("yonghu_id", meirijihua.getYonghuId())
|
||||
.eq("meirijihua_name", meirijihua.getMeirijihuaName())
|
||||
.eq("meirijihua_delete", meirijihua.getMeirijihuaDelete());
|
||||
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:" + queryWrapper.getSqlSegment());
|
||||
// 查询是否存在相同数据
|
||||
MeirijihuaEntity meirijihuaEntity = meirijihuaService.selectOne(queryWrapper);
|
||||
if (meirijihuaEntity == null) {
|
||||
// 设置删除状态和时间戳
|
||||
meirijihua.setMeirijihuaDelete(1);
|
||||
meirijihua.setInsertTime(new Date());
|
||||
meirijihua.setCreateTime(new Date());
|
||||
// 插入数据
|
||||
meirijihuaService.insert(meirijihua);
|
||||
return R.ok();
|
||||
} else {
|
||||
return R.error(511, "表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端修改
|
||||
*
|
||||
* @param meirijihua 每日计划实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody MeirijihuaEntity meirijihua, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
// 记录日志
|
||||
logger.debug("update方法:,,Controller:{},,meirijihua:{}", this.getClass().getName(), meirijihua.toString());
|
||||
// 查询原先数据
|
||||
MeirijihuaEntity oldMeirijihuaEntity = meirijihuaService.selectById(meirijihua.getId());
|
||||
|
||||
// 获取用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if(false)
|
||||
// return R.error(511,"永远不会进入");
|
||||
// else if("用户".equals(role))
|
||||
// meirijihua.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
|
||||
|
||||
// 根据ID更新数据
|
||||
meirijihuaService.updateById(meirijihua);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param ids 每日计划ID数组
|
||||
* @param request HTTP请求对象
|
||||
* @return 删除结果
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
|
||||
// 要删除的数据
|
||||
List<MeirijihuaEntity> oldMeirijihuaList = meirijihuaService.selectBatchIds(Arrays.asList(ids));
|
||||
ArrayList<MeirijihuaEntity> list = new ArrayList<>();
|
||||
for (Integer id : ids) {
|
||||
MeirijihuaEntity meirijihuaEntity = new MeirijihuaEntity();
|
||||
meirijihuaEntity.setId(id);
|
||||
meirijihuaEntity.setMeirijihuaDelete(2);
|
||||
list.add(meirijihuaEntity);
|
||||
}
|
||||
if (list != null && list.size() > 0) {
|
||||
meirijihuaService.updateBatchById(list);
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上传
|
||||
*
|
||||
* @param fileName 文件名
|
||||
* @param request HTTP请求对象
|
||||
* @return 上传结果
|
||||
*/
|
||||
@RequestMapping("/batchInsert")
|
||||
public R save(String fileName, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
|
||||
// 获取用户ID
|
||||
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
List<MeirijihuaEntity> meirijihuaList = new ArrayList<>();// 上传的东西
|
||||
Map<String, List<String>> 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<List<String>> dataList = PoiUtil.poiImport(file.getPath());// 读取xls文件
|
||||
dataList.remove(0);// 删除第一行,因为第一行是提示
|
||||
for (List<String> data : dataList) {
|
||||
// 循环
|
||||
MeirijihuaEntity meirijihuaEntity = new MeirijihuaEntity();
|
||||
// meirijihuaEntity.setYonghuId(Integer.valueOf(data.get(0))); // 用户 要改的
|
||||
// meirijihuaEntity.setMeirijihuaName(data.get(0)); // 计划标题 要改的
|
||||
// meirijihuaEntity.setYinshiText(data.get(0)); // 饮食计划 要改的
|
||||
// meirijihuaEntity.setYundongText(data.get(0)); // 运动计划 要改的
|
||||
// meirijihuaEntity.setYaopinText(data.get(0)); // 药品计划 要改的
|
||||
// meirijihuaEntity.setMeirijihuaContent("");// 详情和图片
|
||||
// meirijihuaEntity.setMeirijihuaTime(sdf.parse(data.get(0))); // 计划时间 要改的
|
||||
// meirijihuaEntity.setMeirijihuaDelete(1);// 逻辑删除字段
|
||||
// meirijihuaEntity.setInsertTime(date);// 时间
|
||||
// meirijihuaEntity.setCreateTime(date);// 时间
|
||||
meirijihuaList.add(meirijihuaEntity);
|
||||
|
||||
// 把要查询是否重复的字段放入map中
|
||||
}
|
||||
|
||||
// 查询是否重复
|
||||
meirijihuaService.insertBatch(meirijihuaList);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return R.error(511, "批量插入数据异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端列表
|
||||
*
|
||||
* @param params 请求参数
|
||||
* @param request HTTP请求对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("list方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
|
||||
|
||||
// 检查参数
|
||||
CommonUtil.checkMap(params);
|
||||
// 查询分页数据
|
||||
PageUtils page = meirijihuaService.queryPage(params);
|
||||
|
||||
// 字典表数据转换
|
||||
List<MeirijihuaView> list = (List<MeirijihuaView>) page.getList();
|
||||
for (MeirijihuaView c : list)
|
||||
dictionaryService.dictionaryConvert(c, request); // 修改对应字典表字段
|
||||
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端详情
|
||||
*
|
||||
* @param id 每日计划ID
|
||||
* @param request HTTP请求对象
|
||||
* @return 每日计划详情
|
||||
*/
|
||||
@RequestMapping("/detail/{id}")
|
||||
public R detail(@PathVariable("id") Long id, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
|
||||
// 根据ID查询每日计划
|
||||
MeirijihuaEntity meirijihua = meirijihuaService.selectById(id);
|
||||
if (meirijihua != null) {
|
||||
// entity转view
|
||||
MeirijihuaView view = new MeirijihuaView();
|
||||
BeanUtils.copyProperties(meirijihua, view);// 把实体数据重构到view中
|
||||
|
||||
// 级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(meirijihua.getYonghuId());
|
||||
if (yonghu != null) {
|
||||
BeanUtils.copyProperties(yonghu, view, new String[]{"id", "createDate"});// 把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view, request);
|
||||
return R.ok().put("data", view);
|
||||
} else {
|
||||
return R.error(511, "查不到数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端保存
|
||||
*
|
||||
* @param meirijihua 每日计划实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public R add(@RequestBody MeirijihuaEntity meirijihua, HttpServletRequest request) {
|
||||
// 记录日志
|
||||
logger.debug("add方法:,,Controller:{},,meirijihua:{}", this.getClass().getName(), meirijihua.toString());
|
||||
// 构建查询条件
|
||||
Wrapper<MeirijihuaEntity> queryWrapper = new EntityWrapper<MeirijihuaEntity>()
|
||||
.eq("yonghu_id", meirijihua.getYonghuId())
|
||||
.eq("meirijihua_name", meirijihua.getMeirijihuaName())
|
||||
.eq("yinshi_text", meirijihua.getYinshiText())
|
||||
.eq("yundong_text", meirijihua.getYundongText())
|
||||
.eq("yaopin_text", meirijihua.getYaopinText())
|
||||
.eq("meirijihua_delete", meirijihua.getMeirijihuaDelete())
|
||||
// .notIn("meirijihua_types", new Integer[]{102})
|
||||
;
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:" + queryWrapper.getSqlSegment());
|
||||
// 查询是否存在相同数据
|
||||
MeirijihuaEntity meirijihuaEntity = meirijihuaService.selectOne(queryWrapper);
|
||||
if (meirijihuaEntity == null) {
|
||||
// 设置删除状态和时间戳
|
||||
meirijihua.setMeirijihuaDelete(1);
|
||||
meirijihua.setInsertTime(new Date());
|
||||
meirijihua.setCreateTime(new Date());
|
||||
// 插入数据
|
||||
// 插入每日计划数据
|
||||
meirijihuaService.insert(meirijihua);
|
||||
|
||||
// 返回成功响应
|
||||
return R.ok();
|
||||
} else {
|
||||
// 返回错误响应,提示表中已有相同数据
|
||||
return R.error(511, "表中有相同数据");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,434 @@
|
||||
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("/meishiCollection")
|
||||
public class MeishiCollectionController {
|
||||
// 日志记录器
|
||||
private static final Logger logger = LoggerFactory.getLogger(MeishiCollectionController.class);
|
||||
|
||||
// 表名常量
|
||||
private static final String TABLE_NAME = "meishiCollection";
|
||||
|
||||
// 自动注入健康食谱收藏服务
|
||||
@Autowired
|
||||
private MeishiCollectionService meishiCollectionService;
|
||||
|
||||
// 自动注入Token服务
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
// 自动注入字典服务
|
||||
@Autowired
|
||||
private DictionaryService dictionaryService;
|
||||
|
||||
// 自动注入论坛服务
|
||||
@Autowired
|
||||
private ForumService forumService;
|
||||
|
||||
// 自动注入体检记录服务
|
||||
@Autowired
|
||||
private GerentizhengService gerentizhengService;
|
||||
|
||||
// 自动注入健康贴士服务
|
||||
@Autowired
|
||||
private JiankangtieshiService jiankangtieshiService;
|
||||
|
||||
// 自动注入每日计划服务
|
||||
@Autowired
|
||||
private MeirijihuaService meirijihuaService;
|
||||
|
||||
// 自动注入健康食谱服务
|
||||
@Autowired
|
||||
private MeishiService meishiService;
|
||||
|
||||
// 自动注入健康食谱留言服务
|
||||
@Autowired
|
||||
private MeishiLiuyanService meishiLiuyanService;
|
||||
|
||||
// 自动注入公告信息服务
|
||||
@Autowired
|
||||
private NewsService newsService;
|
||||
|
||||
// 自动注入药品信息服务
|
||||
@Autowired
|
||||
private YaopinService yaopinService;
|
||||
|
||||
// 自动注入用户服务
|
||||
@Autowired
|
||||
private YonghuService yonghuService;
|
||||
|
||||
// 自动注入运动教程服务
|
||||
@Autowired
|
||||
private YundongService yundongService;
|
||||
|
||||
// 自动注入运动教程收藏服务
|
||||
@Autowired
|
||||
private YundongCollectionService yundongCollectionService;
|
||||
|
||||
// 自动注入运动教程留言服务
|
||||
@Autowired
|
||||
private YundongLiuyanService yundongLiuyanService;
|
||||
|
||||
// 自动注入管理员服务
|
||||
@Autowired
|
||||
private UsersService usersService;
|
||||
|
||||
/**
|
||||
* 后端列表
|
||||
* @param params 请求参数
|
||||
* @param request HTTP请求对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
@RequestMapping("/page")
|
||||
public R page(@RequestParam Map<String, Object> 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"));
|
||||
// 检查参数
|
||||
CommonUtil.checkMap(params);
|
||||
// 查询分页数据
|
||||
PageUtils page = meishiCollectionService.queryPage(params);
|
||||
|
||||
// 字典表数据转换
|
||||
List<MeishiCollectionView> list =(List<MeishiCollectionView>)page.getList();
|
||||
for(MeishiCollectionView c:list){
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(c, request);
|
||||
}
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端详情
|
||||
* @param id 健康食谱收藏ID
|
||||
* @param request HTTP请求对象
|
||||
* @return 健康食谱收藏详情
|
||||
*/
|
||||
@RequestMapping("/info/{id}")
|
||||
public R info(@PathVariable("id") Long id, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
// 根据ID查询健康食谱收藏
|
||||
MeishiCollectionEntity meishiCollection = meishiCollectionService.selectById(id);
|
||||
if(meishiCollection !=null){
|
||||
// entity转view
|
||||
MeishiCollectionView view = new MeishiCollectionView();
|
||||
BeanUtils.copyProperties( meishiCollection , view );
|
||||
// 把实体数据重构到view中
|
||||
// 级联表 健康食谱
|
||||
// 级联表
|
||||
MeishiEntity meishi = meishiService.selectById(meishiCollection.getMeishiId());
|
||||
if(meishi != null){
|
||||
BeanUtils.copyProperties( meishi , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});
|
||||
// 把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
|
||||
view.setMeishiId(meishi.getId());
|
||||
}
|
||||
// 级联表 用户
|
||||
// 级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(meishiCollection.getYonghuId());
|
||||
if(yonghu != null){
|
||||
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime", "yonghuId"});
|
||||
// 把级联的数据添加到view中,并排除id和创建时间字段,当前表的级联注册表
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view, request);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端保存
|
||||
* @param meishiCollection 健康食谱收藏实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody MeishiCollectionEntity meishiCollection, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("save方法:,,Controller:{},,meishiCollection:{}",this.getClass().getName(),meishiCollection.toString());
|
||||
|
||||
// 获取用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// 根据角色设置用户ID
|
||||
if(false)
|
||||
return R.error(511,"永远不会进入");
|
||||
else if("用户".equals(role))
|
||||
meishiCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
|
||||
|
||||
// 构建查询条件
|
||||
Wrapper<MeishiCollectionEntity> queryWrapper = new EntityWrapper<MeishiCollectionEntity>()
|
||||
.eq("meishi_id", meishiCollection.getMeishiId())
|
||||
.eq("yonghu_id", meishiCollection.getYonghuId())
|
||||
.eq("meishi_collection_types", meishiCollection.getMeishiCollectionTypes())
|
||||
;
|
||||
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
// 查询是否存在相同数据
|
||||
MeishiCollectionEntity meishiCollectionEntity = meishiCollectionService.selectOne(queryWrapper);
|
||||
if(meishiCollectionEntity==null){
|
||||
// 设置时间戳
|
||||
meishiCollection.setInsertTime(new Date());
|
||||
meishiCollection.setCreateTime(new Date());
|
||||
// 插入数据
|
||||
meishiCollectionService.insert(meishiCollection);
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"表中有相同数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后端修改
|
||||
* @param meishiCollection 健康食谱收藏实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@RequestMapping("/update")
|
||||
public R update(@RequestBody MeishiCollectionEntity meishiCollection, HttpServletRequest request) throws NoSuchFieldException, ClassNotFoundException, IllegalAccessException, InstantiationException {
|
||||
// 记录日志
|
||||
logger.debug("update方法:,,Controller:{},,meishiCollection:{}",this.getClass().getName(),meishiCollection.toString());
|
||||
// 查询原先数据
|
||||
MeishiCollectionEntity oldMeishiCollectionEntity = meishiCollectionService.selectById(meishiCollection.getId());
|
||||
|
||||
// 获取用户角色
|
||||
String role = String.valueOf(request.getSession().getAttribute("role"));
|
||||
// if(false)
|
||||
// return R.error(511,"永远不会进入");
|
||||
// else if("用户".equals(role))
|
||||
// meishiCollection.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
|
||||
|
||||
// 根据ID更新数据
|
||||
meishiCollectionService.updateById(meishiCollection);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param ids 健康食谱收藏ID数组
|
||||
* @param request HTTP请求对象
|
||||
* @return 删除结果
|
||||
*/
|
||||
@RequestMapping("/delete")
|
||||
public R delete(@RequestBody Integer[] ids, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
|
||||
// 要删除的数据
|
||||
List<MeishiCollectionEntity> oldMeishiCollectionList =meishiCollectionService.selectBatchIds(Arrays.asList(ids));
|
||||
// 批量删除数据
|
||||
meishiCollectionService.deleteBatchIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量上传
|
||||
* @param fileName 文件名
|
||||
* @param request HTTP请求对象
|
||||
* @return 上传结果
|
||||
*/
|
||||
@RequestMapping("/batchInsert")
|
||||
public R save( String fileName, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
|
||||
// 获取用户ID
|
||||
Integer yonghuId = Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId")));
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
List<MeishiCollectionEntity> meishiCollectionList = new ArrayList<>();// 上传的东西
|
||||
Map<String, List<String>> 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<List<String>> dataList = PoiUtil.poiImport(file.getPath());
|
||||
// 读取xls文件
|
||||
dataList.remove(0);// 删除第一行,因为第一行是提示
|
||||
for(List<String> data:dataList){
|
||||
// 循环
|
||||
MeishiCollectionEntity meishiCollectionEntity = new MeishiCollectionEntity();
|
||||
// meishiCollectionEntity.setMeishiId(Integer.valueOf(data.get(0)));
|
||||
// 健康食谱 要改的
|
||||
// meishiCollectionEntity.setYonghuId(Integer.valueOf(data.get(0)));
|
||||
// 用户 要改的
|
||||
// meishiCollectionEntity.setMeishiCollectionTypes(Integer.valueOf(data.get(0)));
|
||||
// 类型 要改的
|
||||
// meishiCollectionEntity.setInsertTime(date);// 时间
|
||||
// meishiCollectionEntity.setCreateTime(date);// 时间
|
||||
meishiCollectionList.add(meishiCollectionEntity);
|
||||
|
||||
// 把要查询是否重复的字段放入map中
|
||||
}
|
||||
|
||||
// 查询是否重复
|
||||
meishiCollectionService.insertBatch(meishiCollectionList);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return R.error(511,"批量插入数据异常,请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端列表
|
||||
* @param params 请求参数
|
||||
* @param request HTTP请求对象
|
||||
* @return 分页数据
|
||||
*/
|
||||
@IgnoreAuth
|
||||
@RequestMapping("/list")
|
||||
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
|
||||
|
||||
// 检查参数
|
||||
CommonUtil.checkMap(params);
|
||||
// 查询分页数据
|
||||
PageUtils page = meishiCollectionService.queryPage(params);
|
||||
|
||||
// 字典表数据转换
|
||||
List<MeishiCollectionView> list =(List<MeishiCollectionView>)page.getList();
|
||||
for(MeishiCollectionView c:list)
|
||||
dictionaryService.dictionaryConvert(c, request);
|
||||
// 修改对应字典表字段
|
||||
|
||||
return R.ok().put("data", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端详情
|
||||
* @param id 健康食谱收藏ID
|
||||
* @param request HTTP请求对象
|
||||
* @return 健康食谱收藏详情
|
||||
*/
|
||||
@RequestMapping("/detail/{id}")
|
||||
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
|
||||
// 根据ID查询健康食谱收藏
|
||||
MeishiCollectionEntity meishiCollection = meishiCollectionService.selectById(id);
|
||||
if(meishiCollection !=null){
|
||||
// entity转view
|
||||
MeishiCollectionView view = new MeishiCollectionView();
|
||||
BeanUtils.copyProperties( meishiCollection , view );
|
||||
// 把实体数据重构到view中
|
||||
|
||||
// 级联表
|
||||
MeishiEntity meishi = meishiService.selectById(meishiCollection.getMeishiId());
|
||||
if(meishi != null){
|
||||
BeanUtils.copyProperties( meishi , view ,new String[]{ "id", "createDate"});
|
||||
// 把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setMeishiId(meishi.getId());
|
||||
}
|
||||
// 级联表
|
||||
YonghuEntity yonghu = yonghuService.selectById(meishiCollection.getYonghuId());
|
||||
if(yonghu != null){
|
||||
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});
|
||||
// 把级联的数据添加到view中,并排除id和创建时间字段
|
||||
view.setYonghuId(yonghu.getId());
|
||||
}
|
||||
// 修改对应字典表字段
|
||||
dictionaryService.dictionaryConvert(view, request);
|
||||
return R.ok().put("data", view);
|
||||
}else {
|
||||
return R.error(511,"查不到数据");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 前端保存
|
||||
* @param meishiCollection 健康食谱收藏实体
|
||||
* @param request HTTP请求对象
|
||||
* @return 保存结果
|
||||
*/
|
||||
@RequestMapping("/add")
|
||||
public R add(@RequestBody MeishiCollectionEntity meishiCollection, HttpServletRequest request){
|
||||
// 记录日志
|
||||
logger.debug("add方法:,,Controller:{},,meishiCollection:{}",this.getClass().getName(),meishiCollection.toString());
|
||||
// 构建查询条件
|
||||
Wrapper<MeishiCollectionEntity> queryWrapper = new EntityWrapper<MeishiCollectionEntity>()
|
||||
.eq("meishi_id", meishiCollection.getMeishiId())
|
||||
.eq("yonghu_id", meishiCollection.getYonghuId())
|
||||
.eq("meishi_collection_types", meishiCollection.getMeishiCollectionTypes())
|
||||
// .notIn("meishi_collection_types", new Integer[]{102})
|
||||
;
|
||||
// 记录SQL语句
|
||||
logger.info("sql语句:"+queryWrapper.getSqlSegment());
|
||||
// 查询是否存在相同数据
|
||||
MeishiCollectionEntity meishiCollectionEntity = meishiCollectionService.selectOne(queryWrapper);
|
||||
if(meishiCollectionEntity==null){
|
||||
// 设置时间戳
|
||||
meishiCollection.setInsertTime(new Date());
|
||||
meishiCollection.setCreateTime(new Date());
|
||||
// 插入数据
|
||||
meishiCollectionService.insert(meishiCollection);
|
||||
|
||||
return R.ok();
|
||||
}else {
|
||||
return R.error(511,"您已经收藏过了");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.entity.ConfigEntity;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
public interface ConfigDao extends BaseMapper<ConfigEntity> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.DictionaryEntity;
|
||||
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.DictionaryView;
|
||||
|
||||
/**
|
||||
* 字典 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface DictionaryDao extends BaseMapper<DictionaryEntity> {
|
||||
|
||||
List<DictionaryView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.MeirijihuaEntity;
|
||||
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.MeirijihuaView;
|
||||
|
||||
/**
|
||||
* 每日计划 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface MeirijihuaDao extends BaseMapper<MeirijihuaEntity> {
|
||||
|
||||
List<MeirijihuaView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.MeishiCollectionEntity;
|
||||
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.MeishiCollectionView;
|
||||
|
||||
/**
|
||||
* 健康食谱收藏 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface MeishiCollectionDao extends BaseMapper<MeishiCollectionEntity> {
|
||||
|
||||
List<MeishiCollectionView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.MeishiEntity;
|
||||
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.MeishiView;
|
||||
|
||||
/**
|
||||
* 健康食谱 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface MeishiDao extends BaseMapper<MeishiEntity> {
|
||||
|
||||
List<MeishiView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.MeishiLiuyanEntity;
|
||||
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.MeishiLiuyanView;
|
||||
|
||||
/**
|
||||
* 健康食谱留言 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface MeishiLiuyanDao extends BaseMapper<MeishiLiuyanEntity> {
|
||||
|
||||
List<MeishiLiuyanView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.NewsEntity;
|
||||
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.NewsView;
|
||||
|
||||
/**
|
||||
* 公告信息 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface NewsDao extends BaseMapper<NewsEntity> {
|
||||
|
||||
List<NewsView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
import com.entity.TokenEntity;
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
public interface TokenDao extends BaseMapper<TokenEntity> {
|
||||
|
||||
List<TokenEntity> selectListView(@Param("ew") Wrapper<TokenEntity> wrapper);
|
||||
|
||||
List<TokenEntity> selectListView(Pagination page,@Param("ew") Wrapper<TokenEntity> wrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
package com.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.mapper.Wrapper;
|
||||
import com.baomidou.mybatisplus.plugins.pagination.Pagination;
|
||||
import com.entity.UsersEntity;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*/
|
||||
public interface UsersDao extends BaseMapper<UsersEntity> {
|
||||
|
||||
List<UsersEntity> selectListView(@Param("ew") Wrapper<UsersEntity> wrapper);
|
||||
|
||||
List<UsersEntity> selectListView(Pagination page, @Param("ew") Wrapper<UsersEntity> wrapper);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YaopinEntity;
|
||||
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.YaopinView;
|
||||
|
||||
/**
|
||||
* 药品信息 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface YaopinDao extends BaseMapper<YaopinEntity> {
|
||||
|
||||
List<YaopinView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YonghuEntity;
|
||||
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.YonghuView;
|
||||
|
||||
/**
|
||||
* 用户 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface YonghuDao extends BaseMapper<YonghuEntity> {
|
||||
|
||||
List<YonghuView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YundongCollectionEntity;
|
||||
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.YundongCollectionView;
|
||||
|
||||
/**
|
||||
* 运动教程收藏 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface YundongCollectionDao extends BaseMapper<YundongCollectionEntity> {
|
||||
|
||||
List<YundongCollectionView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YundongEntity;
|
||||
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.YundongView;
|
||||
|
||||
/**
|
||||
* 运动教程 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface YundongDao extends BaseMapper<YundongEntity> {
|
||||
|
||||
List<YundongView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.dao;
|
||||
|
||||
import com.entity.YundongLiuyanEntity;
|
||||
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.YundongLiuyanView;
|
||||
|
||||
/**
|
||||
* 运动教程留言 Dao 接口
|
||||
*
|
||||
* @author
|
||||
*/
|
||||
public interface YundongLiuyanDao extends BaseMapper<YundongLiuyanEntity> {
|
||||
|
||||
List<YundongLiuyanView> selectListView(Pagination page,@Param("params")Map<String,Object> params);
|
||||
|
||||
}
|
||||
@ -0,0 +1,169 @@
|
||||
package com.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
|
||||
/**
|
||||
* token表实体类
|
||||
*/
|
||||
@TableName("token")
|
||||
// 指定数据库表名为token
|
||||
public class TokenEntity implements Serializable {
|
||||
// 实现Serializable接口以支持序列化
|
||||
private static final long serialVersionUID = 1L;
|
||||
// 序列化版本号
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
// 主键自增
|
||||
private Integer id;
|
||||
// 主键ID
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Integer userid;
|
||||
// 用户ID
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
|
||||
private String username;
|
||||
// 用户名
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String tablename;
|
||||
// 表名
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private String role;
|
||||
// 角色
|
||||
|
||||
/**
|
||||
* token
|
||||
*/
|
||||
private String token;
|
||||
// token字符串
|
||||
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expiratedtime;
|
||||
// token过期时间
|
||||
|
||||
/**
|
||||
* 新增时间
|
||||
*/
|
||||
private Date addtime;
|
||||
// token新增时间
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
// 获取主键ID
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
// 设置主键ID
|
||||
}
|
||||
|
||||
public Integer getUserid() {
|
||||
return userid;
|
||||
// 获取用户ID
|
||||
}
|
||||
|
||||
public void setUserid(Integer userid) {
|
||||
this.userid = userid;
|
||||
// 设置用户ID
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
// 获取角色
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
// 设置角色
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
// 获取token
|
||||
}
|
||||
|
||||
public String getTablename() {
|
||||
return tablename;
|
||||
// 获取表名
|
||||
}
|
||||
|
||||
public void setTablename(String tablename) {
|
||||
this.tablename = tablename;
|
||||
// 设置表名
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
// 设置token
|
||||
}
|
||||
|
||||
public Date getExpiratedtime() {
|
||||
return expiratedtime;
|
||||
// 获取过期时间
|
||||
}
|
||||
|
||||
public void setExpiratedtime(Date expiratedtime) {
|
||||
this.expiratedtime = expiratedtime;
|
||||
// 设置过期时间
|
||||
}
|
||||
|
||||
public Date getAddtime() {
|
||||
return addtime;
|
||||
// 获取新增时间
|
||||
}
|
||||
|
||||
public void setAddtime(Date addtime) {
|
||||
this.addtime = addtime;
|
||||
// 设置新增时间
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
// 获取用户名
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
// 设置用户名
|
||||
}
|
||||
|
||||
public TokenEntity(Integer userid, String username, String tablename,String role, String token, Date expiratedtime) {
|
||||
super();
|
||||
// 调用父类构造方法
|
||||
this.userid = userid;
|
||||
// 初始化用户ID
|
||||
this.username = username;
|
||||
// 初始化用户名
|
||||
this.tablename = tablename;
|
||||
// 初始化表名
|
||||
this.role = role;
|
||||
// 初始化角色
|
||||
this.token = token;
|
||||
// 初始化token
|
||||
this.expiratedtime = expiratedtime;
|
||||
// 初始化过期时间
|
||||
}
|
||||
|
||||
public TokenEntity() {
|
||||
// 默认构造方法
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotations.TableId;
|
||||
import com.baomidou.mybatisplus.annotations.TableName;
|
||||
import com.baomidou.mybatisplus.enums.IdType;
|
||||
|
||||
/**
|
||||
* 用户实体类
|
||||
*/
|
||||
@TableName("users") // 指定数据库表名为users
|
||||
public class UsersEntity implements Serializable { // 实现Serializable接口以支持序列化
|
||||
private static final long serialVersionUID = 1L; // 序列化版本号
|
||||
|
||||
@TableId(type = IdType.AUTO) // 主键自增
|
||||
private Integer id; // 主键ID
|
||||
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
private String username; // 用户账号
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password; // 用户密码
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
private String role; // 用户角色
|
||||
|
||||
private Date addtime; // 用户新增时间
|
||||
|
||||
public String getUsername() {
|
||||
return username; // 获取用户账号
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username; // 设置用户账号
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password; // 获取用户密码
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password; // 设置用户密码
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role; // 获取用户角色
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role; // 设置用户角色
|
||||
}
|
||||
|
||||
public Date getAddtime() {
|
||||
return addtime; // 获取用户新增时间
|
||||
}
|
||||
|
||||
public void setAddtime(Date addtime) {
|
||||
this.addtime = addtime; // 设置用户新增时间
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id; // 获取主键ID
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id; // 设置主键ID
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue