Compare commits

..

No commits in common. 'main' and 'cp' have entirely different histories.
main ... cp

2
.gitignore vendored

@ -4,7 +4,7 @@ node_modules/
# 忽略Logs
logs
*.log
#
# 忽略/dist目录相对.gitignore文件所在目录
/dist

@ -1,27 +1,15 @@
// 定义包名通常用于组织代码结构这里表示该类属于com.annotation包
package com.annotation;
// 导入ElementType枚举类该枚举类定义了注解可以应用的目标元素类型如类、方法、参数等
import java.lang.annotation.ElementType;
// 导入Retention注解用于指定注解的保留策略
import java.lang.annotation.Retention;
// 导入RetentionPolicy枚举类该枚举类定义了注解的保留策略类型如SOURCE、CLASS、RUNTIME
import java.lang.annotation.RetentionPolicy;
// 导入Target注解用于指定注解可以应用的目标元素类型
import java.lang.annotation.Target;
/**
*
*
*/
// @Target注解指定该自定义注解可以应用的目标元素类型这里ElementType.PARAMETER表示可以应用在方法的参数上
@Target(ElementType.PARAMETER)
// @Retention注解指定该自定义注解的保留策略这里RetentionPolicy.RUNTIME表示注解在运行时仍然保留可以通过反射机制获取
@Retention(RetentionPolicy.RUNTIME)
// 使用@interface关键字定义一个自定义注解名为APPLoginUser
public @interface APPLoginUser {
// 这里注解没有定义属性,如果需要可以添加属性,例如:
// String value() default "";
// 这样就定义了一个名为value的属性默认值为空字符串
}
}

@ -1,28 +1,13 @@
// 声明该类所在的包为 com.annotation用于组织和管理代码
package com.annotation;
// 导入 Java 中用于定义注解的相关类
// 其中java.lang.annotation 包包含了创建自定义注解所需的核心类
import java.lang.annotation.*;
/**
* Token
* Token
* Web
* 使
*/
// @Target 注解用于指定自定义注解可以应用的目标元素类型
// ElementType.METHOD 表示该注解可以应用在方法上
@Target(ElementType.METHOD)
// @Retention 注解用于指定自定义注解的保留策略
// RetentionPolicy.RUNTIME 表示该注解在运行时仍然保留,可通过反射机制获取
@Retention(RetentionPolicy.RUNTIME)
// @Documented 注解表示该自定义注解会被包含在 Javadoc 文档中
@Documented
// 使用 @interface 关键字定义一个自定义注解,名为 IgnoreAuth
public @interface IgnoreAuth {
// 注解中没有定义属性,如果有需要可以添加属性,例如:
// String value() default "";
// 这会定义一个名为 value 的属性,默认值为空字符串
}
}

@ -1,29 +1,15 @@
// 声明该类所属的包为 com.annotation用于将相关的类组织在一起便于管理和维护
package com.annotation;
// 导入 ElementType 枚举类,该枚举类定义了注解可以应用的目标元素类型
import java.lang.annotation.ElementType;
// 导入 Retention 注解,用于指定注解的保留策略
import java.lang.annotation.Retention;
// 导入 RetentionPolicy 枚举类,它定义了不同的注解保留策略
import java.lang.annotation.RetentionPolicy;
// 导入 Target 注解,用于指定注解可以应用在哪些目标元素上
import java.lang.annotation.Target;
/**
*
*
*
*/
// @Target 注解指定此自定义注解的使用范围ElementType.PARAMETER 表示该注解只能应用于方法的参数上
@Target(ElementType.PARAMETER)
// @Retention 注解指定注解的保留策略RetentionPolicy.RUNTIME 表示该注解在运行时仍然保留,
// 这样在程序运行期间可以通过反射机制来获取该注解的信息
@Retention(RetentionPolicy.RUNTIME)
// 使用 @interface 关键字定义一个自定义注解,名为 LoginUser
public @interface LoginUser {
// 此处注解没有定义属性,如果有需求,可以添加属性,例如:
// String value() default "";
// 这会定义一个名为 value 的属性,默认值为空字符串
}
}

@ -1,69 +1,39 @@
// 声明该类所属的包名为 com.config用于组织和管理配置相关的类
package com.config;
// 导入 Spring 框架中用于定义 Bean 的注解
import org.springframework.context.annotation.Bean;
// 导入 Spring 框架中用于标记配置类的注解
import org.springframework.context.annotation.Configuration;
// 导入 Spring MVC 中用于配置拦截器注册的类
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
// 导入 Spring MVC 中用于配置资源处理器的类
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
// 导入 Spring MVC 中用于支持 Web MVC 配置的基类
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
// 导入自定义的授权拦截器类
import com.interceptor.AuthorizationInterceptor;
/**
* WebMvcConfigurationSupport
* Spring MVC
*/
@Configuration
public class InterceptorConfig extends WebMvcConfigurationSupport {
/**
* AuthorizationInterceptor Spring Bean
* @return AuthorizationInterceptor
*/
public class InterceptorConfig extends WebMvcConfigurationSupport{
@Bean
public AuthorizationInterceptor getAuthorizationInterceptor() {
return new AuthorizationInterceptor();
}
/**
*
* @param registry
*/
public AuthorizationInterceptor getAuthorizationInterceptor() {
return new AuthorizationInterceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
// 向注册表中添加自定义的授权拦截器
registry.addInterceptor(getAuthorizationInterceptor())
// 设置拦截的路径模式,这里表示拦截所有请求
.addPathPatterns("/**")
// 设置排除的路径模式,这里表示不拦截以 /static/ 开头的请求
.excludePathPatterns("/static/**");
// 调用父类的方法,确保父类的拦截器配置也能生效
super.addInterceptors(registry);
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/static/**");
super.addInterceptors(registry);
}
/**
* springboot 2.0 WebMvcConfigurationSupport
* 访 addResourceHandlers
* @param registry
* springboot 2.0WebMvcConfigurationSupport访addResourceHandlers
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
// 配置资源处理器,处理所有请求路径
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**")
// 添加资源的位置,当请求静态资源时,会从这些位置查找
.addResourceLocations("classpath:/resources/")
.addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/admin/")
.addResourceLocations("classpath:/img/")
.addResourceLocations("classpath:/front/")
.addResourceLocations("classpath:/public/");
// 调用父类的方法,确保父类的资源处理器配置也能生效
.addResourceLocations("classpath:/resources/")
.addResourceLocations("classpath:/static/")
.addResourceLocations("classpath:/admin/")
.addResourceLocations("classpath:/img/")
.addResourceLocations("classpath:/front/")
.addResourceLocations("classpath:/public/");
super.addResourceHandlers(registry);
}
}
}
}

@ -1,52 +1,28 @@
// 声明该类所属的包名为 com.config用于组织和管理配置相关的类
package com.config;
// 导入日期类,用于表示时间
import java.util.Date;
// 导入 MyBatis 框架中用于处理元对象的类,元对象可以方便地操作对象的属性
import org.apache.ibatis.reflection.MetaObject;
// 导入 MyBatis-Plus 框架中用于自定义元对象处理器的基类
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
/**
*
* MyBatis-Plus MetaObjectHandler
*/
public class MyMetaObjectHandler extends MetaObjectHandler {
/**
*
* MyBatis-Plus
* @param metaObject
*/
@Override
public void insertFill(MetaObject metaObject) {
// 使用 setFieldValByName 方法为指定字段设置值
// 第一个参数 "ctime" 是要设置值的字段名
// 第二个参数 new Date() 是要设置的值,这里表示当前时间
// 第三个参数 metaObject 是元对象,用于定位要操作的对象
this.setFieldValByName("ctime", new Date(), metaObject);
}
/**
*
*
* @return false
*/
@Override
public boolean openUpdateFill() {
return false;
}
/**
*
* openUpdateFill false
* @param metaObject
*/
@Override
public void updateFill(MetaObject metaObject) {
// 关闭更新填充、这里不执行
}
}
}

@ -6,6 +6,7 @@ import org.springframework.context.annotation.Configuration;
import com.baomidou.mybatisplus.mapper.MetaObjectHandler;
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
/**
* mybatis-plus
*/

@ -1,63 +1,35 @@
ppackage com.controller;
package com.controller;
import java.io.File;
// 导入用于高精度十进制计算的类
import java.math.BigDecimal;
// 导入处理 URL 的类
import java.net.URL;
// 导入用于格式化日期的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的 JSON 处理类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入 Spring 框架用于 Bean 属性复制的工具类
import org.springframework.beans.BeanUtils;
// 导入 Servlet 请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入 Spring 上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入 Servlet 上下文类
import javax.servlet.ServletContext;
// 导入自定义的 Token 服务类
import com.service.TokenService;
// 导入自定义的工具类包
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入自定义的字典服务类
import com.service.DictionaryService;
// 导入 Apache Commons 提供的字符串工具类
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入 Spring 的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入 Spring 的控制器注解
import org.springframework.stereotype.Controller;
// 导入 Spring 的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入 MyBatis-Plus 的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入 MyBatis-Plus 的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类包
import com.entity.*;
// 导入自定义的视图实体类包
import com.entity.view.*;
// 导入自定义的服务类包
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入阿里巴巴的 JSON 处理类
import com.alibaba.fastjson.*;
/**
@ -65,355 +37,290 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
// @RestController 注解表示该类是一个 RESTful 风格的控制器,处理 HTTP 请求并返回 JSON 等数据格式
*/
@RestController
// @Controller 注解表示该类是一个 Spring MVC 控制器,用于处理请求
@Controller
// @RequestMapping 注解用于映射请求路径,这里所有的请求路径都以 /chat 开头
@RequestMapping("/chat")
public class ChatController {
// 日志记录器,用于记录控制器相关的日志信息
private static final Logger logger = LoggerFactory.getLogger(ChatController.class);
// 自动注入 ChatService用于处理与在线咨询相关的业务逻辑
@Autowired
private ChatService chatService;
// 自动注入 TokenService用于处理与 Token 相关的业务逻辑
@Autowired
private TokenService tokenService;
// 自动注入 DictionaryService用于处理与字典表相关的业务逻辑
@Autowired
private DictionaryService dictionaryService;
// 级联表 service,自动注入 YonghuService用于处理与用户相关的业务逻辑
//级联表service
@Autowired
private YonghuService yonghuService;
// 级联表 service自动注入 YishengService用于处理与医生相关的业务逻辑
@Autowired
private YishengService yishengService;
/**
*
* 线
* @param params Map
* @param request HttpServletRequest
* @return R
*/
*
*/
@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"));
// 这个条件永远为 false这里的代码逻辑可能有误正常不会进入此分支
if(false)
return R.error(511,"永不会进入");
// 如果用户角色是 "用户",则将用户 ID 添加到请求参数中
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
// 如果用户角色是 "医生",则将医生 ID 添加到请求参数中
else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段,则默认按 id 排序
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
// 调用 ChatService 的 queryPage 方法获取分页数据
PageUtils page = chatService.queryPage(params);
// 将分页数据中的列表转换为 ChatView 类型的列表
//字典表数据转换
List<ChatView> list =(List<ChatView>)page.getList();
// 遍历列表,对每个 ChatView 对象进行字典表数据转换
for(ChatView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
// 返回成功响应,并将分页数据封装在 data 属性中
return R.ok().put("data", page);
}
/**
*
* 线
* @param id 线 ID
* @param request HttpServletRequest
* @return R
*/
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要查询的 ID
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
// 根据 ID 查询在线咨询记录
ChatEntity chat = chatService.selectById(id);
// 如果查询到记录
if(chat !=null){
// 将 ChatEntity 转换为 ChatView
//entity转view
ChatView view = new ChatView();
// 使用 BeanUtils 将 ChatEntity 的属性复制到 ChatView 中
BeanUtils.copyProperties( chat , view );
// 级联查询用户信息
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
// 如果查询到用户信息
if(yonghu != null){
// 将用户信息的部分属性复制到 ChatView 中,并排除指定字段
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});
// 设置 ChatView 中的用户 ID
view.setYonghuId(yonghu.getId());
}
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中
// 对 ChatView 对象进行字典表数据转换
//级联表
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将处理后的 ChatView 数据封装在 data 属性中
return R.ok().put("data", view);
}else {
// 如果未查询到记录,返回错误响应
return R.error(511,"查不到数据");
}
}
/**
*
* 线
* @param chat 线
* @param request HttpServletRequest
* @return R
*/
*
*/
@RequestMapping("/save")
public R save(@RequestBody ChatEntity chat, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要保存的 ChatEntity 对象
logger.debug("save方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
// 获取当前用户的角色信息
String role = String.valueOf(request.getSession().getAttribute("role"));
// 这个条件永远为 false这里的代码逻辑可能有误正常不会进入此分支
if(false)
return R.error(511,"永远不会进入");
// 如果用户角色是 "用户",则设置在线咨询记录的用户 ID
else if("用户".equals(role))
chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询条件,检查是否已存在相同数据
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes());
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes())
;
// 记录查询条件的 SQL 片段日志
logger.info("sql语句:"+queryWrapper.getSqlSegment());
// 根据查询条件查询是否已存在相同数据
ChatEntity chatEntity = chatService.selectOne(queryWrapper);
// 如果不存在相同数据
if(chatEntity==null){
// 设置插入时间为当前时间
chat.setInsertTime(new Date());
// 插入在线咨询记录
chatService.insert(chat);
// 返回成功响应
return R.ok();
}else {
// 如果存在相同数据,返回错误响应
return R.error(511,"表中有相同数据");
}
}
/**
*
* 线
* @param chat 线
* @param request HttpServletRequest
* @return R
*/
*
*/
@RequestMapping("/update")
public R update(@RequestBody ChatEntity chat, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要修改的 ChatEntity 对象
logger.debug("update方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
// 获取当前用户的角色信息
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
// else if("用户".equals(role))
// chat.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询条件,检查是否已存在相同数据(排除当前要修改的记录)
//根据字段查询是否有相同数据
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.notIn("id",chat.getId())
.andNew()
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes());
// 记录查询条件的 SQL 片段日志
.notIn("id",chat.getId())
.andNew()
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
// 根据查询条件查询是否已存在相同数据
ChatEntity chatEntity = chatService.selectOne(queryWrapper);
// 如果不存在相同数据
if(chatEntity==null){
// 根据 ID 更新在线咨询记录
chatService.updateById(chat);
// 返回成功响应
chatService.updateById(chat);//根据id更新
return R.ok();
}else {
// 如果存在相同数据,返回错误响应
return R.error(511,"表中有相同数据");
}
}
/**
*
* 线
* @param ids 线 ID
* @return R
*/
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
// 记录调试日志,输出方法名、控制器类名和要删除的 ID 数组
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
// 批量删除在线咨询记录
chatService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
* 线 Excel
* @param fileName Excel
* @return R
*/
@RequestMapping("/batchInsert")
public R save( String fileName){
// 记录调试日志,输出方法名、控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
// 创建用于存储上传的在线咨询实体对象的列表
List<ChatEntity> chatList = new ArrayList<>();
// 创建用于存储要查询的字段的 Map
Map<String, List<String>> seachFields= new HashMap<>();
// 获取当前时间
List<ChatEntity> chatList = 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);
// 如果后缀不是.xls
if(!".xls".equals(suffix)){
// 返回错误响应,提示只支持.xls 后缀的 Excel 文件
return R.error(511,"只支持后缀为xls的excel文件");
}else{
// 获取文件的 URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
File file = new File(resource.getFile());
// 如果文件不存在
if(!file.exists()){
// 返回错误响应,提示找不到上传文件
return R.error(511,"找不到上传文件,请联系管理员");
}else{
// 从 Excel 文件中读取数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行(通常是表头)
dataList.remove(0);
// 遍历数据列表
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
for(List<String> data:dataList){
// 创建在线咨询实体对象
//循环
ChatEntity chatEntity = new ChatEntity();
// chatEntity.setYonghuId(Integer.valueOf(data.get(0))); //提问用户 要改的
// chatEntity.setChatIssue(data.get(0)); //问题 要改的
// chatEntity.setIssueTime(new Date(data.get(0))); //问题时间 要改的
// chatEntity.setChatReply(data.get(0)); //回复 要改的
// chatEntity.setReplyTime(new Date(data.get(0))); //回复时间 要改的
// chatEntity.setZhuangtaiTypes(Integer.valueOf(data.get(0))); //状态 要改的
// chatEntity.setChatTypes(Integer.valueOf(data.get(0))); //数据类型 要改的
// chatEntity.setInsertTime(date);//时间
chatList.add(chatEntity);
// 把要查询是否重复的字段放入 map 中(这里代码未实现具体逻辑)
//把要查询是否重复的字段放入map中
}
// 批量插入在线咨询记录
//查询是否重复
chatService.insertBatch(chatList);
// 返回成功响应
return R.ok();
}
}
}
}catch (Exception e){
// 如果发生异常,返回错误响应,提示批量插入数据异常
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
*
* 线
* @param params Map
* @param request HttpServletRequest
* @return R
*/
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和请求参数
logger.debug("list方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
// 如果没有指定排序字段,就默认按 id 倒序排序
// 没有指定排序字段就默认id倒序
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
// 调用 ChatService 的 queryPage 方法获取分页数据
PageUtils page = chatService.queryPage(params);
// 将分页数据中的列表转换为 ChatView 类型的列表
//字典表数据转换
List<ChatView> list =(List<ChatView>)page.getList();
// 遍历列表,对每个 ChatView 对象进行字典表数据转换
for(ChatView c:list)
dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页数据封装在 data 属性中
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
*
* 线
* @param id 线 ID
* @param request HttpServletRequest
* @return R
*/
*
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
// 记录调试日志,输出方法名、控制器类名和要查询的 ID
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
// 根据 ID 查询在线咨询记录
ChatEntity chat = chatService.selectById(id);
// 如果查询到记录
if(chat !=null){
// 将 ChatEntity 转换为 ChatView
ChatView view = new ChatView();
// 使用 BeanUtils 将 ChatEntity 的属性复制到 ChatView 中
BeanUtils.copyProperties( chat , view );
// 级联查询用户信息
YonghuEntity yonghu = yonghuService.selectById(chat.getYonghuId());
// 如果查询到用户信息
if(yonghu != null){
// 将用户信息的部分属性复制到 ChatView 中,并排除指定字段
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});
// 设置 ChatView 中的用户 ID
view.setYonghuId(yonghu.getId());
if(chat !=null){
//entity转view
ChatView view = new ChatView();
BeanUtils.copyProperties( chat , view );//把实体数据重构到view中
//级联表
YonghuEntity yonghu = yonghuService.selectById(chat.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,"查不到数据");
}
}
// 对 ChatView 对象进行字典表数据转换
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将处理后的 ChatView 数据封装在 data 属性中
return R.ok().put("data", view);
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody ChatEntity chat, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,chat:{}",this.getClass().getName(),chat.toString());
Wrapper<ChatEntity> queryWrapper = new EntityWrapper<ChatEntity>()
.eq("yonghu_id", chat.getYonghuId())
.eq("chat_issue", chat.getChatIssue())
.eq("chat_reply", chat.getChatReply())
.eq("zhuangtai_types", chat.getZhuangtaiTypes())
.eq("chat_types", chat.getChatTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
ChatEntity chatEntity = chatService.selectOne(queryWrapper);
if(chatEntity==null){
chat.setInsertTime(new Date());
chatService.insert(chat);
return R.ok();
}else {
// 如果未查询到记录,返回错误响应
return R.error(511,"查不到数据");
return R.error(511,"表中有相同数据");
}
}
/**
}

@ -41,7 +41,6 @@ import com.utils.R;
@RestController
public class CommonController{
private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
// 注入CommonService处理通用业务逻辑
@Autowired
private CommonService commonService;
@ -53,151 +52,114 @@ public class CommonController{
private static String BAIDU_DITU_AK = null;
@RequestMapping("/location")
public R location(String lng, String lat) {
// 如果BAIDU_DITU_AK为空从配置中获取
if (BAIDU_DITU_AK == null) {
public R location(String lng,String lat) {
if(BAIDU_DITU_AK==null) {
BAIDU_DITU_AK = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "baidu_ditu_ak")).getValue();
// 如果配置中未正确配置,返回错误信息
if (BAIDU_DITU_AK == null) {
if(BAIDU_DITU_AK==null) {
return R.error("请在配置管理中正确配置baidu_ditu_ak");
}
}
// 调用百度工具类获取城市信息
Map<String, String> map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat);
// 返回包含城市信息的结果对象
return R.ok().put("data", map);
}
/**
*
*
* @param face1 1
* @param face2 2
* @param request HttpServletRequest
* @return
* @return
*/
@RequestMapping("/matchFace")
public R matchFace(String face1, String face2, HttpServletRequest request) {
// 如果客户端未初始化,进行初始化
if (client == null) {
// 获取APIKey和SecretKey
if(client==null) {
/*String AppID = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "AppID")).getValue();*/
String APIKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "APIKey")).getValue();
String SecretKey = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "SecretKey")).getValue();
// 获取访问令牌
String token = BaiduUtil.getAuth(APIKey, SecretKey);
// 如果令牌获取失败,返回错误信息
if (token == null) {
if(token==null) {
return R.error("请在配置管理中正确配置APIKey和SecretKey");
}
// 初始化AipFace客户端
client = new AipFace(null, APIKey, SecretKey);
// 设置连接超时时间
client.setConnectionTimeoutInMillis(2000);
// 设置套接字超时时间
client.setSocketTimeoutInMillis(60000);
}
JSONObject res = null;
try {
// 获取人脸图片文件
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload") + "/" + face2);
// 将文件转换为Base64编码的字符串
File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1);
File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2);
String img1 = Base64Util.encode(FileUtil.FileToByte(file1));
String img2 = Base64Util.encode(FileUtil.FileToByte(file2));
// 创建MatchRequest对象
MatchRequest req1 = new MatchRequest(img1, "BASE64");
MatchRequest req2 = new MatchRequest(img2, "BASE64");
// 创建请求列表
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
// 进行人脸比对
res = client.match(requests);
// 打印比对结果
System.out.println(res.get("result"));
} catch (FileNotFoundException e) {
// 处理文件未找到异常
e.printStackTrace();
return R.error("文件不存在");
} catch (IOException e) {
// 处理IO异常
e.printStackTrace();
}
return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString()));
}
/**
* tablecolumn()
* @param tableName
* @param columnName
* @param level
* @param parent
* @return
* @return
*/
@RequestMapping("/option/{tableName}/{columnName}")
@IgnoreAuth
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, String level, String parent) {
// 创建参数Map
public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 如果层级不为空添加到参数Map中
if (StringUtils.isNotBlank(level)) {
if(StringUtils.isNotBlank(level)) {
params.put("level", level);
}
// 如果父级不为空添加到参数Map中
if (StringUtils.isNotBlank(parent)) {
if(StringUtils.isNotBlank(parent)) {
params.put("parent", parent);
}
// 调用CommonService获取列列表
List<String> data = commonService.getOption(params);
// 返回包含列列表的结果对象
return R.ok().put("data", data);
}
/**
* tablecolumn
* @param tableName
* @param columnName
* @param columnValue
* @return
* @return
*/
@RequestMapping("/follow/{tableName}/{columnName}")
@IgnoreAuth
public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, @RequestParam String columnValue) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
params.put("columnValue", columnValue);
// 调用CommonService获取单条记录
Map<String, Object> result = commonService.getFollowByOption(params);
// 返回包含单条记录的结果对象
return R.ok().put("data", result);
}
/**
* tablesfsh
* @param tableName
* @param map Map
* @return
* @param map
* @return
*/
@RequestMapping("/sh/{tableName}")
public R sh(@PathVariable("tableName") String tableName, @RequestBody Map<String, Object> map) {
// 将表名添加到参数Map中
map.put("table", tableName);
// 调用CommonService进行状态修改
commonService.sh(map);
// 返回操作成功结果
return R.ok();
}
/**
*
* @param tableName
* @param columnName
* @param type 1: 2:
* @param map Map
* @return
* @param tableName
* @param columnName
* @param type 1: 2:
* @param map
* @return
*/
@RequestMapping("/remind/{tableName}/{columnName}/{type}")
@IgnoreAuth
@ -209,139 +171,114 @@ public class CommonController{
if(type.equals("2")) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// 获取当前日期
Calendar c = Calendar.getInstance();
Date remindStartDate = null;
Date remindEndDate = null;
// 如果提醒开始日期不为空
if (map.get("remindstart") != null) {
// 解析提醒开始日期偏移量
if(map.get("remindstart")!=null) {
Integer remindStart = Integer.parseInt(map.get("remindstart").toString());
c.setTime(new Date());
c.add(Calendar.DAY_OF_MONTH,remindStart);
remindStartDate = c.getTime();
// 将提醒开始日期格式化后添加到参数Map中
map.put("remindstart", sdf.format(remindStartDate));
}
// 如果提醒结束日期不为空
if (map.get("remindend") != null) {
// 解析提醒结束日期偏移量
if(map.get("remindend")!=null) {
Integer remindEnd = Integer.parseInt(map.get("remindend").toString());
// 设置日期
c.setTime(new Date());
// 计算提醒结束日期
c.add(Calendar.DAY_OF_MONTH, remindEnd);
c.add(Calendar.DAY_OF_MONTH,remindEnd);
remindEndDate = c.getTime();
// 将提醒结束日期格式化后添加到参数Map中
map.put("remindend", sdf.format(remindEndDate));
}
}
int count = commonService.remindCount(map);
// 返回包含提醒记录数的结果对象
return R.ok().put("count", count);
}
/**
*
* @param tableName
* @param params Map
* @return
*/
@IgnoreAuth
@RequestMapping("/group/{tableName}")
public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String, Object> params) {
// 将表名添加到参数Map中
public R group1(@PathVariable("tableName") String tableName, @RequestParam Map<String,Object> params) {
params.put("table1", tableName);
// 调用CommonService进行图表统计
List<Map<String, Object>> result = commonService.chartBoth(params);
// 返回包含统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param columnName
* @return
*/
@RequestMapping("/cal/{tableName}/{columnName}")
@IgnoreAuth
public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用CommonService进行单列求和
Map<String, Object> result = commonService.selectCal(params);
// 返回包含求和结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param columnName
* @return
*/
@RequestMapping("/group/{tableName}/{columnName}")
@IgnoreAuth
public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("column", columnName);
// 调用CommonService进行分组统计
List<Map<String, Object>> result = commonService.selectGroup(params);
// 返回包含分组统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param tableName
* @param yColumnName y
* @param xColumnName x
* @return
*/
@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}")
@IgnoreAuth
public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") String xColumnName) {
// 创建参数Map
Map<String, Object> params = new HashMap<String, Object>();
params.put("table", tableName);
params.put("xColumn", xColumnName);
params.put("yColumn", yColumnName);
// 调用CommonService进行按值统计
List<Map<String, Object>> result = commonService.selectValue(params);
// 返回包含按值统计结果的结果对象
return R.ok().put("data", result);
}
/**
*
*
*
*
*/
/**
*
* @param params Map
* @return
* tableName
* groupColumn
* sumCloum
* @return
*/
@RequestMapping("/newSelectGroupSum")
public R newSelectGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组求和
public R newSelectGroupSum(@RequestParam Map<String,Object> params) {
logger.debug("newSelectGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
// 返回包含分组求和结果的结果对象
return R.ok().put("data", result);
}
/**
tableName
condition1 1
condition1Value 1
average
Number(res.data.value.toFixed(1))
if(res.data){}
* */
/**
tableName
condition1 1
condition1Value 1
average
Number(res.data.value.toFixed(1))
if(res.data){}
* */
@IgnoreAuth
@RequestMapping("/queryScore")
public R queryScore(@RequestParam Map<String, Object> params) {
@ -352,74 +289,108 @@ public class CommonController{
/**
*
* @param params Map
* @return
* tableName
* groupColumn
* @return
*/
@RequestMapping("/newSelectGroupCount")
public R newSelectGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 调用CommonService进行字典表分组统计总条数
public R newSelectGroupCount(@RequestParam Map<String,Object> params) {
logger.debug("newSelectGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
// 返回包含分组统计总条数结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param params Map
* @return
* tableName
* groupColumn
* sumCloum
* dateFormatType 1: 2: 3:
* @return
*/
@RequestMapping("/newSelectDateGroupSum")
public R newSelectDateGroupSum(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
public R newSelectDateGroupSum(@RequestParam Map<String,Object> params) {
logger.debug("newSelectDateGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
String dateFormatType = String.valueOf(params.get("dateFormatType"));
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) {
if("1".equals(dateFormatType)){
params.put("dateFormat", "%Y");
} else if ("2".equals(dateFormatType)) {
}else if("2".equals(dateFormatType)){
params.put("dateFormat", "%Y-%m");
} else if ("3".equals(dateFormatType)) {
}else if("3".equals(dateFormatType)){
params.put("dateFormat", "%Y-%m-%d");
} else {
// 日期格式化类型不正确,返回错误信息
return R.error("日期格式化不正确");
}else{
R.error("日期格式化不正确");
}
// 调用CommonService进行日期分组求和
List<Map<String, Object>> result = commonService.newSelectDateGroupSum(params);
// 返回包含日期分组求和结果的结果对象
return R.ok().put("data", result);
}
/**
*
* @param params Map
* @return
*
*
* tableName
* groupColumn
* dateFormatType 1: 2: 3:
* @return
*/
@RequestMapping("/newSelectDateGroupCount")
public R newSelectDateGroupCount(@RequestParam Map<String, Object> params) {
// 记录日志
logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}", this.getClass().getName(), params);
// 获取日期格式化类型
public R newSelectDateGroupCount(@RequestParam Map<String,Object> params) {
logger.debug("newSelectDateGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
String dateFormatType = String.valueOf(params.get("dateFormatType"));
// 根据日期格式化类型设置日期格式
if ("1".equals(dateFormatType)) {
if("1".equals(dateFormatType)){
params.put("dateFormat", "%Y");
} else if ("2".equals(dateFormatType)) {
}else if("2".equals(dateFormatType)){
params.put("dateFormat", "%Y-%m");
} else if ("3".equals(dateFormatType)) {
}else if("3".equals(dateFormatType)){
params.put("dateFormat", "%Y-%m-%d");
} else {
// 日期格式化类型不正确,返回错误信息
return R.error("日期格式化类型不正确");
}else{
R.error("日期格式化类型不正确");
}
// 调用CommonService进行日期分组统计总条数
List<Map<String, Object>> result = commonService.newSelectDateGroupCount(params);
// 返回包含日期分组统计总条数结果的结果对象
return R.ok().put("data", result);
}
/**
*
* --
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
--
--
-- --
-- --
--
-- --
-- --
--
-- --
-- --
*/
/**
*
--
--
-- 2 1
--
--
--
--
--
--
--
--
--
--
*/
/**
*
@ -444,131 +415,121 @@ public class CommonController{
isJoinTableFlag = true;
}
// 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0";
}
// 处理级联表日期
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表日期
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinDate0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinDate0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinDate0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinDate0";
}
}
}
}
// 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisString0";
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisString0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisString0";
}
}
}
// 处理级联表字符串
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表字符串
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinString0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinString0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinString0";
}
}
}
}
// 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisTypes0";
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisTypes0";
}
}
}
// 处理级联表类型
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表类型
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinTypes0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinTypes0";
}
}
}
}
// 调用CommonService进行柱状图求和
List<Map<String, Object>> result = commonService.barSum(params);
// 报表x轴
List<String> xAxis = new ArrayList<>();
// y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
List<String> xAxis = new ArrayList<>();//报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴
List<String> legend = new ArrayList<>();//标题
// 如果不包含第二列
if (StringUtil.isEmpty(two)) {
if(StringUtil.isEmpty(two)){//不包含第二列
List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0);
legend.add("数值");
for (Map<String, Object> map : result) {
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String value = String.valueOf(map.get("value"));
xAxis.add(oneValue);
yAxis0.add(value);
}
} else {
// 包含第二列
}else{//包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) {
if(StringUtil.isNotEmpty(two)){
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value"));
if (!legend.contains(twoValue)) {
legend.add(twoValue);
if(!legend.contains(twoValue)){
legend.add(twoValue);//添加完成后 就是最全的第二列的类型
}
if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value);
} else {
if(dataMap.containsKey(oneValue)){
dataMap.get(oneValue).put(twoValue,value);
}else{
HashMap<String, String> oneData = new HashMap<>();
oneData.put(twoValue, value);
dataMap.put(oneValue, oneData);
oneData.put(twoValue,value);
dataMap.put(oneValue,oneData);
}
}
}
for (int i = 0; i < legend.size(); i++) {
for(int i =0; i<legend.size(); i++){
yAxis.add(new ArrayList<String>());
}
Set<String> keys = dataMap.keySet();
for (String key : keys) {
for(String key:keys){
xAxis.add(key);
HashMap<String, String> map = dataMap.get(key);
for (int i = 0; i < legend.size(); i++) {
for(int i =0; i<legend.size(); i++){
List<String> data = yAxis.get(i);
if (StringUtil.isNotEmpty(map.get(legend.get(i)))) {
if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
data.add(map.get(legend.get(i)));
} else {
}else{
data.add("0");
}
}
@ -576,15 +537,13 @@ public class CommonController{
System.out.println();
}
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend);
// 返回包含柱状图求和结果的结果对象
resultMap.put("xAxis",xAxis);
resultMap.put("yAxis",yAxis);
resultMap.put("legend",legend);
return R.ok().put("data", resultMap);
}
}
/**
*
*/
@ -608,131 +567,121 @@ public class CommonController{
isJoinTableFlag = true;
}
// 处理当前表日期
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))) {
thisTable.put("date", String.valueOf(thisTable.get("date")).split(","));
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
one = "thisDate0";
}
// 处理级联表日期
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表日期
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))) {
joinTable.put("date", String.valueOf(joinTable.get("date")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinDate0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinDate0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinDate0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinDate0";
}
}
}
}
// 处理当前表字符串
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))) {
thisTable.put("string", String.valueOf(thisTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisString0";
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisString0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisString0";
}
}
}
// 处理级联表字符串
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表字符串
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))) {
joinTable.put("string", String.valueOf(joinTable.get("string")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinString0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinString0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinString0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinString0";
}
}
}
}
// 处理当前表类型
if (StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))) {
thisTable.put("types", String.valueOf(thisTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "thisTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "thisTypes0";
if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="thisTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="thisTypes0";
}
}
}
// 处理级联表类型
if (isJoinTableFlag) {
if(isJoinTableFlag){//级联表类型
Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
if (StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))) {
joinTable.put("types", String.valueOf(joinTable.get("types")).split(","));
if (StringUtil.isEmpty(one)) {
one = "joinTypes0";
} else {
if (StringUtil.isEmpty(two)) {
two = "joinTypes0";
if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
if(StringUtil.isEmpty(one)){
one ="joinTypes0";
}else{
if(StringUtil.isEmpty(two)){
two ="joinTypes0";
}
}
}
}
// 调用CommonService进行柱状图统计
List<Map<String, Object>> result = commonService.barCount(params);
// 报表x轴
List<String> xAxis = new ArrayList<>();
// y轴
List<List<String>> yAxis = new ArrayList<>();
// 标题
List<String> legend = new ArrayList<>();
List<String> xAxis = new ArrayList<>();//报表x轴
List<List<String>> yAxis = new ArrayList<>();//y轴
List<String> legend = new ArrayList<>();//标题
// 如果不包含第二列
if (StringUtil.isEmpty(two)) {
if(StringUtil.isEmpty(two)){//不包含第二列
List<String> yAxis0 = new ArrayList<>();
yAxis.add(yAxis0);
legend.add("数值");
for (Map<String, Object> map : result) {
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String value = String.valueOf(map.get("value"));
xAxis.add(oneValue);
yAxis0.add(value);
}
} else {
// 包含第二列
}else{//包含第二列
Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
if (StringUtil.isNotEmpty(two)) {
for (Map<String, Object> map : result) {
if(StringUtil.isNotEmpty(two)){
for(Map<String, Object> map :result){
String oneValue = String.valueOf(map.get(one));
String twoValue = String.valueOf(map.get(two));
String value = String.valueOf(map.get("value"));
if (!legend.contains(twoValue)) {
legend.add(twoValue);
if(!legend.contains(twoValue)){
legend.add(twoValue);//添加完成后 就是最全的第二列的类型
}
if (dataMap.containsKey(oneValue)) {
dataMap.get(oneValue).put(twoValue, value);
} else {
if(dataMap.containsKey(oneValue)){
dataMap.get(oneValue).put(twoValue,value);
}else{
HashMap<String, String> oneData = new HashMap<>();
oneData.put(twoValue, value);
dataMap.put(oneValue, oneData);
oneData.put(twoValue,value);
dataMap.put(oneValue,oneData);
}
}
}
for (int i = 0; i < legend.size(); i++) {
for(int i =0; i<legend.size(); i++){
yAxis.add(new ArrayList<String>());
}
Set<String> keys = dataMap.keySet();
for (String key : keys) {
for(String key:keys){
xAxis.add(key);
HashMap<String, String> map = dataMap.get(key);
for (int i = 0; i < legend.size(); i++) {
for(int i =0; i<legend.size(); i++){
List<String> data = yAxis.get(i);
if (StringUtil.isNotEmpty(map.get(legend.get(i)))) {
if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
data.add(map.get(legend.get(i)));
} else {
}else{
data.add("0");
}
}
@ -740,12 +689,10 @@ public class CommonController{
System.out.println();
}
// 创建结果Map
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("xAxis", xAxis);
resultMap.put("yAxis", yAxis);
resultMap.put("legend", legend);
// 返回包含柱状图统计结果的结果对象
resultMap.put("xAxis",xAxis);
resultMap.put("yAxis",yAxis);
resultMap.put("legend",legend);
return R.ok().put("data", resultMap);
}
}
}
}

@ -1,156 +1,111 @@
package com.controller;
// 导入用于操作数组的工具类
import java.util.Arrays;
// 导入Map接口用于存储键值对
import java.util.Map;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的路径变量注解用于从URL中获取参数
import org.springframework.web.bind.annotation.PathVariable;
// 导入Spring的POST请求映射注解
import org.springframework.web.bind.annotation.PostMapping;
// 导入Spring的请求体注解用于获取请求体中的数据
import org.springframework.web.bind.annotation.RequestBody;
// 导入Spring的请求映射注解用于映射请求路径
import org.springframework.web.bind.annotation.RequestMapping;
// 导入Spring的请求参数注解用于获取请求参数
import org.springframework.web.bind.annotation.RequestParam;
// 导入Spring的RESTful控制器注解
import org.springframework.web.bind.annotation.RestController;
// 导入自定义的忽略权限验证注解
import com.annotation.IgnoreAuth;
// 导入MyBatis-Plus的实体包装器类用于构建查询条件
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入配置实体类
import com.entity.ConfigEntity;
// 导入配置服务接口
import com.service.ConfigService;
// 导入分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入自定义的验证工具类
import com.utils.ValidatorUtils;
/**
*
*/
// 映射请求路径,所有以/config开头的请求都会由该控制器处理
@RequestMapping("config")
// 声明该类为RESTful控制器
@RestController
public class ConfigController {
// 自动注入配置服务接口的实现类实例
@Autowired
private ConfigService configService;
public class ConfigController{
@Autowired
private ConfigService configService;
/**
/**
*
*/
// 映射/page请求路径支持GET请求
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, ConfigEntity config) {
// 创建一个EntityWrapper对象用于构建查询条件
public R page(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
// 调用配置服务的queryPage方法根据请求参数进行分页查询
PageUtils page = configService.queryPage(params);
// 返回成功响应,并将分页查询结果放入响应数据中
PageUtils page = configService.queryPage(params);
return R.ok().put("data", page);
}
/**
/**
*
*/
// 映射/list请求路径支持GET请求且忽略权限验证
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, ConfigEntity config) {
// 创建一个EntityWrapper对象用于构建查询条件
public R list(@RequestParam Map<String, Object> params,ConfigEntity config){
EntityWrapper<ConfigEntity> ew = new EntityWrapper<ConfigEntity>();
// 调用配置服务的queryPage方法根据请求参数进行分页查询
PageUtils page = configService.queryPage(params);
// 返回成功响应,并将分页查询结果放入响应数据中
PageUtils page = configService.queryPage(params);
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) {
// 调用配置服务的selectById方法根据ID查询配置信息
public R info(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id);
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config);
}
/**
*
*/
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量,且忽略权限验证
@IgnoreAuth
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") String id) {
// 调用配置服务的selectById方法根据ID查询配置信息
public R detail(@PathVariable("id") String id){
ConfigEntity config = configService.selectById(id);
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config);
}
/**
* name
*/
// 映射/info请求路径支持GET请求
@RequestMapping("/info")
public R infoByName(@RequestParam String name) {
// 调用配置服务的selectOne方法根据名称查询配置信息
public R infoByName(@RequestParam String name){
ConfigEntity config = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
// 返回成功响应,并将查询到的配置信息放入响应数据中
return R.ok().put("data", config);
}
/**
*
*/
// 映射/save请求路径支持POST请求
@PostMapping("/save")
public R save(@RequestBody ConfigEntity config) {
// 注释掉的代码,原本用于验证实体数据的合法性
public R save(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config);
// 调用配置服务的insert方法将配置信息插入数据库
configService.insert(config);
// 返回成功响应
configService.insert(config);
return R.ok();
}
/**
*
*/
// 映射/update请求路径支持GET或POST请求
@RequestMapping("/update")
public R update(@RequestBody ConfigEntity config) {
// 注释掉的代码,原本用于验证实体数据的合法性
public R update(@RequestBody ConfigEntity config){
// ValidatorUtils.validateEntity(config);
// 调用配置服务的updateById方法根据ID更新配置信息全部字段更新
configService.updateById(config);
// 返回成功响应
configService.updateById(config);//全部更新
return R.ok();
}
/**
*
*/
// 映射/delete请求路径支持GET或POST请求
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) {
// 调用配置服务的deleteBatchIds方法根据ID数组批量删除配置信息
configService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
public R delete(@RequestBody Long[] ids){
configService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
}

@ -1,62 +1,35 @@
package com.controller;
// 导入文件操作类
import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/**
@ -64,284 +37,214 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
// 声明该类为RESTful控制器
*/
@RestController
// 声明该类为控制器
@Controller
// 映射请求路径,所有以/dictionary开头的请求都会由该控制器处理
@RequestMapping("/dictionary")
public class DictionaryController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
// 此处注解有误,应为@Autowired自动注入用户服务类
@Autow
@Autowired
private DictionaryService dictionaryService;
@Autowired
private TokenService tokenService;
//级联表service
@Autowired
private YonghuService yonghuService;
// 自动注入医生服务类
@Autowired
private YishengService yishengService;
/**
*
*/
// 映射/page请求路径支持GET请求且忽略权限验证
*
*/
@RequestMapping("/page")
@IgnoreAuth
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id");
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
// 调用字典服务的queryPage方法根据请求参数进行分页查询
PageUtils page = dictionaryService.queryPage(params);
// 将分页结果中的列表转换为字典视图列表
List<DictionaryView> list = (List<DictionaryView>) page.getList();
// 遍历字典视图列表
for (DictionaryView c : list) {
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//字典表数据转换
List<DictionaryView> list =(List<DictionaryView>)page.getList();
for(DictionaryView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用字典服务的selectById方法根据id查询字典实体
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
DictionaryEntity dictionary = dictionaryService.selectById(id);
// 如果查询到字典实体
if (dictionary != null) {
// 创建字典视图对象
if(dictionary !=null){
//entity转view
DictionaryView view = new DictionaryView();
// 使用BeanUtils将字典实体的属性复制到字典视图
BeanUtils.copyProperties(dictionary, view);
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将字典视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求
*
*/
@RequestMapping("/save")
public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的字典实体信息
logger.debug("save方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 从请求会话中获取用户角色
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"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件
if(false)
return R.error(511,"永远不会进入");
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
.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());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
logger.info("sql语句:"+queryWrapper.getSqlSegment());
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 设置字典实体的创建时间为当前时间
if(dictionaryEntity==null){
dictionary.setCreateTime(new Date());
// 调用字典服务的insert方法将字典实体插入数据库
dictionaryService.insert(dictionary);
// 查询所有字典实体
//字典表新增数据,把数据再重新查出,放入监听器中
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<String, Map<Integer,String>> map = new HashMap<>();
for(DictionaryEntity d :dictionaryEntities){
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
if(m ==null || m.isEmpty()){
m = new HashMap<>();
}
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m);
m.put(d.getCodeIndex(),d.getIndexName());
map.put(d.getDicCode(),m);
}
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
servletContext.setAttribute("dictionaryMap",map);
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/update请求路径支持POST请求
*
*/
@RequestMapping("/update")
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的字典实体信息
logger.debug("update方法:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 从请求会话中获取用户角色
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false)
// return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,排除当前要修改的记录
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.notIn("id", dictionary.getId())
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
.notIn("id",dictionary.getId())
.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());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
logger.info("sql语句:"+queryWrapper.getSqlSegment());
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 调用字典服务的updateById方法根据id更新字典实体
dictionaryService.updateById(dictionary);
// 查询所有字典实体
if(dictionaryEntity==null){
dictionaryService.updateById(dictionary);//根据id更新
//如果字典表修改数据的话,把数据再重新查出,放入监听器中
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<String, Map<Integer,String>> map = new HashMap<>();
for(DictionaryEntity d :dictionaryEntities){
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
if(m ==null || m.isEmpty()){
m = new HashMap<>();
}
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m);
m.put(d.getCodeIndex(),d.getIndexName());
map.put(d.getDicCode(),m);
}
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
servletContext.setAttribute("dictionaryMap",map);
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/delete请求路径支持POST请求
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用字典服务的deleteBatchIds方法根据id数组批量删除记录
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
dictionaryService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/maxCodeIndex请求路径支持POST请求
@RequestMapping("/maxCodeIndex")
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) {
// 记录方法调用日志,包含控制器类名和传入的字典实体信息
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 创建一个列表,用于存储排序字段
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary){
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString());
List<String> descs = new ArrayList<>();
// 添加按code_index降序排序的字段
descs.add("code_index");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.orderDesc(descs);
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectList方法根据查询条件查询字典实体列表
logger.info("sql语句:"+queryWrapper.getSqlSegment());
List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);
// 如果查询到的列表不为空
if (dictionaryEntityList != null) {
// 返回成功响应并将最大的code_index加1作为结果放入响应数据中
return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1);
} else {
// 如果未查询到数据返回成功响应并将最大的code_index设为1
return R.ok().put("maxCodeIndex", 1);
if(dictionaryEntityList != null ){
return R.ok().put("maxCodeIndex",dictionaryEntityList.get(0).getCodeIndex()+1);
}else{
return R.ok().put("maxCodeIndex",1);
}
}
/**
*
*/
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
// 创建一个列表,用于存储要上传的字典实体
List<DictionaryEntity> dictionaryList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
List<DictionaryEntity> dictionaryList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
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());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取xls文件的数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) {
// 创建一个新的字典实体
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){
//循环
DictionaryEntity dictionaryEntity = new DictionaryEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// dictionaryEntity.setDicCode(data.get(0)); //字段 要改的
// dictionaryEntity.setDicName(data.get(0)); //字段名 要改的
// dictionaryEntity.setCodeIndex(Integer.valueOf(data.get(0))); //编码 要改的
@ -349,22 +252,26 @@ public class DictionaryController {
// dictionaryEntity.setSuperId(Integer.valueOf(data.get(0))); //父字段id 要改的
// dictionaryEntity.setBeizhu(data.get(0)); //备注 要改的
// dictionaryEntity.setCreateTime(date);//时间
// 将字典实体添加到上传列表中
dictionaryList.add(dictionaryEntity);
// 把要查询是否重复的字段放入map中
//把要查询是否重复的字段放入map中
}
// 调用字典服务的insertBatch方法批量插入字典实体
//查询是否重复
dictionaryService.insertBatch(dictionaryList);
// 返回成功响应
return R.ok();
}
}
}
} catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员");
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
}
}

@ -1,370 +1,110 @@
package com.controller;
// 导入文件操作类
import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/**
*
*
* @author
* @email
*
*/
// 声明该类为RESTful控制器
@RestController
// 声明该类为控制器
@Controller
// 映射请求路径,所有以/dictionary开头的请求都会由该控制器处理
@RequestMapping("/dictionary")
public class DictionaryController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class);
// 此处注解有误,应为@Autowired自动注入用户服务类
@Autow
private YonghuService yonghuService;
// 自动注入医生服务类
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
@Autowired
private YishengService yishengService;
private ConfigService configService;
/**
*
*
*/
// 映射/page请求路径支持GET请求且忽略权限验证
@RequestMapping("/page")
@IgnoreAuth
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id");
@RequestMapping("/upload")
public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
if (file.isEmpty()) {
throw new EIException("上传文件不能为空");
}
// 调用字典服务的queryPage方法根据请求参数进行分页查询
PageUtils page = dictionaryService.queryPage(params);
// 将分页结果中的列表转换为字典视图列表
List<DictionaryView> list = (List<DictionaryView>) page.getList();
// 遍历字典视图列表
for (DictionaryView c : list) {
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用字典服务的selectById方法根据id查询字典实体
DictionaryEntity dictionary = dictionaryService.selectById(id);
// 如果查询到字典实体
if (dictionary != null) {
// 创建字典视图对象
DictionaryView view = new DictionaryView();
// 使用BeanUtils将字典实体的属性复制到字典视图中
BeanUtils.copyProperties(dictionary, view);
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将字典视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求
@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"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
}
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 设置字典实体的创建时间为当前时间
dictionary.setCreateTime(new Date());
// 调用字典服务的insert方法将字典实体插入数据库
dictionaryService.insert(dictionary);
// 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
m = new HashMap<>();
}
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m);
}
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
File upload = new File(path.getAbsolutePath(),"/upload/");
if(!upload.exists()) {
upload.mkdirs();
}
}
/**
*
*/
// 映射/update请求路径支持POST请求
@RequestMapping("/update")
public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的字典实体信息
logger.debug("update方法:,,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>()
.notIn("id", dictionary.getId())
.eq("dic_code", dictionary.getDicCode())
.eq("index_name", dictionary.getIndexName());
// 如果字典代码包含_erji_types则添加super_id的查询条件
if (dictionary.getDicCode().contains("_erji_types")) {
queryWrapper.eq("super_id", dictionary.getSuperId());
}
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectOne方法根据查询条件查询是否存在相同数据
DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (dictionaryEntity == null) {
// 调用字典服务的updateById方法根据id更新字典实体
dictionaryService.updateById(dictionary);
// 查询所有字典实体
List<DictionaryEntity> dictionaryEntities = dictionaryService.selectList(new EntityWrapper<DictionaryEntity>());
// 获取Servlet上下文
ServletContext servletContext = request.getServletContext();
// 创建一个Map用于存储字典数据
Map<String, Map<Integer, String>> map = new HashMap<>();
// 遍历所有字典实体
for (DictionaryEntity d : dictionaryEntities) {
// 获取当前字典代码对应的子Map
Map<Integer, String> m = map.get(d.getDicCode());
// 如果子Map为空则创建一个新的子Map
if (m == null || m.isEmpty()) {
m = new HashMap<>();
}
// 将当前字典实体的代码索引和索引名称存入子Map
m.put(d.getCodeIndex(), d.getIndexName());
// 将子Map存入主Map
map.put(d.getDicCode(), m);
String fileName = new Date().getTime()+"."+fileExt;
File dest = new File(upload.getAbsolutePath()+"/"+fileName);
file.transferTo(dest);
if(StringUtils.isNotBlank(type) && type.equals("1")) {
ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
if(configEntity==null) {
configEntity = new ConfigEntity();
configEntity.setName("faceFile");
configEntity.setValue(fileName);
} else {
configEntity.setValue(fileName);
}
// 将主Map存入Servlet上下文的属性中
servletContext.setAttribute("dictionaryMap", map);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}
}
/**
*
*/
// 映射/delete请求路径支持POST请求
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用字典服务的deleteBatchIds方法根据id数组批量删除记录
dictionaryService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/maxCodeIndex请求路径支持POST请求
@RequestMapping("/maxCodeIndex")
public R maxCodeIndex(@RequestBody DictionaryEntity dictionary) {
// 记录方法调用日志,包含控制器类名和传入的字典实体信息
logger.debug("maxCodeIndex:,,Controller:{},,dictionary:{}", this.getClass().getName(), dictionary.toString());
// 创建一个列表,用于存储排序字段
List<String> descs = new ArrayList<>();
// 添加按code_index降序排序的字段
descs.add("code_index");
// 创建查询包装器,用于构建查询条件
Wrapper<DictionaryEntity> queryWrapper = new EntityWrapper<DictionaryEntity>()
.eq("dic_code", dictionary.getDicCode())
.orderDesc(descs);
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用字典服务的selectList方法根据查询条件查询字典实体列表
List<DictionaryEntity> dictionaryEntityList = dictionaryService.selectList(queryWrapper);
// 如果查询到的列表不为空
if (dictionaryEntityList != null) {
// 返回成功响应并将最大的code_index加1作为结果放入响应数据中
return R.ok().put("maxCodeIndex", dictionaryEntityList.get(0).getCodeIndex() + 1);
} else {
// 如果未查询到数据返回成功响应并将最大的code_index设为1
return R.ok().put("maxCodeIndex", 1);
configService.insertOrUpdate(configEntity);
}
return R.ok().put("file", fileName);
}
/**
*
*
*/
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
@IgnoreAuth
@RequestMapping("/download")
public ResponseEntity<byte[]> download(@RequestParam String fileName) {
try {
// 创建一个列表,用于存储要上传的字典实体
List<DictionaryEntity> dictionaryList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
File file = new File(resource.getFile());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取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中
}
// 调用字典服务的insertBatch方法批量插入字典实体
dictionaryService.insertBatch(dictionaryList);
// 返回成功响应
return R.ok();
}
}
File path = new File(ResourceUtils.getURL("classpath:static").getPath());
if(!path.exists()) {
path = new File("");
}
File upload = new File(path.getAbsolutePath(),"/upload/");
if(!upload.exists()) {
upload.mkdirs();
}
File file = new File(upload.getAbsolutePath()+"/"+fileName);
if(file.exists()){
/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
getResponse().sendError(403);
}*/
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", fileName);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
} catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员");
} catch (IOException e) {
e.printStackTrace();
}
return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
}
}
}

@ -1,63 +1,35 @@
package com.controller;
// 导入文件操作相关类
import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/**
@ -65,276 +37,205 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
// 声明该类为RESTful控制器
*/
@RestController
// 声明该类为控制器
@Controller
// 映射请求路径,所有以/guahao开头的请求都会由该控制器处理
@RequestMapping("/guahao")
public class GuahaoController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(GuahaoController.class);
// 自动注入挂号服务类,用于处理挂号相关业务逻辑
@Autowired
private GuahaoService guahaoService;
// 自动注入令牌服务类
@Autowired
private TokenService tokenService;
// 自动注入字典服务类
@Autowired
private DictionaryService dictionaryService;
// 级联表service,自动注入医生服务类
//级联表service
@Autowired
private YishengService yishengService;
// 级联表service自动注入用户服务类
@Autowired
private YonghuService yonghuService;
/**
*
*/
// 映射/page请求路径支持GET请求
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
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"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id");
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
// 调用挂号服务的queryPage方法根据请求参数进行分页查询
PageUtils page = guahaoService.queryPage(params);
// 将分页结果中的列表转换为挂号视图列表
List<GuahaoView> list = (List<GuahaoView>) page.getList();
// 遍历挂号视图列表
for (GuahaoView c : list) {
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//字典表数据转换
List<GuahaoView> list =(List<GuahaoView>)page.getList();
for(GuahaoView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用挂号服务的selectById方法根据id查询挂号实体
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
GuahaoEntity guahao = guahaoService.selectById(id);
// 如果查询到挂号实体
if (guahao != null) {
// 创建挂号视图对象
if(guahao !=null){
//entity转view
GuahaoView view = new GuahaoView();
// 使用BeanUtils将挂号实体的属性复制到挂号视图中
BeanUtils.copyProperties(guahao, view);
// 级联查询医生信息
YishengEntity yisheng = yishengService.selectById(guahao.getYishengId());
// 如果查询到医生信息
if (yisheng != null) {
// 将医生信息的部分属性复制到挂号视图中,并排除指定字段
BeanUtils.copyProperties(yisheng, view, new String[]{"id", "createTime", "insertTime", "updateTime"});
// 设置挂号视图中的医生id
view.setYishengId(yisheng.getId());
}
// 级联查询用户信息
YonghuEntity yonghu = yonghuService.selectById(guahao.getYonghuId());
// 如果查询到用户信息
if (yonghu != null) {
// 将用户信息的部分属性复制到挂号视图中,并排除指定字段
BeanUtils.copyProperties(yonghu, view, new String[]{"id", "createTime", "insertTime", "updateTime"});
// 设置挂号视图中的用户id
view.setYonghuId(yonghu.getId());
}
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
BeanUtils.copyProperties( guahao , view );//把实体数据重构到view中
//级联表
YishengEntity yisheng = yishengService.selectById(guahao.getYishengId());
if(yisheng != null){
BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYishengId(yisheng.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(guahao.getYonghuId());
if(yonghu != null){
BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createTime", "insertTime", "updateTime"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYonghuId(yonghu.getId());
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将挂号视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求
*
*/
@RequestMapping("/save")
public R save(@RequestBody GuahaoEntity guahao, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的挂号实体信息
logger.debug("save方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString());
// 从请求会话中获取用户角色
public R save(@RequestBody GuahaoEntity guahao, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,guahao:{}",this.getClass().getName(),guahao.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
// 如果用户角色为"医生"
else if ("医生".equals(role))
// 设置挂号实体的医生id为当前会话中的用户id
if(false)
return R.error(511,"永远不会进入");
else if("医生".equals(role))
guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 如果用户角色为"用户"
else if ("用户".equals(role))
// 设置挂号实体的用户id为当前会话中的用户id
else if("用户".equals(role))
guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询包装器,用于构建查询条件
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_time", new SimpleDateFormat("yyyy-MM-dd").format(guahao.getGuahaoTime()))
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText());
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用挂号服务的selectOne方法根据查询条件查询是否存在相同数据
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_time", new SimpleDateFormat("yyyy-MM-dd").format(guahao.getGuahaoTime()))
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (guahaoEntity == null) {
// 设置挂号审核类型为1
if(guahaoEntity==null){
guahao.setGuahaoYesnoTypes(1);
// 设置挂号实体的创建时间为当前时间
guahao.setCreateTime(new Date());
// 调用挂号服务的insert方法将挂号实体插入数据库
guahaoService.insert(guahao);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/update请求路径支持POST请求
*
*/
@RequestMapping("/update")
public R update(@RequestBody GuahaoEntity guahao, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的挂号实体信息
logger.debug("update方法:,,Controller:{},,guahao:{}", this.getClass().getName(), guahao.toString());
// 从请求会话中获取用户角色
public R update(@RequestBody GuahaoEntity guahao, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,guahao:{}",this.getClass().getName(),guahao.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false)
// return R.error(511, "永远不会进入");
// else if ("医生".equals(role))
// if(false)
// return R.error(511,"永远不会进入");
// else if("医生".equals(role))
// guahao.setYishengId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// else if ("用户".equals(role))
// else if("用户".equals(role))
// guahao.setYonghuId(Integer.valueOf(String.valueOf(request.getSession().getAttribute("userId"))));
// 创建查询包装器,用于构建查询条件,排除当前要修改的记录
//根据字段查询是否有相同数据
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.notIn("id", guahao.getId())
.andNew()
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_time", guahao.getGuahaoTime())
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText());
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用挂号服务的selectOne方法根据查询条件查询是否存在相同数据
.notIn("id",guahao.getId())
.andNew()
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_time", guahao.getGuahaoTime())
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (guahaoEntity == null) {
// 调用挂号服务的updateById方法根据id更新挂号实体
guahaoService.updateById(guahao);
// 返回成功响应
if(guahaoEntity==null){
guahaoService.updateById(guahao);//根据id更新
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/delete请求路径支持POST请求
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用挂号服务的deleteBatchIds方法根据id数组批量删除记录
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
guahaoService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/batchInsert请求路径支持POST请求
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
// 创建一个列表,用于存储要上传的挂号实体
List<GuahaoEntity> guahaoList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
List<GuahaoEntity> guahaoList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
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());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取xls文件的数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) {
// 创建一个新的挂号实体
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){
//循环
GuahaoEntity guahaoEntity = new GuahaoEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// guahaoEntity.setYishengId(Integer.valueOf(data.get(0))); //医生 要改的
// guahaoEntity.setYonghuId(Integer.valueOf(data.get(0))); //用户 要改的
// guahaoEntity.setGuahaoUuinNumber(Integer.valueOf(data.get(0))); //就诊识别码 要改的
@ -344,10 +245,119 @@ public class GuahaoController {
// guahaoEntity.setGuahaoYesnoTypes(Integer.valueOf(data.get(0))); //挂号审核 要改的
// guahaoEntity.setGuahaoYesnoText(data.get(0)); //审核结果 要改的
// guahaoEntity.setCreateTime(date);//时间
// 将挂号实体添加到上传列表中
guahaoList.add(guahaoEntity);
// 把要查询是否重复的字段放入map中
//把要查询是否重复的字段放入map中
}
//
//查询是否重复
guahaoService.insertBatch(guahaoList);
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> 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 = guahaoService.queryPage(params);
//字典表数据转换
List<GuahaoView> list =(List<GuahaoView>)page.getList();
for(GuahaoView 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);
GuahaoEntity guahao = guahaoService.selectById(id);
if(guahao !=null){
//entity转view
GuahaoView view = new GuahaoView();
BeanUtils.copyProperties( guahao , view );//把实体数据重构到view中
//级联表
YishengEntity yisheng = yishengService.selectById(guahao.getYishengId());
if(yisheng != null){
BeanUtils.copyProperties( yisheng , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段
view.setYishengId(yisheng.getId());
}
//级联表
YonghuEntity yonghu = yonghuService.selectById(guahao.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,"查不到数据");
}
}
/**
*
*/
@RequestMapping("/add")
public R add(@RequestBody GuahaoEntity guahao, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,guahao:{}",this.getClass().getName(),guahao.toString());
Wrapper<GuahaoEntity> queryWrapper = new EntityWrapper<GuahaoEntity>()
.eq("yisheng_id", guahao.getYishengId())
.eq("yonghu_id", guahao.getYonghuId())
.eq("guahao_uuin_number", guahao.getGuahaoUuinNumber())
.eq("guahao_types", guahao.getGuahaoTypes())
.eq("guahao_status_types", guahao.getGuahaoStatusTypes())
.eq("guahao_yesno_types", guahao.getGuahaoYesnoTypes())
.eq("guahao_yesno_text", guahao.getGuahaoYesnoText())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
GuahaoEntity guahaoEntity = guahaoService.selectOne(queryWrapper);
if(guahaoEntity==null){
guahao.setGuahaoYesnoTypes(1);
guahao.setCreateTime(new Date());
YonghuEntity userId = yonghuService.selectById((Integer) request.getSession().getAttribute("userId"));
YishengEntity yishengEntity = yishengService.selectById(guahao.getYishengId());
if(userId.getNewMoney()<yishengEntity.getYishengNewMoney()){
return R.error("余额不足请充值");
}
userId.setNewMoney(userId.getNewMoney()-yishengEntity.getYishengNewMoney());
boolean b = yonghuService.updateById(userId);
if(!b){
return R.error();
}
guahaoService.insert(guahao);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}

@ -1,63 +1,35 @@
package com.controller;
// 导入文件操作相关类
import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/**
@ -65,261 +37,189 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
// 声明该类为RESTful控制器用于处理HTTP请求并返回JSON数据
*/
@RestController
// 声明该类为Spring MVC控制器
@Controller
// 映射请求路径,所有以/jiankangjiaoyu开头的请求都会由该控制器处理
@RequestMapping("/jiankangjiaoyu")
public class JiankangjiaoyuController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(JiankangjiaoyuController.class);
// 自动注入健康教育服务类,用于处理健康教育相关业务逻辑
@Autowired
private JiankangjiaoyuService jiankangjiaoyuService;
// 自动注入令牌服务类
@Autowired
private TokenService tokenService;
// 自动注入字典服务类,用于字典表数据转换
@Autowired
private DictionaryService dictionaryService;
// 级联表service自动注入用户服务类
//级联表service
@Autowired
private YonghuService yonghuService;
// 级联表service自动注入医生服务类
@Autowired
private YishengService yishengService;
/**
*
*/
// 映射/page请求路径支持GET请求用于获取健康教育信息的分页列表
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
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"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId"));
// 设置查询条件限定健康教育未被删除逻辑删除字段值为1
params.put("jiankangjiaoyuDeleteStart", 1);
params.put("jiankangjiaoyuDeleteEnd", 1);
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id");
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId"));
params.put("jiankangjiaoyuDeleteStart",1);params.put("jiankangjiaoyuDeleteEnd",1);
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
// 调用健康教育服务的queryPage方法根据请求参数进行分页查询
PageUtils page = jiankangjiaoyuService.queryPage(params);
// 将分页结果中的列表转换为健康教育视图列表
List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList();
// 遍历健康教育视图列表
for (JiankangjiaoyuView c : list) {
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//字典表数据转换
List<JiankangjiaoyuView> list =(List<JiankangjiaoyuView>)page.getList();
for(JiankangjiaoyuView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量用于获取指定id的健康教育信息详情
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用健康教育服务的selectById方法根据id查询健康教育实体
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id);
// 如果查询到健康教育实体
if (jiankangjiaoyu != null) {
// 创建健康教育视图对象
if(jiankangjiaoyu !=null){
//entity转view
JiankangjiaoyuView view = new JiankangjiaoyuView();
// 使用BeanUtils将健康教育实体的属性复制到健康教育视图中
BeanUtils.copyProperties(jiankangjiaoyu, view);
BeanUtils.copyProperties( jiankangjiaoyu , view );//把实体数据重构到view中
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将健康教育视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求用于保存新的健康教育信息
*
*/
@RequestMapping("/save")
public R save(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的健康教育实体信息
logger.debug("save方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 从请求会话中获取用户角色
public R save(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,jiankangjiaoyu:{}",this.getClass().getName(),jiankangjiaoyu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
if(false)
return R.error(511,"永远不会进入");
// 创建查询包装器,用于构建查询条件,检查是否存在相同的健康教育信息
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete())
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
logger.info("sql语句:"+queryWrapper.getSqlSegment());
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) {
// 设置插入时间为当前时间
if(jiankangjiaoyuEntity==null){
jiankangjiaoyu.setInsertTime(new Date());
// 设置逻辑删除字段为1表示未删除
jiankangjiaoyu.setJiankangjiaoyuDelete(1);
// 设置创建时间为当前时间
jiankangjiaoyu.setCreateTime(new Date());
// 调用健康教育服务的insert方法将健康教育实体插入数据库
jiankangjiaoyuService.insert(jiankangjiaoyu);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/update请求路径支持POST请求用于修改已有的健康教育信息
*
*/
@RequestMapping("/update")
public R update(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的健康教育实体信息
logger.debug("update方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 从请求会话中获取用户角色
public R update(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,jiankangjiaoyu:{}",this.getClass().getName(),jiankangjiaoyu.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false)
// return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,排除当前要修改的记录,检查是否存在相同的健康教育信息
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.notIn("id", jiankangjiaoyu.getId())
.andNew()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
.notIn("id",jiankangjiaoyu.getId())
.andNew()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果健康教育照片字段为空字符串或"null"则将其设置为null
if ("".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto()) || "null".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto())) {
jiankangjiaoyu.setJiankangjiaoyuPhoto(null);
if("".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto()) || "null".equals(jiankangjiaoyu.getJiankangjiaoyuPhoto())){
jiankangjiaoyu.setJiankangjiaoyuPhoto(null);
}
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) {
// 调用健康教育服务的updateById方法根据id更新健康教育实体
jiankangjiaoyuService.updateById(jiankangjiaoyu);
// 返回成功响应
if(jiankangjiaoyuEntity==null){
jiankangjiaoyuService.updateById(jiankangjiaoyu);//根据id更新
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/delete请求路径支持POST请求用于删除健康教育信息逻辑删除
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 创建一个ArrayList用于存储要更新的健康教育实体
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
ArrayList<JiankangjiaoyuEntity> list = new ArrayList<>();
// 遍历要删除的记录id数组
for (Integer id : ids) {
// 创建一个新的健康教育实体
for(Integer id:ids){
JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity();
// 设置健康教育实体的id
jiankangjiaoyuEntity.setId(id);
// 设置逻辑删除字段为2表示已删除
jiankangjiaoyuEntity.setJiankangjiaoyuDelete(2);
// 将健康教育实体添加到列表中
list.add(jiankangjiaoyuEntity);
}
// 如果列表不为空
if (list != null && list.size() > 0) {
// 调用健康教育服务的updateBatchById方法批量更新健康教育实体
if(list != null && list.size() >0){
jiankangjiaoyuService.updateBatchById(list);
}
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/batchInsert请求路径支持POST请求用于批量上传健康教育信息
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
// 创建一个列表,用于存储要上传的健康教育实体
List<JiankangjiaoyuEntity> jiankangjiaoyuList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
List<JiankangjiaoyuEntity> jiankangjiaoyuList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
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());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取xls文件的数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) {
// 创建一个新的健康教育实体
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){
//循环
JiankangjiaoyuEntity jiankangjiaoyuEntity = new JiankangjiaoyuEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// jiankangjiaoyuEntity.setJiankangjiaoyuName(data.get(0)); //健康教育标题 要改的
// jiankangjiaoyuEntity.setJiankangjiaoyuTypes(Integer.valueOf(data.get(0))); //健康教育类型 要改的
// jiankangjiaoyuEntity.setJiankangjiaoyuPhoto("");//照片
@ -327,111 +227,94 @@ public class JiankangjiaoyuController {
// jiankangjiaoyuEntity.setJiankangjiaoyuContent("");//照片
// jiankangjiaoyuEntity.setJiankangjiaoyuDelete(1);//逻辑删除字段
// jiankangjiaoyuEntity.setCreateTime(date);//时间
// 将健康教育实体添加到上传列表中
jiankangjiaoyuList.add(jiankangjiaoyuEntity);
// 把要查询是否重复的字段放入map中
//把要查询是否重复的字段放入map中
}
// 调用健康教育服务的insertBatch方法批量插入健康教育实体
//查询是否重复
jiankangjiaoyuService.insertBatch(jiankangjiaoyuList);
// 返回成功响应
return R.ok();
}
}
}
} catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员");
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
*
*/
// 映射/list请求路径支持GET请求用于前端获取健康教育信息的分页列表忽略权限验证
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> 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");
public R list(@RequestParam Map<String, Object> 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");
}
// 调用健康教育服务的queryPage方法根据请求参数进行分页查询
PageUtils page = jiankangjiaoyuService.queryPage(params);
// 将分页结果中的列表转换为健康教育视图列表
List<JiankangjiaoyuView> list = (List<JiankangjiaoyuView>) page.getList();
// 遍历健康教育视图列表
for (JiankangjiaoyuView c : list)
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页查询结果放入响应数据中
//字典表数据转换
List<JiankangjiaoyuView> list =(List<JiankangjiaoyuView>)page.getList();
for(JiankangjiaoyuView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
*
*/
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量用于前端获取指定id的健康教育信息详情
*
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用健康教育服务的selectById方法根据id查询健康教育实体
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
JiankangjiaoyuEntity jiankangjiaoyu = jiankangjiaoyuService.selectById(id);
// 如果查询到健康教育实体
if (jiankangjiaoyu != null) {
// 创建健康教育视图对象
JiankangjiaoyuView view = new JiankangjiaoyuView();
// 使用BeanUtils将健康教育实体的属性复制到健康教育视图中
BeanUtils.copyProperties(jiankangjiaoyu, view);
if(jiankangjiaoyu !=null){
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将健康教育视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}
//entity转view
JiankangjiaoyuView view = new JiankangjiaoyuView();
BeanUtils.copyProperties( jiankangjiaoyu , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/add请求路径支持POST请求用于前端保存新的健康教育信息
*
*/
@RequestMapping("/add")
public R add(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的健康教育实体信息
logger.debug("add方法:,,Controller:{},,jiankangjiaoyu:{}", this.getClass().getName(), jiankangjiaoyu.toString());
// 创建查询包装器,用于构建查询条件,检查是否存在相同的健康教育信息
public R add(@RequestBody JiankangjiaoyuEntity jiankangjiaoyu, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,jiankangjiaoyu:{}",this.getClass().getName(),jiankangjiaoyu.toString());
Wrapper<JiankangjiaoyuEntity> queryWrapper = new EntityWrapper<JiankangjiaoyuEntity>()
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete());
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用健康教育服务的selectOne方法根据查询条件查询是否存在相同数据
.eq("jiankangjiaoyu_name", jiankangjiaoyu.getJiankangjiaoyuName())
.eq("jiankangjiaoyu_types", jiankangjiaoyu.getJiankangjiaoyuTypes())
.eq("jiankangjiaoyu_delete", jiankangjiaoyu.getJiankangjiaoyuDelete())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
JiankangjiaoyuEntity jiankangjiaoyuEntity = jiankangjiaoyuService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (jiankangjiaoyuEntity == null) {
// 设置插入时间为当前时间
if(jiankangjiaoyuEntity==null){
jiankangjiaoyu.setInsertTime(new Date());
// 设置逻辑删除字段为1表示未删除
jiankangjiaoyu.setJiankangjiaoyuDelete(1);
// 设置创建时间为当前时间
jiankangjiaoyu.setCreateTime(new Date());
// 调用健康教育服务的insert方法将健康教育实体插入数据库
jiankangjiaoyuService.insert(jiankangjiaoyu);
// 返回成功响应
jiankangjiaoyuService.insert(jiankangjiaoyu);
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
}
}

@ -1,63 +1,35 @@
package com.controller;
// 导入文件操作相关类
import java.io.File;
// 导入用于高精度计算的类
import java.math.BigDecimal;
// 导入用于处理URL的类
import java.net.URL;
// 导入用于日期格式化的类
import java.text.SimpleDateFormat;
// 导入阿里巴巴的JSON对象类
import com.alibaba.fastjson.JSONObject;
// 导入常用的集合类
import java.util.*;
// 导入Spring的Bean属性复制工具类
import org.springframework.beans.BeanUtils;
// 导入Servlet请求相关类
import javax.servlet.http.HttpServletRequest;
// 导入Spring的上下文加载器类
import org.springframework.web.context.ContextLoader;
// 导入Servlet上下文类
import javax.servlet.ServletContext;
// 导入令牌服务类
import com.service.TokenService;
// 导入自定义工具类
import com.utils.*;
// 导入反射调用异常类
import java.lang.reflect.InvocationTargetException;
// 导入字典服务类
import com.service.DictionaryService;
// 导入Apache Commons提供的字符串工具类
import org.apache.commons.lang3.StringUtils;
// 导入自定义的忽略权限注解类
import com.annotation.IgnoreAuth;
// 导入日志记录器接口
import org.slf4j.Logger;
// 导入日志记录器工厂类
import org.slf4j.LoggerFactory;
// 导入Spring的自动注入注解
import org.springframework.beans.factory.annotation.Autowired;
// 导入Spring的控制器注解
import org.springframework.stereotype.Controller;
// 导入Spring的请求映射注解
import org.springframework.web.bind.annotation.*;
// 导入MyBatis-Plus的实体包装器类
import com.baomidou.mybatisplus.mapper.EntityWrapper;
// 导入MyBatis-Plus的查询包装器接口
import com.baomidou.mybatisplus.mapper.Wrapper;
// 导入自定义的实体类
import com.entity.*;
// 导入自定义的视图类
import com.entity.view.*;
// 导入自定义的服务类
import com.service.*;
// 导入自定义的分页工具类
import com.utils.PageUtils;
// 导入自定义的响应结果类
import com.utils.R;
// 导入阿里巴巴的JSON工具类
import com.alibaba.fastjson.*;
/**
@ -65,322 +37,268 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
// 声明该类为RESTful控制器用于处理HTTP请求并返回JSON数据
*/
@RestController
// 声明该类为Spring MVC控制器
@Controller
// 映射请求路径,所有以/news开头的请求都会由该控制器处理
@RequestMapping("/news")
public class NewsController {
// 日志记录器,用于记录当前控制器类的日志信息
private static final Logger logger = LoggerFactory.getLogger(NewsController.class);
// 自动注入新闻服务类,用于处理新闻相关业务逻辑
@Autowired
private NewsService newsService;
// 自动注入令牌服务类
@Autowired
private TokenService tokenService;
// 自动注入字典服务类,用于字典表数据转换
@Autowired
private DictionaryService dictionaryService;
// 级联表service自动注入用户服务类
//级联表service
@Autowired
private YonghuService yonghuService;
// 级联表service自动注入医生服务类
@Autowired
private YishengService yishengService;
/**
*
*/
// 映射/page请求路径支持GET请求用于获取公告信息的分页列表
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和请求参数
logger.debug("page方法:,,Controller:{},,params:{}", this.getClass().getName(), JSONObject.toJSONString(params));
// 从请求会话中获取用户角色
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"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永不会进入");
// 如果用户角色为"用户"
else if ("用户".equals(role))
// 在请求参数中添加用户id
params.put("yonghuId", request.getSession().getAttribute("userId"));
// 如果用户角色为"医生"
else if ("医生".equals(role))
// 在请求参数中添加医生id
params.put("yishengId", request.getSession().getAttribute("userId"));
// 如果请求参数中没有指定排序字段则默认按id排序
if (params.get("orderBy") == null || params.get("orderBy") == "") {
params.put("orderBy", "id");
if(false)
return R.error(511,"永不会进入");
else if("用户".equals(role))
params.put("yonghuId",request.getSession().getAttribute("userId"));
else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId"));
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
}
// 调用新闻服务的queryPage方法根据请求参数进行分页查询
PageUtils page = newsService.queryPage(params);
// 将分页结果中的列表转换为新闻视图列表
List<NewsView> list = (List<NewsView>) page.getList();
// 遍历新闻视图列表
for (NewsView c : list) {
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//字典表数据转换
List<NewsView> list =(List<NewsView>)page.getList();
for(NewsView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
}
// 返回成功响应,并将分页查询结果放入响应数据中
return R.ok().put("data", page);
}
/**
*
*/
// 映射/info/{id}请求路径支持GET请求{id}为路径变量用于获取指定id的公告信息详情
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("info方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用新闻服务的selectById方法根据id查询新闻实体
public R info(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
NewsEntity news = newsService.selectById(id);
// 如果查询到新闻实体
if (news != null) {
// 创建新闻视图对象
if(news !=null){
//entity转view
NewsView view = new NewsView();
// 使用BeanUtils将新闻实体的属性复制到新闻视图中
BeanUtils.copyProperties(news, view);
BeanUtils.copyProperties( news , view );//把实体数据重构到view中
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将新闻视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/save请求路径支持POST请求用于保存新的公告信息
*
*/
@RequestMapping("/save")
public R save(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的新闻实体信息
logger.debug("save方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
// 从请求会话中获取用户角色
public R save(@RequestBody NewsEntity news, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,news:{}",this.getClass().getName(),news.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件永远为false注释掉的代码表示永远不会进入该分支
if (false)
return R.error(511, "永远不会进入");
if(false)
return R.error(511,"永远不会进入");
// 创建查询包装器,用于构建查询条件,检查是否存在相同的公告信息
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes());
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用新闻服务的selectOne方法根据查询条件查询是否存在相同数据
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
// 如果未查询到相同数据
if (newsEntity == null) {
// 设置插入时间为当前时间
if(newsEntity==null){
news.setInsertTime(new Date());
// 设置创建时间为当前时间
news.setCreateTime(new Date());
// 调用新闻服务的insert方法将新闻实体插入数据库
newsService.insert(news);
// 返回成功响应
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/update请求路径支持POST请求用于修改已有的公告信息
*
*/
@RequestMapping("/update")
public R update(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要修改的新闻实体信息
logger.debug("update方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
// 从请求会话中获取用户角色
public R update(@RequestBody NewsEntity news, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,news:{}",this.getClass().getName(),news.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// 此条件注释掉,表示永远不会进入该分支
// if (false)
// return R.error(511, "永远不会进入");
// 创建查询包装器,用于构建查询条件,排除当前要修改的记录,检查是否存在相同的公告信息
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.notIn("id", news.getId())
.andNew()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes());
// 记录生成的SQL查询语句
logger.info("sql语句:" + queryWrapper.getSqlSegment());
// 调用新闻服务的selectOne方法根据查询条件查询是否存在相同数据
.notIn("id",news.getId())
.andNew()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
// 如果新闻照片字段为空字符串或"null"则将其设置为null
if ("".equals(news.getNewsPhoto()) || "null".equals(news.getNewsPhoto())) {
news.setNewsPhoto(null);
if("".equals(news.getNewsPhoto()) || "null".equals(news.getNewsPhoto())){
news.setNewsPhoto(null);
}
// 如果未查询到相同数据
if (newsEntity == null) {
// 调用新闻服务的updateById方法根据id更新新闻实体
newsService.updateById(news);
// 返回成功响应
if(newsEntity==null){
newsService.updateById(news);//根据id更新
return R.ok();
} else {
// 如果查询到相同数据返回错误响应错误码为511
return R.error(511, "表中有相同数据");
}else {
return R.error(511,"表中有相同数据");
}
}
/**
*
*/
// 映射/delete请求路径支持POST请求用于删除公告信息
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids) {
// 记录方法调用日志包含控制器类名和要删除的记录id数组
logger.debug("delete:,,Controller:{},,ids:{}", this.getClass().getName(), ids.toString());
// 调用新闻服务的deleteBatchIds方法根据id数组批量删除记录
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
newsService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
/**
*
*/
// 映射/batchInsert请求路径支持POST请求用于批量上传公告信息
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
// 创建一个列表,用于存储要上传的新闻实体
List<NewsEntity> newsList = new ArrayList<>();
// 创建一个Map用于存储要查询的字段
Map<String, List<String>> seachFields = new HashMap<>();
// 获取当前时间
List<NewsEntity> newsList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
// 如果文件名中没有点返回错误响应错误码为511
if (lastIndexOf == -1) {
return R.error(511, "该文件没有后缀");
} else {
// 获取文件后缀
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
}else{
String suffix = fileName.substring(lastIndexOf);
// 如果文件后缀不是.xls返回错误响应错误码为511
if (!".xls".equals(suffix)) {
return R.error(511, "只支持后缀为xls的excel文件");
} else {
// 获取文件的URL
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);
// 创建文件对象
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());
// 如果文件不存在返回错误响应错误码为511
if (!file.exists()) {
return R.error(511, "找不到上传文件,请联系管理员");
} else {
// 使用PoiUtil工具类读取xls文件的数据
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());
// 删除第一行数据,因为第一行通常是表头
dataList.remove(0);
// 遍历数据列表
for (List<String> data : dataList) {
// 创建一个新的新闻实体
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){
//循环
NewsEntity newsEntity = new NewsEntity();
// 以下代码注释掉,表示需要根据实际情况修改字段赋值
// newsEntity.setNewsName(data.get(0)); //公告名称 要改的
// newsEntity.setNewsPhoto("");//照片
// newsEntity.setNewsTypes(Integer.valueOf(data.get(0))); //公告类型 要改的
// newsEntity.setInsertTime(date);//时间
// newsEntity.setNewsContent("");//照片
// newsEntity.setCreateTime(date);//时间
// 将新闻实体添加到上传列表中
newsList.add(newsEntity);
// 把要查询是否重复的字段放入map中
//把要查询是否重复的字段放入map中
}
// 调用新闻服务的insertBatch方法批量插入新闻实体
//查询是否重复
newsService.insertBatch(newsList);
// 返回成功响应
return R.ok();
}
}
}
} catch (Exception e) {
// 如果发生异常返回错误响应错误码为511
return R.error(511, "批量插入数据异常,请联系管理员");
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
}
}
/**
*
*/
// 映射/list请求路径支持GET请求用于前端获取公告信息的分页列表忽略权限验证
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> 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");
public R list(@RequestParam Map<String, Object> 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");
}
// 调用新闻服务的queryPage方法根据请求参数进行分页查询
PageUtils page = newsService.queryPage(params);
// 将分页结果中的列表转换为新闻视图列表
List<NewsView> list = (List<NewsView>) page.getList();
// 遍历新闻视图列表
for (NewsView c : list)
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
// 返回成功响应,并将分页查询结果放入响应数据中
//字典表数据转换
List<NewsView> list =(List<NewsView>)page.getList();
for(NewsView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
}
/**
*
*/
// 映射/detail/{id}请求路径支持GET请求{id}为路径变量用于前端获取指定id的公告信息详情
*
*/
@RequestMapping("/detail/{id}")
public R detail(@PathVariable("id") Long id, HttpServletRequest request) {
// 记录方法调用日志包含控制器类名和请求的id
logger.debug("detail方法:,,Controller:{},,id:{}", this.getClass().getName(), id);
// 调用新闻服务的selectById方法根据id查询新闻实体
public R detail(@PathVariable("id") Long id, HttpServletRequest request){
logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
NewsEntity news = newsService.selectById(id);
// 如果查询到新闻实体
if (news != null) {
// 创建新闻视图对象
NewsView view = new NewsView();
// 使用BeanUtils将新闻实体的属性复制到新闻视图中
BeanUtils.copyProperties(news, view);
if(news !=null){
// 调用字典服务的dictionaryConvert方法修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
// 返回成功响应,并将新闻视图对象放入响应数据中
return R.ok().put("data", view);
} else {
// 如果未查询到数据返回错误响应错误码为511
return R.error(511, "查不到数据");
}
//entity转view
NewsView view = new NewsView();
BeanUtils.copyProperties( news , view );//把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
}
/**
*
*/
// 映射/add请求路径支持POST请求用于前端保存新的公告信息
*
*/
@RequestMapping("/add")
public R add(@RequestBody NewsEntity news, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的新闻实体信息
logger.debug("add方法:,,Controller:{},,news:{}", this.getClass().getName(), news.toString());
// 创建查询包装器,用于构建查询条件,检查是否存在相同的公告信息
public R add(@RequestBody NewsEntity news, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,news:{}",this.getClass().getName(),news.toString());
Wrapper<NewsEntity> queryWrapper = new EntityWrapper<NewsEntity>()
.eq("news_name", news.getNewsName())
.eq("news_types", news.getNewsTypes())
;
logger.info("sql语句:"+queryWrapper.getSqlSegment());
NewsEntity newsEntity = newsService.selectOne(queryWrapper);
if(newsEntity==null){
news.setInsertTime(new Date());
news.setCreateTime(new Date());
newsService.insert(news);
return R.ok();
}else {
return R.error(511,"表中有相同数据");
}
}
}

@ -1,5 +1,7 @@
package com.controller;
import java.util.Arrays;
import java.util.Map;
@ -26,209 +28,141 @@ import com.utils.R;
/**
*
*/
// 定义请求映射路径,所有以/users开头的请求会被该控制器处理
@RequestMapping("users")
// 声明该类为一个RESTful风格的控制器用于处理HTTP请求并返回JSON数据
@RestController
public class UsersController {
// 自动注入UsersService用于处理与用户相关的业务逻辑
@Autowired
private UsersService usersService;
// 自动注入TokenService用于处理与令牌相关的业务逻辑
@Autowired
private TokenService tokenService;
/**
*
* @param username
* @param password
* @param captcha 使
* @param request HTTP
* @return R
*
*/
@IgnoreAuth // 忽略权限验证的注解
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
// 根据用户名查询用户实体
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
// 如果用户不存在或者用户输入的密码与数据库中存储的密码不匹配
if (user == null || !user.getPassword().equals(password)) {
// 返回错误响应,提示账号或密码不正确
if(user==null || !user.getPassword().equals(password)) {
return R.error("账号或密码不正确");
}
// 生成用户令牌参数依次为用户ID、用户名、用户类型标识、用户角色
String token = tokenService.generateToken(user.getId(), username, "users", user.getRole());
// 创建一个成功的响应对象
String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
R r = R.ok();
// 将生成的令牌放入响应数据中
r.put("token", token);
// 将用户的角色信息放入响应数据中
r.put("role", user.getRole());
// 将用户的ID信息放入响应数据中
r.put("userId", user.getId());
// 返回响应对象
r.put("role",user.getRole());
r.put("userId",user.getId());
return r;
}
/**
*
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户名查询数据库,判断用户是否已经存在
if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) {
// 如果用户已存在,返回错误响应
return R.error("用户已存在");
}
// 将新用户插入到数据库中
usersService.insert(user);
// 返回成功响应
return R.ok();
}
public R register(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
usersService.insert(user);
return R.ok();
}
/**
* 退
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
// 使当前用户的会话失效,实现退出登录
request.getSession().invalidate();
// 返回成功响应,并附带退出成功的提示信息
return R.ok("退出成功");
}
/**
*
* @param username
* @param request HTTP
* @return R
*/
@IgnoreAuth // 忽略权限验证的注解
*
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) {
// 根据用户名查询用户实体
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
// 如果用户不存在
if (user == null) {
// 返回错误响应,提示账号不存在
return R.error("账号不存在");
}
// 将用户密码重置为默认值123456
user.setPassword("123456");
// 更新用户信息到数据库第二个参数为null可能表示更新时不设置额外的条件
usersService.update(user, null);
// 返回成功响应,并附带密码已重置的提示信息
return R.ok("密码已重置为123456");
}
/**
*
* @param params Map
* @param user
* @return R
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params, UsersEntity user) {
// 创建一个EntityWrapper对象用于构建查询条件
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
// 调用usersService的queryPage方法进行分页查询MPUtil.sort等方法用于处理查询条件和排序
PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
// 返回成功响应,并将分页结果数据放入响应中
return R.ok().put("data", page);
}
public R resetPass(String username, HttpServletRequest request){
UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
if(user==null) {
return R.error("账号不存在");
}
user.setPassword("123456");
usersService.update(user,null);
return R.ok("密码已重置为123456");
}
/**
*
* @param user
* @return R
*/
@RequestMapping("/list")
public R list(UsersEntity user) {
// 创建一个EntityWrapper对象
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
// 根据用户实体对象构建查询条件使用MPUtil.allEQMapPre方法设置相等条件
ew.allEq(MPUtil.allEQMapPre(user, "user"));
// 调用usersService的selectListView方法查询用户列表并将结果放入响应中返回
return R.ok().put("data", usersService.selectListView(ew));
}
*
*/
@RequestMapping("/page")
public R page(@RequestParam Map<String, Object> params,UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
return R.ok().put("data", page);
}
/**
*
* @param id ID
* @return R
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id) {
// 根据用户ID查询用户实体
UsersEntity user = usersService.selectById(id);
// 返回成功响应,并将用户信息放入响应中
return R.ok().put("data", user);
}
/**
*
* @param request HTTP
* @return R
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request) {
// 从当前会话中获取用户ID
Integer id = (Integer) request.getSession().getAttribute("userId");
// 根据用户ID查询用户实体
UsersEntity user = usersService.selectById(id);
// 返回成功响应,并将用户信息放入响应中
return R.ok().put("data", user);
}
/**
*
* @param user
* @return R
*/
@PostMapping("/save")
public R save(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户名查询数据库,判断用户是否已经存在
if (usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) != null) {
// 如果用户已存在,返回错误响应
return R.error("用户已存在");
}
// 设置用户密码为默认值123456
user.setPassword("123456");
// 将用户插入到数据库中
usersService.insert(user);
// 返回成功响应
return R.ok();
}
/**
*
* @param user
* @return R
*/
@RequestMapping("/update")
public R update(@RequestBody UsersEntity user) {
// ValidatorUtils.validateEntity(user); // 被注释掉的代码,可能用于验证用户实体的合法性,目前未启用
// 根据用户ID更新用户信息到数据库
usersService.updateById(user); // 全部更新
// 返回成功响应
return R.ok();
}
/**
*
* @param ids ID
* @return R
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids) {
// 根据用户ID数组批量删除用户
usersService.deleteBatchIds(Arrays.asList(ids));
// 返回成功响应
return R.ok();
}
}
*
*/
@RequestMapping("/list")
public R list( UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", usersService.selectListView(ew));
}
/**
*
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UsersEntity user = usersService.selectById(id);
return R.ok().put("data", user);
}
/**
* session
*/
@RequestMapping("/session")
public R getCurrUser(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
UsersEntity user = usersService.selectById(id);
return R.ok().put("data", user);
}
/**
*
*/
@PostMapping("/save")
public R save(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
user.setPassword("123456");
usersService.insert(user);
return R.ok();
}
/**
*
*/
@RequestMapping("/update")
public R update(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
usersService.updateById(user);//全部更新
return R.ok();
}
/**
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
usersService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}

@ -36,307 +36,278 @@ import com.alibaba.fastjson.*;
*
* @author
* @email
*/
*/
@RestController
// 声明为Spring MVC控制器
@Controller
// 定义请求映射路径,所有以/yisheng开头的请求由该控制器处理
@RequestMapping("/yisheng")
public class YishengController {
// 日志记录器,用于记录当前控制器的日志信息
private static final Logger logger = LoggerFactory.getLogger(YishengController.class);
// 自动注入医生服务类,用于处理医生相关业务逻辑
@Autowired
private YishengService yishengService;
private YishengService yishengService; // 医生服务
@Autowired
private TokenService tokenService;
private TokenService tokenService; // token服务
@Autowired
private DictionaryService dictionaryService;
private DictionaryService dictionaryService; // 字典服务
//级联表service
// 级联表service自动注入用户服务类
@Autowired
private YonghuService yonghuService;
private YonghuService yonghuService; // 用户服务
/**
*
*/
*
*/
@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"));
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("yonghuId",request.getSession().getAttribute("userId")); // 如果是用户角色添加用户ID参数
else if("医生".equals(role))
params.put("yishengId",request.getSession().getAttribute("userId"));
params.put("yishengId",request.getSession().getAttribute("userId")); // 如果是医生角色添加医生ID参数
if(params.get("orderBy")==null || params.get("orderBy")==""){
params.put("orderBy","id");
params.put("orderBy","id"); // 默认按ID排序
}
PageUtils page = yishengService.queryPage(params);
PageUtils page = yishengService.queryPage(params); // 分页查询
//字典表数据转换
List<YishengView> list =(List<YishengView>)page.getList();
for(YishengView c:list){
//修改对应字典表字段
dictionaryService.dictionaryConvert(c, request);
dictionaryService.dictionaryConvert(c, request); // 转换字典字段
}
return R.ok().put("data", page);
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);
YishengEntity yisheng = yishengService.selectById(id);
YishengEntity yisheng = yishengService.selectById(id); // 根据ID查询医生
if(yisheng !=null){
//entity转view
YishengView view = new YishengView();
BeanUtils.copyProperties( yisheng , view );//把实体数据重构到view中
BeanUtils.copyProperties( yisheng , view ); // 把实体数据重构到view中
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
dictionaryService.dictionaryConvert(view, request); // 转换字典字段
return R.ok().put("data", view); // 返回医生详情
}else {
return R.error(511,"查不到数据");
return R.error(511,"查不到数据"); // 查询不到返回错误
}
}
/**
*
*/
*
*/
@RequestMapping("/save")
public R save(@RequestBody YishengEntity yisheng, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要保存的医生实体信息
logger.debug("save方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString());
public R save(@RequestBody YishengEntity yisheng, HttpServletRequest request){
logger.debug("save方法:,,Controller:{},,yisheng:{}",this.getClass().getName(),yisheng.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
String role = String.valueOf(request.getSession().getAttribute("role")); // 获取用户角色
if(false)
return R.error(511,"永远不会进入");
// 构建查询条件:用户名或手机号
Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>()
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone());
logger.info("sql语句:"+queryWrapper.getSqlSegment());
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper);
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper); // 查询是否已存在
if(yishengEntity==null){
yisheng.setCreateTime(new Date());
yisheng.setPassword("123456");
yishengService.insert(yisheng);
return R.ok();
yisheng.setCreateTime(new Date()); // 设置创建时间
yisheng.setPassword("123456"); // 设置默认密码
yishengService.insert(yisheng); // 插入新医生数据
return R.ok(); // 返回成功
}else {
return R.error(511,"账户或者联系方式已经被使用");
return R.error(511,"账户或者联系方式已经被使用"); // 已存在返回错误
}
}
/**
*
*/
*
*/
@RequestMapping("/update")
public R update(@RequestBody YishengEntity yisheng, HttpServletRequest request) {
// 记录方法调用日志,包含控制器类名和要更新的医生实体信息
logger.debug("update方法:,,Controller:{},,yisheng:{}", this.getClass().getName(), yisheng.toString());
String role = String.valueOf(request.getSession().getAttribute("role"));
// if(false)
// return R.error(511,"永远不会进入");
//根据字段查询是否有相同数据
public R update(@RequestBody YishengEntity yisheng, HttpServletRequest request){
logger.debug("update方法:,,Controller:{},,yisheng:{}",this.getClass().getName(),yisheng.toString());
String role = String.valueOf(request.getSession().getAttribute("role")); // 获取用户角色
// 构建查询条件排除当前ID查询用户名或手机号是否已被其他记录使用
Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>()
.notIn("id",yisheng.getId())
.andNew()
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone())
;
.notIn("id",yisheng.getId())
.andNew()
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone());
logger.info("sql语句:"+queryWrapper.getSqlSegment());
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper);
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper); // 查询是否冲突
if("".equals(yisheng.getYishengPhoto()) || "null".equals(yisheng.getYishengPhoto())){
yisheng.setYishengPhoto(null);
yisheng.setYishengPhoto(null); // 处理空照片
}
if(yishengEntity==null){
yishengService.updateById(yisheng);//根据id更新
return R.ok();
yishengService.updateById(yisheng); // 根据id更新
return R.ok(); // 返回成功
}else {
return R.error(511,"账户或者联系方式已经被使用");
return R.error(511,"账户或者联系方式已经被使用"); // 冲突返回错误
}
}
/**
*
*/
*
*/
@RequestMapping("/delete")
public R delete(@RequestBody Integer[] ids){
logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
yishengService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
yishengService.deleteBatchIds(Arrays.asList(ids)); // 批量删除
return R.ok(); // 返回成功
}
/**
*
*
*/
@RequestMapping("/batchInsert")
public R save(String fileName) {
// 记录方法调用日志,包含控制器类名和文件名
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}", this.getClass().getName(), fileName);
public R save( String fileName){
logger.debug("batchInsert方法:,,Controller:{},,fileName:{}",this.getClass().getName(),fileName);
try {
List<YishengEntity> yishengList = new ArrayList<>();//上传的东西
Map<String, List<String>> seachFields= new HashMap<>();//要查询的字段
List<YishengEntity> yishengList = new ArrayList<>(); // 上传的数据列表
Map<String, List<String>> seachFields= new HashMap<>(); // 要查询的字段
Date date = new Date();
// 获取文件名中最后一个点的索引
int lastIndexOf = fileName.lastIndexOf(".");
if(lastIndexOf == -1){
return R.error(511,"该文件没有后缀");
return R.error(511,"该文件没有后缀"); // 文件后缀检查
}else{
String suffix = fileName.substring(lastIndexOf);
if(!".xls".equals(suffix)){
return R.error(511,"只支持后缀为xls的excel文件");
return R.error(511,"只支持后缀为xls的excel文件"); // 文件格式检查
}else{
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName);//获取文件路径
URL resource = this.getClass().getClassLoader().getResource("static/upload/" + fileName); // 获取文件路径
File file = new File(resource.getFile());
if(!file.exists()){
return R.error(511,"找不到上传文件,请联系管理员");
return R.error(511,"找不到上传文件,请联系管理员"); // 文件存在检查
}else{
List<List<String>> dataList = PoiUtil.poiImport(file.getPath());//读取xls文件
dataList.remove(0);//删除第一行,因为第一行是提示
List<List<String>> dataList = PoiUtil.poiImport(file.getPath()); // 读取xls文件
dataList.remove(0); // 删除第一行提示
for(List<String> data:dataList){
//循环
//循环处理每行数据
YishengEntity yishengEntity = new YishengEntity();
// yishengEntity.setYishengUuidNumber(data.get(0)); //医生工号 要改的
// yishengEntity.setUsername(data.get(0)); //账户 要改的
// //yishengEntity.setPassword("123456");//密码
// yishengEntity.setYishengName(data.get(0)); //医生名称 要改的
// yishengEntity.setYishengTypes(Integer.valueOf(data.get(0))); //科室 要改的
// yishengEntity.setZhiweiTypes(Integer.valueOf(data.get(0))); //职位 要改的
// yishengEntity.setYishengZhichneg(data.get(0)); //职称 要改的
// yishengEntity.setYishengPhoto("");//照片
// yishengEntity.setYishengPhone(data.get(0)); //联系方式 要改的
// yishengEntity.setYishengGuahao(data.get(0)); //挂号须知 要改的
// yishengEntity.setYishengEmail(data.get(0)); //邮箱 要改的
// yishengEntity.setYishengNewMoney(data.get(0)); //挂号价格 要改的
// yishengEntity.setYishengContent("");//照片
// yishengEntity.setCreateTime(date);//时间
yishengList.add(yishengEntity);
//把要查询是否重复的字段放入map中
//医生工号
if(seachFields.containsKey("yishengUuidNumber")){
List<String> yishengUuidNumber = seachFields.get("yishengUuidNumber");
yishengUuidNumber.add(data.get(0));//要改的
}else{
List<String> yishengUuidNumber = new ArrayList<>();
yishengUuidNumber.add(data.get(0));//要改的
seachFields.put("yishengUuidNumber",yishengUuidNumber);
}
//账户
if(seachFields.containsKey("username")){
List<String> username = seachFields.get("username");
username.add(data.get(0));//要改的
}else{
List<String> username = new ArrayList<>();
username.add(data.get(0));//要改的
seachFields.put("username",username);
}
//联系方式
if(seachFields.containsKey("yishengPhone")){
List<String> yishengPhone = seachFields.get("yishengPhone");
yishengPhone.add(data.get(0));//要改的
}else{
List<String> yishengPhone = new ArrayList<>();
yishengPhone.add(data.get(0));//要改的
seachFields.put("yishengPhone",yishengPhone);
}
// 这里注释掉的代码是字段映射示例实际使用时需要根据Excel列对应关系修改
yishengList.add(yishengEntity); // 添加到列表
// 把要查询是否重复的字段放入map中
// 医生工号
if(seachFields.containsKey("yishengUuidNumber")){
List<String> yishengUuidNumber = seachFields.get("yishengUuidNumber");
yishengUuidNumber.add(data.get(0)); // 要改的
}else{
List<String> yishengUuidNumber = new ArrayList<>();
yishengUuidNumber.add(data.get(0)); // 要改的
seachFields.put("yishengUuidNumber",yishengUuidNumber);
}
// 账户
if(seachFields.containsKey("username")){
List<String> username = seachFields.get("username");
username.add(data.get(0)); // 要改的
}else{
List<String> username = new ArrayList<>();
username.add(data.get(0)); // 要改的
seachFields.put("username",username);
}
// 联系方式
if(seachFields.containsKey("yishengPhone")){
List<String> yishengPhone = seachFields.get("yishengPhone");
yishengPhone.add(data.get(0)); // 要改的
}else{
List<String> yishengPhone = new ArrayList<>();
yishengPhone.add(data.get(0)); // 要改的
seachFields.put("yishengPhone",yishengPhone);
}
}
//查询是否重复
//医生工号
// 查询是否重复
// 医生工号
List<YishengEntity> yishengEntities_yishengUuidNumber = yishengService.selectList(new EntityWrapper<YishengEntity>().in("yisheng_uuid_number", seachFields.get("yishengUuidNumber")));
if (yishengEntities_yishengUuidNumber.size() > 0) {
if(yishengEntities_yishengUuidNumber.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for (YishengEntity s : yishengEntities_yishengUuidNumber) {
for(YishengEntity s:yishengEntities_yishengUuidNumber){
repeatFields.add(s.getYishengUuidNumber());
}
return R.error(511, "数据库的该表中的 [医生工号] 字段已经存在 存在数据为:" + repeatFields.toString());
return R.error(511,"数据库的该表中的 [医生工号] 字段已经存在 存在数据为:"+repeatFields.toString());
}
// 账户
List<YishengEntity> yishengEntities_username = yishengService.selectList(new EntityWrapper<YishengEntity>().in("username", seachFields.get("username")));
if (yishengEntities_username.size() > 0) {
if(yishengEntities_username.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for (YishengEntity s : yishengEntities_username) {
for(YishengEntity s:yishengEntities_username){
repeatFields.add(s.getUsername());
}
return R.error(511, "数据库的该表中的 [账户] 字段已经存在 存在数据为:" + repeatFields.toString());
return R.error(511,"数据库的该表中的 [账户] 字段已经存在 存在数据为:"+repeatFields.toString());
}
// 联系方式
List<YishengEntity> yishengEntities_yishengPhone = yishengService.selectList(new EntityWrapper<YishengEntity>().in("yisheng_phone", seachFields.get("yishengPhone")));
if (yishengEntities_yishengPhone.size() > 0) {
if(yishengEntities_yishengPhone.size() >0 ){
ArrayList<String> repeatFields = new ArrayList<>();
for (YishengEntity s : yishengEntities_yishengPhone) {
for(YishengEntity s:yishengEntities_yishengPhone){
repeatFields.add(s.getYishengPhone());
}
return R.error(511, "数据库的该表中的 [联系方式] 字段已经存在 存在数据为:" + repeatFields.toString());
return R.error(511,"数据库的该表中的 [联系方式] 字段已经存在 存在数据为:"+repeatFields.toString());
}
yishengService.insertBatch(yishengList);
yishengService.insertBatch(yishengList); // 批量插入
return R.ok();
}
}
}
}catch (Exception e){
return R.error(511,"批量插入数据异常,请联系管理员");
return R.error(511,"批量插入数据异常,请联系管理员"); // 异常处理
}
}
/**
*
*/
*
*/
@IgnoreAuth
@RequestMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
YishengEntity yisheng = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("username", username));
YishengEntity yisheng = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("username", username)); // 根据用户名查询
if(yisheng==null || !yisheng.getPassword().equals(password))
return R.error("账号或密码不正确");
// // 获取监听器中的字典表
// ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext();
// Map<String, Map<Integer, String>> dictionaryMap= (Map<String, Map<Integer, String>>) servletContext.getAttribute("dictionaryMap");
// Map<Integer, String> role_types = dictionaryMap.get("role_types");
// role_types.get(.getRoleTypes());
String token = tokenService.generateToken(yisheng.getId(),username, "yisheng", "医生");
return R.error("账号或密码不正确"); // 验证账号密码
String token = tokenService.generateToken(yisheng.getId(),username, "yisheng", "医生"); // 生成token
R r = R.ok();
r.put("token", token);
r.put("role","医生");
r.put("username",yisheng.getYishengName());
r.put("tableName","yisheng");
r.put("userId",yisheng.getId());
r.put("token", token); // 返回token
r.put("role","医生"); // 返回角色
r.put("username",yisheng.getYishengName()); // 返回医生姓名
r.put("tableName","yisheng"); // 返回表名
r.put("userId",yisheng.getId()); // 返回用户ID
return r;
}
/**
*
*/
*
*/
@IgnoreAuth
@PostMapping(value = "/register")
public R register(@RequestBody YishengEntity yisheng){
// ValidatorUtils.validateEntity(user);
// 构建查询条件:用户名或手机号
Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>()
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone())
;
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper);
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone());
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper); // 查询是否已存在
if(yishengEntity != null)
return R.error("账户或者联系方式已经被使用");
yisheng.setYishengNewMoney(0.0);
yisheng.setCreateTime(new Date());
yishengService.insert(yisheng);
return R.ok();
return R.error("账户或者联系方式已经被使用"); // 已存在返回错误
yisheng.setYishengNewMoney(0.0); // 设置初始金额
yisheng.setCreateTime(new Date()); // 设置创建时间
yishengService.insert(yisheng); // 插入新医生
return R.ok(); // 返回成功
}
/**
@ -345,69 +316,63 @@ public class YishengController {
@GetMapping(value = "/resetPassword")
public R resetPassword(Integer id){
YishengEntity yisheng = new YishengEntity();
yisheng.setPassword("123456");
yisheng.setPassword("123456"); // 重置为默认密码
yisheng.setId(id);
yishengService.updateById(yisheng);
return R.ok();
yishengService.updateById(yisheng); // 更新密码
return R.ok(); // 返回成功
}
/**
*
*/
@IgnoreAuth
@RequestMapping(value = "/resetPass")
public R resetPass(String username, HttpServletRequest request) {
YishengEntity yisheng = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("username", username));
YishengEntity yisheng = yishengService.selectOne(new EntityWrapper<YishengEntity>().eq("username", username)); // 根据用户名查询
if(yisheng!=null){
yisheng.setPassword("123456");
boolean b = yishengService.updateById(yisheng);
yisheng.setPassword("123456"); // 重置为默认密码
boolean b = yishengService.updateById(yisheng); // 更新密码
if(!b){
return R.error();
return R.error(); // 更新失败
}
}else{
return R.error("账号不存在");
return R.error("账号不存在"); // 账号不存在
}
return R.ok();
return R.ok(); // 返回成功
}
/**
* session
*/
* session
*/
@RequestMapping("/session")
public R getCurrYisheng(HttpServletRequest request){
Integer id = (Integer)request.getSession().getAttribute("userId");
YishengEntity yisheng = yishengService.selectById(id);
Integer id = (Integer)request.getSession().getAttribute("userId"); // 获取session中的用户ID
YishengEntity yisheng = yishengService.selectById(id); // 查询用户信息
if(yisheng !=null){
//entity转view
YishengView view = new YishengView();
BeanUtils.copyProperties( yisheng , view );//把实体数据重构到view中
BeanUtils.copyProperties( yisheng , view ); // 复制属性到view
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
dictionaryService.dictionaryConvert(view, request); // 转换字典字段
return R.ok().put("data", view); // 返回用户信息
}else {
return R.error(511,"查不到数据");
return R.error(511,"查不到数据"); // 查询不到返回错误
}
}
/**
* 退
*/
* 退
*/
@GetMapping(value = "logout")
public R logout(HttpServletRequest request) {
request.getSession().invalidate();
return R.ok("退出成功");
request.getSession().invalidate(); // 使session失效
return R.ok("退出成功"); // 返回退出成功
}
/**
*
*/
*
*/
@IgnoreAuth
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
@ -417,60 +382,55 @@ public class YishengController {
if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
params.put("orderBy","id");
}
PageUtils page = yishengService.queryPage(params);
PageUtils page = yishengService.queryPage(params); // 分页查询
//字典表数据转换
List<YishengView> list =(List<YishengView>)page.getList();
for(YishengView c:list)
dictionaryService.dictionaryConvert(c, request); //修改对应字典表字段
return R.ok().put("data", page);
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);
YishengEntity yisheng = yishengService.selectById(id);
if(yisheng !=null){
//entity转view
YishengView view = new YishengView();
BeanUtils.copyProperties( yisheng , view );//把实体数据重构到view中
YishengEntity yisheng = yishengService.selectById(id); // 根据ID查询
if(yisheng !=null){
//entity转view
YishengView view = new YishengView();
BeanUtils.copyProperties( yisheng , view ); // 复制属性到view
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request);
return R.ok().put("data", view);
}else {
return R.error(511,"查不到数据");
}
//修改对应字典表字段
dictionaryService.dictionaryConvert(view, request); // 转换字典字段
return R.ok().put("data", view); // 返回详情
}else {
return R.error(511,"查不到数据"); // 查询不到返回错误
}
}
/**
*
*/
*
*/
@RequestMapping("/add")
public R add(@RequestBody YishengEntity yisheng, HttpServletRequest request){
logger.debug("add方法:,,Controller:{},,yisheng:{}",this.getClass().getName(),yisheng.toString());
// 构建查询条件:用户名或手机号
Wrapper<YishengEntity> queryWrapper = new EntityWrapper<YishengEntity>()
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone())
;
.eq("username", yisheng.getUsername())
.or()
.eq("yisheng_phone", yisheng.getYishengPhone());
logger.info("sql语句:"+queryWrapper.getSqlSegment());
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper);
YishengEntity yishengEntity = yishengService.selectOne(queryWrapper); // 查询是否已存在
if(yishengEntity==null){
yisheng.setCreateTime(new Date());
yisheng.setPassword("123456");
yishengService.insert(yisheng);
return R.ok();
yisheng.setCreateTime(new Date()); // 设置创建时间
yisheng.setPassword("123456"); // 设置默认密码
yishengService.insert(yisheng); // 插入新医生
return R.ok(); // 返回成功
}else {
return R.error(511,"账户或者联系方式已经被使用");
return R.error(511,"账户或者联系方式已经被使用"); // 已存在返回错误
}
}
}
}

@ -1,3 +1,4 @@
package com.controller;
import java.io.File;
@ -50,7 +51,7 @@ public class YonghuController {
@Autowired
private TokenService tokenService;
@Autowired
private DictionaryService dictionaryService; // 字典服务
private DictionaryService dictionaryService;
//级联表service
@ -104,6 +105,7 @@ public class YonghuController {
}else {
return R.error(511,"查不到数据");
}
}
/**
@ -195,6 +197,7 @@ public class YonghuController {
return R.ok();
}
/**
*
*/
@ -305,6 +308,7 @@ public class YonghuController {
}
}
/**
*
*/

@ -9,10 +9,10 @@ import com.baomidou.mybatisplus.plugins.pagination.Pagination;
import org.apache.ibatis.annotations.Param;
import com.entity.view.YonghuView;
/*
* Dao
* @author
/**
* Dao
*
* @author
*/
public interface YonghuDao extends BaseMapper<YonghuEntity> {

@ -1,310 +1,277 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解,确保字段不为空字符串
import javax.validation.constraints.NotBlank;
// 导入 JSR 303 验证注解,确保集合或数组不为空
import javax.validation.constraints.NotEmpty;
// 导入 JSR 303 验证注解,确保字段不为 null
import javax.validation.constraints.NotNull;
// 导入 Jackson 注解,用于忽略 JSON 序列化和反序列化时的某些属性
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表集合类
import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
* 线
*
* @author
* @author
* @email
*/
// 指定该类对应数据库中的 chat 表
@TableName("chat")
// 实现 Serializable 接口,使该类的对象可以进行序列化和反序列化操作
public class ChatEntity<T> implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,方便创建 ChatEntity 类的实例
public ChatEntity() {
}
public ChatEntity() {
}
public ChatEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 带参构造函数,接收一个泛型对象 t将其属性复制到当前 ChatEntity 对象
public ChatEntity(T t) {
try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*/
// 指定该字段为主键,且主键生成策略为自增
@TableId(type = IdType.AUTO)
// 指定该字段对应数据库表中的 id 字段
@TableField(value = "id")
// 主键,用于唯一标识一条在线咨询记录
private Integer id;
/**
*
*/
// 指定该字段对应数据库表中的 yonghu_id 字段
@TableField(value = "yonghu_id")
// 提问用户的 ID关联用户表
private Integer yonghuId;
/**
*
*/
// 指定该字段对应数据库表中的 chat_issue 字段
@TableField(value = "chat_issue")
// 用户提出的问题内容
private String chatIssue;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 指定该字段对应数据库表中的 issue_time 字段
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "issue_time")
// 用户提出问题的时间
private Date issueTime;
/**
*
*/
// 指定该字段对应数据库表中的 chat_reply 字段
@TableField(value = "chat_reply")
// 针对用户问题的回复内容
private String chatReply;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 指定该字段对应数据库表中的 reply_time 字段
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "reply_time")
// 回复用户问题的时间
private Date replyTime;
/**
*
*/
// 指定该字段对应数据库表中的 zhuangtai_types 字段
@TableField(value = "zhuangtai_types")
// 在线咨询的状态,可能用整数表示不同状态,如 0 表示待回复1 表示已回复等
private Integer zhuangtaiTypes;
/**
*
*/
// 指定该字段对应数据库表中的 chat_types 字段
@TableField(value = "chat_types")
// 在线咨询的数据类型,可能用整数表示不同类型,如 1 表示文字咨询2 表示图片咨询等
private Integer chatTypes;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 指定该字段对应数据库表中的 insert_time 字段,且在插入数据时自动填充
@TableField(value = "insert_time", fill = FieldFill.INSERT)
// 该条在线咨询记录的创建时间
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "insert_time",fill = FieldFill.INSERT)
private Date insertTime;
/**
*
*/
// 获取主键的方法
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键的方法
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取提问用户 ID 的方法
*
*/
public Integer getYonghuId() {
return yonghuId;
}
/**
*
*/
// 设置提问用户 ID 的方法
*
*/
public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId;
}
/**
*
*/
// 获取问题内容的方法
*
*/
public String getChatIssue() {
return chatIssue;
}
/**
*
*/
// 设置问题内容的方法
*
*/
public void setChatIssue(String chatIssue) {
this.chatIssue = chatIssue;
}
/**
*
*/
// 获取问题时间的方法
*
*/
public Date getIssueTime() {
return issueTime;
}
/**
*
*/
// 设置问题时间的方法
*
*/
public void setIssueTime(Date issueTime) {
this.issueTime = issueTime;
}
/**
*
*/
// 获取回复内容的方法
*
*/
public String getChatReply() {
return chatReply;
}
/**
*
*/
// 设置回复内容的方法
*
*/
public void setChatReply(String chatReply) {
this.chatReply = chatReply;
}
/**
*
*/
// 获取回复时间的方法
*
*/
public Date getReplyTime() {
return replyTime;
}
/**
*
*/
// 设置回复时间的方法
*
*/
public void setReplyTime(Date replyTime) {
this.replyTime = replyTime;
}
/**
*
*/
// 获取状态的方法
*
*/
public Integer getZhuangtaiTypes() {
return zhuangtaiTypes;
}
/**
*
*/
// 设置状态的方法
*
*/
public void setZhuangtaiTypes(Integer zhuangtaiTypes) {
this.zhuangtaiTypes = zhuangtaiTypes;
}
/**
*
*/
// 获取数据类型的方法
*
*/
public Integer getChatTypes() {
return chatTypes;
}
/**
*
*/
// 设置数据类型的方法
*
*/
public void setChatTypes(Integer chatTypes) {
this.chatTypes = chatTypes;
}
/**
*
*/
// 获取创建时间的方法
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置创建时间的方法
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
// 重写 toString 方法,方便打印对象信息
@Override
public String toString() {
return "Chat{" +
"id=" + id +
", yonghuId=" + yonghuId +
", chatIssue=" + chatIssue +
", issueTime=" + issueTime +
", chatReply=" + chatReply +
", replyTime=" + replyTime +
", zhuangtaiTypes=" + zhuangtaiTypes +
", chatTypes=" + chatTypes +
", insertTime=" + insertTime +
"}";
"id=" + id +
", yonghuId=" + yonghuId +
", chatIssue=" + chatIssue +
", issueTime=" + issueTime +
", chatReply=" + chatReply +
", replyTime=" + replyTime +
", zhuangtaiTypes=" + zhuangtaiTypes +
", chatTypes=" + chatTypes +
", insertTime=" + insertTime +
"}";
}
}
}

@ -7,21 +7,22 @@ import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
/**
* @author yangliyuan
* @version 202027 8:36:05
* :
*/
* @author yangliyuan
* @version 202027 8:36:05
* :
*/
@TableName("config")
public class ConfigEntity implements Serializable{
// 定义主键字段
private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
private Long id;
/**
* name
* key
*/
private String name;
/**
* value
*/
@ -50,4 +51,5 @@ public class ConfigEntity implements Serializable{
public void setValue(String value) {
this.value = value;
}
}
}

@ -1,276 +1,249 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @author
* @email
*/
// 使用 TableName 注解指定该类对应的数据库表名为 "dictionary"
@TableName("dictionary")
// 定义泛型类 DictionaryEntity实现 Serializable 接口,以便对象可以进行序列化和反序列化
public class DictionaryEntity<T> implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 DictionaryEntity 对象
public DictionaryEntity() {
}
public DictionaryEntity() {
}
public DictionaryEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 DictionaryEntity 对象中
public DictionaryEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*/
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id")
// 存储字典表记录的主键值,用于唯一标识一条记录
private Integer id;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "dic_code"
@TableField(value = "dic_code")
// 存储字典表中的字段代码,可能用于标识不同的字典项类别等
private String dicCode;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "dic_name"
@TableField(value = "dic_name")
// 存储字典表中字段的名称,与 dicCode 对应,提供更易读的名称标识
private String dicName;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "code_index"
@TableField(value = "code_index")
// 存储字典表中某一字典项的编码值,可能用于内部编码或排序等用途
private Integer codeIndex;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "index_name"
@TableField(value = "index_name")
// 存储编码对应的名称,与 codeIndex 对应,提供更详细的编码描述
private String indexName;
/**
* id
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "super_id"
@TableField(value = "super_id")
// 存储当前字典项的父字段 ID用于表示字典项之间的层级关系
private Integer superId;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "beizhu"
@TableField(value = "beizhu")
// 存储关于当前字典项的备注信息,用于记录额外的说明或注意事项
private String beizhu;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储字典表记录的创建时间,用于记录数据的创建时间戳
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
// 获取主键值的方法,外部可以通过调用该方法获取 id 字段的值
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键值的方法,外部可以通过调用该方法设置 id 字段的值
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取字段代码值的方法,外部可以通过调用该方法获取 dicCode 字段的值
*
*/
public String getDicCode() {
return dicCode;
}
/**
*
*/
// 设置字段代码值的方法,外部可以通过调用该方法设置 dicCode 字段的值
*
*/
public void setDicCode(String dicCode) {
this.dicCode = dicCode;
}
/**
*
*/
// 获取字段名称值的方法,外部可以通过调用该方法获取 dicName 字段的值
*
*/
public String getDicName() {
return dicName;
}
/**
*
*/
// 设置字段名称值的方法,外部可以通过调用该方法设置 dicName 字段的值
*
*/
public void setDicName(String dicName) {
this.dicName = dicName;
}
/**
*
*/
// 获取编码值的方法,外部可以通过调用该方法获取 codeIndex 字段的值
*
*/
public Integer getCodeIndex() {
return codeIndex;
}
/**
*
*/
// 设置编码值的方法,外部可以通过调用该方法设置 codeIndex 字段的值
*
*/
public void setCodeIndex(Integer codeIndex) {
this.codeIndex = codeIndex;
}
/**
*
*/
// 获取编码名称值的方法,外部可以通过调用该方法获取 indexName 字段的值
*
*/
public String getIndexName() {
return indexName;
}
/**
*
*/
// 设置编码名称值的方法,外部可以通过调用该方法设置 indexName 字段的值
*
*/
public void setIndexName(String indexName) {
this.indexName = indexName;
}
/**
* id
*/
// 获取父字段 ID 值的方法,外部可以通过调用该方法获取 superId 字段的值
* id
*/
public Integer getSuperId() {
return superId;
}
/**
* id
*/
// 设置父字段 ID 值的方法,外部可以通过调用该方法设置 superId 字段的值
* id
*/
public void setSuperId(Integer superId) {
this.superId = superId;
}
/**
*
*/
// 获取备注信息值的方法,外部可以通过调用该方法获取 beizhu 字段的值
*
*/
public String getBeizhu() {
return beizhu;
}
/**
*
*/
// 设置备注信息值的方法,外部可以通过调用该方法设置 beizhu 字段的值
*
*/
public void setBeizhu(String beizhu) {
this.beizhu = beizhu;
}
/**
*
*/
// 获取创建时间值的方法,外部可以通过调用该方法获取 createTime 字段的值
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 设置创建时间值的方法,外部可以通过调用该方法设置 createTime 字段的值
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override
public String toString() {
return "Dictionary{" +
"id=" + id +
", dicCode=" + dicCode +
", dicName=" + dicName +
", codeIndex=" + codeIndex +
", indexName=" + indexName +
", superId=" + superId +
", beizhu=" + beizhu +
", createTime=" + createTime +
"}";
}
}
"id=" + id +
", dicCode=" + dicCode +
", dicName=" + dicName +
", codeIndex=" + codeIndex +
", indexName=" + indexName +
", superId=" + superId +
", beizhu=" + beizhu +
", createTime=" + createTime +
"}";
}
}

@ -1,64 +1,52 @@
package com.entity;
/**
*
*/
// 定义一个名为EIException的类它继承自RuntimeException表明这是一个运行时异常类
public class EIException extends RuntimeException {
// 定义序列化版本号,用于在序列化和反序列化过程中确保兼容性
private static final long serialVersionUID = 1L;
// 用于存储异常的详细信息,描述异常发生的情况
private String msg;
// 用于存储异常的状态码默认值为500通常表示服务器内部错误
private int code = 500;
// 构造函数接受一个字符串参数msg将其设置为异常信息并调用父类的构造函数传递异常信息
public EIException(String msg) {
private String msg;
private int code = 500;
public EIException(String msg) {
super(msg);
this.msg = msg;
}
// 构造函数接受一个字符串参数msg和一个Throwable对象e
// 将msg设置为异常信息调用父类的构造函数传递异常信息和异常原因
public EIException(String msg, Throwable e) {
super(msg, e);
this.msg = msg;
}
// 构造函数接受一个字符串参数msg和一个整数参数code
// 将msg设置为异常信息code设置为异常状态码并调用父类的构造函数传递异常信息
public EIException(String msg, int code) {
super(msg);
this.msg = msg;
this.code = code;
}
// 构造函数接受一个字符串参数msg、一个整数参数code和一个Throwable对象e
// 将msg设置为异常信息code设置为异常状态码调用父类的构造函数传递异常信息和异常原因
public EIException(String msg, int code, Throwable e) {
super(msg, e);
this.msg = msg;
this.code = code;
}
// 获取异常信息的方法,返回存储的异常信息字符串
public String getMsg() {
return msg;
}
// 设置异常信息的方法,将传入的字符串设置为新的异常信息
public void setMsg(String msg) {
this.msg = msg;
}
// 获取异常状态码的方法,返回存储的异常状态码
public int getCode() {
return code;
}
// 设置异常状态码的方法,将传入的整数设置为新的异常状态码
public void setCode(int code) {
this.code = code;
}
}
}

@ -1,330 +1,299 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @author
* @email
*/
// 使用 TableName 注解指定该类对应的数据库表名为 "guahao"
@TableName("guahao")
// 定义泛型类 GuahaoEntity实现 Serializable 接口,以便对象可以进行序列化和反序列化
public class GuahaoEntity<T> implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 GuahaoEntity 对象
public GuahaoEntity() {
}
public GuahaoEntity() {
}
public GuahaoEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 GuahaoEntity 对象中
public GuahaoEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*/
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id")
// 存储挂号记录的主键值,用于唯一标识一条挂号记录
private Integer id;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "yisheng_id"
@TableField(value = "yisheng_id")
// 存储挂号对应的医生 ID关联医生表
private Integer yishengId;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "yonghu_id"
@TableField(value = "yonghu_id")
// 存储挂号的用户 ID关联用户表
private Integer yonghuId;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_uuin_number"
@TableField(value = "guahao_uuin_number")
// 存储就诊的唯一识别码,用于标识具体的就诊记录
private String guahaoUuinNumber;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_time"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd")
@DateTimeFormat
@TableField(value = "guahao_time")
// 存储挂号的具体时间
private Date guahaoTime;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_types"
@TableField(value = "guahao_types")
// 存储挂号的时间类型,可能表示上午、下午、晚上等不同时间段,用整数标识
private Integer guahaoTypes;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_status_types"
@TableField(value = "guahao_status_types")
// 存储挂号的状态,例如已挂号、已取消、已就诊等,用整数标识不同状态
private Integer guahaoStatusTypes;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_yesno_types"
@TableField(value = "guahao_yesno_types")
// 存储挂号审核的结果,可能表示通过、不通过等,用整数标识
private Integer guahaoYesnoTypes;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "guahao_yesno_text"
@TableField(value = "guahao_yesno_text")
// 存储挂号审核结果的具体文本描述,例如不通过的原因等
private String guahaoYesnoText;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储挂号记录的创建时间,用于记录数据的创建时间戳
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
// 获取主键值的方法,外部可以通过调用该方法获取 id 字段的值
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键值的方法,外部可以通过调用该方法设置 id 字段的值
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取医生 ID 值的方法,外部可以通过调用该方法获取 yishengId 字段的值
*
*/
public Integer getYishengId() {
return yishengId;
}
/**
*
*/
// 设置医生 ID 值的方法,外部可以通过调用该方法设置 yishengId 字段的值
*
*/
public void setYishengId(Integer yishengId) {
this.yishengId = yishengId;
}
/**
*
*/
// 获取用户 ID 值的方法,外部可以通过调用该方法获取 yonghuId 字段的值
*
*/
public Integer getYonghuId() {
return yonghuId;
}
/**
*
*/
// 设置用户 ID 值的方法,外部可以通过调用该方法设置 yonghuId 字段的值
*
*/
public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId;
}
/**
*
*/
// 获取就诊识别码值的方法,外部可以通过调用该方法获取 guahaoUuinNumber 字段的值
*
*/
public String getGuahaoUuinNumber() {
return guahaoUuinNumber;
}
/**
*
*/
// 设置就诊识别码值的方法,外部可以通过调用该方法设置 guahaoUuinNumber 字段的值
*
*/
public void setGuahaoUuinNumber(String guahaoUuinNumber) {
this.guahaoUuinNumber = guahaoUuinNumber;
}
/**
*
*/
// 获取挂号时间值的方法,外部可以通过调用该方法获取 guahaoTime 字段的值
*
*/
public Date getGuahaoTime() {
return guahaoTime;
}
/**
*
*/
// 设置挂号时间值的方法,外部可以通过调用该方法设置 guahaoTime 字段的值
*
*/
public void setGuahaoTime(Date guahaoTime) {
this.guahaoTime = guahaoTime;
}
/**
*
*/
// 获取时间类型值的方法,外部可以通过调用该方法获取 guahaoTypes 字段的值
*
*/
public Integer getGuahaoTypes() {
return guahaoTypes;
}
/**
*
*/
// 设置时间类型值的方法,外部可以通过调用该方法设置 guahaoTypes 字段的值
*
*/
public void setGuahaoTypes(Integer guahaoTypes) {
this.guahaoTypes = guahaoTypes;
}
/**
*
*/
// 获取挂号状态值的方法,外部可以通过调用该方法获取 guahaoStatusTypes 字段的值
*
*/
public Integer getGuahaoStatusTypes() {
return guahaoStatusTypes;
}
/**
*
*/
// 设置挂号状态值的方法,外部可以通过调用该方法设置 guahaoStatusTypes 字段的值
*
*/
public void setGuahaoStatusTypes(Integer guahaoStatusTypes) {
this.guahaoStatusTypes = guahaoStatusTypes;
}
/**
*
*/
// 获取挂号审核值的方法,外部可以通过调用该方法获取 guahaoYesnoTypes 字段的值
*
*/
public Integer getGuahaoYesnoTypes() {
return guahaoYesnoTypes;
}
/**
*
*/
// 设置挂号审核值的方法,外部可以通过调用该方法设置 guahaoYesnoTypes 字段的值
*
*/
public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) {
this.guahaoYesnoTypes = guahaoYesnoTypes;
}
/**
*
*/
// 获取审核结果值的方法,外部可以通过调用该方法获取 guahaoYesnoText 字段的值
*
*/
public String getGuahaoYesnoText() {
return guahaoYesnoText;
}
/**
*
*/
// 设置审核结果值的方法,外部可以通过调用该方法设置 guahaoYesnoText 字段的值
*
*/
public void setGuahaoYesnoText(String guahaoYesnoText) {
this.guahaoYesnoText = guahaoYesnoText;
}
/**
*
*/
// 获取创建时间值的方法,外部可以通过调用该方法获取 createTime 字段的值
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 设置创建时间值的方法,外部可以通过调用该方法设置 createTime 字段的值
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override
public String toString() {
return "Guahao{" +
"id=" + id +
", yishengId=" + yishengId +
", yonghuId=" + yonghuId +
", guahaoUuinNumber=" + guahaoUuinNumber +
", guahaoTime=" + guahaoTime +
", guahaoTypes=" + guahaoTypes +
", guahaoStatusTypes=" + guahaoStatusTypes +
", guahaoYesnoTypes=" + guahaoYesnoTypes +
", guahaoYesnoText=" + guahaoYesnoText +
", createTime=" + createTime +
"}";
"id=" + id +
", yishengId=" + yishengId +
", yonghuId=" + yonghuId +
", guahaoUuinNumber=" + guahaoUuinNumber +
", guahaoTime=" + guahaoTime +
", guahaoTypes=" + guahaoTypes +
", guahaoStatusTypes=" + guahaoStatusTypes +
", guahaoYesnoTypes=" + guahaoYesnoTypes +
", guahaoYesnoText=" + guahaoYesnoText +
", createTime=" + createTime +
"}";
}
}
}

@ -1,279 +1,251 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解,可用于字段验证,当前代码未使用这些注解进行实际验证
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
// 导入 Jackson 注解,可用于忽略 JSON 序列化和反序列化时的某些属性,当前代码未使用
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化操作
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表集合类,当前代码未使用
import java.util.List;
// 导入 Spring 框架用于日期格式化的注解,用于将字符串日期转换为 Date 对象
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @author
* @email
*/
// 指定该类对应数据库中的 jiankangjiaoyu 表
@TableName("jiankangjiaoyu")
// 定义泛型类,实现 Serializable 接口
public class JiankangjiaoyuEntity<T> implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,方便创建 JiankangjiaoyuEntity 类的实例
public JiankangjiaoyuEntity() {
}
public JiankangjiaoyuEntity() {
}
public JiankangjiaoyuEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 带参构造函数,接收一个泛型对象 t将其属性复制到当前 JiankangjiaoyuEntity 对象
public JiankangjiaoyuEntity(T t) {
try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*/
// 指定该字段为主键,且主键生成策略为自增
@TableId(type = IdType.AUTO)
// 指定该字段对应数据库表中的 id 字段
@TableField(value = "id")
// 主键,用于唯一标识一条健康教育记录
private Integer id;
/**
*
*/
// 指定该字段对应数据库表中的 jiankangjiaoyu_name 字段
@TableField(value = "jiankangjiaoyu_name")
// 健康教育的标题
private String jiankangjiaoyuName;
/**
*
*/
// 指定该字段对应数据库表中的 jiankangjiaoyu_types 字段
@TableField(value = "jiankangjiaoyu_types")
// 健康教育的类型,用整数表示不同类型
private Integer jiankangjiaoyuTypes;
/**
*
*/
// 指定该字段对应数据库表中的 jiankangjiaoyu_photo 字段
@TableField(value = "jiankangjiaoyu_photo")
// 健康教育相关图片的存储路径
private String jiankangjiaoyuPhoto;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 指定该字段对应数据库表中的 insert_time 字段,且在插入数据时自动填充
@TableField(value = "insert_time", fill = FieldFill.INSERT)
// 健康教育的时间
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "insert_time",fill = FieldFill.INSERT)
private Date insertTime;
/**
*
*/
// 指定该字段对应数据库表中的 jiankangjiaoyu_content 字段
@TableField(value = "jiankangjiaoyu_content")
// 健康教育的详细内容
private String jiankangjiaoyuContent;
/**
*
*/
// 指定该字段对应数据库表中的 jiankangjiaoyu_delete 字段
@TableField(value = "jiankangjiaoyu_delete")
// 假删除标记,用整数表示是否删除,如 0 表示未删除1 表示已删除
private Integer jiankangjiaoyuDelete;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 指定该字段对应数据库表中的 create_time 字段,且在插入数据时自动填充
@TableField(value = "create_time", fill = FieldFill.INSERT)
// 该条健康教育记录的创建时间
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
// 获取主键的方法
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键的方法
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取健康教育标题的方法
*
*/
public String getJiankangjiaoyuName() {
return jiankangjiaoyuName;
}
/**
*
*/
// 设置健康教育标题的方法
*
*/
public void setJiankangjiaoyuName(String jiankangjiaoyuName) {
this.jiankangjiaoyuName = jiankangjiaoyuName;
}
/**
*
*/
// 获取健康教育类型的方法
*
*/
public Integer getJiankangjiaoyuTypes() {
return jiankangjiaoyuTypes;
}
/**
*
*/
// 设置健康教育类型的方法
*
*/
public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) {
this.jiankangjiaoyuTypes = jiankangjiaoyuTypes;
}
/**
*
*/
// 获取健康教育图片路径的方法
*
*/
public String getJiankangjiaoyuPhoto() {
return jiankangjiaoyuPhoto;
}
/**
*
*/
// 设置健康教育图片路径的方法
*
*/
public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) {
this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto;
}
/**
*
*/
// 获取健康教育时间的方法
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置健康教育时间的方法
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
// 获取健康教育详情的方法
*
*/
public String getJiankangjiaoyuContent() {
return jiankangjiaoyuContent;
}
/**
*
*/
// 设置健康教育详情的方法
*
*/
public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) {
this.jiankangjiaoyuContent = jiankangjiaoyuContent;
}
/**
*
*/
// 获取假删除标记的方法
*
*/
public Integer getJiankangjiaoyuDelete() {
return jiankangjiaoyuDelete;
}
/**
*
*/
// 设置假删除标记的方法
*
*/
public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) {
this.jiankangjiaoyuDelete = jiankangjiaoyuDelete;
}
/**
*
*/
// 获取创建时间的方法
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 设置创建时间的方法
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
// 重写 toString 方法,方便打印对象信息
@Override
public String toString() {
return "Jiankangjiaoyu{" +
"id=" + id +
", jiankangjiaoyuName=" + jiankangjiaoyuName +
", jiankangjiaoyuTypes=" + jiankangjiaoyuTypes +
", jiankangjiaoyuPhoto=" + jiankangjiaoyuPhoto +
", insertTime=" + insertTime +
", jiankangjiaoyuContent=" + jiankangjiaoyuContent +
", jiankangjiaoyuDelete=" + jiankangjiaoyuDelete +
", createTime=" + createTime +
"}";
}
}
"id=" + id +
", jiankangjiaoyuName=" + jiankangjiaoyuName +
", jiankangjiaoyuTypes=" + jiankangjiaoyuTypes +
", jiankangjiaoyuPhoto=" + jiankangjiaoyuPhoto +
", insertTime=" + insertTime +
", jiankangjiaoyuContent=" + jiankangjiaoyuContent +
", jiankangjiaoyuDelete=" + jiankangjiaoyuDelete +
", createTime=" + createTime +
"}";
}
}

@ -1,256 +1,227 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(当前未实际使用)
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
// 导入 Jackson 用于忽略属性的注解(当前未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表类(当前未实际使用)
import java.util.List;
// 导入 Spring 用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* @author
* @author
* @email
*/
// 使用 TableName 注解指定该类对应的数据库表名为 "news"
@TableName("news")
// 定义泛型类 NewsEntity实现 Serializable 接口,用于对象的序列化和反序列化
public class NewsEntity<T> implements Serializable {
// 定义序列化版本号,保证序列化和反序列化的兼容性
private static final long serialVersionUID = 1L;
// 无参构造函数,用于创建 NewsEntity 对象
public NewsEntity() {
}
public NewsEntity() {
}
public NewsEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// 带参构造函数,接受一个泛型对象 t通过 BeanUtils.copyProperties 方法
// 将对象 t 的属性复制到当前 NewsEntity 对象中
public NewsEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*/
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长IdType.AUTO
@TableId(type = IdType.AUTO)
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "id"
@TableField(value = "id")
// 存储公告信息记录的主键值,用于唯一标识一条公告记录
private Integer id;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_name"
@TableField(value = "news_name")
// 存储公告的名称
private String newsName;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_photo"
@TableField(value = "news_photo")
// 存储公告相关图片的路径或标识
private String newsPhoto;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_types"
@TableField(value = "news_types")
// 存储公告的类型,用整数表示不同的公告类型,如通知、公告等
private Integer newsTypes;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "insert_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "insert_time", fill = FieldFill.INSERT)
// 存储公告的发布时间
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "insert_time",fill = FieldFill.INSERT)
private Date insertTime;
/**
*
*/
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "news_content"
@TableField(value = "news_content")
// 存储公告的详细内容
private String newsContent;
/**
*
*/
// 设置 JSON 序列化时日期的格式,使用中文环境,时区为东八区,格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
// 用于 Spring MVC 接收表单数据时将日期字符串转换为 Date 对象
@DateTimeFormat
// 使用 TableField 注解指定该字段在数据库表中对应的字段名为 "create_time"
// 并设置在插入数据时自动填充当前时间
@TableField(value = "create_time", fill = FieldFill.INSERT)
// 存储公告记录的创建时间,用于记录数据的创建时间戳
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "create_time",fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
// 获取主键值的方法
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键值的方法
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取公告名称值的方法
*
*/
public String getNewsName() {
return newsName;
}
/**
*
*/
// 设置公告名称值的方法
*
*/
public void setNewsName(String newsName) {
this.newsName = newsName;
}
/**
*
*/
// 获取公告图片路径值的方法
*
*/
public String getNewsPhoto() {
return newsPhoto;
}
/**
*
*/
// 设置公告图片路径值的方法
*
*/
public void setNewsPhoto(String newsPhoto) {
this.newsPhoto = newsPhoto;
}
/**
*
*/
// 获取公告类型值的方法
*
*/
public Integer getNewsTypes() {
return newsTypes;
}
/**
*
*/
// 设置公告类型值的方法
*
*/
public void setNewsTypes(Integer newsTypes) {
this.newsTypes = newsTypes;
}
/**
*
*/
// 获取公告发布时间值的方法
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置公告发布时间值的方法
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
// 获取公告详情值的方法
*
*/
public String getNewsContent() {
return newsContent;
}
/**
*
*/
// 设置公告详情值的方法
*
*/
public void setNewsContent(String newsContent) {
this.newsContent = newsContent;
}
/**
*
*/
// 获取创建时间值的方法
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 设置创建时间值的方法
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
// 重写 toString 方法,返回对象的字符串表示,方便调试和日志记录
@Override
public String toString() {
return "News{" +
"id=" + id +
", newsName=" + newsName +
", newsPhoto=" + newsPhoto +
", newsTypes=" + newsTypes +
", insertTime=" + insertTime +
", newsContent=" + newsContent +
", createTime=" + createTime +
"}";
}
}
"id=" + id +
", newsName=" + newsName +
", newsPhoto=" + newsPhoto +
", newsTypes=" + newsTypes +
", insertTime=" + insertTime +
", newsContent=" + newsContent +
", createTime=" + createTime +
"}";
}
}

@ -1,156 +1,122 @@
package com.entity;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化
import java.io.Serializable;
// 导入日期类,用于处理日期相关的操作
import java.util.Date;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
/**
* token
*/
// 使用 TableName 注解指定该类对应的数据库表名为 "token"
@TableName("token")
//定义 TokenEntity 类,实现 Serializable 接口,以支持对象的序列化和反序列化
public class TokenEntity implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO)
// 存储记录的主键值,用于唯一标识一条 token 记录
private Integer id;
/**
* id
*/
// 存储与该 token 相关联的用户 ID
private Integer userid;
/**
*
*/
// 存储与该 token 相关联的用户名
private String username;
/**
*
*/
// 存储与该 token 相关的表名(具体用途可能根据业务需求而定)
private String tablename;
/**
*
*/
// 存储用户的角色信息,用于权限控制等
private String role;
/**
* token
*/
// 存储具体的 token 值,用于身份验证和授权
private String token;
/**
*
*/
// 存储该 token 的过期时间,用于判断 token 是否有效
private Date expiratedtime;
/**
*
*/
// 存储该 token 记录的创建时间,用于记录数据的生成时间戳
private Date addtime;
// 获取主键值的方法
public Integer getId() {
return id;
}
// 设置主键值的方法
public void setId(Integer id) {
this.id = id;
}
// 获取用户 ID 的方法
public Integer getUserid() {
return userid;
}
// 设置用户 ID 的方法
public void setUserid(Integer userid) {
this.userid = userid;
}
// 获取角色信息的方法
public String getRole() {
return role;
}
// 设置角色信息的方法
public void setRole(String role) {
this.role = role;
}
// 获取 token 值的方法
public String getToken() {
return token;
}
// 获取表名的方法
public String getTablename() {
return tablename;
}
// 设置表名的方法
public void setTablename(String tablename) {
this.tablename = tablename;
}
// 设置 token 值的方法
public void setToken(String token) {
this.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;
}
// 带参数的构造函数,用于初始化 TokenEntity 对象的部分属性
public TokenEntity(Integer userid, String username, String tablename, String role, String token, Date expiratedtime) {
public TokenEntity(Integer userid, String username, String tablename,String role, String token, Date expiratedtime) {
super();
this.userid = userid;
this.username = username;
@ -159,8 +125,8 @@ public class TokenEntity implements Serializable {
this.token = token;
this.expiratedtime = expiratedtime;
}
// 无参构造函数,用于创建 TokenEntity 对象的实例
public TokenEntity() {
}
}
}

@ -1,100 +1,77 @@
package com.entity;
// 导入序列化接口,使该类的对象可以进行序列化和反序列化操作
import java.io.Serializable;
// 导入日期类,用于处理与日期相关的操作
import java.util.Date;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
/**
*
*/
// 使用 TableName 注解指定该类对应的数据库表名为 "users"
@TableName("users")
// 定义 UsersEntity 类,实现 Serializable 接口,以支持对象的序列化和反序列化
public class UsersEntity implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
// 使用 TableId 注解指定该字段为主键主键生成策略为自动增长AUTO
@TableId(type = IdType.AUTO)
// 存储用户记录的主键值,用于唯一标识一条用户记录
private Integer 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;
}
// 设置用户记录主键的方法
public void setId(Integer id) {
this.id = id;
}
}
}

@ -1,393 +1,445 @@
package com.entity;
// 导入 MyBatis-Plus 用于指定主键的注解
import com.baomidou.mybatisplus.annotations.TableId;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 JSR 303 验证注解(在当前代码中未实际使用)
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
// 导入 Jackson 注解(在当前代码中未实际使用)
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
// 导入列表集合类(在当前代码中未实际使用)
import java.util.List;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入 MyBatis-Plus 用于指定字段的注解
import com.baomidou.mybatisplus.annotations.TableField;
// 导入 MyBatis-Plus 字段填充策略枚举
import com.baomidou.mybatisplus.enums.FieldFill;
// 导入 MyBatis-Plus 主键生成策略枚举
import com.baomidou.mybatisplus.enums.IdType;
/**
*
*
* Serializable 便
*
* @author
* @email
* @author
* @email
*/
@TableName("yisheng")
@TableName("yisheng") // 表明该实体类对应数据库中的表名为 "yisheng"
public class YishengEntity<T> implements Serializable {
// 序列化版本号,用于保证序列化和反序列化过程中对象版本的一致性
private static final long serialVersionUID = 1L;
public YishengEntity() {
/**
*
* YishengEntity
*/
public YishengEntity() {
}
public YishengEntity(T t) {
try {
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
* t YishengEntity
*
* @param t
*/
public YishengEntity(T t) {
try {
// 使用 BeanUtils 工具类将对象 t 的属性复制到当前对象
BeanUtils.copyProperties(this, t);
} catch (IllegalAccessException | InvocationTargetException e) {
// 若复制属性过程中出现异常,打印异常堆栈信息
e.printStackTrace();
}
}
/**
*
*
*/
@TableId(type = IdType.AUTO)
@TableField(value = "id")
@TableId(type = IdType.AUTO) // 表示该字段为主键,且采用自增方式生成
@TableField(value = "id") // 表明该属性对应数据库表中的字段名为 "id"
private Integer id;
/**
*
*
*/
@TableField(value = "yisheng_uuid_number")
@TableField(value = "yisheng_uuid_number") // 表明该属性对应数据库表中的字段名为 "yisheng_uuid_number"
private String yishengUuidNumber;
/**
*
* 使
*/
@TableField(value = "username")
@TableField(value = "username") // 表明该属性对应数据库表中的字段名为 "username"
private String username;
/**
*
* 使
*/
@TableField(value = "password")
@TableField(value = "password") // 表明该属性对应数据库表中的字段名为 "password"
private String password;
/**
*
*
*/
@TableField(value = "yisheng_name")
@TableField(value = "yisheng_name") // 表明该属性对应数据库表中的字段名为 "yisheng_name"
private String yishengName;
/**
*
*
*/
@TableField(value = "yisheng_types")
@TableField(value = "yisheng_types") // 表明该属性对应数据库表中的字段名为 "yisheng_types"
private Integer yishengTypes;
/**
*
*
*/
@TableField(value = "zhiwei_types")
@TableField(value = "zhiwei_types") // 表明该属性对应数据库表中的字段名为 "zhiwei_types"
private Integer zhiweiTypes;
/**
*
*
*/
@TableField(value = "yisheng_zhichneg")
@TableField(value = "yisheng_zhichneg") // 表明该属性对应数据库表中的字段名为 "yisheng_zhichneg"
private String yishengZhichneg;
/**
*
*
*/
@TableField(value = "yisheng_photo")
@TableField(value = "yisheng_photo") // 表明该属性对应数据库表中的字段名为 "yisheng_photo"
private String yishengPhoto;
/**
*
*
*/
@TableField(value = "yisheng_phone")
@TableField(value = "yisheng_phone") // 表明该属性对应数据库表中的字段名为 "yisheng_phone"
private String yishengPhone;
/**
*
*
*/
@TableField(value = "yisheng_guahao")
@TableField(value = "yisheng_guahao") // 表明该属性对应数据库表中的字段名为 "yisheng_guahao"
private String yishengGuahao;
/**
*
*
*/
@TableField(value = "yisheng_email")
@TableField(value = "yisheng_email") // 表明该属性对应数据库表中的字段名为 "yisheng_email"
private String yishengEmail;
/**
*
*
*/
@TableField(value = "yisheng_new_money")
@TableField(value = "yisheng_new_money") // 表明该属性对应数据库表中的字段名为 "yisheng_new_money"
private Double yishengNewMoney;
/**
*
*
*/
@TableField(value = "yisheng_content")
@TableField(value = "yisheng_content") // 表明该属性对应数据库表中的字段名为 "yisheng_content"
private String yishengContent;
/**
*
*
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@TableField(value = "create_time",fill = FieldFill.INSERT)
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") // 用于将日期格式化为指定格式,方便前端展示
@DateTimeFormat // 用于将前端传递的日期字符串解析为 Date 类型
@TableField(value = "create_time",fill = FieldFill.INSERT) // 表明该属性对应数据库表中的字段名为 "create_time",且在插入数据时自动填充
private Date createTime;
/**
*
*/
*
*
* @return
*/
public Integer getId() {
return id;
}
/**
*
*/
*
*
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
*
*
* @return
*/
public String getYishengUuidNumber() {
return yishengUuidNumber;
}
/**
*
*/
*
*
* @param yishengUuidNumber
*/
public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber;
}
/**
*
*/
*
*
* @return
*/
public String getUsername() {
return username;
}
/**
*
*/
*
*
* @param username
*/
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
*
*
* @return
*/
public String getPassword() {
return password;
}
/**
*
*/
*
*
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
*
*/
*
*
* @return
*/
public String getYishengName() {
return yishengName;
}
/**
*
*/
*
*
* @param yishengName
*/
public void setYishengName(String yishengName) {
this.yishengName = yishengName;
}
/**
*
*/
*
*
* @return
*/
public Integer getYishengTypes() {
return yishengTypes;
}
/**
*
*/
*
*
* @param yishengTypes
*/
public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes;
}
/**
*
*/
*
*
* @return
*/
public Integer getZhiweiTypes() {
return zhiweiTypes;
}
/**
*
*/
*
*
* @param zhiweiTypes
*/
public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes;
}
/**
*
*/
*
*
* @return
*/
public String getYishengZhichneg() {
return yishengZhichneg;
}
/**
*
*/
*
*
* @param yishengZhichneg
*/
public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg;
}
/**
*
*/
*
*
* @return
*/
public String getYishengPhoto() {
return yishengPhoto;
}
/**
*
*/
*
*
* @param yishengPhoto
*/
public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto;
}
/**
*
*/
*
*
* @return
*/
public String getYishengPhone() {
return yishengPhone;
}
/**
*
*/
*
*
* @param yishengPhone
*/
public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone;
}
/**
*
*/
*
*
* @return
*/
public String getYishengGuahao() {
return yishengGuahao;
}
/**
*
*/
*
*
* @param yishengGuahao
*/
public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao;
}
/**
*
*/
*
*
* @return
*/
public String getYishengEmail() {
return yishengEmail;
}
/**
*
*/
*
*
* @param yishengEmail
*/
public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail;
}
/**
*
*/
*
*
* @return
*/
public Double getYishengNewMoney() {
return yishengNewMoney;
}
/**
*
*/
*
*
* @param yishengNewMoney
*/
public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney;
}
/**
*
*/
*
*
* @return
*/
public String getYishengContent() {
return yishengContent;
}
/**
*
*/
*
*
* @param yishengContent
*/
public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent;
}
/**
*
*/
*
*
* @return
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
*
*
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* toString
* 便
*
* @return
*/
@Override
public String toString() {
return "Yisheng{" +

@ -21,10 +21,9 @@ import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
/**
*
* yonghu
*
*
* @author
* @author
* @email
*/
@TableName("yonghu")
@ -34,7 +33,7 @@ public class YonghuEntity<T> implements Serializable {
public YonghuEntity() {
}
}
public YonghuEntity(T t) {
try {
@ -45,46 +44,48 @@ public class YonghuEntity<T> implements Serializable {
}
}
/**
* ID
*
*
*/
@TableId(type = IdType.AUTO)
@TableField(value = "id")
private Integer id;
/**
* /
*
*
*/
@TableField(value = "username")
private String username;
/**
*
*
*/
@TableField(value = "password")
private String password;
/**
*
*
*/
@TableField(value = "yonghu_name")
private String yonghuName;
/**
*
*
*
*/
@TableField(value = "yonghu_photo")
private String yonghuPhoto;
/**
*
*/
@ -92,6 +93,7 @@ public class YonghuEntity<T> implements Serializable {
private String yonghuPhone;
/**
*
*/
@ -99,39 +101,41 @@ public class YonghuEntity<T> implements Serializable {
private String yonghuIdNumber;
/**
*
*
*/
@TableField(value = "yonghu_email")
private String yonghuEmail;
/**
*
* 使
*/
@TableField(value = "sex_types")
private Integer sexTypes;
/**
*
*
*/
@TableField(value = "new_money")
private Double newMoney;
/**
*
* 1-2-
*
*/
@TableField(value = "yonghu_delete")
private Integer yonghuDelete;
/**
*
* yyyy-MM-dd HH:mm:ss
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@ -147,6 +151,7 @@ public class YonghuEntity<T> implements Serializable {
return id;
}
/**
*
*/
@ -154,7 +159,6 @@ public class YonghuEntity<T> implements Serializable {
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
@ -162,6 +166,7 @@ public class YonghuEntity<T> implements Serializable {
return username;
}
/**
*
*/
@ -169,7 +174,6 @@ public class YonghuEntity<T> implements Serializable {
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
@ -177,6 +181,7 @@ public class YonghuEntity<T> implements Serializable {
return password;
}
/**
*
*/
@ -184,7 +189,6 @@ public class YonghuEntity<T> implements Serializable {
public void setPassword(String password) {
this.password = password;
}
/**
*
*/
@ -192,6 +196,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuName;
}
/**
*
*/
@ -199,7 +204,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
@ -207,6 +211,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuPhoto;
}
/**
*
*/
@ -214,7 +219,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
@ -222,6 +226,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuPhone;
}
/**
*
*/
@ -229,7 +234,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
@ -237,6 +241,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuIdNumber;
}
/**
*
*/
@ -244,7 +249,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
@ -252,6 +256,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuEmail;
}
/**
*
*/
@ -259,7 +264,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
@ -267,6 +271,7 @@ public class YonghuEntity<T> implements Serializable {
return sexTypes;
}
/**
*
*/
@ -274,7 +279,6 @@ public class YonghuEntity<T> implements Serializable {
public void setSexTypes(Integer sexTypes) {
this.sexTypes = sexTypes;
}
/**
*
*/
@ -282,6 +286,7 @@ public class YonghuEntity<T> implements Serializable {
return newMoney;
}
/**
*
*/
@ -289,7 +294,6 @@ public class YonghuEntity<T> implements Serializable {
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
@ -297,6 +301,7 @@ public class YonghuEntity<T> implements Serializable {
return yonghuDelete;
}
/**
*
*/
@ -304,7 +309,6 @@ public class YonghuEntity<T> implements Serializable {
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
/**
*
*/
@ -312,6 +316,7 @@ public class YonghuEntity<T> implements Serializable {
return createTime;
}
/**
*
*/
@ -323,18 +328,18 @@ public class YonghuEntity<T> implements Serializable {
@Override
public String toString() {
return "Yonghu{" +
"id=" + id +
", username=" + username +
", password=" + password +
", yonghuName=" + yonghuName +
", yonghuPhoto=" + yonghuPhoto +
", yonghuPhone=" + yonghuPhone +
", yonghuIdNumber=" + yonghuIdNumber +
", yonghuEmail=" + yonghuEmail +
", sexTypes=" + sexTypes +
", newMoney=" + newMoney +
", yonghuDelete=" + yonghuDelete +
", createTime=" + createTime +
"}";
"id=" + id +
", username=" + username +
", password=" + password +
", yonghuName=" + yonghuName +
", yonghuPhoto=" + yonghuPhoto +
", yonghuPhone=" + yonghuPhone +
", yonghuIdNumber=" + yonghuIdNumber +
", yonghuEmail=" + yonghuEmail +
", sexTypes=" + sexTypes +
", newMoney=" + newMoney +
", yonghuDelete=" + yonghuDelete +
", createTime=" + createTime +
"}";
}
}
}

@ -8,6 +8,7 @@ import java.util.Date;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* 线
*
@ -15,216 +16,196 @@ import java.io.Serializable;
* ModelAndView model
*/
public class ChatModel implements Serializable {
// 序列化版本号,用于保证序列化和反序列化的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于唯一标识一条在线咨询记录的主键
private Integer id;
/**
*
*/
// 发起咨询问题的用户的ID
private Integer yonghuId;
/**
*
*/
// 用户提出的咨询问题内容
private String chatIssue;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 用户提出问题的具体时间
@DateTimeFormat
private Date issueTime;
/**
*
*/
// 针对用户咨询问题给出的回复内容
private String chatReply;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 给出回复的具体时间
@DateTimeFormat
private Date replyTime;
/**
*
*/
// 表示该在线咨询记录的状态,使用整数类型表示不同状态
private Integer zhuangtaiTypes;
/**
*
*/
// 表示该在线咨询记录的数据类型,使用整数类型表示不同类型
private Integer chatTypes;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 该在线咨询记录的创建时间
@DateTimeFormat
private Date insertTime;
/**
*
*/
// 获取主键ID的方法
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键ID的方法
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取提问用户ID的方法
*
*/
public Integer getYonghuId() {
return yonghuId;
}
/**
*
*/
// 设置提问用户ID的方法
*
*/
public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId;
}
/**
*
*/
// 获取咨询问题内容的方法
*
*/
public String getChatIssue() {
return chatIssue;
}
/**
*
*/
// 设置咨询问题内容的方法
*
*/
public void setChatIssue(String chatIssue) {
this.chatIssue = chatIssue;
}
/**
*
*/
// 获取用户提出问题时间的方法
*
*/
public Date getIssueTime() {
return issueTime;
}
/**
*
*/
// 设置用户提出问题时间的方法
*
*/
public void setIssueTime(Date issueTime) {
this.issueTime = issueTime;
}
/**
*
*/
// 获取咨询问题回复内容的方法
*
*/
public String getChatReply() {
return chatReply;
}
/**
*
*/
// 设置咨询问题回复内容的方法
*
*/
public void setChatReply(String chatReply) {
this.chatReply = chatReply;
}
/**
*
*/
// 获取给出回复时间的方法
*
*/
public Date getReplyTime() {
return replyTime;
}
/**
*
*/
// 设置给出回复时间的方法
*
*/
public void setReplyTime(Date replyTime) {
this.replyTime = replyTime;
}
/**
*
*/
// 获取咨询记录状态的方法
*
*/
public Integer getZhuangtaiTypes() {
return zhuangtaiTypes;
}
/**
*
*/
// 设置咨询记录状态的方法
*
*/
public void setZhuangtaiTypes(Integer zhuangtaiTypes) {
this.zhuangtaiTypes = zhuangtaiTypes;
}
/**
*
*/
// 获取咨询记录数据类型的方法
*
*/
public Integer getChatTypes() {
return chatTypes;
}
/**
*
*/
// 设置咨询记录数据类型的方法
*
*/
public void setChatTypes(Integer chatTypes) {
this.chatTypes = chatTypes;
}
/**
*
*/
// 获取咨询记录创建时间的方法
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置咨询记录创建时间的方法
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
}
}

@ -1,206 +1,187 @@
package com.entity.model;
// 引入字典表实体类,可能用于与数据库实体交互或类型转换等操作
import com.entity.DictionaryEntity;
// 该注解用于指定实体类对应的数据库表名,不过在当前代码中未实际使用该功能
import com.baomidou.mybatisplus.annotations.TableName;
// 用于在将对象序列化为JSON时对日期类型的字段进行格式化处理
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
// 用于在Spring MVC中将前端传递的日期字符串绑定到Java对象的日期字段时进行格式化
import org.springframework.format.annotation.DateTimeFormat;
// 实现该接口意味着这个类的对象可以被序列化和反序列化,方便在网络传输或存储时使用
import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
*/
// 定义一个名为DictionaryModel的类实现Serializable接口用于接收字典表相关的参数
public class DictionaryModel implements Serializable {
// 序列化版本号,用于在反序列化时验证版本一致性,避免不同版本类之间反序列化出错
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于唯一标识字典表中的每一条记录,在数据库操作中常作为主键使用
private Integer id;
/**
*
*/
// 表示字典表中的某个字段,可能用于存储特定的数据标识
private String dicCode;
/**
*
*/
// 该字段的名称用于更直观地描述dicCode所代表的含义
private String dicName;
/**
*
*/
// 可能是对该字段的一种编码表示,方便数据的分类和查询
private Integer codeIndex;
/**
*
*/
// 编码对应的名称,用于更清晰地展示编码的具体含义
private String indexName;
/**
* id
*/
// 用于关联父字段,可能用于构建字典表的层级结构
private Integer superId;
/**
*
*/
// 对该条字典记录的额外说明信息,可用于记录一些特殊情况或备注
private String beizhu;
/**
*
*/
// 对日期进行JSON序列化时指定日期的格式、语言环境和时区
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于在Spring MVC中将前端传递的日期字符串转换为Date类型时指定格式
@DateTimeFormat
// 记录该条字典记录的创建时间
@DateTimeFormat
private Date createTime;
/**
*
*/
// 定义一个公共的获取主键的方法供外部调用获取id的值
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 定义一个公共的设置主键的方法供外部调用设置id的值
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 定义一个公共的获取字段标识的方法供外部调用获取dicCode的值
*
*/
public String getDicCode() {
return dicCode;
}
/**
*
*/
// 定义一个公共的设置字段标识的方法供外部调用设置dicCode的值
*
*/
public void setDicCode(String dicCode) {
this.dicCode = dicCode;
}
/**
*
*/
// 定义一个公共的获取字段名称的方法供外部调用获取dicName的值
*
*/
public String getDicName() {
return dicName;
}
/**
*
*/
// 定义一个公共的设置字段名称的方法供外部调用设置dicName的值
*
*/
public void setDicName(String dicName) {
this.dicName = dicName;
}
/**
*
*/
// 定义一个公共的获取编码的方法供外部调用获取codeIndex的值
*
*/
public Integer getCodeIndex() {
return codeIndex;
}
/**
*
*/
// 定义一个公共的设置编码的方法供外部调用设置codeIndex的值
*
*/
public void setCodeIndex(Integer codeIndex) {
this.codeIndex = codeIndex;
}
/**
*
*/
// 定义一个公共的获取编码名称的方法供外部调用获取indexName的值
*
*/
public String getIndexName() {
return indexName;
}
/**
*
*/
// 定义一个公共的设置编码名称的方法供外部调用设置indexName的值
*
*/
public void setIndexName(String indexName) {
this.indexName = indexName;
}
/**
* id
*/
// 定义一个公共的获取父字段ID的方法供外部调用获取superId的值
* id
*/
public Integer getSuperId() {
return superId;
}
/**
* id
*/
// 定义一个公共的设置父字段ID的方法供外部调用设置superId的值
* id
*/
public void setSuperId(Integer superId) {
this.superId = superId;
}
/**
*
*/
// 定义一个公共的获取备注信息的方法供外部调用获取beizhu的值
*
*/
public String getBeizhu() {
return beizhu;
}
/**
*
*/
// 定义一个公共的设置备注信息的方法供外部调用设置beizhu的值
*
*/
public void setBeizhu(String beizhu) {
this.beizhu = beizhu;
}
/**
*
*/
// 定义一个公共的获取创建时间的方法供外部调用获取createTime的值
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 定义一个公共的设置创建时间的方法供外部调用设置createTime的值
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
}

@ -1,253 +1,229 @@
package com.entity.model;
// 导入GuahaoEntity类可能用于实体之间的转换或关联操作
import com.entity.GuahaoEntity;
// 导入MyBatis-Plus的TableName注解这里可能用于指定数据库表名但代码中未实际使用
import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时格式化日期类型字段
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时格式化日期类型字段
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
*/
// 定义一个名为GuahaoModel的类实现Serializable接口使其对象可序列化
public class GuahaoModel implements Serializable {
// 定义序列化版本号,确保在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于唯一标识挂号记录的主键,在数据库操作中通常作为唯一标识
private Integer id;
/**
*
*/
// 表示进行挂号的医生的ID用于关联医生信息
private Integer yishengId;
/**
*
*/
// 表示进行挂号的用户的ID用于关联用户信息
private Integer yonghuId;
/**
*
*/
// 可能是用于识别就诊记录的唯一编码,具体用途可能根据业务需求而定
private Integer guahaoUuinNumber;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录挂号操作的具体时间
@DateTimeFormat
private Date guahaoTime;
/**
*
*/
// 可能用于区分不同类型的挂号时间,例如预约时间、实际挂号时间等
private Integer guahaoTypes;
/**
*
*/
// 用于表示挂号的当前状态,例如已挂号、已取消、已就诊等
private Integer guahaoStatusTypes;
/**
*
*/
// 用于表示挂号是否经过审核可能是0未审核、1审核通过、2审核不通过
private Integer guahaoYesnoTypes;
/**
*
*/
// 当挂号经过审核后,记录审核的具体结果信息,例如审核不通过的原因等
private String guahaoYesnoText;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录该挂号记录的创建时间
@DateTimeFormat
private Date createTime;
/**
*
*/
// 获取主键ID的方法供外部调用以获取该挂号记录的唯一标识
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键ID的方法供外部调用以设置该挂号记录的唯一标识
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取进行挂号的医生ID的方法供外部调用以获取医生的标识
*
*/
public Integer getYishengId() {
return yishengId;
}
/**
*
*/
// 设置进行挂号的医生ID的方法供外部调用以设置医生的标识
*
*/
public void setYishengId(Integer yishengId) {
this.yishengId = yishengId;
}
/**
*
*/
// 获取进行挂号的用户ID的方法供外部调用以获取用户的标识
*
*/
public Integer getYonghuId() {
return yonghuId;
}
/**
*
*/
// 设置进行挂号的用户ID的方法供外部调用以设置用户的标识
*
*/
public void setYonghuId(Integer yonghuId) {
this.yonghuId = yonghuId;
}
/**
*
*/
// 获取就诊识别码的方法,供外部调用以获取该挂号记录的识别编码
*
*/
public Integer getGuahaoUuinNumber() {
return guahaoUuinNumber;
}
/**
*
*/
// 设置就诊识别码的方法,供外部调用以设置该挂号记录的识别编码
*
*/
public void setGuahaoUuinNumber(Integer guahaoUuinNumber) {
this.guahaoUuinNumber = guahaoUuinNumber;
}
/**
*
*/
// 获取挂号时间的方法,供外部调用以获取挂号操作的具体时间
*
*/
public Date getGuahaoTime() {
return guahaoTime;
}
/**
*
*/
// 设置挂号时间的方法,供外部调用以设置挂号操作的具体时间
*
*/
public void setGuahaoTime(Date guahaoTime) {
this.guahaoTime = guahaoTime;
}
/**
*
*/
// 获取时间类型的方法,供外部调用以获取该挂号记录的时间类型
*
*/
public Integer getGuahaoTypes() {
return guahaoTypes;
}
/**
*
*/
// 设置时间类型的方法,供外部调用以设置该挂号记录的时间类型
*
*/
public void setGuahaoTypes(Integer guahaoTypes) {
this.guahaoTypes = guahaoTypes;
}
/**
*
*/
// 获取挂号状态的方法,供外部调用以获取该挂号记录的当前状态
*
*/
public Integer getGuahaoStatusTypes() {
return guahaoStatusTypes;
}
/**
*
*/
// 设置挂号状态的方法,供外部调用以设置该挂号记录的当前状态
*
*/
public void setGuahaoStatusTypes(Integer guahaoStatusTypes) {
this.guahaoStatusTypes = guahaoStatusTypes;
}
/**
*
*/
// 获取挂号审核状态的方法,供外部调用以获取该挂号记录的审核状态
*
*/
public Integer getGuahaoYesnoTypes() {
return guahaoYesnoTypes;
}
/**
*
*/
// 设置挂号审核状态的方法,供外部调用以设置该挂号记录的审核状态
*
*/
public void setGuahaoYesnoTypes(Integer guahaoYesnoTypes) {
this.guahaoYesnoTypes = guahaoYesnoTypes;
}
/**
*
*/
// 获取审核结果的方法,供外部调用以获取该挂号记录的审核具体结果信息
*
*/
public String getGuahaoYesnoText() {
return guahaoYesnoText;
}
/**
*
*/
// 设置审核结果的方法,供外部调用以设置该挂号记录的审核具体结果信息
*
*/
public void setGuahaoYesnoText(String guahaoYesnoText) {
this.guahaoYesnoText = guahaoYesnoText;
}
/**
*
*/
// 获取创建时间的方法,供外部调用以获取该挂号记录的创建时间
*
*/
public Date getCreateTime() {
return createTime;
}
/**
*
*/
// 设置创建时间的方法,供外部调用以设置该挂号记录的创建时间
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
}

@ -1,209 +1,189 @@
package com.entity.model;
// 导入JiankangjiaoyuEntity类可能用于与数据库实体进行交互或数据转换等操作
import com.entity.JiankangjiaoyuEntity;
// 导入MyBatis-Plus的TableName注解通常用于指定数据库表名但在当前代码中未实际使用该注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时对日期类型字段进行格式化处理
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时对日期类型字段进行格式化
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
*/
// 定义一个名为JiankangjiaoyuModel的类实现Serializable接口使该类的对象可以被序列化和反序列化
public class JiankangjiaoyuModel implements Serializable {
// 定义序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于唯一标识健康教育记录的主键,在数据库操作中通常作为唯一标识字段
private Integer id;
/**
*
*/
// 存储健康教育内容的标题,用于展示和区分不同的健康教育信息
private String jiankangjiaoyuName;
/**
*
*/
// 表示健康教育的具体类型,可能是如疾病预防、健康生活方式等不同分类,以整数类型存储
private Integer jiankangjiaoyuTypes;
/**
*
*/
// 存储健康教育相关的图片路径或标识,用于展示相关的图片内容
private String jiankangjiaoyuPhoto;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录健康教育内容的插入时间,即该记录创建或添加到系统的时间
@DateTimeFormat
private Date insertTime;
/**
*
*/
// 存储健康教育的详细内容,如具体的健康知识、建议等文本信息
private String jiankangjiaoyuContent;
/**
*
*/
// 用于实现逻辑删除的字段可能0表示未删除1表示已删除假删以整数类型存储
private Integer jiankangjiaoyuDelete;
/**
* show1 show2 nameShow
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录该健康教育记录的实际创建时间,可能与插入时间有所区别
@DateTimeFormat
private Date createTime;
/**
*
*/
// 获取主键ID的方法供外部调用以获取该健康教育记录的唯一标识
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键ID的方法供外部调用以设置该健康教育记录的唯一标识
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取健康教育标题的方法,供外部调用以获取该记录的标题信息
*
*/
public String getJiankangjiaoyuName() {
return jiankangjiaoyuName;
}
/**
*
*/
// 设置健康教育标题的方法,供外部调用以修改该记录的标题信息
*
*/
public void setJiankangjiaoyuName(String jiankangjiaoyuName) {
this.jiankangjiaoyuName = jiankangjiaoyuName;
}
/**
*
*/
// 获取健康教育类型的方法,供外部调用以获取该记录的类型信息
*
*/
public Integer getJiankangjiaoyuTypes() {
return jiankangjiaoyuTypes;
}
/**
*
*/
// 设置健康教育类型的方法,供外部调用以修改该记录的类型信息
*
*/
public void setJiankangjiaoyuTypes(Integer jiankangjiaoyuTypes) {
this.jiankangjiaoyuTypes = jiankangjiaoyuTypes;
}
/**
*
*/
// 获取健康教育图片相关信息的方法,供外部调用以获取图片路径或标识
*
*/
public String getJiankangjiaoyuPhoto() {
return jiankangjiaoyuPhoto;
}
/**
*
*/
// 设置健康教育图片相关信息的方法,供外部调用以修改图片路径或标识
*
*/
public void setJiankangjiaoyuPhoto(String jiankangjiaoyuPhoto) {
this.jiankangjiaoyuPhoto = jiankangjiaoyuPhoto;
}
/**
*
*/
// 获取健康教育内容插入时间的方法,供外部调用以获取该记录的插入时间
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置健康教育内容插入时间的方法,供外部调用以修改该记录的插入时间
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
// 获取健康教育详细内容的方法,供外部调用以获取该记录的详细文本信息
*
*/
public String getJiankangjiaoyuContent() {
return jiankangjiaoyuContent;
}
/**
*
*/
// 设置健康教育详细内容的方法,供外部调用以修改该记录的详细文本信息
*
*/
public void setJiankangjiaoyuContent(String jiankangjiaoyuContent) {
this.jiankangjiaoyuContent = jiankangjiaoyuContent;
}
/**
*
*/
// 获取逻辑删除标识的方法,供外部调用以获取该记录的假删状态
*
*/
public Integer getJiankangjiaoyuDelete() {
return jiankangjiaoyuDelete;
}
/**
*
*/
// 设置逻辑删除标识的方法,供外部调用以修改该记录的假删状态
*
*/
public void setJiankangjiaoyuDelete(Integer jiankangjiaoyuDelete) {
this.jiankangjiaoyuDelete = jiankangjiaoyuDelete;
}
/**
* show1 show2 nameShow
*/
// 获取健康教育记录创建时间的方法,供外部调用以获取该记录的实际创建时间
* show1 show2 nameShow
*/
public Date getCreateTime() {
return createTime;
}
/**
* show1 show2 nameShow
*/
// 设置健康教育记录创建时间的方法,供外部调用以修改该记录的实际创建时间
* show1 show2 nameShow
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
}

@ -1,188 +1,169 @@
package com.entity.model;
// 导入NewsEntity类可能用于与数据库实体交互或进行数据转换
import com.entity.NewsEntity;
// 导入MyBatis-Plus的TableName注解通常用于指定实体类对应的数据库表名但此代码未实际使用
import com.baomidou.mybatisplus.annotations.TableName;
// 导入Jackson的JsonFormat注解用于在JSON序列化和反序列化时对日期类型字段进行格式化
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
// 导入Spring的DateTimeFormat注解用于在处理表单数据时对日期类型字段进行格式化
import org.springframework.format.annotation.DateTimeFormat;
// 导入Serializable接口实现该接口意味着该类的对象可以被序列化和反序列化
import java.io.Serializable;
/**
*
*
* entity
* ModelAndView model
*/
// 定义一个名为NewsModel的类实现Serializable接口
public class NewsModel implements Serializable {
// 序列化版本号,用于保证序列化和反序列化过程中类的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于唯一标识每条公告信息的主键
private Integer id;
/**
*
*/
// 存储公告的名称,用于在列表等地方显示公告的标题
private String newsName;
/**
*
*/
// 存储公告相关图片的路径或标识
private String newsPhoto;
/**
*
*/
// 用整数表示公告的类型,不同的数值可能代表不同的公告分类
private Integer newsTypes;
/**
*
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录公告发布的具体时间
@DateTimeFormat
private Date insertTime;
/**
*
*/
// 存储公告的详细内容,如具体的通知信息等
private String newsContent;
/**
* show1 show2 nameShow
*/
// 设置JSON序列化时日期的格式使用中文环境时区为东八区格式为 "yyyy-MM-dd HH:mm:ss"
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
// 用于Spring MVC接收表单数据时将日期字符串转换为Date对象
@DateTimeFormat
// 记录该公告信息在系统中创建的时间
@DateTimeFormat
private Date createTime;
/**
*
*/
// 获取主键ID的公共方法供外部调用获取公告的唯一标识
*
*/
public Integer getId() {
return id;
}
/**
*
*/
// 设置主键ID的公共方法供外部调用设置公告的唯一标识
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
// 获取公告名称的公共方法,供外部调用获取公告的标题
*
*/
public String getNewsName() {
return newsName;
}
/**
*
*/
// 设置公告名称的公共方法,供外部调用修改公告的标题
*
*/
public void setNewsName(String newsName) {
this.newsName = newsName;
}
/**
*
*/
// 获取公告图片路径或标识的公共方法,供外部调用获取公告的图片信息
*
*/
public String getNewsPhoto() {
return newsPhoto;
}
/**
*
*/
// 设置公告图片路径或标识的公共方法,供外部调用修改公告的图片信息
*
*/
public void setNewsPhoto(String newsPhoto) {
this.newsPhoto = newsPhoto;
}
/**
*
*/
// 获取公告类型的公共方法,供外部调用获取公告的分类信息
*
*/
public Integer getNewsTypes() {
return newsTypes;
}
/**
*
*/
// 设置公告类型的公共方法,供外部调用修改公告的分类信息
*
*/
public void setNewsTypes(Integer newsTypes) {
this.newsTypes = newsTypes;
}
/**
*
*/
// 获取公告发布时间的公共方法,供外部调用获取公告的发布时间
*
*/
public Date getInsertTime() {
return insertTime;
}
/**
*
*/
// 设置公告发布时间的公共方法,供外部调用修改公告的发布时间
*
*/
public void setInsertTime(Date insertTime) {
this.insertTime = insertTime;
}
/**
*
*/
// 获取公告详细内容的公共方法,供外部调用获取公告的具体信息
*
*/
public String getNewsContent() {
return newsContent;
}
/**
*
*/
// 设置公告详细内容的公共方法,供外部调用修改公告的具体信息
*
*/
public void setNewsContent(String newsContent) {
this.newsContent = newsContent;
}
/**
* show1 show2 nameShow
*/
// 获取公告创建时间的公共方法,供外部调用获取公告在系统中的创建时间
* show1 show2 nameShow
*/
public Date getCreateTime() {
return createTime;
}
/**
* show1 show2 nameShow
*/
// 设置公告创建时间的公共方法,供外部调用修改公告在系统中的创建时间
* show1 show2 nameShow
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
}

@ -15,10 +15,7 @@ import java.io.Serializable;
* ModelAndView model
*/
public class YishengModel implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L; // 序列化版本UID用于版本控制
/**
*
@ -100,215 +97,245 @@ public class YishengModel implements Serializable {
* 使@JsonFormat@DateTimeFormat
*/
@JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss")
@DateTimeFormat
@DateTimeFormat
private Date createTime;
/**
*
*/
* ID
* @return ID
*/
public Integer getId() {
return id;
}
/**
*
*/
* ID
* @param id ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
*
* @return
*/
public String getYishengUuidNumber() {
return yishengUuidNumber;
}
/**
*
*/
*
* @param yishengUuidNumber
*/
public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber;
}
/**
*
*/
*
* @return
*/
public String getUsername() {
return username;
}
/**
*
*/
*
* @param username
*/
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
*
* @return
*/
public String getPassword() {
return password;
}
/**
*
*/
*
* @param password
*/
public void setPassword(String password) {
this.password = password;
}
/**
*
*/
*
* @return
*/
public String getYishengName() {
return yishengName;
}
/**
*
*/
*
* @param yishengName
*/
public void setYishengName(String yishengName) {
this.yishengName = yishengName;
}
/**
*
*/
*
* @return
*/
public Integer getYishengTypes() {
return yishengTypes;
}
/**
*
*/
*
* @param yishengTypes
*/
public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes;
}
/**
*
*/
*
* @return
*/
public Integer getZhiweiTypes() {
return zhiweiTypes;
}
/**
*
*/
*
* @param zhiweiTypes
*/
public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes;
}
/**
*
*/
*
* @return
*/
public String getYishengZhichneg() {
return yishengZhichneg;
}
/**
*
*/
*
* @param yishengZhichneg
*/
public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg;
}
/**
*
*/
*
* @return
*/
public String getYishengPhoto() {
return yishengPhoto;
}
/**
*
*/
*
* @param yishengPhoto
*/
public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto;
}
/**
*
*/
*
* @return
*/
public String getYishengPhone() {
return yishengPhone;
}
/**
*
*/
*
* @param yishengPhone
*/
public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone;
}
/**
*
*/
*
* @return
*/
public String getYishengGuahao() {
return yishengGuahao;
}
/**
*
*/
*
* @param yishengGuahao
*/
public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao;
}
/**
*
*/
*
* @return
*/
public String getYishengEmail() {
return yishengEmail;
}
/**
*
*/
*
* @param yishengEmail
*/
public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail;
}
/**
*
*/
*
* @return
*/
public Double getYishengNewMoney() {
return yishengNewMoney;
}
/**
*
*/
*
* @param yishengNewMoney
*/
public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney;
}
/**
*
*/
*
* @return
*/
public String getYishengContent() {
return yishengContent;
}
/**
*
*/
*
* @param yishengContent
*/
public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent;
}
/**
* show1 show2 photoShow
*/
*
* @return
*/
public Date getCreateTime() {
return createTime;
}
/**
* show1 show2 photoShow
*/
*
* @param createTime
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

@ -18,62 +18,75 @@ import java.io.Serializable;
public class YonghuModel implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
private Integer id;
/**
*
*/
private String username;
/**
*
*/
private String password;
/**
*
*/
private String yonghuName;
/**
*
*/
private String yonghuPhoto;
/**
*
*/
private String yonghuPhone;
/**
*
*/
private String yonghuIdNumber;
/**
*
*/
private String yonghuEmail;
/**
*
*/
private Integer sexTypes;
/**
*
*/
private Double newMoney;
/**
*
* 01
*/
private Integer yonghuDelete;
/**
*
*/
@ -81,6 +94,7 @@ public class YonghuModel implements Serializable {
@DateTimeFormat
private Date createTime;
/**
*
*/
@ -88,13 +102,13 @@ public class YonghuModel implements Serializable {
return id;
}
/**
*
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*/
@ -102,13 +116,13 @@ public class YonghuModel implements Serializable {
return username;
}
/**
*
*/
public void setUsername(String username) {
this.username = username;
}
/**
*
*/
@ -116,13 +130,13 @@ public class YonghuModel implements Serializable {
return password;
}
/**
*
*/
public void setPassword(String password) {
this.password = password;
}
/**
*
*/
@ -130,13 +144,13 @@ public class YonghuModel implements Serializable {
return yonghuName;
}
/**
*
*/
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
@ -144,13 +158,13 @@ public class YonghuModel implements Serializable {
return yonghuPhoto;
}
/**
*
*/
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
@ -158,13 +172,13 @@ public class YonghuModel implements Serializable {
return yonghuPhone;
}
/**
*
*/
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
@ -172,13 +186,13 @@ public class YonghuModel implements Serializable {
return yonghuIdNumber;
}
/**
*
*/
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
@ -186,13 +200,13 @@ public class YonghuModel implements Serializable {
return yonghuEmail;
}
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
@ -200,13 +214,13 @@ public class YonghuModel implements Serializable {
return sexTypes;
}
/**
*
*/
public void setSexTypes(Integer sexTypes) {
this.sexTypes = sexTypes;
}
/**
*
*/
@ -214,13 +228,13 @@ public class YonghuModel implements Serializable {
return newMoney;
}
/**
*
*/
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
@ -228,13 +242,13 @@ public class YonghuModel implements Serializable {
return yonghuDelete;
}
/**
*
*/
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
/**
*
*/
@ -242,10 +256,12 @@ public class YonghuModel implements Serializable {
return createTime;
}
/**
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
}

@ -14,226 +14,191 @@ import java.util.Date;
*
* 使
*/
// 使用TableName注解指定该类对应的数据库表名为 "chat"
@TableName("chat")
// ChatView类继承自ChatEntity类并实现了Serializable接口以便对象可以被序列化和反序列化
public class ChatView extends ChatEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于存储在线咨询相关的状态值,可能表示咨询的状态(如进行中、已结束等)
private String zhuangtaiValue;
/**
*
*/
// 用于存储在线咨询的数据类型相关的值,具体含义可能根据业务需求而定
private String chatValue;
// 级联表 yonghu
/**
*
*/
// 存储与在线咨询相关联的用户的姓名信息
private String yonghuName;
/**
*
*/
// 存储与在线咨询相关联的用户的头像路径或标识
private String yonghuPhoto;
/**
*
*/
// 存储与在线咨询相关联的用户的手机号码,用于联系用户
private String yonghuPhone;
/**
*
*/
// 存储与在线咨询相关联的用户的身份证号码,用于身份验证等业务
private String yonghuIdNumber;
/**
*
*/
// 存储与在线咨询相关联的用户的电子邮箱地址,可用于发送通知等
private String yonghuEmail;
/**
*
*/
// 存储与在线咨询相关联的用户的账户余额,可能与咨询费用等相关
private Double newMoney;
/**
*
*/
// 用于标识与在线咨询相关联的用户记录是否被逻辑删除假删0表示未删除1表示已删除
private Integer yonghuDelete;
// 无参构造函数用于创建ChatView对象
private static final long serialVersionUID = 1L;
/**
*
*/
private String zhuangtaiValue;
/**
*
*/
private String chatValue;
//级联表 yonghu
/**
*
*/
private String yonghuName;
/**
*
*/
private String yonghuPhoto;
/**
*
*/
private String yonghuPhone;
/**
*
*/
private String yonghuIdNumber;
/**
*
*/
private String yonghuEmail;
/**
*
*/
private Double newMoney;
/**
*
*/
private Integer yonghuDelete;
public ChatView() {
}
// 构造函数接受一个ChatEntity对象作为参数通过BeanUtils.copyProperties方法
// 将ChatEntity对象的属性值复制到当前ChatView对象中
public ChatView(ChatEntity chatEntity) {
try {
BeanUtils.copyProperties(this, chatEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中出现异常,打印异常堆栈信息
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
*/
// 获取状态值的方法外部可以通过调用该方法获取zhuangtaiValue属性的值
public String getZhuangtaiValue() {
return zhuangtaiValue;
}
/**
*
*/
// 设置状态值的方法外部可以通过调用该方法设置zhuangtaiValue属性的值
public void setZhuangtaiValue(String zhuangtaiValue) {
this.zhuangtaiValue = zhuangtaiValue;
}
/**
*
*/
// 获取数据类型值的方法外部可以通过调用该方法获取chatValue属性的值
public String getChatValue() {
return chatValue;
}
/**
*
*/
// 设置数据类型值的方法外部可以通过调用该方法设置chatValue属性的值
public void setChatValue(String chatValue) {
this.chatValue = chatValue;
}
// 级联表的get和set yonghu
/**
*
*/
// 获取用户姓名的方法外部可以通过调用该方法获取yonghuName属性的值
public String getYonghuName() {
return yonghuName;
}
/**
*
*/
// 设置用户姓名的方法外部可以通过调用该方法设置yonghuName属性的值
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
// 获取用户头像的方法外部可以通过调用该方法获取yonghuPhoto属性的值
public String getYonghuPhoto() {
return yonghuPhoto;
}
/**
*
*/
// 设置用户头像的方法外部可以通过调用该方法设置yonghuPhoto属性的值
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
// 获取用户手机号的方法外部可以通过调用该方法获取yonghuPhone属性的值
public String getYonghuPhone() {
return yonghuPhone;
}
/**
*
*/
// 设置用户手机号的方法外部可以通过调用该方法设置yonghuPhone属性的值
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
// 获取用户身份证号的方法外部可以通过调用该方法获取yonghuIdNumber属性的值
public String getYonghuIdNumber() {
return yonghuIdNumber;
}
/**
*
*/
// 设置用户身份证号的方法外部可以通过调用该方法设置yonghuIdNumber属性的值
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
// 获取用户邮箱的方法外部可以通过调用该方法获取yonghuEmail属性的值
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
*/
// 设置用户邮箱的方法外部可以通过调用该方法设置yonghuEmail属性的值
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
// 获取用户余额的方法外部可以通过调用该方法获取newMoney属性的值
public Double getNewMoney() {
return newMoney;
}
/**
*
*/
// 设置用户余额的方法外部可以通过调用该方法设置newMoney属性的值
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
// 获取用户假删状态的方法外部可以通过调用该方法获取yonghuDelete属性的值
public Integer getYonghuDelete() {
return yonghuDelete;
}
/**
*
*/
// 设置用户假删状态的方法外部可以通过调用该方法设置yonghuDelete属性的值
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
}
/**
*
*/
public String getZhuangtaiValue() {
return zhuangtaiValue;
}
/**
*
*/
public void setZhuangtaiValue(String zhuangtaiValue) {
this.zhuangtaiValue = zhuangtaiValue;
}
/**
*
*/
public String getChatValue() {
return chatValue;
}
/**
*
*/
public void setChatValue(String chatValue) {
this.chatValue = chatValue;
}
//级联表的get和set yonghu
/**
*
*/
public String getYonghuName() {
return yonghuName;
}
/**
*
*/
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
public String getYonghuPhoto() {
return yonghuPhoto;
}
/**
*
*/
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
public String getYonghuPhone() {
return yonghuPhone;
}
/**
*
*/
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
public String getYonghuIdNumber() {
return yonghuIdNumber;
}
/**
*
*/
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
public Double getNewMoney() {
return newMoney;
}
/**
*
*/
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
public Integer getYonghuDelete() {
return yonghuDelete;
}
/**
*
*/
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
}

@ -14,29 +14,44 @@ import java.util.Date;
*
* 使
*/
// 使用TableName注解指定该类对应的数据库表名为 "dictionary"
@TableName("dictionary")
// DictionaryView类继承自DictionaryEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,方便在网络传输或存储中使用
public class DictionaryView extends DictionaryEntity implements Serializable {
// 序列化版本号,用于确保在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
// 无参构造函数用于创建DictionaryView对象在不需要初始化特定属性时使用
public DictionaryView() {
}
// 构造函数接受一个DictionaryEntity对象作为参数
// 通过BeanUtils.copyProperties方法将DictionaryEntity对象的属性值复制到当前DictionaryView对象中
// 这样可以方便地从Entity对象转换为View对象减少手动赋值的工作量
public DictionaryView(DictionaryEntity dictionaryEntity) {
try {
BeanUtils.copyProperties(this, dictionaryEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中发生异常(例如属性访问权限问题或反射调用目标方法失败)
// 打印异常堆栈信息,以便开发人员调试和定位问题
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}

@ -14,499 +14,430 @@ import java.util.Date;
*
* 使
*/
// 使用TableName注解指定该类对应的数据库表名为 "guahao"
@TableName("guahao")
// GuahaoView类继承自GuahaoEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,便于在网络传输或存储中使用
public class GuahaoView extends GuahaoEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
/**
*
*/
// 用于存储挂号相关的时间类型的值,可能表示不同的挂号时间分类等
private String guahaoValue;
/**
*
*/
// 用于存储挂号状态的具体值,例如已挂号、已取消、已就诊等状态的描述
private String guahaoStatusValue;
/**
*
*/
// 用于存储挂号审核结果的具体值,例如审核通过、审核不通过等描述
private String guahaoYesnoValue;
// 级联表 yisheng
/**
*
*/
// 存储与该挂号记录关联的医生的工号,用于唯一标识医生
private String yishengUuidNumber;
/**
*
*/
// 存储与该挂号记录关联的医生的姓名
private String yishengName;
/**
*
*/
// 用整数表示与该挂号记录关联的医生所属的科室
private Integer yishengTypes;
/**
*
*/
// 存储科室的具体描述值可能是科室的名称等与yishengTypes配合使用
private String yishengValue;
/**
*
*/
// 用整数表示与该挂号记录关联的医生的职位
private Integer zhiweiTypes;
/**
*
*/
// 存储职位的具体描述值可能是职位的名称等与zhiweiTypes配合使用
private String zhiweiValue;
/**
*
*/
// 存储与该挂号记录关联的医生的职称信息
private String yishengZhichneg;
/**
*
*/
// 存储与该挂号记录关联的医生的头像路径或标识
private String yishengPhoto;
/**
*
*/
// 存储与该挂号记录关联的医生的联系电话或其他联系方式
private String yishengPhone;
/**
*
*/
// 存储与该医生相关的挂号注意事项和规定等信息
private String yishengGuahao;
/**
*
*/
// 存储与该挂号记录关联的医生的电子邮箱地址
private String yishengEmail;
/**
*
*/
// 存储该医生的挂号费用金额以Double类型表示
private Double yishengNewMoney;
/**
*
*/
// 存储与该挂号记录关联的医生的个人履历和专业介绍等信息
private String yishengContent;
// 级联表 yonghu
/**
*
*/
// 存储与该挂号记录关联的用户的姓名
private String yonghuName;
/**
*
*/
// 存储与该挂号记录关联的用户的头像路径或标识
private String yonghuPhoto;
/**
*
*/
// 存储与该挂号记录关联的用户的手机号码,用于联系用户
private String yonghuPhone;
/**
*
*/
// 存储与该挂号记录关联的用户的身份证号码,用于身份验证等业务
private String yonghuIdNumber;
/**
*
*/
// 存储与该挂号记录关联的用户的电子邮箱地址,可用于发送通知等
private String yonghuEmail;
/**
*
*/
// 存储与该挂号记录关联的用户的账户余额,可能与挂号费用支付等相关
private Double newMoney;
/**
*
*/
// 用于标识与该挂号记录关联的用户记录是否被逻辑删除假删0表示未删除1表示已删除
private Integer yonghuDelete;
// 无参构造函数用于创建GuahaoView对象
private static final long serialVersionUID = 1L;
/**
*
*/
private String guahaoValue;
/**
*
*/
private String guahaoStatusValue;
/**
*
*/
private String guahaoYesnoValue;
//级联表 yisheng
/**
*
*/
private String yishengUuidNumber;
/**
*
*/
private String yishengName;
/**
*
*/
private Integer yishengTypes;
/**
*
*/
private String yishengValue;
/**
*
*/
private Integer zhiweiTypes;
/**
*
*/
private String zhiweiValue;
/**
*
*/
private String yishengZhichneg;
/**
*
*/
private String yishengPhoto;
/**
*
*/
private String yishengPhone;
/**
*
*/
private String yishengGuahao;
/**
*
*/
private String yishengEmail;
/**
*
*/
private Double yishengNewMoney;
/**
*
*/
private String yishengContent;
//级联表 yonghu
/**
*
*/
private String yonghuName;
/**
*
*/
private String yonghuPhoto;
/**
*
*/
private String yonghuPhone;
/**
*
*/
private String yonghuIdNumber;
/**
*
*/
private String yonghuEmail;
/**
*
*/
private Double newMoney;
/**
*
*/
private Integer yonghuDelete;
public GuahaoView() {
}
// 构造函数接受一个GuahaoEntity对象作为参数
// 通过BeanUtils.copyProperties方法将GuahaoEntity对象的属性值复制到当前GuahaoView对象中
public GuahaoView(GuahaoEntity guahaoEntity) {
try {
BeanUtils.copyProperties(this, guahaoEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中出现异常,打印异常堆栈信息
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
*/
// 获取时间类型值的方法外部可以通过调用该方法获取guahaoValue属性的值
public String getGuahaoValue() {
return guahaoValue;
}
/**
*
*/
// 设置时间类型值的方法外部可以通过调用该方法设置guahaoValue属性的值
public void setGuahaoValue(String guahaoValue) {
this.guahaoValue = guahaoValue;
}
/**
*
*/
// 获取挂号状态值的方法外部可以通过调用该方法获取guahaoStatusValue属性的值
public String getGuahaoStatusValue() {
return guahaoStatusValue;
}
/**
*
*/
// 设置挂号状态值的方法外部可以通过调用该方法设置guahaoStatusValue属性的值
public void setGuahaoStatusValue(String guahaoStatusValue) {
this.guahaoStatusValue = guahaoStatusValue;
}
/**
*
*/
// 获取挂号审核值的方法外部可以通过调用该方法获取guahaoYesnoValue属性的值
public String getGuahaoYesnoValue() {
return guahaoYesnoValue;
}
/**
*
*/
// 设置挂号审核值的方法外部可以通过调用该方法设置guahaoYesnoValue属性的值
public void setGuahaoYesnoValue(String guahaoYesnoValue) {
this.guahaoYesnoValue = guahaoYesnoValue;
}
// 级联表的get和set yisheng
/**
*
*/
// 获取医生工号的方法外部可以通过调用该方法获取yishengUuidNumber属性的值
public String getYishengUuidNumber() {
return yishengUuidNumber;
}
/**
*
*/
// 设置医生工号的方法外部可以通过调用该方法设置yishengUuidNumber属性的值
public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber;
}
/**
*
*/
// 获取医生名称的方法外部可以通过调用该方法获取yishengName属性的值
public String getYishengName() {
return yishengName;
}
/**
*
*/
// 设置医生名称的方法外部可以通过调用该方法设置yishengName属性的值
public void setYishengName(String yishengName) {
this.yishengName = yishengName;
}
/**
*
*/
// 获取科室编号的方法外部可以通过调用该方法获取yishengTypes属性的值
public Integer getYishengTypes() {
return yishengTypes;
}
/**
*
*/
// 设置科室编号的方法外部可以通过调用该方法设置yishengTypes属性的值
public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes;
}
/**
*
*/
// 获取科室描述值的方法外部可以通过调用该方法获取yishengValue属性的值
public String getYishengValue() {
return yishengValue;
}
/**
*
*/
// 设置科室描述值的方法外部可以通过调用该方法设置yishengValue属性的值
public void setYishengValue(String yishengValue) {
this.yishengValue = yishengValue;
}
/**
*
*/
// 获取职位编号的方法外部可以通过调用该方法获取zhiweiTypes属性的值
public Integer getZhiweiTypes() {
return zhiweiTypes;
}
/**
*
*/
// 设置职位编号的方法外部可以通过调用该方法设置zhiweiTypes属性的值
public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes;
}
/**
*
*/
// 获取职位描述值的方法外部可以通过调用该方法获取zhiweiValue属性的值
public String getZhiweiValue() {
return zhiweiValue;
}
/**
*
*/
// 设置职位描述值的方法外部可以通过调用该方法设置zhiweiValue属性的值
public void setZhiweiValue(String zhiweiValue) {
this.zhiweiValue = zhiweiValue;
}
/**
*
*/
// 获取职称信息的方法外部可以通过调用该方法获取yishengZhichneg属性的值
public String getYishengZhichneg() {
return yishengZhichneg;
}
/**
*
*/
// 设置职称信息的方法外部可以通过调用该方法设置yishengZhichneg属性的值
public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg;
}
/**
*
*/
// 获取医生头像路径或标识的方法外部可以通过调用该方法获取yishengPhoto属性的值
public String getYishengPhoto() {
return yishengPhoto;
}
/**
*
*/
// 设置医生头像路径或标识的方法外部可以通过调用该方法设置yishengPhoto属性的值
public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto;
}
/**
*
*/
// 获取医生联系方式的方法外部可以通过调用该方法获取yishengPhone属性的值
public String getYishengPhone() {
return yishengPhone;
}
/**
*
*/
// 设置医生联系方式的方法外部可以通过调用该方法设置yishengPhone属性的值
public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone;
}
/**
*
*/
// 获取挂号须知信息的方法外部可以通过调用该方法获取yishengGuahao属性的值
public String getYishengGuahao() {
return yishengGuahao;
}
/**
*
*/
// 设置挂号须知信息的方法外部可以通过调用该方法设置yishengGuahao属性的值
public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao;
}
/**
*
*/
// 获取医生邮箱地址的方法外部可以通过调用该方法获取yishengEmail属性的值
public String getYishengEmail() {
return yishengEmail;
}
/**
*
*/
// 设置医生邮箱地址的方法外部可以通过调用该方法设置yishengEmail属性的值
public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail;
}
/**
*
*/
// 获取挂号价格信息的方法外部可以通过调用该方法获取yishengNewMoney属性的值
public Double getYishengNewMoney() {
return yishengNewMoney;
}
/**
*
*/
// 设置挂号价格信息的方法外部可以通过调用该方法设置yishengNewMoney属性的值
public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney;
}
/**
*
*/
// 获取医生履历介绍信息的方法外部可以通过调用该方法获取yishengContent属性的值
public String getYishengContent() {
return yishengContent;
}
/**
*
*/
// 设置医生履历介绍信息的方法外部可以通过调用该方法设置yishengContent属性的值
public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent;
}
// 级联表的get和set yonghu
/**
*
*/
// 获取用户姓名的方法外部可以通过调用该方法获取yonghuName属性的值
public String getYonghuName() {
return yonghuName;
}
/**
*
*/
// 设置用户姓名的方法外部可以通过调用该方法设置yonghuName属性的值
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
// 获取用户头像路径或标识的方法外部可以通过调用该方法获取yonghuPhoto属性的值
public String getYonghuPhoto() {
return yonghuPhoto;
}
/**
*
*/
// 设置用户头像路径或标识的方法外部可以通过调用该方法设置yonghuPhoto属性的值
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
// 获取用户手机号的方法外部可以通过调用该方法获取yonghuPhone属性的值
public String getYonghuPhone() {
return yonghuPhone;
}
/**
*
*/
// 设置用户手机号的方法外部可以通过调用该方法设置yonghuPhone属性的值
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
// 获取用户身份证号的方法外部可以通过调用该方法获取yonghuIdNumber属性的值
public String getYonghuIdNumber() {
return yonghuIdNumber;
}
/**
*
*/
// 设置用户身份证号的方法外部可以通过调用该方法设置yonghuIdNumber属性的值
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
// 获取用户邮箱地址的方法外部可以通过调用该方法获取yonghuEmail属性的值
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
/**
*
*/
public String getGuahaoValue() {
return guahaoValue;
}
/**
*
*/
public void setGuahaoValue(String guahaoValue) {
this.guahaoValue = guahaoValue;
}
/**
*
*/
public String getGuahaoStatusValue() {
return guahaoStatusValue;
}
/**
*
*/
public void setGuahaoStatusValue(String guahaoStatusValue) {
this.guahaoStatusValue = guahaoStatusValue;
}
/**
*
*/
public String getGuahaoYesnoValue() {
return guahaoYesnoValue;
}
/**
*
*/
public void setGuahaoYesnoValue(String guahaoYesnoValue) {
this.guahaoYesnoValue = guahaoYesnoValue;
}
//级联表的get和set yisheng
/**
*
*/
public String getYishengUuidNumber() {
return yishengUuidNumber;
}
/**
*
*/
public void setYishengUuidNumber(String yishengUuidNumber) {
this.yishengUuidNumber = yishengUuidNumber;
}
/**
*
*/
public String getYishengName() {
return yishengName;
}
/**
*
*/
public void setYishengName(String yishengName) {
this.yishengName = yishengName;
}
/**
*
*/
public Integer getYishengTypes() {
return yishengTypes;
}
/**
*
*/
public void setYishengTypes(Integer yishengTypes) {
this.yishengTypes = yishengTypes;
}
/**
*
*/
public String getYishengValue() {
return yishengValue;
}
/**
*
*/
public void setYishengValue(String yishengValue) {
this.yishengValue = yishengValue;
}
/**
*
*/
public Integer getZhiweiTypes() {
return zhiweiTypes;
}
/**
*
*/
public void setZhiweiTypes(Integer zhiweiTypes) {
this.zhiweiTypes = zhiweiTypes;
}
/**
*
*/
public String getZhiweiValue() {
return zhiweiValue;
}
/**
*
*/
public void setZhiweiValue(String zhiweiValue) {
this.zhiweiValue = zhiweiValue;
}
/**
*
*/
public String getYishengZhichneg() {
return yishengZhichneg;
}
/**
*
*/
public void setYishengZhichneg(String yishengZhichneg) {
this.yishengZhichneg = yishengZhichneg;
}
/**
*
*/
public String getYishengPhoto() {
return yishengPhoto;
}
/**
*
*/
public void setYishengPhoto(String yishengPhoto) {
this.yishengPhoto = yishengPhoto;
}
/**
*
*/
public String getYishengPhone() {
return yishengPhone;
}
/**
*
*/
public void setYishengPhone(String yishengPhone) {
this.yishengPhone = yishengPhone;
}
/**
*
*/
public String getYishengGuahao() {
return yishengGuahao;
}
/**
*
*/
public void setYishengGuahao(String yishengGuahao) {
this.yishengGuahao = yishengGuahao;
}
/**
*
*/
public String getYishengEmail() {
return yishengEmail;
}
/**
*
*/
public void setYishengEmail(String yishengEmail) {
this.yishengEmail = yishengEmail;
}
/**
*
*/
public Double getYishengNewMoney() {
return yishengNewMoney;
}
/**
*
*/
public void setYishengNewMoney(Double yishengNewMoney) {
this.yishengNewMoney = yishengNewMoney;
}
/**
*
*/
public String getYishengContent() {
return yishengContent;
}
/**
*
*/
public void setYishengContent(String yishengContent) {
this.yishengContent = yishengContent;
}
//级联表的get和set yonghu
/**
*
*/
public String getYonghuName() {
return yonghuName;
}
/**
*
*/
public void setYonghuName(String yonghuName) {
this.yonghuName = yonghuName;
}
/**
*
*/
public String getYonghuPhoto() {
return yonghuPhoto;
}
/**
*
*/
public void setYonghuPhoto(String yonghuPhoto) {
this.yonghuPhoto = yonghuPhoto;
}
/**
*
*/
public String getYonghuPhone() {
return yonghuPhone;
}
/**
*
*/
public void setYonghuPhone(String yonghuPhone) {
this.yonghuPhone = yonghuPhone;
}
/**
*
*/
public String getYonghuIdNumber() {
return yonghuIdNumber;
}
/**
*
*/
public void setYonghuIdNumber(String yonghuIdNumber) {
this.yonghuIdNumber = yonghuIdNumber;
}
/**
*
*/
public String getYonghuEmail() {
return yonghuEmail;
}
/**
*
*/
public void setYonghuEmail(String yonghuEmail) {
this.yonghuEmail = yonghuEmail;
}
/**
*
*/
public Double getNewMoney() {
return newMoney;
}
/**
*
*/
public void setNewMoney(Double newMoney) {
this.newMoney = newMoney;
}
/**
*
*/
public Integer getYonghuDelete() {
return yonghuDelete;
}
/**
*
*/
public void setYonghuDelete(Integer yonghuDelete) {
this.yonghuDelete = yonghuDelete;
}
}

@ -14,51 +14,52 @@ import java.util.Date;
*
* 使
*/
// 使用TableName注解指定该类对应的数据库表名为 "jiankangjiaoyu"
@TableName("jiankangjiaoyu")
// JiankangjiaoyuView类继承自JiankangjiaoyuEntity类并实现了Serializable接口
// 使得该类的对象可以被序列化和反序列化,方便在网络传输或存储中使用
public class JiankangjiaoyuView extends JiankangjiaoyuEntity implements Serializable {
// 序列化版本号,用于保证在不同版本的类之间进行序列化和反序列化时的兼容性
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
private String jiankangjiaoyuValue;
/**
*
*/
// 用于存储健康教育相关的类型值,可能表示不同的健康教育分类,如疾病预防、健康生活方式等
private String jiankangjiaoyuValue;
// 无参构造函数用于创建JiankangjiaoyuView对象在不需要初始化特定属性时使用
public JiankangjiaoyuView() {
}
// 构造函数接受一个JiankangjiaoyuEntity对象作为参数
// 通过BeanUtils.copyProperties方法将JiankangjiaoyuEntity对象的属性值复制到当前JiankangjiaoyuView对象中
// 这样可以方便地从Entity对象转换为View对象减少手动赋值的工作量
public JiankangjiaoyuView(JiankangjiaoyuEntity jiankangjiaoyuEntity) {
try {
BeanUtils.copyProperties(this, jiankangjiaoyuEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果在复制属性过程中发生异常(例如属性访问权限问题或反射调用目标方法失败),
// 打印异常堆栈信息,以便开发人员调试和定位问题
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
*/
// 获取健康教育类型值的方法外部可以通过调用该方法获取jiankangjiaoyuValue属性的值
public String getJiankangjiaoyuValue() {
return jiankangjiaoyuValue;
}
/**
*
*/
// 设置健康教育类型值的方法外部可以通过调用该方法设置jiankangjiaoyuValue属性的值
public void setJiankangjiaoyuValue(String jiankangjiaoyuValue) {
this.jiankangjiaoyuValue = jiankangjiaoyuValue;
}
}
/**
*
*/
public String getJiankangjiaoyuValue() {
return jiankangjiaoyuValue;
}
/**
*
*/
public void setJiankangjiaoyuValue(String jiankangjiaoyuValue) {
this.jiankangjiaoyuValue = jiankangjiaoyuValue;
}
}

@ -1,20 +1,12 @@
package com.entity.view;
// 导入公告信息实体类NewsView 会继承该类
import com.entity.NewsEntity;
// 导入 MyBatis-Plus 用于指定数据库表名的注解
import com.baomidou.mybatisplus.annotations.TableName;
// 导入 Apache Commons BeanUtils 工具类,用于对象属性复制
import org.apache.commons.beanutils.BeanUtils;
// 导入反射调用可能抛出的异常类
import java.lang.reflect.InvocationTargetException;
// 导入 Spring 框架用于日期格式化的注解
import org.springframework.format.annotation.DateTimeFormat;
// 导入 Jackson 用于 JSON 序列化时日期格式化的注解
import com.fasterxml.jackson.annotation.JsonFormat;
// 导入序列化接口
import java.io.Serializable;
// 导入日期类
import java.util.Date;
/**
@ -22,48 +14,52 @@ import java.util.Date;
*
* 使
*/
// 指定该类对应数据库中的 news 表
@TableName("news")
// NewsView 类继承自 NewsEntity 类,并实现 Serializable 接口,可进行序列化操作
public class NewsView extends NewsEntity implements Serializable {
// 序列化版本号,确保序列化和反序列化的兼容性
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
*
*/
private String newsValue;
/**
*
*/
// 存储公告类型的具体描述值,例如“紧急通知”“普通公告”等
private String newsValue;
// 无参构造函数,方便创建 NewsView 类的实例
public NewsView() {
}
// 带参构造函数,接收一个 NewsEntity 对象,将其属性复制到当前 NewsView 对象
public NewsView(NewsEntity newsEntity) {
try {
// 使用 BeanUtils 工具类复制属性
BeanUtils.copyProperties(this, newsEntity);
} catch (IllegalAccessException | InvocationTargetException e) {
// 若复制属性过程中出现异常,打印异常堆栈信息
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
*
*/
// 获取公告类型值的方法
public String getNewsValue() {
return newsValue;
}
/**
*
*/
// 设置公告类型值的方法
public void setNewsValue(String newsValue) {
this.newsValue = newsValue;
}
}
/**
*
*/
public String getNewsValue() {
return newsValue;
}
/**
*
*/
public void setNewsValue(String newsValue) {
this.newsValue = newsValue;
}
}

@ -9,7 +9,6 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
/**
*
*
@ -19,10 +18,9 @@ import java.util.Date;
public class YonghuView extends YonghuEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
*
*/
/**
*
*/
private String sexValue;
@ -42,17 +40,15 @@ public class YonghuView extends YonghuEntity implements Serializable {
/**
*
*/
/**
*
*/
public String getSexValue() {
return sexValue;
}
/**
*
*/
/**
*
*/
public void setSexValue(String sexValue) {
this.sexValue = sexValue;
}

@ -29,18 +29,19 @@ public class AuthorizationInterceptor implements HandlerInterceptor {
public static final String LOGIN_TOKEN_KEY = "Token";
@Autowired
private TokenService tokenService; // 注入 TokenService
private TokenService tokenService;
@Override
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String servletPath = request.getServletPath();
if ("/dictionary/page".equals(request.getServletPath()) || "/file/upload".equals(request.getServletPath()) || "/yonghu/register".equals(request.getServletPath())) {
// 请求路径是字典表或者文件上传 直接放行
if("/dictionary/page".equals(request.getServletPath()) || "/file/upload".equals(request.getServletPath()) || "/yonghu/register".equals(request.getServletPath()) ){//请求路径是字典表或者文件上传 直接放行
return true;
}
// 支持跨域请求
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
//支持跨域请求
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization");
@ -53,41 +54,41 @@ public class AuthorizationInterceptor implements HandlerInterceptor {
return true;
}
// 从header中获取token
//从header中获取token
String token = request.getHeader(LOGIN_TOKEN_KEY);
/**
*
*/
if (annotation != null) {
return true;
if(annotation!=null) {
return true;
}
TokenEntity tokenEntity = null;
if (StringUtils.isNotBlank(token)) {
tokenEntity = tokenService.getTokenEntity(token);
if(StringUtils.isNotBlank(token)) {
tokenEntity = tokenService.getTokenEntity(token);
}
if (tokenEntity != null) {
request.getSession().setAttribute("userId", tokenEntity.getUserid());
request.getSession().setAttribute("role", tokenEntity.getRole());
request.getSession().setAttribute("tableName", tokenEntity.getTablename());
request.getSession().setAttribute("username", tokenEntity.getUsername());
return true;
}
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
try {
writer = response.getWriter();
writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
} finally {
if (writer != null) {
writer.close();
}
if(tokenEntity != null) {
request.getSession().setAttribute("userId", tokenEntity.getUserid());
request.getSession().setAttribute("role", tokenEntity.getRole());
request.getSession().setAttribute("tableName", tokenEntity.getTablename());
request.getSession().setAttribute("username", tokenEntity.getUsername());
return true;
}
// throw new EIException("请先登录", 401);
return false;
PrintWriter writer = null;
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json; charset=utf-8");
try {
writer = response.getWriter();
writer.print(JSONObject.toJSONString(R.error(401, "请先登录")));
} finally {
if(writer != null){
writer.close();
}
}
// throw new EIException("请先登录", 401);
return false;
}
}
}

@ -1,39 +1,31 @@
package com.model.enums;
// 导入序列化接口,使枚举对象可以进行序列化和反序列化操作
import java.io.Serializable;
// 导入 MyBatis-Plus 的枚举接口,用于将枚举值映射到数据库字段
import com.baomidou.mybatisplus.enums.IEnum;
/**
* IEnum spring-mybatis.xml typeEnumsPackage
*
*/
public enum TypeEnum implements IEnum {
// 定义枚举常量,分别表示禁用状态和正常状态
DISABLED(0, "禁用"),
NORMAL(1, "正常");
// 用于存储枚举值对应的整数值,通常与数据库中的字段值对应
private final int value;
// 用于存储枚举值对应的中文描述,方便在代码中使用和展示
private final String desc;
// 枚举类的构造函数,用于初始化枚举常量的 value 和 desc 属性
TypeEnum(final int value, final String desc) {
this.value = value;
this.desc = desc;
}
// 实现 IEnum 接口的方法,返回枚举值对应的整数值,用于与数据库字段进行映射
@Override
public Serializable getValue() {
return this.value;
}
// 该方法用于获取枚举值的中文描述,使用 Jackson 注解时,可将该描述作为 JSON 序列化时的值
// 这样在进行 JSON 序列化时,会返回枚举值的中文描述而不是枚举名称
// Jackson 注解为 JsonValue 返回中文 json 描述
public String getDesc() {
return this.desc;
}
}
}

@ -6,16 +6,14 @@ import com.entity.YonghuEntity;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
/**
*
*/
public interface YonghuService extends IService<YonghuEntity> {
/**
* @param params
* @return
*/
* @param params
* @return
*/
PageUtils queryPage(Map<String, Object> params);
}

@ -1,28 +1,17 @@
// 定义一个包含积分订单和配置相关 API 路径的常量对象
const api = {
// 积分订单相关 API 路径
// 获取积分订单列表的分页接口路径
// 积分订单
orderpage: 'orders/page',
// 删除积分订单的接口路径
orderdelete: 'orders/delete',
// 获取积分订单详情的接口路径,后面需拼接订单 ID
orderinfo: 'orders/info/',
// 保存积分订单的接口路径
ordersave: 'orders/save',
// 更新积分订单的接口路径
orderupdate: 'orders/update',
// 配置相关 API 路径
// 获取配置列表的分页接口路径
// 配置
configpage: 'config/page',
// 删除配置的接口路径
configdelete: 'config/delete',
// 获取配置详情的接口路径,后面需拼接配置 ID
configinfo: 'config/info/',
// 保存配置的接口路径
configsave: 'config/save',
// 更新配置的接口路径
configupdate: 'config/update'
}
// 导出 api 对象,以便在其他模块中使用
export default api
export default api

@ -1,24 +1,16 @@
// 定义一个名为 base 的对象,用于存储项目的基础配置信息
const base = {
// 定义 get 方法,该方法返回一个包含项目基础信息的对象
get() {
return {
// 项目的基础 URL通常为后端服务的访问地址
url: "http://localhost:8080/yiyuanguanhaojiuzhen/",
// 项目的名称,可用于标识该项目
url : "http://localhost:8080/yiyuanguanhaojiuzhen/",
name: "yiyuanguanhaojiuzhen",
// 退出到首页的链接,当需要跳转到项目首页时可使用该链接
// 退出到首页链接
indexUrl: 'http://localhost:8080/yiyuanguanhaojiuzhen/front/index.html'
};
},
// 定义 getProjectName 方法,该方法返回一个包含项目名称的对象
getProjectName() {
getProjectName(){
return {
// 项目的中文名称,可用于前端展示等场景
projectName: "医院挂号就诊系统"
};
}
}
};
// 导出 base 对象,以便其他模块可以引入并使用这些基础配置信息
export default base;
}
export default base

@ -1,50 +1,29 @@
// 引入 axios 库,用于发送 HTTP 请求
import axios from 'axios'
// 引入路由实例,用于路由跳转
import router from '@/router/router-static'
// 引入存储工具,用于处理本地存储等操作
import storage from '@/utils/storage'
// 创建一个 axios 实例,进行一些全局配置
const http = axios.create({
// 设置请求超时时间为一天86400 秒)
timeout: 1000 * 86400,
// 允许跨域请求携带凭证(如 cookie
withCredentials: true,
// 设置请求的基础 URL后续请求的 URL 会基于此拼接
baseURL: '/yiyuanguanhaojiuzhen',
// 设置请求头,指定请求体的内容类型为 JSON 且字符编码为 UTF - 8
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
})
// 请求拦截器,在发送请求前进行一些处理
// 请求拦截
http.interceptors.request.use(config => {
// 可以在这里添加请求头信息,例如添加 token
// const token = storage.get('token')
// if (token) {
// config.headers['Authorization'] = `Bearer ${token}`
// }
config.headers['Token'] = storage.get('Token') // 请求头带上token
return config
}, error => {
// 请求出错时,将错误信息通过 Promise.reject 返回
return Promise.reject(error)
})
// 响应拦截器,在接收到响应后进行一些处理
// 响应拦截
http.interceptors.response.use(response => {
// 检查响应数据中的 code 字段,如果为 401 表示 token 失效
if (response.data && response.data.code === 401) {
// 跳转到登录页面
if (response.data && response.data.code === 401) { // 401, token失效
router.push({ name: 'login' })
}
// 返回响应数据
return response
}, error => {
// 响应出错时,将错误信息通过 Promise.reject 返回
return Promise.reject(error)
})
// 导出配置好的 axios 实例,供其他模块使用
export default http
export default http

@ -1,23 +1,12 @@
/**
* 翻译路由元信息中的标题用于面包屑导航侧边栏和标签页视图
* @param {string} title - 路由元信息中的标题
* @returns {string} - 翻译后的标题如果没有翻译则返回原标题
*/
// translate router.meta.title, be used in breadcrumb sidebar tagsview
export function generateTitle(title) {
// 检查是否存在对应的翻译键
// this.$te 是 vue-i18n 提供的方法,用于检查是否存在指定的翻译键
const hasKey = this.$te('route.' + title);
const hasKey = this.$te('route.' + title)
// 如果存在对应的翻译键
if (hasKey) {
// 使用 this.$t 方法进行翻译this.$t 是 vue-i18n 提供的翻译方法
// 这里的 'route.' + title 是翻译键的格式
const translatedTitle = this.$t('route.' + title);
// $t :this method from vue-i18n, inject in @/lang/index.js
const translatedTitle = this.$t('route.' + title)
// 返回翻译后的标题
return translatedTitle;
return translatedTitle
}
// 如果不存在对应的翻译键,直接返回原标题
return title;
}
return title
}

@ -1,317 +1,300 @@
// 定义一个名为menu的对象其中包含一个list方法用于返回菜单数据
const menu = {
list() {
return [
// 第一个角色(管理员)的菜单配置
{
"backMenu":[
{
// 后台菜单列表
"backMenu": [
"child":[
{
// 子菜单列表
"child": [
{
// 按钮列表,包含对该菜单操作的按钮
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
// 菜单名称
"menu": "管理员管理",
// 菜单跳转目标,这里是跳转到列表页面
"menuJump": "列表",
// 关联的表名,用于数据操作等
"tableName": "users"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
// 父菜单名称
"menu": "管理员管理"
},
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "在线咨询管理",
"menuJump": "列表",
"tableName": "chat"
}
],
"menu": "在线咨询管理"
},
{
"child": [
{
"buttons": [
"查看",
"新增",
"删除",
"修改"
],
"menu": "健康教育类型管理",
"menuJump": "列表",
"tableName": "dictionaryJiankangjiaoyu"
},
{
"buttons": [
"查看",
"新增",
"删除",
"修改"
],
"menu": "公告类型管理",
"menuJump": "列表",
"tableName": "dictionaryNews"
},
{
"buttons": [
"查看",
"新增",
"删除",
"修改"
],
"menu": "科室管理",
"menuJump": "列表",
"tableName": "dictionaryYisheng"
},
{
"buttons": [
"查看",
"新增",
"删除",
"修改"
],
"menu": "职位管理",
"menuJump": "列表",
"tableName": "dictionaryZhiwei"
}
],
"menu": "基础数据管理"
},
{
"child": [
{
"buttons": [
"查看",
"审核",
"报表",
"删除"
],
"menu": "挂号管理",
"menuJump": "列表",
"tableName": "guahao"
}
],
"menu": "挂号管理"
},
"menu":"管理员管理",
"menuJump":"列表",
"tableName":"users"
}
],
"menu":"管理员管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "健康教育管理",
"menuJump": "列表",
"tableName": "jiankangjiaoyu"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "健康教育管理"
},
"menu":"在线咨询管理",
"menuJump":"列表",
"tableName":"chat"
}
],
"menu":"在线咨询管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "公告信息管理",
"menuJump": "列表",
"tableName": "news"
}
"buttons":[
"查看",
"新增",
"删除",
"修改"
],
"menu": "公告信息管理"
},
"menu":"健康教育类型管理",
"menuJump":"列表",
"tableName":"dictionaryJiankangjiaoyu"
}
,
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "医生管理",
"menuJump": "列表",
"tableName": "yisheng"
}
"buttons":[
"查看",
"新增",
"删除",
"修改"
],
"menu": "医生管理"
},
"menu":"公告类型管理",
"menuJump":"列表",
"tableName":"dictionaryNews"
}
,
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "用户管理",
"menuJump": "列表",
"tableName": "yonghu"
}
"buttons":[
"查看",
"新增",
"删除",
"修改"
],
"menu": "用户管理"
},
"menu":"科室管理",
"menuJump":"列表",
"tableName":"dictionaryYisheng"
}
,
{
"child": [
{
"buttons": [
"查看",
"新增",
"修改",
"删除"
],
"menu": "轮播图管理",
"menuJump": "列表",
"tableName": "config"
}
"buttons":[
"查看",
"新增",
"删除",
"修改"
],
"menu": "轮播图信息"
"menu":"职位管理",
"menuJump":"列表",
"tableName":"dictionaryZhiwei"
}
],
// 前端菜单列表,这里为空
"frontMenu": [],
// 是否有后台登录功能
"hasBackLogin": "是",
// 是否有后台注册功能
"hasBackRegister": "否",
// 是否有前端登录功能
"hasFrontLogin": "否",
// 是否有前端注册功能
"hasFrontRegister": "否",
// 角色名称
"roleName": "管理员",
// 关联的表名,用于数据操作等
"tableName": "users"
},
// 第二个角色(医生)的菜单配置
{
"backMenu": [
"menu":"基础数据管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看",
"审核"
],
"menu": "挂号管理",
"menuJump": "列表",
"tableName": "guahao"
}
"buttons":[
"查看",
"审核",
"报表",
"删除"
],
"menu": "挂号管理"
},
"menu":"挂号管理",
"menuJump":"列表",
"tableName":"guahao"
}
],
"menu":"挂号管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看"
],
"menu": "健康教育管理",
"menuJump": "列表",
"tableName": "jiankangjiaoyu"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "健康教育管理"
},
"menu":"健康教育管理",
"menuJump":"列表",
"tableName":"jiankangjiaoyu"
}
],
"menu":"健康教育管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看"
],
"menu": "公告信息管理",
"menuJump": "列表",
"tableName": "news"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "公告信息管理"
"menu":"公告信息管理",
"menuJump":"列表",
"tableName":"news"
}
],
"frontMenu": [],
"hasBackLogin": "是",
"hasBackRegister": "否",
"hasFrontLogin": "否",
"hasFrontRegister": "否",
"roleName": "医生",
"tableName": "yisheng"
},
// 第三个角色(用户)的菜单配置
{
"backMenu": [
"menu":"公告信息管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看",
"删除"
],
"menu": "挂号管理",
"menuJump": "列表",
"tableName": "guahao"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "挂号管理"
},
"menu":"医生管理",
"menuJump":"列表",
"tableName":"yisheng"
}
],
"menu":"医生管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看"
],
"menu": "健康教育管理",
"menuJump": "列表",
"tableName": "jiankangjiaoyu"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "健康教育管理"
},
"menu":"用户管理",
"menuJump":"列表",
"tableName":"yonghu"
}
],
"menu":"用户管理"
}
,{
"child":[
{
"child": [
{
"buttons": [
"查看"
],
"menu": "公告信息管理",
"menuJump": "列表",
"tableName": "news"
}
"buttons":[
"查看",
"新增",
"修改",
"删除"
],
"menu": "公告信息管理"
"menu":"轮播图管理",
"menuJump":"列表",
"tableName":"config"
}
],
"frontMenu": [],
"hasBackLogin": "是",
"hasBackRegister": "否",
"hasFrontLogin": "否",
"hasFrontRegister": "否",
"roleName": "用户",
"tableName": "yonghu"
"menu":"轮播图信息"
}
];
],
"frontMenu":[],
"hasBackLogin":"是",
"hasBackRegister":"否",
"hasFrontLogin":"否",
"hasFrontRegister":"否",
"roleName":"管理员",
"tableName":"users"
},
{
"backMenu":[
{
"child":[
{
"buttons":[
"查看",
"审核"
],
"menu":"挂号管理",
"menuJump":"列表",
"tableName":"guahao"
}
],
"menu":"挂号管理"
}
,{
"child":[
{
"buttons":[
"查看"
],
"menu":"健康教育管理",
"menuJump":"列表",
"tableName":"jiankangjiaoyu"
}
],
"menu":"健康教育管理"
}
,{
"child":[
{
"buttons":[
"查看"
],
"menu":"公告信息管理",
"menuJump":"列表",
"tableName":"news"
}
],
"menu":"公告信息管理"
}
],
"frontMenu":[],
"hasBackLogin":"是",
"hasBackRegister":"否",
"hasFrontLogin":"否",
"hasFrontRegister":"否",
"roleName":"医生",
"tableName":"yisheng"
},
{
"backMenu":[
{
"child":[
{
"buttons":[
"查看",
"删除"
],
"menu":"挂号管理",
"menuJump":"列表",
"tableName":"guahao"
}
],
"menu":"挂号管理"
}
,{
"child":[
{
"buttons":[
"查看"
],
"menu":"健康教育管理",
"menuJump":"列表",
"tableName":"jiankangjiaoyu"
}
],
"menu":"健康教育管理"
}
,{
"child":[
{
"buttons":[
"查看"
],
"menu":"公告信息管理",
"menuJump":"列表",
"tableName":"news"
}
],
"menu":"公告信息管理"
}
],
"frontMenu":[],
"hasBackLogin":"是",
"hasBackRegister":"否",
"hasFrontLogin":"否",
"hasFrontRegister":"否",
"roleName":"用户",
"tableName":"yonghu"
}
]
}
};
// 导出menu对象以便在其他模块中使用这些菜单配置数据
export default menu;
}
export default menu;

@ -1,59 +1,18 @@
// 定义一个名为 storage 的对象,用于封装对 localStorage 的操作
const storage = {
/**
* 将数据存储到 localStorage
* @param {string} key - 存储数据的键
* @param {any} value - 要存储的数据会被转换为 JSON 字符串
*/
set(key, value) {
// 使用 localStorage.setItem 方法将键值对存储到 localStorage 中
// 为了能存储任意类型的数据,使用 JSON.stringify 将值转换为 JSON 字符串
localStorage.setItem(key, JSON.stringify(value));
},
/**
* localStorage 中获取数据
* @param {string} key - 要获取数据的键
* @returns {string} - 返回存储的数据如果没有则返回空字符串
*/
get(key) {
// 先检查 localStorage 中是否存在该键对应的数据
if (localStorage.getItem(key)) {
// 如果存在,去除字符串两端可能存在的引号后返回
return localStorage.getItem(key).replace('"', '').replace('"', '');
}
// 如果不存在,返回空字符串
return "";
return localStorage.getItem(key)?localStorage.getItem(key).replace('"','').replace('"',''):"";
},
/**
* localStorage 中获取对象类型的数据
* @param {string} key - 要获取数据的键
* @returns {object|null} - 返回解析后的对象如果没有则返回 null
*/
getObj(key) {
// 先检查 localStorage 中是否存在该键对应的数据
if (localStorage.getItem(key)) {
// 如果存在,使用 JSON.parse 将存储的 JSON 字符串解析为对象并返回
return JSON.parse(localStorage.getItem(key));
}
// 如果不存在,返回 null
return null;
return localStorage.getItem(key)?JSON.parse(localStorage.getItem(key)):null;
},
/**
* localStorage 中移除指定键的数据
* @param {string} key - 要移除数据的键
*/
remove(key) {
// 使用 localStorage.removeItem 方法移除指定键的数据
localStorage.removeItem(key);
},
/**
* 清空 localStorage 中的所有数据
*/
clear() {
// 使用 localStorage.clear 方法清空 localStorage 中的所有数据
localStorage.clear();
localStorage.clear();
}
};
// 导出 storage 对象,以便在其他模块中使用这些封装的 localStorage 操作方法
export default storage;
}
export default storage;

@ -1,59 +1,94 @@
// storage localStorage
const storage = {
/**
* localStorage
* @param {string} key -
* @param {any} value - JSON
*/
set(key, value) {
// 使 localStorage.setItem localStorage
// 使 JSON.stringify JSON
localStorage.setItem(key, JSON.stringify(value));
},
/**
* localStorage
* @param {string} key -
* @returns {string} -
*/
get(key) {
// localStorage
if (localStorage.getItem(key)) {
//
return localStorage.getItem(key).replace('"', '').replace('"', '');
}
//
return "";
},
/**
* localStorage
* @param {string} key -
* @returns {object|null} - null
*/
getObj(key) {
// localStorage
if (localStorage.getItem(key)) {
// 使 JSON.parse JSON
return JSON.parse(localStorage.getItem(key));
}
// null
return null;
},
/**
* localStorage
* @param {string} key -
*/
remove(key) {
// 使 localStorage.removeItem
localStorage.removeItem(key);
},
/**
* localStorage
*/
clear() {
// 使 localStorage.clear localStorage
localStorage.clear();
}
};
// storage 便使 localStorage
export default storage;
/* 全局list页面按钮样式 */
.slt {
margin: 0 !important;
display: flex;
}
.ad {
margin: 0 !important;
display: flex;
}
.pages {
& /deep/ el-pagination__sizes{
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
}
}
}
.el-button+.el-button {
margin:0;
}
.tables {
& /deep/ .el-button--success {
height: 36px;
color: rgba(40, 167, 69, 1);
font-size: 10px;
border-width: 0px;
border-style: solid;
border-color: #DCDFE6;
border-radius: 0px;
background-color: rgba(255, 255, 255, 1);
}
& /deep/ .el-button--primary {
height: 36px;
color: rgba(255, 193, 7, 1);
font-size: 10px;
border-width: 0px;
border-style: solid;
border-color: #DCDFE6;
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button--danger {
height: 36px;
color: rgba(220, 53, 69, 1);
font-size: 10px;
border-width: 0px;
border-style: solid;
border-color: #DCDFE6;
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button {
margin: 4px;
}
}
/* 全局add-or-update页面按钮样式 */
.editor{
height: 500px;
& /deep/ .ql-container {
height: 310px;
}
}
.amap-wrapper {
width: 100%;
height: 500px;
}
.search-box {
position: absolute;
}
.addEdit-block {
margin: -10px;
}
.detail-form-content {
padding: 12px;
}
.btn .el-button {
padding: 0;
}
/*IndexMain.vue list
//
.el-main
//list
.router-view
*/

@ -1,326 +1,9 @@
// 定义一个名为 style 的对象,用于管理不同页面的样式配置
const style = {
// listStyle 方法,返回列表页面的样式配置对象
listStyle() {
return {
// 搜索按钮的字体颜色
"searchBtnFontColor": "rgba(106, 0, 138, 1)",
// 分页位置(具体含义需根据业务逻辑确定,这里是 1
"pagePosition": "1",
// 输入框的字体大小
"inputFontSize": "14px",
// 输入框的边框圆角
"inputBorderRadius": "0px",
// 表格删除按钮的字体颜色
"tableBtnDelFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮图标位置(具体含义需根据业务逻辑确定,这里是 1
"tableBtnIconPosition": "1",
// 搜索按钮的高度
"searchBtnHeight": "40px",
// 输入框图标的颜色
"inputIconColor": "rgba(88, 179, 81, 1)",
// 搜索按钮的边框圆角
"searchBtnBorderRadius": "4px",
// 表格是否显示斑马纹
"tableStripe": true,
// 按钮全部警告的字体颜色
"btnAdAllWarnFontColor": "rgba(88, 179, 81, 1)",
// 表格删除按钮的背景颜色
"tableBtnDelBgColor": "#fff",
// 搜索按钮的图标(具体含义需根据业务逻辑确定,这里是 1
"searchBtnIcon": "1",
// 表格的尺寸为 mini
"tableSize": "mini",
// 搜索按钮的边框样式为 solid
"searchBtnBorderStyle": "solid",
// 表格是否显示行选择框
"tableSelection": false,
// 搜索按钮的边框宽度
"searchBtnBorderWidth": "2px",
// 表格内容的字体大小
"tableContentFontSize": "14px",
// 搜索按钮的背景颜色
"searchBtnBgColor": "#fff",
// 输入框标题的大小
"inputTitleSize": "14px",
// 按钮全部的边框颜色
"btnAdAllBorderColor": "rgba(88, 179, 81, 1)",
// 是否显示分页跳转框
"pageJumper": true,
// 按钮全部图标位置(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllIconPosition": "1",
// 搜索框的位置(具体含义需根据业务逻辑确定,这里是 3
"searchBoxPosition": "3",
// 表格详情按钮的字体颜色
"tableBtnDetailFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的高度
"tableBtnHeight": "30px",
// 是否显示分页导航条
"pagePager": true,
// 搜索按钮的边框颜色
"searchBtnBorderColor": "rgba(88, 179, 81, 1)",
// 表格表头的字体颜色
"tableHeaderFontColor": "rgba(255, 255, 255, 1)",
// 输入框标题(具体含义需根据业务逻辑确定,这里是 1
"inputTitle": "1",
// 表格按钮的边框圆角
"tableBtnBorderRadius": "0px",
// 按钮全部的字体(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllFont": "1",
// 按钮全部删除的字体颜色
"btnAdAllDelFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的图标(具体含义需根据业务逻辑确定,这里是 1
"tableBtnIcon": "1",
// 按钮全部的高度
"btnAdAllHeight": "40px",
// 按钮全部警告的背景颜色
"btnAdAllWarnBgColor": "#fff",
// 按钮全部的边框宽度
"btnAdAllBorderWidth": "2px",
// 表格斑马纹的字体颜色
"tableStripeFontColor": "#606266",
// 表格按钮的边框样式为底部 solid
"tableBtnBorderStyle": "none none solid none",
// 输入框的高度
"inputHeight": "40px",
// 按钮全部的边框圆角
"btnAdAllBorderRadius": "4px",
// 按钮全部删除的背景颜色
"btnAdAllDelBgColor": "#fff",
// 是否显示分页上一页和下一页按钮
"pagePrevNext": true,
// 按钮全部添加的背景颜色
"btnAdAllAddBgColor": "rgba(250, 212, 0, 1)",
// 搜索按钮的字体(具体含义需根据业务逻辑确定,这里是 1
"searchBtnFont": "1",
// 表格是否显示索引列
"tableIndex": true,
// 按钮全部的图标(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllIcon": "1",
// 表格是否可排序
"tableSortable": false,
// 是否显示每页数量选择框
"pageSizes": true,
// 表格是否自动调整列宽
"tableFit": true,
// 分页按钮是否有背景
"pageBtnBG": true,
// 搜索按钮的字体大小
"searchBtnFontSize": "14px",
// 表格编辑按钮的背景颜色
"tableBtnEditBgColor": "#fff",
// 输入框的边框宽度
"inputBorderWidth": "1px",
// 输入框字体的位置(具体含义需根据业务逻辑确定,这里是 1
"inputFontPosition": "1",
// 输入框的字体颜色
"inputFontColor": "rgba(88, 179, 81, 1)",
// 每页显示的数量
"pageEachNum": 10,
// 表格表头的背景颜色
"tableHeaderBgColor": "rgba(88, 179, 81, 1)",
// 输入框标题的颜色
"inputTitleColor": "rgba(88, 179, 81, 1)",
// 按钮全部的盒子位置(具体含义需根据业务逻辑确定,这里是 1
"btnAdAllBoxPosition": "1",
// 表格详情按钮的背景颜色
"tableBtnDetailBgColor": "#fff",
// 输入框的图标(具体含义需根据业务逻辑确定,这里是 1
"inputIcon": "1",
// 搜索按钮图标的位置(具体含义需根据业务逻辑确定,这里是 1
"searchBtnIconPosition": "1",
// 按钮全部的字体大小
"btnAdAllFontSize": "10px",
// 输入框的边框样式为底部 solid
"inputBorderStyle": "none none solid none ",
// 输入框的背景颜色
"inputBgColor": "#fff",
// 分页样式(具体含义需根据业务逻辑确定,这里是 false
"pageStyle": false,
// 是否显示总页数
"pageTotal": true,
// 按钮全部添加的字体颜色
"btnAdAllAddFontColor": "rgba(88, 179, 81, 1)",
// 表格按钮的字体(具体含义需根据业务逻辑确定,这里是 1
"tableBtnFont": "1",
// 表格内容的字体颜色
"tableContentFontColor": "#606266",
// 输入框的边框颜色
"inputBorderColor": "rgba(88, 179, 81, 1)",
// 表格是否显示表头
"tableShowHeader": true,
// 表格按钮的字体大小
"tableBtnFontSize": "12px",
// 表格按钮的边框颜色
"tableBtnBorderColor": "rgba(88, 179, 81, 1)",
// 输入框图标的位置(具体含义需根据业务逻辑确定,这里是 2
"inputIconPosition": "2",
// 表格是否有边框
"tableBorder": true,
// 按钮全部的边框样式为 solid
"btnAdAllBorderStyle": "solid",
// 表格按钮的边框宽度
"tableBtnBorderWidth": "1px",
// 表格斑马纹的背景颜色
"tableStripeBgColor": "rgba(227, 225, 225, 1)",
// 表格编辑按钮的字体颜色
"tableBtnEditFontColor": "rgba(88, 179, 81, 1)",
// 表格内容的对齐方式为左对齐
"tableAlign": "left"
};
listStyle(){
return {"searchBtnFontColor":"rgba(106, 0, 138, 1)","pagePosition":"1","inputFontSize":"14px","inputBorderRadius":"0px","tableBtnDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIconPosition":"1","searchBtnHeight":"40px","inputIconColor":"rgba(88, 179, 81, 1)","searchBtnBorderRadius":"4px","tableStripe":true,"btnAdAllWarnFontColor":"rgba(88, 179, 81, 1)","tableBtnDelBgColor":"#fff","searchBtnIcon":"1","tableSize":"mini","searchBtnBorderStyle":"solid","tableSelection":false,"searchBtnBorderWidth":"2px","tableContentFontSize":"14px","searchBtnBgColor":"#fff","inputTitleSize":"14px","btnAdAllBorderColor":"rgba(88, 179, 81, 1)","pageJumper":true,"btnAdAllIconPosition":"1","searchBoxPosition":"3","tableBtnDetailFontColor":"rgba(88, 179, 81, 1)","tableBtnHeight":"30px","pagePager":true,"searchBtnBorderColor":"rgba(88, 179, 81, 1)","tableHeaderFontColor":"rgba(255, 255, 255, 1)","inputTitle":"1","tableBtnBorderRadius":"0px","btnAdAllFont":"1","btnAdAllDelFontColor":"rgba(88, 179, 81, 1)","tableBtnIcon":"1","btnAdAllHeight":"40px","btnAdAllWarnBgColor":"#fff","btnAdAllBorderWidth":"2px","tableStripeFontColor":"#606266","tableBtnBorderStyle":"none none solid none","inputHeight":"40px","btnAdAllBorderRadius":"4px","btnAdAllDelBgColor":"#fff","pagePrevNext":true,"btnAdAllAddBgColor":"rgba(250, 212, 0, 1)","searchBtnFont":"1","tableIndex":true,"btnAdAllIcon":"1","tableSortable":false,"pageSizes":true,"tableFit":true,"pageBtnBG":true,"searchBtnFontSize":"14px","tableBtnEditBgColor":"#fff","inputBorderWidth":"1px","inputFontPosition":"1","inputFontColor":"rgba(88, 179, 81, 1)","pageEachNum":10,"tableHeaderBgColor":"rgba(88, 179, 81, 1)","inputTitleColor":"rgba(88, 179, 81, 1)","btnAdAllBoxPosition":"1","tableBtnDetailBgColor":"#fff","inputIcon":"1","searchBtnIconPosition":"1","btnAdAllFontSize":"10px","inputBorderStyle":"none none solid none ","inputBgColor":"#fff","pageStyle":false,"pageTotal":true,"btnAdAllAddFontColor":"rgba(88, 179, 81, 1)","tableBtnFont":"1","tableContentFontColor":"#606266","inputBorderColor":"rgba(88, 179, 81, 1)","tableShowHeader":true,"tableBtnFontSize":"12px","tableBtnBorderColor":"rgba(88, 179, 81, 1)","inputIconPosition":"2","tableBorder":true,"btnAdAllBorderStyle":"solid","tableBtnBorderWidth":"1px","tableStripeBgColor":"rgba(227, 225, 225, 1)","tableBtnEditFontColor":"rgba(88, 179, 81, 1)","tableAlign":"left"}
},
// addStyle 方法,返回添加或编辑页面的样式配置对象
addStyle() {
return {
// 保存按钮的字体颜色
"btnSaveFontColor": "#fff",
// 选择框的字体大小
"selectFontSize": "14px",
// 取消按钮的边框颜色
"btnCancelBorderColor": "#DCDFE6",
// 输入框的边框圆角
"inputBorderRadius": "4px",
// 输入框的字体大小
"inputFontSize": "14px",
// 文本域的背景颜色
"textareaBgColor": "#fff",
// 保存按钮的字体大小
"btnSaveFontSize": "14px",
// 文本域的边框圆角
"textareaBorderRadius": "4px",
// 上传区域的背景颜色
"uploadBgColor": "#fff",
// 文本域的边框样式为 solid
"textareaBorderStyle": "solid",
// 取消按钮的宽度
"btnCancelWidth": "88px",
// 文本域的高度
"textareaHeight": "120px",
// 日期选择框的背景颜色
"dateBgColor": "#fff",
// 保存按钮的边框圆角
"btnSaveBorderRadius": "4px",
// 上传区域标签的字体大小
"uploadLableFontSize": "14px",
// 文本域的边框宽度
"textareaBorderWidth": "1px",
// 输入框标签的颜色
"inputLableColor": "rgba(199, 21, 133, 1)",
// 添加或编辑盒子的颜色
"addEditBoxColor": "rgba(242, 241, 242, 1)",
// 日期选择框图标的字体大小
"dateIconFontSize": "14px",
// 保存按钮的背景颜色
"btnSaveBgColor": "rgba(199, 21, 133, 1)",
// 上传区域图标的字体颜色
"uploadIconFontColor": "#8c939d",
// 文本域的边框颜色
"textareaBorderColor": "#DCDFE6",
// 取消按钮的背景颜色
"btnCancelBgColor": "rgba(253, 252, 254, 1)",
// 选择框标签的颜色
"selectLableColor": "rgba(199, 21, 133, 1)",
// 保存按钮的边框样式为 solid
"btnSaveBorderStyle": "solid",
// 日期选择框的边框宽度
"dateBorderWidth": "1px",
// 日期选择框标签的字体大小
"dateLableFontSize": "14px",
// 日期选择框的边框圆角
"dateBorderRadius": "4px",
// 取消按钮的边框样式为 solid
"btnCancelBorderStyle": "solid",
// 选择框标签的字体大小
"selectLableFontSize": "14px",
// 选择框的边框样式为 solid
"selectBorderStyle": "solid",
// 选择框图标的字体颜色
"selectIconFontColor": "#C0C4CC",
// 取消按钮的高度
"btnCancelHeight": "44px",
// 输入框的高度
"inputHeight": "40px",
// 取消按钮的字体颜色
"btnCancelFontColor": "rgba(106, 0, 138, 1)",
// 日期选择框的边框颜色
"dateBorderColor": "#DCDFE6",
// 日期选择框图标的字体颜色
"dateIconFontColor": "#C0C4CC",
// 上传区域的边框样式为 solid
"uploadBorderStyle": "solid",
// 日期选择框的边框样式为 solid
"dateBorderStyle": "solid",
// 日期选择框标签的颜色
"dateLableColor": "rgba(199, 21, 133, 1)",
// 日期选择框的字体大小
"dateFontSize": "14px",
// 输入框的边框宽度
"inputBorderWidth": "1px",
// 上传区域图标的字体大小
"uploadIconFontSize": "28px",
// 选择框的高度
"selectHeight": "40px",
// 输入框的字体颜色
"inputFontColor": "#606266",
// 上传区域的高度
"uploadHeight": "148px",
// 文本域标签的颜色
"textareaLableColor": "rgba(199, 21, 133, 1)",
// 文本域标签的字体大小
"textareaLableFontSize": "14px",
// 取消按钮的字体大小
"btnCancelFontSize": "14px",
// 输入框的边框样式为 solid
"inputBorderStyle": "solid",
// 取消按钮的边框圆角
"btnCancelBorderRadius": "4px",
// 输入框的背景颜色
"inputBgColor": "#fff",
// 输入框标签的字体大小
"inputLableFontSize": "14px",
// 上传区域标签的颜色
"uploadLableColor": "rgba(199, 21, 133, 1)",
// 上传区域的边框圆角
"uploadBorderRadius": "4px",
// 保存按钮的高度
"btnSaveHeight": "44px",
// 选择框的背景颜色
"selectBgColor": "rgba(255, 255, 255, 1)",
// 保存按钮的宽度
"btnSaveWidth": "88px",
// 选择框图标的字体大小
"selectIconFontSize": "14px",
// 日期选择框的高度
"dateHeight": "40px",
// 选择框的边框颜色
"selectBorderColor": "#DCDFE6",
// 输入框的边框颜色
"inputBorderColor": "#DCDFE6",
// 上传区域的边框颜色
"uploadBorderColor": "#DCDFE6",
// 文本域的字体颜色
"textareaFontColor": "#606266",
// 选择框的边框宽度
"selectBorderWidth": "1px",
// 日期选择框的字体颜色
"dateFontColor": "#606266",
// 取消按钮的边框宽度
"btnCancelBorderWidth": "1px",
// 上传区域的边框宽度
"uploadBorderWidth": "1px",
// 文本域的字体大小
"textareaFontSize": "14px",
// 选择框的边框圆角
"selectBorderRadius": "4px",
// 选择框的字体颜色
"selectFontColor": "rgba(10, 10, 10, 1)",
// 保存按钮的边框颜色
"btnSaveBorderColor": "#409EFF",
// 保存按钮的边框宽度
"btnSaveBorderWidth": "0px"
};
addStyle(){
return {"btnSaveFontColor":"#fff","selectFontSize":"14px","btnCancelBorderColor":"#DCDFE6","inputBorderRadius":"4px","inputFontSize":"14px","textareaBgColor":"#fff","btnSaveFontSize":"14px","textareaBorderRadius":"4px","uploadBgColor":"#fff","textareaBorderStyle":"solid","btnCancelWidth":"88px","textareaHeight":"120px","dateBgColor":"#fff","btnSaveBorderRadius":"4px","uploadLableFontSize":"14px","textareaBorderWidth":"1px","inputLableColor":"rgba(199, 21, 133, 1)","addEditBoxColor":"rgba(242, 241, 242, 1)","dateIconFontSize":"14px","btnSaveBgColor":"rgba(199, 21, 133, 1)","uploadIconFontColor":"#8c939d","textareaBorderColor":"#DCDFE6","btnCancelBgColor":"rgba(253, 252, 254, 1)","selectLableColor":"rgba(199, 21, 133, 1)","btnSaveBorderStyle":"solid","dateBorderWidth":"1px","dateLableFontSize":"14px","dateBorderRadius":"4px","btnCancelBorderStyle":"solid","selectLableFontSize":"14px","selectBorderStyle":"solid","selectIconFontColor":"#C0C4CC","btnCancelHeight":"44px","inputHeight":"40px","btnCancelFontColor":"rgba(106, 0, 138, 1)","dateBorderColor":"#DCDFE6","dateIconFontColor":"#C0C4CC","uploadBorderStyle":"solid","dateBorderStyle":"solid","dateLableColor":"rgba(199, 21, 133, 1)","dateFontSize":"14px","inputBorderWidth":"1px","uploadIconFontSize":"28px","selectHeight":"40px","inputFontColor":"#606266","uploadHeight":"148px","textareaLableColor":"rgba(199, 21, 133, 1)","textareaLableFontSize":"14px","btnCancelFontSize":"14px","inputBorderStyle":"solid","btnCancelBorderRadius":"4px","inputBgColor":"#fff","inputLableFontSize":"14px","uploadLableColor":"rgba(199, 21, 133, 1)","uploadBorderRadius":"4px","btnSaveHeight":"44px","selectBgColor":"rgba(255, 255, 255, 1)","btnSaveWidth":"88px","selectIconFontSize":"14px","dateHeight":"40px","selectBorderColor":"#DCDFE6","inputBorderColor":"#DCDFE6","uploadBorderColor":"#DCDFE6","textareaFontColor":"#606266","selectBorderWidth":"1px","dateFontColor":"#606266","btnCancelBorderWidth":"1px","uploadBorderWidth":"1px","textareaFontSize":"14px","selectBorderRadius":"4px","selectFontColor":"rgba(10, 10, 10, 1)","btnSaveBorderColor":"#409EFF","btnSaveBorderWidth":"0px"}
}
};
// 导出 style 对象,以便在其他模块中使用这些样式配置
export default style;style;
}
export default style;

@ -1,82 +1,61 @@
// 引入自定义的 storage 模块,用于本地存储操作
import storage from './storage';
// 引入自定义的 menu 模块,用于获取菜单信息
import menu from './menu';
/**
* 判断用户是否对指定的表格具有特定操作的权限
* @param {string} tableName - 要检查权限的表格名称
* @param {string} key - 要检查的操作权限例如 '查看', '新增'
* @returns {boolean} - 如果用户具有该权限则返回 true否则返回 false
* 是否有权限
* @param {*} key
*/
export function isAuth(tableName, key) {
// 从本地存储中获取用户角色
export function isAuth(tableName,key) {
let role = storage.get("role");
// 如果本地存储中没有角色信息,则默认设置为 '管理员'
if (!role) {
if(!role){
role = '管理员';
}
// 获取所有的菜单列表
let menus = menu.list();
// 遍历所有角色的菜单信息
for (let i = 0; i < menus.length; i++) {
// 如果当前角色与用户角色匹配
if (menus[i].roleName === role) {
// 遍历该角色的后台菜单
for (let j = 0; j < menus[i].backMenu.length; j++) {
// 遍历菜单的子项
for (let k = 0; k < menus[i].backMenu[j].child.length; k++) {
// 如果当前菜单子项的表格名称与传入的表格名称匹配
if (tableName === menus[i].backMenu[j].child[k].tableName) {
// 将该菜单子项的所有按钮操作拼接成字符串
for(let i=0;i<menus.length;i++){
if(menus[i].roleName==role){
for(let j=0;j<menus[i].backMenu.length;j++){
for(let k=0;k<menus[i].backMenu[j].child.length;k++){
if(tableName==menus[i].backMenu[j].child[k].tableName){
let buttons = menus[i].backMenu[j].child[k].buttons.join(',');
// 判断指定的操作权限是否在按钮操作字符串中
return buttons.indexOf(key)!== -1;
return buttons.indexOf(key) !== -1 || false
}
}
}
}
}
// 如果没有匹配的权限信息,则返回 false
// for(let i=0;i<menus.length;i++){
// if(menus[i].roleName==role){
// for(let j=0;j<menus[i].backMenu.length;j++){
// if(menus[i].backMenu[j].tableName==tableName){
// let buttons = menus[i].backMenu[j].child[0].buttons.join(',');
// return buttons.indexOf(key) !== -1 || false
// }
// }
// }
// }
return false;
}
/**
* 获取当前时间格式为 yyyy-MM-dd hh:mm:ss
* @returns {string} - 当前时间的字符串表示
*/
* * 获取当前时间yyyy-MM-dd hh:mm:ss
* */
export function getCurDateTime() {
// 创建一个 Date 对象表示当前时间
let currentTime = new Date();
// 获取当前年份
let year = currentTime.getFullYear();
// 获取当前月份,小于 10 时在前面补 0
let month = currentTime.getMonth() + 1 < 10? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
// 获取当前日期,小于 10 时在前面补 0
let day = currentTime.getDate() < 10? '0' + currentTime.getDate() : currentTime.getDate();
// 获取当前小时
let hour = currentTime.getHours();
// 获取当前分钟
let minute = currentTime.getMinutes();
// 获取当前秒数
let second = currentTime.getSeconds();
// 拼接成 yyyy-MM-dd hh:mm:ss 格式的字符串并返回
return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
let currentTime = new Date(),
year = currentTime.getFullYear(),
month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1,
day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate(),
hour = currentTime.getHours(),
minute = currentTime.getMinutes(),
second = currentTime.getSeconds();
return year + "-" + month + "-" + day + " " +hour +":" +minute+":"+second;
}
/**
* 获取当前日期格式为 yyyy-MM-dd
* @returns {string} - 当前日期的字符串表示
*/
* * 获取当前日期yyyy-MM-dd
* */
export function getCurDate() {
// 创建一个 Date 对象表示当前时间
let currentTime = new Date();
// 获取当前年份
let year = currentTime.getFullYear();
// 获取当前月份,小于 10 时在前面补 0
let month = currentTime.getMonth() + 1 < 10? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1;
// 获取当前日期,小于 10 时在前面补 0
let day = currentTime.getDate() < 10? '0' + currentTime.getDate() : currentTime.getDate();
// 拼接成 yyyy-MM-dd 格式的字符串并返回
let currentTime = new Date(),
year = currentTime.getFullYear(),
month = currentTime.getMonth() + 1 < 10 ? '0' + (currentTime.getMonth() + 1) : currentTime.getMonth() + 1,
day = currentTime.getDate() < 10 ? '0' + currentTime.getDate() : currentTime.getDate();
return year + "-" + month + "-" + day;
}
}

@ -1,74 +1,57 @@
/**
* 验证输入的字符串是否为合法的邮箱地址
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的邮箱地址则返回 true否则返回 false
* 邮箱
* @param {*} s
*/
export function isEmail(s) {
// 使用正则表达式匹配邮箱地址格式
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s);
export function isEmail (s) {
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
}
/**
* 验证输入的字符串是否为合法的手机号码
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的手机号码则返回 true否则返回 false
* 手机号码
* @param {*} s
*/
export function isMobile(s) {
// 使用正则表达式匹配手机号码格式,以 1 开头,后面跟着 10 位数字
return /^1[0-9]{10}$/.test(s);
export function isMobile (s) {
return /^1[0-9]{10}$/.test(s)
}
/**
* 验证输入的字符串是否为合法的电话号码
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的电话号码则返回 true否则返回 false
* 电话号码
* @param {*} s
*/
export function isPhone(s) {
// 使用正则表达式匹配电话号码格式,可以是 3 到 4 位区号加上 7 到 8 位号码,区号前可以有 -
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s);
export function isPhone (s) {
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
}
/**
* 验证输入的字符串是否为合法的 URL 地址
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的 URL 地址则返回 true否则返回 false
* URL地址
* @param {*} s
*/
export function isURL(s) {
// 使用正则表达式匹配 URL 地址格式,以 http 或 https 开头
return /^http[s]?:\/\/.*/.test(s);
export function isURL (s) {
return /^http[s]?:\/\/.*/.test(s)
}
/**
* 验证输入的字符串是否为合法的数字可以是小数不可以是负数可以为空
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的数字则返回 true否则返回 false
* 匹配数字可以是小数不可以是负数,可以为空
* @param {*} s
*/
export function isNumber(s) {
// 使用正则表达式匹配数字格式,支持小数和科学计数法,且不能为负数,也可以为空字符串
return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s);
export function isNumber(s){
return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s);
}
/**
* 验证输入的字符串是否为合法的整数可以为空
* @param {string} s - 待验证的字符串
* @returns {boolean} - 如果字符串是合法的整数则返回 true否则返回 false
* 匹配整数可以为空
* @param {*} s
*/
export function isIntNumer(s) {
// 使用正则表达式匹配整数格式,可以是正数、负数或 0也可以为空字符串
return /(^-?\d+$)|(^$)/.test(s);
export function isIntNumer(s){
return /(^-?\d+$)|(^$)/.test(s);
}
/**
* 验证输入的字符串是否为合法的身份证号码
* @param {string} idcard - 待验证的身份证号码字符串
* @returns {boolean} - 如果字符串是合法的身份证号码则返回 true否则返回 false
* 身份证校验
*/
export function checkIdCard(idcard) {
// 使用正则表达式匹配身份证号码格式,支持 15 位、18 位或 17 位数字加 X或 x
const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (!regIdCard.test(idcard)) {
return false;
return false;
} else {
return true;
return true;
}
}
}

@ -1,197 +1,152 @@
<template>
<!-- 组件的根元素 -->
<div>
<!-- 表单组件用于输入回复内容 -->
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
>
<!-- 聊天内容展示区域 -->
<div class="chat-content">
<!-- 遍历聊天数据列表 -->
<div v-bind:key="item.id" v-for="item in dataList">
<!-- 如果是用户提问显示在左侧 -->
<div v-if="item.chatIssue" class="left-content">
<el-alert class="text-content" :title="item.chatIssue" :closable="false" type="success"></el-alert>
</div>
<!-- 如果是回复内容显示在右侧 -->
<div v-else class="right-content">
<el-alert class="text-content" :title="item.chatReply" :closable="false" type="warning"></el-alert>
</div>
<!-- 清除浮动 -->
<div class="clear-float"></div>
</div>
</div>
<!-- 清除浮动 -->
<div class="clear-float"></div>
<!-- 回复输入框 -->
<el-form-item label="回复" prop="chatReply">
<el-input v-model="ruleForm.chatReply" placeholder="回复" clearable></el-input>
</el-form-item>
<!-- 操作按钮 -->
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="back()"></el-button>
</el-form-item>
</el-form>
</div>
<div>
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
>
<div class="chat-content">
<div v-bind:key="item.id" v-for="item in dataList">
<div v-if="item.chatIssue" class="left-content">
<el-alert class="text-content" :title="item.chatIssue" :closable="false" type="success"></el-alert>
</div>
<div v-else class="right-content">
<el-alert class="text-content" :title="item.chatReply" :closable="false" type="warning"></el-alert>
</div>
<div class="clear-float"></div>
</div>
</div>
<div class="clear-float"></div>
<el-form-item label="回复" prop="chatReply">
<el-input v-model="ruleForm.chatReply" placeholder="回复" clearable></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button @click="back()"></el-button>
</el-form-item>
</el-form>
</div>
</template>
<script>
export default {
data() {
return {
// ID
id: "",
//
ruleForm: {},
//
dataList: [],
//
chatDate: {},
//
rules: {
chatReply: [
{ required: true, message: "回复内容不能为空", trigger: "blur" }
]
},
//
inter: null
};
},
//
props: ["parent"],
methods: {
//
init(row) {
//
this.chatDate = row;
// ID
this.id = row.yonghuId;
var that = this;
// 5
var inter = setInterval(function () {
that.getList();
}, 5000);
//
this.inter = inter;
},
export default {
data() {
return {
id: "",
ruleForm: {},
dataList: [],
chatDate:{},
rules: {
chatReply: [
{ required: true, message: "回复内容不能为空", trigger: "blur" }
]
},
inter:null
};
},
props: ["parent"],
methods: {
//
init(row) {
this.chatDate = row
this.id = row.yonghuId;
var that = this;
var inter= setInterval(function(){
that.getList();
},5000)
this.inter = inter;
},
//
getList() {
//
let params = {
yonghuId: this.id
};
//
this.$http({
url: 'chat/page',
method: "get",
params: params
}).then(({ data }) => {
if (data && data.code === 0) {
// ID
this.ruleForm.yonghuId = this.id;
//
this.dataList = data.data.list;
console.log(this.dataList);
} else {
//
this.$message.error(data.msg);
}
});
},
getList() {
let params = {
yonghuId: this.id,
}
this.$http({
url: 'chat/page',
method: "get",
params: params
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm.yonghuId = this.id;
this.dataList = data.data.list;
console.log(this.dataList)
} else {
this.$message.error(data.msg);
}
});
},
//
onSubmit() {
this.$refs["ruleForm"].validate(valid => {
this.ruleForm.replyTime = this.getCurDateTime()
this.ruleForm.chatTypes = 2
if (valid) {
this.$http({
url: 'chat/save',
method: "post",
data: this.ruleForm
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getList();
this.ruleForm.chatReply = "";
//
onSubmit() {
//
this.$refs["ruleForm"].validate(valid => {
//
this.ruleForm.replyTime = this.getCurDateTime();
//
this.ruleForm.chatTypes = 2;
if (valid) {
//
this.$http({
url: 'chat/save',
method: "post",
data: this.ruleForm
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
//
this.getList();
//
this.ruleForm.chatReply = "";
//
this.chatDate.zhuangtaiTypes = 2;
//
this.$http({
url: 'chat/update',
method: "post",
data: this.chatDate
}).then(({ data }) => {
//
});
this.chatDate.zhuangtaiTypes = 2
this.$http({
url: 'chat/update',
method: "post",
data: this.chatDate
}).then(({ data }) => {
});
}
});
} else {
this.$message.error(data.msg);
}
});
}
});
},
//
back() {
this.parent.showFlag = false;
this.parent.getDataList();
if(this.inter){
clearInterval(this.inter);
}
});
} else {
//
this.$message.error(data.msg);
}
});
}
});
},
//
back() {
//
this.parent.showFlag = false;
//
this.parent.getDataList();
//
if (this.inter) {
clearInterval(this.inter);
}
}
}
};
};
</script>
<style lang="scss">
.chat-content {
margin-left: 80px;
padding-bottom: 60px;
width: 500px;
margin-bottom: 30px;
max-height: 300px;
height: 300px;
overflow-y: scroll;
border: 1px solid #eeeeee;
.left-content {
float: left;
margin-bottom: 10px;
padding: 10px;
}
.right-content {
float: right;
margin-bottom: 10px;
padding: 10px;
}
}
.chat-content {
margin-left: 80px;
padding-bottom: 60px;
width: 500px;
margin-bottom: 30px;
max-height: 300px;
height: 300px;
overflow-y: scroll;
border: 1px solid #eeeeee;
.left-content {
float: left;
margin-bottom: 10px;
padding: 10px;
}
.right-content {
float: right;
margin-bottom: 10px;
padding: 10px;
}
}
.clear-float {
clear: both;
}
</style>
.clear-float {
clear: both;
}
</style>

@ -1,243 +1,199 @@
<template>
<!-- 主内容容器 -->
<div class="main-content">
<!-- 列表页展示 showFlag false 时显示 -->
<div v-if="!showFlag">
<!-- 表格内容容器 -->
<div class="table-content">
<!-- Element UI 表格组件用于展示聊天消息列表 -->
<el-table
:data="dataList"
empty-text="暂无需要回复的消息"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<!-- 新消息列 -->
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- 发送时间列 -->
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<!-- 状态列 -->
<el-table-column
prop="allnode"
header-align="center"
align="center"
sortable
label="状态"
width="150"
>
<!-- 自定义状态列内容 -->
<template slot-scope="scope">
<!-- 根据状态类型显示不同样式的标签 -->
<el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
</template>
</el-table-column>
<!-- 操作列固定在右侧 -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<!-- 自定义操作列内容 -->
<template slot-scope="scope">
<!-- 回复按钮点击调用 addOrUpdateHandler 方法 -->
<el-button
type="text"
icon="el-icon-edit"
size="small"
@click="addOrUpdateHandler(scope.row)"
>回复</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
class="pagination-content"
></el-pagination>
</div>
<div class="main-content">
<!-- 列表页 -->
<div v-if="!showFlag">
<div class="table-content">
<el-table
:data="dataList"
empty-text="暂无需要回复的消息"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<el-table-column
prop="allnode"
header-align="center"
align="center"
sortable
label="状态"
width="150"
>
<template slot-scope="scope">
<el-tag v-if="" :type="scope.row.zhuangtaiTypes==1?'success':'info'">{{scope.row.zhuangtaiValue}}</el-tag>
</template>
</el-table-column>
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<template slot-scope="scope">
<el-button
type="text"
icon="el-icon-edit"
size="small"
@click="addOrUpdateHandler(scope.row)"
>回复</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
class="pagination-content"
></el-pagination>
</div>
</div>
<!-- 添加/修改页面 将父组件的search方法传递给子组件-->
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
</div>
<!-- 添加/修改页面 showFlag true 时显示 -->
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import { setInterval, clearInterval } from 'timers';
export default {
data() {
return {
//
searchForm: {},
//
dataList: [],
//
pageIndex: 1,
//
pageSize: 10,
//
totalPage: 0,
//
dataListLoading: false,
// /
showFlag: false,
//
dataListSelections: [],
//
inter: null
};
},
//
created() {
var that = this;
// 5 getDataList
var inter = setInterval(function () {
that.getDataList();
}, 5000);
this.inter = inter;
},
//
destroyed() {
//
clearInterval(this.inter);
},
//
components: {
AddOrUpdate
},
methods: {
//
getDataList() {
//
this.dataListLoading = true;
// HTTP
this.$http({
url: 'chat/page',
method: "get",
params: {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
zhuangtaiTypes: 1,
chatTypes: 1,
}
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.dataList = data.data.list;
//
this.totalPage = data.data.total;
} else {
//
this.dataList = [];
this.totalPage = 0;
import AddOrUpdate from "./add-or-update";
import { setInterval, clearInterval } from 'timers';
export default {
data() {
return {
searchForm: {},
dataList: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
showFlag: false,
dataListSelections: [],
inter: null
};
},
created() {
var that = this;
var inter = setInterval(function(){
that.getDataList();
},5000);
this.inter = inter;
},
destroyed(){
clearInterval(this.inter);
},
components: {
AddOrUpdate
},
methods: {
getDataList() {
this.dataListLoading = true;
this.$http({
url: 'chat/page',
method: "get",
params: {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
zhuangtaiTypes: 1,
chatTypes: 1,
}
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.data.list;
this.totalPage = data.data.total;
} else {
this.dataList = [];
this.totalPage = 0;
}
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
this.pageSize = val;
this.pageIndex = 1;
this.getDataList();
},
//
currentChangeHandle(val) {
this.pageIndex = val;
this.getDataList();
},
//
addOrUpdateHandler(row) {
this.showFlag = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
}
}
//
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
//
this.pageSize = val;
// 1
this.pageIndex = 1;
//
this.getDataList();
},
//
currentChangeHandle(val) {
//
this.pageIndex = val;
//
this.getDataList();
},
//
addOrUpdateHandler(row) {
// /
this.showFlag = true;
// DOM init
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
}
}
};
};
</script>
<style lang="scss" scoped>
/* 部分样式类定义,用于设置表格、按钮等元素的样式 */
.slt {
margin: 0 !important;
display: flex;
}
margin: 0 !important;
display: flex;
}
.ad {
margin: 0 !important;
display: flex;
}
.ad {
margin: 0 !important;
display: flex;
}
.pages {
& /deep/ el-pagination__sizes {
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
.pages {
& /deep/ el-pagination__sizes{
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
}
}
}
}
.el-button +.el-button {
margin: 0;
}
.el-button+.el-button {
margin:0;
}
.tables {
& /deep/.el-button--success {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
.tables {
& /deep/ .el-button--success {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button--primary {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button--danger {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/.el-button--primary {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button {
margin: 4px;
}
}</style>
& /deep/.el-button--danger {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/.el-button {
margin: 4px;
}
}
</style>

@ -1,28 +1,35 @@
<template>
<div class="addEdit-block">
<el-form
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules=v-model="ruleForm.name"
placeholder="名称" clearable :readonly="ro.name"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="名称" prop="name">
<el-input v-model="ruleForm.name"
placeholder="名称" readonly></el-input>
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}"
>
<el-row>
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="名称" prop="name">
<el-input v-model="ruleForm.name"
placeholder="名称" clearable :readonly="ro.name"></el-input>
</el-form-item>
</div>
<div v-else>
<el-form-item class="input" label="名称" prop="name">
<el-input v-model="ruleForm.name"
placeholder="名称" readonly></el-input>
</el-form-item>
</div>
</el-col>
<el-col :span="24">
<el-col :span="24">
<el-form-item class="upload" v-if="type!='info' && !ro.value" label="值" prop="value">
<file-upload
tip="点击上传值"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.value?ruleForm.value:''"
@change="valueUploadChange"
tip="点击上传值"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.value?ruleForm.value:''"
@change="valueUploadChange"
></file-upload>
</el-form-item>
<div v-else>
@ -38,7 +45,7 @@
<el-button v-if="type=='info'" class="btn-close" @click="back()"></el-button>
</el-form-item>
</el-form>
</div>
</template>
@ -113,23 +120,23 @@ export default {
}
};
return {
addEditForm: null,
addEditForm: null,
id: '',
type: '',
ro:{
name : false,
value : false,
name : false,
value : false,
},
ruleForm: {
name: '',
value: '',
},
rules: {
name: [
{ required: true, message: '名称不能为空', trigger: 'blur' },
],
value: [
],
name: [
{ required: true, message: '名称不能为空', trigger: 'blur' },
],
value: [
],
}
};
},
@ -138,8 +145,8 @@ export default {
},
created() {
this.addEditForm = styleJs.addStyle();
this.addEditStyleChange()
this.addEditUploadStyleChange()
this.addEditStyleChange()
this.addEditUploadStyleChange()
},
methods: {
//
@ -159,12 +166,12 @@ export default {
for (var o in obj){
if(o=='name'){
this.ruleForm.name = obj[o];
this.ro.name = true;
this.ro.name = true;
continue;
}
if(o=='value'){
this.ruleForm.value = obj[o];
this.ro.value = true;
this.ro.value = true;
continue;
}
}
@ -177,9 +184,9 @@ export default {
method: "get"
}).then(({ data }) => {
if (data && data.code === 0) {
this.ruleForm = data.data;
//
let reg=new RegExp('../../../upload','g')//g
this.ruleForm = data.data;
//
let reg=new RegExp('../../../upload','g')//g
} else {
this.$message.error(data.msg);
}
@ -227,145 +234,145 @@ export default {
this.parent.contentStyleChange();
},
valueUploadChange(fileUrls) {
this.ruleForm.value = fileUrls;
this.addEditUploadStyleChange()
},
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
//
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
this.ruleForm.value = fileUrls;
this.addEditUploadStyleChange()
},
addEditStyleChange() {
this.$nextTick(()=>{
// input
document.querySelectorAll('.addEdit-block .input .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputFontColor
el.style.fontSize = this.addEditForm.inputFontSize
el.style.borderWidth = this.addEditForm.inputBorderWidth
el.style.borderStyle = this.addEditForm.inputBorderStyle
el.style.borderColor = this.addEditForm.inputBorderColor
el.style.borderRadius = this.addEditForm.inputBorderRadius
el.style.backgroundColor = this.addEditForm.inputBgColor
})
document.querySelectorAll('.addEdit-block .input .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.inputHeight
el.style.color = this.addEditForm.inputLableColor
el.style.fontSize = this.addEditForm.inputLableFontSize
})
// select
document.querySelectorAll('.addEdit-block .select .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectFontColor
el.style.fontSize = this.addEditForm.selectFontSize
el.style.borderWidth = this.addEditForm.selectBorderWidth
el.style.borderStyle = this.addEditForm.selectBorderStyle
el.style.borderColor = this.addEditForm.selectBorderColor
el.style.borderRadius = this.addEditForm.selectBorderRadius
el.style.backgroundColor = this.addEditForm.selectBgColor
})
document.querySelectorAll('.addEdit-block .select .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.selectHeight
el.style.color = this.addEditForm.selectLableColor
el.style.fontSize = this.addEditForm.selectLableFontSize
})
document.querySelectorAll('.addEdit-block .select .el-select__caret').forEach(el=>{
el.style.color = this.addEditForm.selectIconFontColor
el.style.fontSize = this.addEditForm.selectIconFontSize
})
// date
document.querySelectorAll('.addEdit-block .date .el-input__inner').forEach(el=>{
el.style.height = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateFontColor
el.style.fontSize = this.addEditForm.dateFontSize
el.style.borderWidth = this.addEditForm.dateBorderWidth
el.style.borderStyle = this.addEditForm.dateBorderStyle
el.style.borderColor = this.addEditForm.dateBorderColor
el.style.borderRadius = this.addEditForm.dateBorderRadius
el.style.backgroundColor = this.addEditForm.dateBgColor
})
document.querySelectorAll('.addEdit-block .date .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.dateHeight
el.style.color = this.addEditForm.dateLableColor
el.style.fontSize = this.addEditForm.dateLableFontSize
})
document.querySelectorAll('.addEdit-block .date .el-input__icon').forEach(el=>{
el.style.color = this.addEditForm.dateIconFontColor
el.style.fontSize = this.addEditForm.dateIconFontSize
el.style.lineHeight = this.addEditForm.dateHeight
})
// upload
let iconLineHeight = parseInt(this.addEditForm.uploadHeight) - parseInt(this.addEditForm.uploadBorderWidth) * 2 + 'px'
document.querySelectorAll('.addEdit-block .upload .el-upload--picture-card').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
document.querySelectorAll('.addEdit-block .upload .el-form-item__label').forEach(el=>{
el.style.lineHeight = this.addEditForm.uploadHeight
el.style.color = this.addEditForm.uploadLableColor
el.style.fontSize = this.addEditForm.uploadLableFontSize
})
document.querySelectorAll('.addEdit-block .upload .el-icon-plus').forEach(el=>{
el.style.color = this.addEditForm.uploadIconFontColor
el.style.fontSize = this.addEditForm.uploadIconFontSize
el.style.lineHeight = iconLineHeight
el.style.display = 'block'
})
//
document.querySelectorAll('.addEdit-block .textarea .el-textarea__inner').forEach(el=>{
el.style.height = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaFontColor
el.style.fontSize = this.addEditForm.textareaFontSize
el.style.borderWidth = this.addEditForm.textareaBorderWidth
el.style.borderStyle = this.addEditForm.textareaBorderStyle
el.style.borderColor = this.addEditForm.textareaBorderColor
el.style.borderRadius = this.addEditForm.textareaBorderRadius
el.style.backgroundColor = this.addEditForm.textareaBgColor
})
document.querySelectorAll('.addEdit-block .textarea .el-form-item__label').forEach(el=>{
// el.style.lineHeight = this.addEditForm.textareaHeight
el.style.color = this.addEditForm.textareaLableColor
el.style.fontSize = this.addEditForm.textareaLableFontSize
})
//
document.querySelectorAll('.addEdit-block .btn .btn-success').forEach(el=>{
el.style.width = this.addEditForm.btnSaveWidth
el.style.height = this.addEditForm.btnSaveHeight
el.style.color = this.addEditForm.btnSaveFontColor
el.style.fontSize = this.addEditForm.btnSaveFontSize
el.style.borderWidth = this.addEditForm.btnSaveBorderWidth
el.style.borderStyle = this.addEditForm.btnSaveBorderStyle
el.style.borderColor = this.addEditForm.btnSaveBorderColor
el.style.borderRadius = this.addEditForm.btnSaveBorderRadius
el.style.backgroundColor = this.addEditForm.btnSaveBgColor
})
//
document.querySelectorAll('.addEdit-block .btn .btn-close').forEach(el=>{
el.style.width = this.addEditForm.btnCancelWidth
el.style.height = this.addEditForm.btnCancelHeight
el.style.color = this.addEditForm.btnCancelFontColor
el.style.fontSize = this.addEditForm.btnCancelFontSize
el.style.borderWidth = this.addEditForm.btnCancelBorderWidth
el.style.borderStyle = this.addEditForm.btnCancelBorderStyle
el.style.borderColor = this.addEditForm.btnCancelBorderColor
el.style.borderRadius = this.addEditForm.btnCancelBorderRadius
el.style.backgroundColor = this.addEditForm.btnCancelBgColor
})
})
},
addEditUploadStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.addEdit-block .upload .el-upload-list--picture-card .el-upload-list__item').forEach(el=>{
el.style.width = this.addEditForm.uploadHeight
el.style.height = this.addEditForm.uploadHeight
el.style.borderWidth = this.addEditForm.uploadBorderWidth
el.style.borderStyle = this.addEditForm.uploadBorderStyle
el.style.borderColor = this.addEditForm.uploadBorderColor
el.style.borderRadius = this.addEditForm.uploadBorderRadius
el.style.backgroundColor = this.addEditForm.uploadBgColor
})
})
},
}
};
</script>
@ -374,7 +381,7 @@ export default {
height: 500px;
& /deep/ .ql-container {
height: 310px;
height: 310px;
}
}
.amap-wrapper {
@ -385,10 +392,10 @@ export default {
position: absolute;
}
.addEdit-block {
margin: -10px;
margin: -10px;
}
.detail-form-content {
padding: 12px;
padding: 12px;
}
.btn .el-button {
padding: 0;

@ -1,243 +1,513 @@
<template>
<!-- 主内容容器 -->
<div class="main-content">
<!-- 列表页展示 showFlag false 时显示 -->
<div v-if="!showFlag">
<!-- 表格内容容器 -->
<!-- 列表页 -->
<div v-if="showFlag">
<el-form :inline="true" :model="searchForm" class="form-content">
<el-row class="ad" :style="{justifyContent:contents.btnAdAllBoxPosition=='1'?'flex-start':contents.btnAdAllBoxPosition=='2'?'center':'flex-end'}">
<el-form-item>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1"
type="success"
icon="el-icon-plus"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}<i class="el-icon-plus el-icon--right" /></el-button>
<el-button
v-if="isAuth('config','新增') && contents.btnAdAllIcon == 0"
type="success"
@click="addOrUpdateHandler()"
>{{ contents.btnAdAllFont == 1?'新增':'' }}</el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 1 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
icon="el-icon-delete"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 1 && contents.btnAdAllIconPosition == 2 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
<el-button
v-if="isAuth('config','删除') && contents.btnAdAllIcon == 0 && contents.tableSelection"
:disabled="dataListSelections.length <= 0"
type="danger"
@click="deleteHandler()"
>{{ contents.btnAdAllFont == 1?'删除':'' }}</el-button>
</el-form-item>
</el-row>
</el-form>
<div class="table-content">
<!-- Element UI 表格组件用于展示聊天消息列表 -->
<el-table
<el-table class="tables" :size="contents.tableSize" :show-header="contents.tableShowHeader"
:header-row-style="headerRowStyle" :header-cell-style="headerCellStyle"
:border="contents.tableBorder"
:fit="contents.tableFit"
:stripe="contents.tableStripe"
:row-style="rowStyle"
:cell-style="cellStyle"
:style="{width: '100%',fontSize:contents.tableContentFontSize,color:contents.tableContentFontColor}"
v-if="isAuth('config','查看')"
:data="dataList"
empty-text="暂无需要回复的消息"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<!-- 新消息列 -->
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- 发送时间列 -->
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<!-- 状态列 -->
<el-table-column
prop="allnode"
header-align="center"
align="center"
sortable
label="状态"
width="150"
>
<!-- 自定义状态列内容 -->
<template slot-scope="scope">
<!-- 根据状态类型显示不同样式的标签 -->
<el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
</template>
</el-table-column>
<!-- 操作列固定在右侧 -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<!-- 自定义操作列内容 -->
<template slot-scope="scope">
<!-- 回复按钮点击调用 addOrUpdateHandler 方法 -->
<el-button
type="text"
icon="el-icon-edit"
size="small"
@click="addOrUpdateHandler(scope.row)"
>回复</el-button>
</template>
</el-table-column>
@selection-change="selectionChangeHandler">
<el-table-column v-if="contents.tableSelection"
type="selection"
header-align="center"
align="center"
width="50">
</el-table-column>
<el-table-column label="索引" v-if="contents.tableIndex" type="index" width="50" />
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign"
prop="name"
header-align="center"
label="名称">
<template slot-scope="scope">
{{scope.row.name}}
</template>
</el-table-column>
<el-table-column :sortable="contents.tableSortable" :align="contents.tableAlign" prop="value"
header-align="center"
width="200"
label="值">
<template slot-scope="scope">
<div v-if="scope.row.value">
<img :src="scope.row.value.split(',')[0]" width="100" height="100">
</div>
<div v-else></div>
</template>
</el-table-column>
<el-table-column width="300" :align="contents.tableAlign"
header-align="center"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="success" icon="el-icon-tickets" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-tickets el-icon--right" /></el-button>
<el-button v-if="isAuth('config','查看') && contents.tableBtnIcon == 0" type="success" size="mini" @click="addOrUpdateHandler(scope.row.id,'info')">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="primary" icon="el-icon-edit" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-edit el-icon--right" /></el-button>
<el-button v-if="isAuth('config','修改') && contents.tableBtnIcon == 0" type="primary" size="mini" @click="addOrUpdateHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 1" type="danger" icon="el-icon-delete" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 1 && contents.tableBtnIconPosition == 2" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}<i class="el-icon-delete el-icon--right" /></el-button>
<el-button v-if="isAuth('config','删除') && contents.tableBtnIcon == 0" type="danger" size="mini" @click="deleteHandler(scope.row.id)">{{ contents.tableBtnFont == 1?'':'' }}</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
class="pagination-content"
clsss="pages"
:layout="layouts"
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="Number(contents.pageEachNum)"
:total="totalPage"
:small="contents.pageStyle"
class="pagination-content"
:background="contents.pageBtnBG"
:style="{textAlign:contents.pagePosition==1?'left':contents.pagePosition==2?'center':'right'}"
></el-pagination>
</div>
</div>
<!-- 添加/修改页面 showFlag true 时显示 -->
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
<!-- 添加/修改页面 将父组件的search方法传递给子组件-->
<add-or-update v-if="addOrUpdateFlag" :parent="this" ref="addOrUpdate"></add-or-update>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import { setInterval, clearInterval } from 'timers';
import AddOrUpdate from "./add-or-update.vue";
import styleJs from "../../../utils/style.js";
export default {
data() {
return {
//
searchForm: {},
//
searchForm: {
key: ""
},
form:{},
dataList: [],
//
pageIndex: 1,
//
pageSize: 10,
//
totalPage: 0,
//
dataListLoading: false,
// /
showFlag: false,
//
dataListSelections: [],
//
inter: null
showFlag: true,
sfshVisiable: false,
shForm: {},
chartVisiable: false,
addOrUpdateFlag:false,
contents:null,
layouts: '',
};
},
//
created() {
var that = this;
// 5 getDataList
var inter = setInterval(function () {
that.getDataList();
}, 5000);
this.inter = inter;
this.contents = styleJs.listStyle();
this.init();
this.getDataList();
this.contentStyleChange()
},
//
destroyed() {
//
clearInterval(this.inter);
mounted() {
},
filters: {
htmlfilter: function (val) {
return val.replace(/<[^>]*>/g).replace(/undefined/g,'');
}
},
//
components: {
AddOrUpdate
AddOrUpdate,
},
methods: {
//
contentStyleChange() {
this.contentSearchStyleChange()
this.contentBtnAdAllStyleChange()
this.contentSearchBtnStyleChange()
this.contentTableBtnStyleChange()
this.contentPageStyleChange()
},
contentSearchStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .slt .el-input__inner').forEach(el=>{
let textAlign = 'left'
if(this.contents.inputFontPosition == 2) textAlign = 'center'
if(this.contents.inputFontPosition == 3) textAlign = 'right'
el.style.textAlign = textAlign
el.style.height = this.contents.inputHeight
el.style.lineHeight = this.contents.inputHeight
el.style.color = this.contents.inputFontColor
el.style.fontSize = this.contents.inputFontSize
el.style.borderWidth = this.contents.inputBorderWidth
el.style.borderStyle = this.contents.inputBorderStyle
el.style.borderColor = this.contents.inputBorderColor
el.style.borderRadius = this.contents.inputBorderRadius
el.style.backgroundColor = this.contents.inputBgColor
})
if(this.contents.inputTitle) {
document.querySelectorAll('.form-content .slt .el-form-item__label').forEach(el=>{
el.style.color = this.contents.inputTitleColor
el.style.fontSize = this.contents.inputTitleSize
el.style.lineHeight = this.contents.inputHeight
})
}
setTimeout(()=>{
document.querySelectorAll('.form-content .slt .el-input__prefix').forEach(el=>{
el.style.color = this.contents.inputIconColor
el.style.lineHeight = this.contents.inputHeight
})
document.querySelectorAll('.form-content .slt .el-input__suffix').forEach(el=>{
el.style.color = this.contents.inputIconColor
el.style.lineHeight = this.contents.inputHeight
})
document.querySelectorAll('.form-content .slt .el-input__icon').forEach(el=>{
el.style.lineHeight = this.contents.inputHeight
})
},10)
})
},
//
contentSearchBtnStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .slt .el-button--success').forEach(el=>{
el.style.height = this.contents.searchBtnHeight
el.style.color = this.contents.searchBtnFontColor
el.style.fontSize = this.contents.searchBtnFontSize
el.style.borderWidth = this.contents.searchBtnBorderWidth
el.style.borderStyle = this.contents.searchBtnBorderStyle
el.style.borderColor = this.contents.searchBtnBorderColor
el.style.borderRadius = this.contents.searchBtnBorderRadius
el.style.backgroundColor = this.contents.searchBtnBgColor
})
})
},
//
contentBtnAdAllStyleChange() {
this.$nextTick(()=>{
document.querySelectorAll('.form-content .ad .el-button--success').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllAddFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllAddBgColor
})
document.querySelectorAll('.form-content .ad .el-button--danger').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllDelFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllDelBgColor
})
document.querySelectorAll('.form-content .ad .el-button--warning').forEach(el=>{
el.style.height = this.contents.btnAdAllHeight
el.style.color = this.contents.btnAdAllWarnFontColor
el.style.fontSize = this.contents.btnAdAllFontSize
el.style.borderWidth = this.contents.btnAdAllBorderWidth
el.style.borderStyle = this.contents.btnAdAllBorderStyle
el.style.borderColor = this.contents.btnAdAllBorderColor
el.style.borderRadius = this.contents.btnAdAllBorderRadius
el.style.backgroundColor = this.contents.btnAdAllWarnBgColor
})
})
},
//
rowStyle({ row, rowIndex}) {
if (rowIndex % 2 == 1) {
if(this.contents.tableStripe) {
return {color:this.contents.tableStripeFontColor}
}
} else {
return ''
}
},
cellStyle({ row, rowIndex}){
if (rowIndex % 2 == 1) {
if(this.contents.tableStripe) {
return {backgroundColor:this.contents.tableStripeBgColor}
}
} else {
return ''
}
},
headerRowStyle({ row, rowIndex}){
return {color: this.contents.tableHeaderFontColor}
},
headerCellStyle({ row, rowIndex}){
return {backgroundColor: this.contents.tableHeaderBgColor}
},
//
contentTableBtnStyleChange(){
// this.$nextTick(()=>{
// setTimeout(()=>{
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--success').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnDetailFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnDetailBgColor
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--primary').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnEditFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnEditBgColor
// })
// document.querySelectorAll('.table-content .tables .el-table__body .el-button--danger').forEach(el=>{
// el.style.height = this.contents.tableBtnHeight
// el.style.color = this.contents.tableBtnDelFontColor
// el.style.fontSize = this.contents.tableBtnFontSize
// el.style.borderWidth = this.contents.tableBtnBorderWidth
// el.style.borderStyle = this.contents.tableBtnBorderStyle
// el.style.borderColor = this.contents.tableBtnBorderColor
// el.style.borderRadius = this.contents.tableBtnBorderRadius
// el.style.backgroundColor = this.contents.tableBtnDelBgColor
// })
// }, 50)
// })
},
//
contentPageStyleChange(){
let arr = []
if(this.contents.pageTotal) arr.push('total')
if(this.contents.pageSizes) arr.push('sizes')
if(this.contents.pagePrevNext){
arr.push('prev')
if(this.contents.pagePager) arr.push('pager')
arr.push('next')
}
if(this.contents.pageJumper) arr.push('jumper')
this.layouts = arr.join()
this.contents.pageEachNum = 10
},
init () {
},
search() {
this.pageIndex = 1;
this.getDataList();
},
//
getDataList() {
//
this.dataListLoading = true;
// HTTP
let params = {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
}
if(this.searchForm.name!='' && this.searchForm.name!=undefined){
params['name'] = '%' + this.searchForm.name + '%'
}
this.$http({
url: 'chat/page',
url: "config/page",
method: "get",
params: {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
zhuangtaiTypes: 1,
chatTypes: 1,
}
params: params
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.dataList = data.data.list;
//
this.totalPage = data.data.total;
} else {
//
this.dataList = [];
this.totalPage = 0;
}
//
this.dataListLoading = false;
});
},
//
//
sizeChangeHandle(val) {
//
this.pageSize = val;
// 1
this.pageIndex = 1;
//
this.getDataList();
},
//
//
currentChangeHandle(val) {
//
this.pageIndex = val;
//
this.getDataList();
},
//
addOrUpdateHandler(row) {
// /
this.showFlag = true;
// DOM init
//
selectionChangeHandler(val) {
this.dataListSelections = val;
},
// /
addOrUpdateHandler(id,type) {
this.showFlag = false;
this.addOrUpdateFlag = true;
this.crossAddOrUpdateFlag = false;
if(type!='info'){
type = 'else';
}
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
this.$refs.addOrUpdate.init(id,type);
});
}
},
//
//
download(file){
window.open(`${file}`)
},
//
deleteHandler(id) {
var ids = id
? [Number(id)]
: this.dataListSelections.map(item => {
return Number(item.id);
});
this.$confirm(`确定进行[${id ? "删除" : "批量删除"}]操作?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(() => {
this.$http({
url: "config/delete",
method: "post",
data: ids
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.search();
}
});
} else {
this.$message.error(data.msg);
}
});
});
},
}
};
</script>
<style lang="scss" scoped>
/* 部分样式类定义,用于设置表格、按钮等元素的样式 */
.slt {
margin: 0 !important;
display: flex;
}
.ad {
margin: 0 !important;
display: flex;
}
.pages {
& /deep/ el-pagination__sizes {
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
}
}
}
.el-button +.el-button {
margin: 0;
}
.tables {
& /deep/.el-button--success {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
margin: 0 !important;
display: flex;
}
& /deep/.el-button--primary {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
.ad {
margin: 0 !important;
display: flex;
}
& /deep/.el-button--danger {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
.pages {
& /deep/ el-pagination__sizes{
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
}
}
}
& /deep/.el-button {
margin: 4px;
}
}
</style>
.el-button+.el-button {
margin:0;
}
.tables {
& /deep/ .el-button--success {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button--primary {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button--danger {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/ .el-button {
margin: 4px;
}
}</style>

@ -4,7 +4,15 @@
class="detail-form-content"
ref="ruleForm"
:model="ruleForm"
:rule" clearable :readonly="ro.dicCode"></el-input>
:rules="rules"
label-width="80px"
:style="{backgroundColor:addEditForm.addEditBoxColor}">
<el-row>
<input id="updateId" name="id" type="hidden">
<el-col :span="12">
<el-form-item class="input" v-if="type!='info'" label="字段" prop="dicCode">
<el-input v-model="ruleForm.dicCode"
placeholder="字段" clearable :readonly="ro.dicCode"></el-input>
</el-form-item>
<div v-else>
<el-form-item class="input" label="字段" prop="dicCode">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,243 +1,701 @@
<template>
<!-- -->
<div class="main-content">
<!-- showFlag false -->
<div v-if="!showFlag">
<!-- -->
<div class="table-content">
<!-- Element UI -->
<el-table
:data="dataList"
empty-text="暂无需要回复的消息"
border
v-loading="dataListLoading"
style="width: 100%;"
>
<!-- -->
<el-table-column prop="chatIssue" header-align="center" align="center" sortable label="新消息"></el-table-column>
<!-- -->
<el-table-column prop="issueTime" header-align="center" align="center" sortable label="发送时间"></el-table-column>
<!-- -->
<el-table-column
prop="allnode"
header-align="center"
align="center"
sortable
label="状态"
width="150"
>
<!-- -->
<template slot-scope="scope">
<!-- -->
<el-tag v-if="" :type="scope.row.zhuangtaiTypes === 1? 'success' : 'info'">{{ scope.row.zhuangtaiValue }}</el-tag>
</template>
</el-table-column>
<!-- -->
<el-table-column
fixed="right"
header-align="center"
align="center"
width="150"
label="操作"
>
<!-- -->
<template slot-scope="scope">
<!-- addOrUpdateHandler -->
<el-button
type="text"
icon="el-icon-edit"
size="small"
@click="addOrUpdateHandler(scope.row)"
></el-button>
</template>
</el-table-column>
</el-table>
<!-- -->
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
layout="total, sizes, prev, pager, next, jumper"
class="pagination-content"
></el-pagination>
</div>
</div>
<!-- / showFlag true -->
<add-or-update v-else :parent="this" ref="addOrUpdate"></add-or-update>
</div>
</template>
<script>
// /
import AddOrUpdate from "./add-or-update";
//
import { setInterval, clearInterval } from 'timers';
export default {
data() {
return {
//
searchForm: {},
//
dataList: [],
//
pageIndex: 1,
//
pageSize: 10,
//
totalPage: 0,
//
dataListLoading: false,
// /
showFlag: false,
//
dataListSelections: [],
//
inter: null
};
},
//
created() {
var that = this;
// 5 getDataList
var inter = setInterval(function () {
that.getDataList();
}, 5000);
this.inter = inter;
},
//
destroyed() {
//
clearInterval(this.inter);
},
//
components: {
AddOrUpdate
},
methods: {
//
getDataList() {
//
this.dataListLoading = true;
// HTTP
this.$http({
url: 'chat/page',
method: "get",
params: {
page: this.pageIndex,
limit: this.pageSize,
sort: 'id',
zhuangtaiTypes: 1,
chatTypes: 1,
}
}).then(({ data }) => {
if (data && data.code === 0) {
//
this.dataList = data.data.list;
//
this.totalPage = data.data.total;
} else {
//
this.dataList = [];
this.totalPage = 0;
}
//
this.dataListLoading = false;
});
},
//
sizeChangeHandle(val) {
//
this.pageSize = val;
// 1
this.pageIndex = 1;
//
this.getDataList();
},
//
currentChangeHandle(val) {
//
this.pageIndex = val;
//
this.getDataList();
},
//
addOrUpdateHandler(row) {
// /
this.showFlag = true;
// DOM init
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row);
});
}
}
};
</script>
<style lang="scss" scoped>
/* 部分样式类定义,用于设置表格、按钮等元素的样式 */
.slt {
margin: 0 !important;
display: flex;
}
.ad {
margin: 0 !important;
.container {
margin: 0 auto;
width: 980px;
}
label {
margin: 0;
}
/* 导航栏 */
.nav {
text-align: center;
}
.layui-nav * {
font-size: 18px;
}
/* 轮播图 */
.swiper-item {
width: 100%;
}
.layui-carousel-ind li {
width: 80px;
height: 5px;
border-radius: 0;
}
/* 商品推荐标题 */
.recommend-container {
margin-top: 20px;
}
.index-title {
margin: 0 auto;
width: 980px;
text-align: center;
font-size: 42px;
font-family: "Times New Roman", Times, serif;
text-transform: uppercase;
}
.recommend-list {
width: 1000px;
margin: 0 auto;
height: 360px;
padding: 0px 0 0 0;
}
.recommend-item {
float: left;
width: 1000px;
padding: 20px 0 0 0;
}
.recommend-item li {
float: left;
width: 218px;
position: relative;
display: inline;
margin: 0 15px;
}
.recommend-item li a.img {
float: left;
width: 218px;
height: 218px;
position: absolute;
left: 0;
top: 0;
background: url(../img/yuan.png) left top no-repeat;
}
.recommend-item li a.wor {
float: left;
width: 218px;
height: 30px;
line-height: 30px;
text-align: center;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
font-size: 14px;
color: #000;
display: inline;
margin: 10px 0 0 0;
}
/* 首页新闻样式(手风琴) */
.news-home-container {
padding-top: 20px;
margin-bottom: 20px;
padding-bottom: 20px;
}
.news-home-container .layui-collapse {
border: 0;
margin: 0 20px;
}
.news-home-container .layui-colla-item {
margin-top: 14px;
}
.news-home-container .layui-colla-content {
font-size: 16px;
line-height: 40px;
height: 115px;
}
.news-home-container .layui-colla-title {
height: 50px;
line-height: 50px;
font-size: 16px;
font-weight: 500;
}
.news-home-container .card-container {
margin-top: 18px;
}
.news-home-container .layui-card-header {
height: 50px;
line-height: 50px;
}
/* 底部导航 */
.nav-bottom {
text-align: center;
}
/* 底部栏 */
.footer {
margin: 10px;
text-align: center;
}
.footer-item {
color: #515151;
margin-top: 10px;
}
/* 留言 */
.message-container {
width: 980px;
margin: 0 auto;
text-align: center;
}
.message-container .message-form {
margin-top: 20px;
border-bottom: 1px dotted #888888;
}
.message-container .message-list {
text-align: left;
}
.message-container .message-list .message-item {
margin-top: 20px;
border-bottom: 1px solid #EEEEEE;
}
.message-container .message-list .message-item .username-container {
font-size: 18px;
}
.message-container .message-list .message-item .username-container .avator {
width: 60px;
height: 60px;
border-radius: 50%;
}
.message-container .message-list .message-item .content {
margin: 10px;
}
.message-container .message-list .message-item .replay {
background: #EEEEEE;
margin: 10px;
padding: 20px;
border-radius: 20px;
}
/* 论坛 */
.forum-container {
width: 980px;
margin: 0 auto;
text-align: center;
}
.forum-container .forum-list {
text-align: left;
margin-top: 20px;
}
.forum-container .forum-list .forum-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
border-bottom: 3px dotted #EEEEEE;
border-top: 3px dotted #EEEEEE;
}
.pages {
& /deep/ el-pagination__sizes {
& /deep/ el-input__inner {
height: 22px;
line-height: 22px;
}
}
.forum-container .forum-list .forum-item.line {
background: #EEEEEE;
}
.el-button +.el-button {
margin: 0;
.forum-container .forum-list .forum-item .h2 {
font-size: 14px;
}
.forum-container .forum-list .forum-item .create-time {
font-size: 14px;
}
.forum-container {
margin-top: 20px;
}
.forum-container .title {
font-size: 22px;
font-weight: bold;
}
.forum-container .content {
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 30px;
font-size: 16px;
line-height: 30px;
}
.forum-container .auth-container {
margin-top: 20px;
color: #888888;
border-bottom: 1px dotted #888888;
padding-bottom: 20px;
}
.forum-container .bottom-container {
display: flex;
justify-content: space-between;
width: 980px;
margin: 0 auto;
background: #EEEEEE;
height: 60px;
line-height: 60px;
margin-top: 30px;
}
.forum-container .bottom-container .title {
margin-left: 30px;
font-size: 20px;
color: #515151;
}
.forum-container .bottom-container .btn {
font-size: 20px;
padding: 0 20px;
}
.forum-container .message-list {
text-align: left;
}
.forum-container .message-list .message-item {
margin-top: 20px;
border-bottom: 1px solid #EEEEEE;
}
.forum-container .message-list .message-item .username-container {
font-size: 18px;
}
.forum-container .message-list .message-item .username-container .avator {
width: 60px;
height: 60px;
border-radius: 50%;
}
.forum-container .message-list .message-item .content {
margin: 10px;
}
.forum-container .message-list .message-item .replay {
background: #EEEEEE;
margin: 10px;
padding: 20px;
border-radius: 20px;
}
/* 考试 */
.paper-container {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: center;
}
.paper-container thead {
border-radius: 100px;
}
.paper-container thead tr th {
font-size: 16px;
font-weight: blod;
line-height: 50px;
height: 50px;
text-align: center;
}
.paper-container tbody tr td {
font-size: 16px;
height: 50px;
border-bottom: 5px dotted #EEEEEE;
}
.paper-container tbody tr {
border: 3px dotted #EEEEEE;
}
/* 个人中心 */
.center-container {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: center;
display: flex;
margin-bottom: 20px;
}
.center-container .left-container {
border: 2px dotted #EEEEEE;
background: #FFFFFF;
width: 200px;
padding-top: 20px;
height: 600px;
}
.center-container .right-container {
flex: 1;
border: 2px dotted #EEEEEE;
background: #FFFFFF;
text-align: left;
padding: 20px;
padding-top: 40px;
}
/* 购物车 */
.btn-container {
margin-top: 20px;
text-align: right;
margin-bottom: 60px;
border: 2px dotted #EEEEEE;
padding: 20px;
}
/* 登陆注册 */
.login-container {
background: #FFFFFF;
z-index: 9;
position: relative;
width: 480px;
margin: 0 auto;
border-radius: 20px;
margin-top: 100px;
padding-top: 30px;
}
.login-form {
text-align: center;
padding: 20px;
}
.login-bg {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 0.8;
background-size: 100% 100%;
background-repeat: no-repeat;
}
.login-container .bottom-container {
text-align: center;
color: #888888;
padding: 20px;
}
.login-container .bottom-container a {
margin-left: 10px;
border: 2px dotted #888888;
padding: 10px;
}
/* 确认下单页面 */
.address-table {
border: 3px dotted #EEEEEE;
}
/* 图文列表 */
.data-container {
margin: 20px 0;
text-align: center;
display: flex;
flex-direction: column;
}
.data-container .data-list .data-item {
padding: 20px;
text-align: left;
margin-bottom: 10px;
min-height: 330px;
}
.data-container .data-list .data-item:hover {
padding: 10px;
}
.data-container .data-list .data-item .cover {
width: 100%;
height: 200px;
object-fit: cover;
border: 1px solid #EEEEEE;
}
.data-container .data-list .data-item .title {
text-align: center;
padding: 10px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.data-container .data-list .data-item .price {
font-size: 20px;
text-align: right;
}
.data-container .data-list .data-item .data {
font-size: 16px;
border: 1px solid #EEEEEE;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.data-container .data-list .data-item .data .item {
width: 40%;
text-align: center;
margin: 10px;
}
.search-container {
border: 0;
font-size: 16px;
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 10px;
margin-bottom: 10px;
}
/* 数据详情页 */
.data-detail {
width: 980px;
margin: 0 auto;
margin-top: 20px;
text-align: left;
margin-bottom: 20px;
}
.data-detail-breadcrumb {
margin: 10px 0;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}
.data-detail .title {
font-size: 20px;
font-weight: bold;
border: 3px dotted #EEEEEE;
padding: 10px;
}
.data-detail .count-container {
background: url(../img/seckilling.jpg);
margin-top: 20px;
padding: 15px;
display: flex;
justify-content: space-between;
align-items: center;
}
.data-detail .count-container .text {
font-size: 18px;
font-weight: blod;
}
.data-detail .count-container .number {
padding: 10px;
font-size: 16px;
font-weight: blod;
}
.data-detail .tool-container {
display: flex;
justify-content: space-between;
align-items: center;
margin-top: 20px;
font-size: 16px;
font-weight: bolder;
padding: 10px;
}
.data-detail .price {
color: red;
font-size: 16px;
font-weight: bolder;
font-size: 20px;
font-weight: bolder;
}
.data-detail .detail-item {
background: #EEEEEE;
padding: 10px;
display: flex;
align-items: center;
}
.data-detail .desc {
font-size: 16px;
color: #515151;
}
.video-container {
width: 100%;
margin-top: 20px;
}
.num-picker {
display: flex;
align-items: center;
margin-right: 20px;
}
.num-picker button {
border: 0;
font-size: 20px;
}
.num-picker input {
width: 50px;
text-align: center;
height: 40px;
}
.data-add-container{
width: 800px;
margin: 0 auto;
margin-top: 20px;
text-align: left;
margin-bottom: 20px;
background: #FFFFFF;
padding: 20px;
padding-top: 30px;
}
/* 详情页选座 */
.seat-list {
display: flex;
align-items: center;
flex-wrap: wrap;
background: #FFFFFF;
margin: 20px;
border-radius: 20px;
padding: 20px;
font-size: 16px;
}
.seat-item {
width: 10%;
display: flex;
align-items: center;
flex-direction: column;
margin-bottom: 20px;
}
.seat-icon {
width: 30px;
height: 30px;
margin-bottom: 10px;
}
/* banner */
.banner {
width: 100%;
height: 50px;
margin-top: 30px;
}
/* 新闻列表 */
.news-container {
text-align: center;
margin: 0 auto;
margin: 40px 0;
}
.tables {
& /deep/.el-button--success {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/.el-button--primary {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/.el-button--danger {
height: 30px;
color: rgba(88, 179, 81, 1);
font-size: 12px;
border-width: 1px;
border-style: none none solid none;
border-color: rgba(88, 179, 81, 1);
border-radius: 0px;
background-color: #fff;
}
& /deep/.el-button {
margin: 4px;
}
}
</style>
.news-container .pager {
margin: 20px 0;
}
.news-container .news-list {
width: 980px;
margin: 0 auto;
text-align: left;
}
.news-container .news-list .news-item {
display: flex;
border-bottom: 1px solid #EEEEEE;
padding: 10px;
}
.news-container .news-list .news-item .cover-container {
margin: 0 20px;
}
.news-container .news-list .news-item .cover-container .cover {
width: 200px;
height: 200px;
object-fit: cover;
}
.news-container .news-list .news-item .detail-container .h2 {
font-size: 18px;
font-weight: bold;
}
.news-container .news-list .news-item .detail-container .desc {
height: 140px;
padding-top: 20px;
}
.news-container .title {
font-size: 22px;
font-weight: bold;
}
.news-container .content {
width: 980px;
margin: 0 auto;
text-align: left;
margin-top: 30px;
font-size: 16px;
line-height: 30px;
}
.news-container .auth-container {
margin-top: 20px;
color: #888888;
border-bottom: 1px dotted #888888;
padding-bottom: 20px;
}
.news-container .bottom-container {
display: flex;
justify-content: space-between;
width: 980px;
margin: 0 auto;
background: #EEEEEE;
height: 60px;
line-height: 60px;
margin-top: 30px;
}
.news-container .bottom-container .title {
margin-left: 30px;
font-size: 20px;
color: #515151;
}
.news-container .bottom-container .btn {
font-size: 20px;
padding: 0 20px;
}

@ -1,90 +1,74 @@
/**
* 验证输入的字符串是否为有效的邮箱地址
* @param {*} s - 要验证的字符串预期为邮箱地址
* @returns {boolean} - 如果字符串是有效的邮箱地址返回 true否则返回 false当传入的 s null undefined 直接返回 true
* 邮箱
* @param {*} s
*/
function isEmail(s) {
if (s) {
// 使用正则表达式匹配邮箱地址的格式
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s);
if(s){
return /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/.test(s)
}
return true;
}
/**
* 验证输入的字符串是否为有效的手机号码
* @param {*} s - 要验证的字符串预期为手机号码
* @returns {boolean} - 如果字符串是有效的手机号码返回 true否则返回 false当传入的 s null undefined 直接返回 true
* 手机号码
* @param {*} s
*/
function isMobile(s) {
if (s) {
// 使用正则表达式匹配手机号码的格式(以 1 开头,后面跟着 10 位数字)
return /^1[0-9]{10}$/.test(s);
if(s){
return /^1[0-9]{10}$/.test(s)
}
return true;
}
/**
* 验证输入的字符串是否为有效的电话号码
* @param {*} s - 要验证的字符串预期为电话号码
* @returns {boolean} - 如果字符串是有效的电话号码返回 true否则返回 false当传入的 s null undefined 直接返回 true
* 电话号码
* @param {*} s
*/
function isPhone(s) {
if (s) {
// 使用正则表达式匹配电话号码的格式(可以有 3 到 4 位区号,后面跟着 7 到 8 位号码,区号和号码之间用 - 分隔)
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s);
if(s){
return /^([0-9]{3,4}-)?[0-9]{7,8}$/.test(s)
}
return true;
}
/**
* 验证输入的字符串是否为有效的 URL 地址
* @param {*} s - 要验证的字符串预期为 URL 地址
* @returns {boolean} - 如果字符串是有效的 URL 地址返回 true否则返回 false当传入的 s null undefined 直接返回 true
* URL地址
* @param {*} s
*/
function isURL(s) {
if (s) {
// 使用正则表达式匹配 URL 地址的格式(以 http 或 https 开头)
return /^http[s]?:\/\/.*/.test(s);
if(s){
return /^http[s]?:\/\/.*/.test(s)
}
return true;
}
/**
* 验证输入的字符串是否为有效的数字可以是小数不能是负数可以为空
* @param {*} s - 要验证的字符串预期为数字
* @returns {boolean} - 如果字符串是有效的数字符合指定格式返回 true否则返回 false当传入的 s null undefined 直接返回 true
* 匹配数字可以是小数不可以是负数,可以为空
* @param {*} s
*/
function isNumber(s) {
if (s) {
// 使用正则表达式匹配数字的格式,包括小数和科学计数法形式,不允许负数
if(s){
return /(^-?[+-]?([0-9]*\.?[0-9]+|[0-9]+\.?[0-9]*)([eE][+-]?[0-9]+)?$)|(^$)/.test(s);
}
return true;
}
/**
* 验证输入的字符串是否为有效的整数可以为空
* @param {*} s - 要验证的字符串预期为整数
* @returns {boolean} - 如果字符串是有效的整数符合指定格式返回 true否则返回 false当传入的 s null undefined 直接返回 true
* 匹配整数可以为空
* @param {*} s
*/
function isIntNumer(s) {
if (s) {
// 使用正则表达式匹配整数的格式,包括正负整数和空字符串
if(s){
return /(^-?\d+$)|(^$)/.test(s);
}
return true;
}
/**
* 验证输入的字符串是否为有效的身份证号码
* @param {string} idcard - 要验证的字符串预期为身份证号码
* @returns {boolean} - 如果字符串是有效的身份证号码符合 15 18 位或 17 位加最后一位为 X x 的格式返回 true否则返回 false当传入的 idcard null undefined 直接返回 true
* 身份证校验
*/
function isIdentity(idcard) {
const regIdCard = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
if (idcard) {
if(idcard){
return regIdCard.test(idcard);
}
return true;
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save