12 3 months ago
parent d639f14fa7
commit d4e5882ce8

@ -0,0 +1,103 @@
# 心理辅助系统
## 项目简介
这是一个基于前后端分离架构开发的心理辅助系统,旨在提供心理健康相关的服务和功能。
## 技术栈
### 后端技术
- **Spring Boot** 2.5.9 - 后端开发框架
- **MyBatis** - 持久层框架
- **MySQL** 5.1.32 - 数据库
- **PageHelper** - 分页插件
- **Hutool** - Java工具包
- **JWT** - 身份认证
- **Lombok** - 简化Java代码
### 前端技术
- **Vue.js** 2.6.14 - 前端框架
- **Element UI** - UI组件库
- **Vue Router** - 路由管理
- **Axios** - HTTP客户端
- **ECharts** - 数据可视化
- **WangEditor** - 富文本编辑器
## 环境要求
### 后端环境
- JDK 1.8
- Maven 3.6+
- MySQL 5.7+
### 前端环境
- Node.js 14+
- npm 6+
## 安装配置
### 1. 数据库配置
1. 创建数据库:`CREATE DATABASE xinliai CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;`
2. 导入数据库脚本:`xinliai.sql`
### 2. 后端配置
1. 修改配置文件:`src/main/resources/application.yml`
2. 配置数据库连接信息:
```yaml
spring:
datasource:
url: jdbc:mysql://localhost:3306/xinliai?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: 123456
3. 启动后端服务:
```
mvn spring-boot:run
```
### 3. 前端配置
1. 进入前端项目目录:
```
cd vue_project
```
2. 安装依赖:
```
npm install
```
3. 启动前端服务:
```
npm run serve
```
## 项目结构
```
.
├── src/                     # 后端源代码
   └── main/
       ├── java/            # Java代码
       └── resources/       # 配置文件
├── vue_project/             # 前端项目
   ├── public/              # 静态资源
   └── src/
       ├── assets/          # 资源文件
       ├── components/      # 组件
       ├── router/          # 路由
       ├── utils/           # 工具
       └── views/           # 页面
├── files/                   # 项目资源文件
├── pom.xml                  # Maven配置
├── xinliai.sql              # 数据库脚本
└── README.md                # 项目说明
```
## 主要功能
- 用户管理:注册、登录、信息管理
- 心理测试:各类心理健康测试
- 心理咨询:在线咨询预约
- 心理文章:心理健康知识分享
- 数据分析:用户数据统计分析
## 访问地址
- 后端API http://localhost:8080
- 前端页面: http://localhost:8080
## 注意事项
1. 确保MySQL服务已启动
2. 配置文件中的数据库信息需根据实际情况修改
3. 前端服务默认端口为8081可在vue.config.js中修改
4. 项目依赖较多,安装过程可能需要一些时间
## 许可证
MIT License

@ -0,0 +1,15 @@
package com.xin.lcyxjy;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("com.xin.lcyxjy")
public class Xinxinzixun {
public static void main(String[] args) {
SpringApplication.run(Xinxinzixun.class, args);
}
}

@ -0,0 +1,5 @@
package com.xin.lcyxjy.common;
public interface Constants {
String TOKEN="token";
}

@ -0,0 +1,70 @@
package com.xin.lcyxjy.common;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import okhttp3.*;
public class DeepSeekUtil {
private static final String API_URL = "https://api.deepseek.com/v1/chat/completions";
// private static final OkHttpClient client = new OkHttpClient();
private static final OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(30000, java.util.concurrent.TimeUnit.SECONDS)
.readTimeout(30000, java.util.concurrent.TimeUnit.SECONDS)
.writeTimeout(30000, java.util.concurrent.TimeUnit.SECONDS)
.build();
private static final Gson gson = new Gson();
/**
* DeepSeek API
* @param apiKey API Key
* @param userInput
* @return AI
* @throws Exception
*/
public static String chatWithDeepSeek(String apiKey, String userInput) throws Exception {
// 构建请求体
JsonObject message = new JsonObject();
message.addProperty("role", "user");
message.addProperty("content", userInput);
JsonArray messages = new JsonArray();
messages.add(message);
JsonObject data = new JsonObject();
data.addProperty("model", "deepseek-chat");
data.add("messages", messages);
RequestBody body = RequestBody.create(
gson.toJson(data),
MediaType.parse("application/json")
);
Request request = new Request.Builder()
.url(API_URL)
.addHeader("Authorization", "Bearer " + apiKey)
.addHeader("Content-Type", "application/json")
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
if (response.isSuccessful() && response.body() != null) {
// 解析返回内容
String responseBody = response.body().string();
JsonObject json = gson.fromJson(responseBody, JsonObject.class);
// 解析 AI 回复内容
JsonArray choices = json.getAsJsonArray("choices");
if (choices != null && choices.size() > 0) {
JsonObject firstChoice = choices.get(0).getAsJsonObject();
JsonObject messageObj = firstChoice.getAsJsonObject("message");
if (messageObj != null && messageObj.has("content")) {
return messageObj.get("content").getAsString();
}
}
return "未获取到AI回复内容";
} else {
return "请求失败,状态码:" + response.code();
}
}
}
}

@ -0,0 +1,50 @@
package com.xin.lcyxjy.common;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import lombok.Data;
@Data
public class Result {
private String code;
private Object data;
private String msg;
public Result(Object data) {
this.data = data;
}
public Result()
{ }
public static Result success() {
Result tResult = new Result();
tResult.setCode(ResultCodeEnum.SUCCESS.code);
tResult.setMsg(ResultCodeEnum.SUCCESS.msg);
return tResult;
}
public static Result success(Object data) {
Result tResult = new Result(data);
tResult.setCode(ResultCodeEnum.SUCCESS.code);
tResult.setMsg(ResultCodeEnum.SUCCESS.msg);
return tResult;
}
public static Result error() {
Result tResult = new Result();
tResult.setCode(ResultCodeEnum.SYSTEM_ERROR.code);
tResult.setMsg(ResultCodeEnum.SYSTEM_ERROR.msg);
return tResult;
}
public static Result error(String code,String msg) {
Result tResult = new Result();
tResult.setCode(code);
tResult.setMsg(msg);
return tResult;
}
public static Result error(ResultCodeEnum resultCodeEnum) {
Result tResult = new Result();
tResult.setCode(resultCodeEnum.code);
tResult.setMsg(resultCodeEnum.msg);
return tResult;
}
}

@ -0,0 +1,24 @@
package com.xin.lcyxjy.common.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;
@Configuration
public class CrosConfig {
@Bean
public CorsFilter corsFilter(){
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration corsConfiguration = new CorsConfiguration();
corsConfiguration.addAllowedOrigin("*");
corsConfiguration.addAllowedHeader("*");
corsConfiguration.addAllowedMethod("*");
source.registerCorsConfiguration( "/**",corsConfiguration);
return new CorsFilter(source);
}
}

@ -0,0 +1,74 @@
package com.xin.lcyxjy.common.config;
import cn.hutool.core.util.ObjectUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.exceptions.JWTVerificationException;
import com.xin.lcyxjy.common.Constants;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import com.xin.lcyxjy.common.enums.RoleEnum;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.exception.CustomException;
import com.xin.lcyxjy.service.AdminService;
import com.xin.lcyxjy.service.UserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Component
public class JwtInterceptor implements HandlerInterceptor {
private static final Logger log = LoggerFactory.getLogger(JwtInterceptor.class);
@Resource
private AdminService adminService;
@Autowired
private UserService userService;
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
String token = request.getHeader(Constants.TOKEN);
if (ObjectUtil.isEmpty(token)) {
token = request.getParameter(Constants.TOKEN);
}
if (ObjectUtil.isEmpty(token)) {
throw new CustomException(ResultCodeEnum.TOKEN_INVALID_ERROR);
}
Account account = null;
try {
String userRole = JWT.decode(token).getAudience().get(0);
String userId = userRole.split("-")[0];
String role = userRole.split("-")[1];
if (RoleEnum.ADMIN.name().equals(role)) {
account = adminService.selectById(Integer.valueOf(userId));
}
if (RoleEnum.USER.name().equals(role)) {
account = userService.selectById(Integer.valueOf(userId));
}
} catch (Exception e) {
throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR);
}
if (ObjectUtil.isNull(account)) {
throw new CustomException(ResultCodeEnum.USER_NOT_EXIST_ERROR);
}
try {
JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(account.getPassword())).build();
jwtVerifier.verify(token);
} catch (JWTVerificationException e) {
throw new CustomException(ResultCodeEnum.TOKEN_CHECK_ERROR);
}
return true;
}
}

@ -0,0 +1,21 @@
package com.xin.lcyxjy.common.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import javax.annotation.Resource;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Resource
private JwtInterceptor jwtInterceptor;
public void addInterceptors(InterceptorRegistry registry) {
System.out.println("!11");
registry.addInterceptor(jwtInterceptor).addPathPatterns("/**")
.excludePathPatterns("/login")
.excludePathPatterns("/register")
.excludePathPatterns("/files/**");
}
}

@ -0,0 +1,35 @@
package com.xin.lcyxjy.common.enums;
public enum ResultCodeEnum {
SUCCESS("200", "成功"),
PARAM_ERROR("400", "参数异常"),
TOKEN_INVALID_ERROR("401", "无效的token"),
TOKEN_CHECK_ERROR("401", "token验证失败请重新登录"),
PARAM_LOST_ERROR("4001", "参数缺失"),
SYSTEM_ERROR("500", "系统异常"),
USER_EXIST_ERROR("5001", "用户名已存在"),
USER_NOT_LOGIN("5002", "用户未登录"),
USER_ACCOUNT_ERROR("5003", "账号或密码错误"),
USER_NOT_EXIST_ERROR("5004", "用户不存在"),
PARAM_PASSWORD_ERROR("5005", "原密码输入错误"),
NOT_DATA("5006", "未查询到数据"),
IS_CHOOSE_TYPE("5007", "您已收藏该酒店"),
ROOM_IS_EXIST("5008", "该房间编号已存在"),
DATE_ERROR("5008", "离店时间必须大于入店时间"),
DATE_NOT_SAME("5009", "离店时间不能等于入店时间"),
ROOM_IS_USE_DONT_DEL("50010", "房间正在使用,不能删除"),
ROOM_IS_USE_DONT_UPDATE("50011", "房间正在使用,不能修改"),
TYPE_IS_USE_DONT_DEL("50012", "该分类下有房间,不能删除"),
USER_NOT_YUEYUE_ERROR("5005", "预约失败!"),
;
public String code;
public String msg;
ResultCodeEnum(String code, String msg) {
this.code = code;
this.msg = msg;
}
}

@ -0,0 +1,6 @@
package com.xin.lcyxjy.common.enums;
public enum RoleEnum {
ADMIN,
USER,
}

@ -0,0 +1,25 @@
package com.xin.lcyxjy.controller;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.service.AIService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RestController
@RequestMapping("/ai")
public class AIController {
@Resource
private AIService aiService;
@GetMapping("/selectSearch/{content}")
public Result selectAll(@PathVariable String content ) {
System.out.println(content);
String list = aiService.selectSearch(content);
return Result.success(list);
}
}

@ -0,0 +1,32 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Admin;
import com.xin.lcyxjy.entity.Notice;
import com.xin.lcyxjy.service.AdminService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/admin")
public class AdminController {
@Resource
private AdminService adminService;
@PutMapping("/update")
public Result updateById(@RequestBody Admin admin) {
adminService.updateById(admin);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Admin admin = adminService.selectById(id);
return Result.success(admin);
}
}

@ -0,0 +1,55 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Ceshi;
import com.xin.lcyxjy.service.CeshiService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/ceshi")
public class CeshiController {
@Resource
private CeshiService ceshiService;
@PostMapping("/add")
public Result add(@RequestBody Ceshi ceshi) {
System.out.println(ceshi);
ceshiService.add(ceshi);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
System.out.println(id+"----------------");
ceshiService.deleteById(id);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Ceshi ceshi) {
System.out.println("-----------------------");
ceshiService.updateById(ceshi);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Ceshi admin = ceshiService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Ceshi ceshi ) {
System.out.println(ceshi);
List<Ceshi> list = ceshiService.selectAll(ceshi);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Ceshi ceshi,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Ceshi> page = ceshiService.selectPage(ceshi, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,69 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Collections;
import com.xin.lcyxjy.entity.Param;
import com.xin.lcyxjy.service.CollectionService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/collection")
public class CollectionController {
@Resource
private CollectionService collectionService;
@PostMapping("/add")
public Result add(@RequestBody Collections collection) {
System.out.println(collection);
collectionService.add(collection);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
System.out.println(id+"----------------");
collectionService.deleteById(id);
return Result.success();
}
@PutMapping("/updatestatus")
public Result updatestatus(@RequestBody Collections collection) {
System.out.println("-----------------------");
collectionService.updatestatus(collection);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Collections collection) {
System.out.println("-----------------------");
collectionService.updateById(collection);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Collections admin = collectionService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectByuserid")
public Result selectByuserid( Param param ) {
System.out.println(param);
Collections collections = collectionService.selectByuserid(param);
return Result.success(collections);
}
@GetMapping("/selectAll")
public Result selectAll(Collections collection ) {
System.out.println(collection);
List<Collections> list = collectionService.selectAll(collection);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Collections collection,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Collections> page = collectionService.selectPage(collection, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,103 @@
package com.xin.lcyxjy.controller;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import com.xin.lcyxjy.common.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
@RestController
@RequestMapping("/files")
public class FileController {
private static final String filePath = System.getProperty("user.dir") + "/files/";
@Value("9999")
private String port;
@Value("localhost")
private String ip;
/**
*
*
* @param file
* @return
*/
@PostMapping("/upload")
public Result upload(MultipartFile file) throws InterruptedException {
String flag;
synchronized (FileController.class) {
String filePath = System.getProperty("user.dir") + "/src/main/resources/static/file/";
flag = System.currentTimeMillis() + "";
Thread.sleep(1L);
}
Thread.sleep(1000);
String fileName = file.getOriginalFilename();
try {
if(!FileUtil.isDirectory(filePath)) {
FileUtil.mkdir(filePath);
}
FileUtil.writeBytes(file.getBytes(), filePath + flag + "-" + fileName);
System.out.println(fileName + "--上传成功");
} catch (Exception e) {
System.err.println(fileName + "--文件上传失败");
}
String http="http://"+ip+":"+port+"/files/";
return Result.success(http+flag+"-"+fileName);
}
/**
*
*
* @param flag
* @param response
*/
@GetMapping("/{flag}")
public void avatarPath(@PathVariable String flag, HttpServletResponse response)
{
if(!FileUtil.isDirectory(filePath)) {
FileUtil.mkdir(filePath);
}
OutputStream os;
// String basePath = System.getProperty("user.dir") + "/src/main/resources/static/file/";
try {
if (StrUtil.isNotEmpty(flag)) {
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(flag, "UTF-8"));
response.setContentType("application/octet-stream");
byte[] bytes = FileUtil.readBytes(filePath + flag);
os = response.getOutputStream();
os.write(bytes);
os.flush();
os.close();
}
} catch (Exception e) {
System.out.println("文件下载失败");
}
}
/**
*
*
* @param flag
*/
@DeleteMapping("/{flag}")
public void delFile(@PathVariable String flag) {
List<String> fileNames = FileUtil.listFileNames(filePath);
if(!FileUtil.isDirectory(filePath)) {
FileUtil.mkdir(filePath);
}
String filename = fileNames.stream().filter(name -> name.contains(flag)).findAny().orElse("");
FileUtil.del(filePath + filename);
System.out.println("删除文件" + filename + "成功");
}
}

@ -0,0 +1,97 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Grade;
import com.xin.lcyxjy.service.GradeService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/grade")
public class GradeController {
@Resource
private GradeService gradeService;
@PostMapping("/add")
public Result add(@RequestBody Grade grade) {
System.out.println(grade);
gradeService.add(grade);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
System.out.println(id+"----------------");
gradeService.deleteById(id);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Grade grade) {
System.out.println("-----------------------");
gradeService.updateById(grade);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Grade admin = gradeService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Grade grade ) {
System.out.println(grade);
List<Grade> list = gradeService.selectAll(grade);
return Result.success(list);
}
@GetMapping("/selectData")
public Result selectData(Grade data) {
System.out.println(data);
List<Grade> list = gradeService.selectAll(data);
Map<String,Object> maplost=new HashMap<String, Object>();
List<String> ids = new ArrayList<String>();
ids.add("轻度心里困扰");
ids.add("中度心里困扰");
ids.add("严重心里困扰");
ids.add("总人数");
List<Integer> shuis= new ArrayList<Integer>();
int a,b,c;
a=0;
b=0;
c=0;
for(Grade data1:list)
{
if(data1.getScore()<=10)
{
a++;
}
else if(data1.getScore()<=20)
{
b++;
}
else if(data1.getScore()<=30)
{
c++;
}
}
shuis.add(a);
shuis.add(b);
shuis.add(c);
shuis.add(list.size());
maplost.put("xAxis",ids);
maplost.put("series",shuis);
return Result.success(maplost);
}
@GetMapping("/selectPage")
public Result selectPage(Grade grade,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Grade> page = gradeService.selectPage(grade, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,68 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Jieguo;
import com.xin.lcyxjy.service.JieguoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/jieguo")
public class JieguoController {
@Resource
private JieguoService jieguoService;
@PostMapping("/add")
public Result add(@RequestBody Jieguo jieguo) {
System.out.println(jieguo);
jieguoService.add(jieguo);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
jieguoService.deleteById(id);
return Result.success();
}
@DeleteMapping("/delete/batch")
public Result deleteByBatch(@RequestBody List<Integer> ids) {
jieguoService.deleteBatch(ids);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Jieguo jieguo) {
jieguoService.updateById(jieguo);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id)
{
Jieguo admin = jieguoService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Jieguo jieguo )
{
List<Jieguo> list = jieguoService.selectAll(jieguo);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Jieguo jieguo,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Jieguo> page = jieguoService.selectPage(jieguo, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,63 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Notice;
import com.xin.lcyxjy.service.NoticeService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/notice")
public class NoticeController {
@Resource
private NoticeService noticeService;
@PostMapping("/add")
public Result add(@RequestBody Notice notice) {
noticeService.add(notice);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
noticeService.deleteById(id);
return Result.success();
}
@DeleteMapping("/delete/batch")
public Result deleteByBatch(@RequestBody List<Integer> ids) {
noticeService.deleteBatch(ids);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Notice notice) {
noticeService.updateById(notice);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Notice admin = noticeService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Notice notice ) {
List<Notice> list = noticeService.selectAll(notice);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Notice notice,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Notice> page = noticeService.selectPage(notice, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,70 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Question;
import com.xin.lcyxjy.service.QuestionService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/question")
public class QuestionController {
@Resource
private QuestionService questionService;
@PostMapping("/add")
public Result add(@RequestBody Question question) {
questionService.add(question);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
questionService.deleteById(id);
return Result.success();
}
@DeleteMapping("/delete/batch")
public Result deleteByBatch(@RequestBody List<Integer> ids) {
questionService.deleteBatch(ids);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Question question) {
questionService.updateById(question);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Question admin = questionService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Question question ) {
List<Question> list = questionService.selectAll(question);
return Result.success(list);
}
@GetMapping("/forntselectAll")
public Result forntselectPage(Question question, @RequestParam("userid")int userid) {
List<Question> list = questionService.forntselectAll(question,userid);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Question question,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Question> page = questionService.selectPage(question, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,63 @@
package com.xin.lcyxjy.controller;
import cn.hutool.core.util.ObjectUtil;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import com.xin.lcyxjy.entity.User;
import com.xin.lcyxjy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@GetMapping("/selectPage")
public Result selectPage(User user, @RequestParam(defaultValue = "1") Integer pageNum , @RequestParam(defaultValue = "10") Integer pageSize){
PageInfo<User> userPageInfo = userService.selectPage(user, pageNum, pageSize);
if (ObjectUtil.isEmpty(userPageInfo)){
return Result.error(ResultCodeEnum.NOT_DATA);
}
return Result.success(userPageInfo);
}
@PostMapping("/add")
public Result addUser(@RequestBody User user){
userService.addUser(user);
return Result.success();
}
@PutMapping("/update")
public Result updateUser(@RequestBody User user){
userService.updateUser(user);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteUserById(@PathVariable("id") Integer id){
userService.deleteUserById(id);
return Result.success();
}
@GetMapping("/selectAll")
public Result selectAll(User user ) {
List<User> users = userService.selectAll(user);
return Result.success(users);
}
@DeleteMapping("/delete/batch")
public Result deleteUserBatch(@RequestBody List<Integer> ids){
userService.deleteUserBatch(ids);
return Result.success();
}
}

@ -0,0 +1,65 @@
package com.xin.lcyxjy.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import com.xin.lcyxjy.common.enums.RoleEnum;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.service.AdminService;
import com.xin.lcyxjy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
public class WebController {
@Resource
private AdminService adminService;
@Autowired
private UserService userService;
@GetMapping("/")
public Result hello() {
return Result.success("访问成功");
}
@PostMapping("/login")
public Result login(@RequestBody Account account) {
System.out.println(account);
if (ObjectUtil.isEmpty(account.getName()) || ObjectUtil.isEmpty(account.getPassword())
|| ObjectUtil.isEmpty(account.getRole())) {
return Result.error(ResultCodeEnum.PARAM_LOST_ERROR);
}
if (RoleEnum.ADMIN.name().equals(account.getRole())) {
account = adminService.login(account);
}
if (RoleEnum.USER.name().equals(account.getRole())) {
account = userService.login(account);
}
return Result.success(account);
}
@PostMapping("/register")
public Result register(@RequestBody Account account) {
if (StrUtil.isBlank(account.getName()) || StrUtil.isBlank(account.getPassword())
|| ObjectUtil.isEmpty(account.getRole())) {
return Result.error(ResultCodeEnum.PARAM_LOST_ERROR);
}
if (RoleEnum.USER.name().equals(account.getRole())) {
userService.register(account);
}
return Result.success();
}
}

@ -0,0 +1,62 @@
package com.xin.lcyxjy.controller;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Result;
import com.xin.lcyxjy.entity.Wenzhang;
import com.xin.lcyxjy.service.WenzhangService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/wenzhang")
public class WenzhangController {
@Resource
private WenzhangService wenzhangService;
@PostMapping("/add")
public Result add(@RequestBody Wenzhang wenzhang) {
wenzhangService.add(wenzhang);
return Result.success();
}
@DeleteMapping("/delete/{id}")
public Result deleteById(@PathVariable Integer id) {
wenzhangService.deleteById(id);
return Result.success();
}
@DeleteMapping("/delete/batch")
public Result deleteByBatch(@RequestBody List<Integer> ids) {
wenzhangService.deleteBatch(ids);
return Result.success();
}
@PutMapping("/update")
public Result updateById(@RequestBody Wenzhang wenzhang) {
wenzhangService.updateById(wenzhang);
return Result.success();
}
@GetMapping("/selectById/{id}")
public Result selectById(@PathVariable Integer id) {
Wenzhang admin = wenzhangService.selectById(id);
return Result.success(admin);
}
@GetMapping("/selectAll")
public Result selectAll(Wenzhang wenzhang ) {
List<Wenzhang> list = wenzhangService.selectAll(wenzhang);
return Result.success(list);
}
@GetMapping("/selectPage")
public Result selectPage(Wenzhang wenzhang,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize) {
PageInfo<Wenzhang> page = wenzhangService.selectPage(wenzhang, pageNum, pageSize);
return Result.success(page);
}
}

@ -0,0 +1,23 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Account {
private Integer id;
private String name;
private String password;
private String newPassword;
private String role;
private String token;
private String sex;
private String sexs;
private String birth;
private int age;
}

@ -0,0 +1,20 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Admin extends Account implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String password;
private String name;
private String role;
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Ceshi {
private static final long serialVersionUID = 1L;
private Integer id;
private String name;
private String descr;
private String sex;
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Collections {
private static final long serialVersionUID = 1L;
private Integer id;
private Integer userid;
private Integer collectionid;
private String username;
private Integer source;
private Integer status;
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Grade {
private Integer id;
private Integer cid;
private String cname;
private Integer userid;
private String username;
private float score;
}

@ -0,0 +1,22 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Jieguo {
private Integer id;
private Integer qid;
private String name;
private String a;
private String b;
private String c;
private String d;
private String right;
private Integer userid;
private String username;
private String ans;
private String cid;
}

@ -0,0 +1,15 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Notice {
private Integer id;
private String title;
private String content;
}

@ -0,0 +1,20 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Param {
private static final long serialVersionUID = 1L;
private Integer userid;
private Integer collectionid;
private Integer source;
private Integer id;
private float avgevalue;
private float maxvalue;
private float minvalue;
}

@ -0,0 +1,19 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Question {
private Integer id;
private String name;
private String a;
private String b;
private String c;
private String d;
private String right;
private Integer ceshiid;
private Ceshi ceshititle;
private Ceshi ceshidata;
}

@ -0,0 +1,19 @@
package com.xin.lcyxjy.entity;
import lombok.Data;
import java.io.Serializable;
@Data
public class User extends Account implements Serializable {
private static final long serialVersionUID = 1L;
private Integer id;
private String password;
private String name;
private String sex;
private String sexs;
private String birth;
private String role;
private String img;
}

@ -0,0 +1,20 @@
package com.xin.lcyxjy.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Wenzhang {
private Integer id;
private String content;
private String time;
private String title;
private String img;
private String type;
}

@ -0,0 +1,28 @@
package com.xin.lcyxjy.exception;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
public class CustomException extends RuntimeException {
private String code;
private String msg;
public CustomException(ResultCodeEnum resultCodeEnum) {
this.code = resultCodeEnum.code;
this.msg = resultCodeEnum.msg;
}
public CustomException(String code, String msg) {
this.code = code;
this.msg = msg;
}
public String getCode() {
return code;
}
public String getMsg() {
return msg;
}
}

@ -0,0 +1,28 @@
package com.xin.lcyxjy.exception;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.xin.lcyxjy.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
@ControllerAdvice(basePackages = "com.xin.lcyxjy.controller")
public class GlobalExceptionHandler {
private static final Log log= LogFactory.get();
@ExceptionHandler(Exception.class)
@ResponseBody
public Result handle(HttpServletRequest request, Exception e){
log.error("异常信息",e);
return Result.error();
}
@ExceptionHandler(CustomException.class)
@ResponseBody
public Result customError(HttpServletRequest request, CustomException e) {
return Result.error(e.getCode(), e.getMsg());
}
}

@ -0,0 +1,11 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Admin;
public interface AdminMapper {
int updateById(Admin admin);
Admin selectByUsername(String name);
Admin selectById(Integer id);
}

@ -0,0 +1,20 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Ceshi;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface CeshiMapper {
int insert(Ceshi ceshi);
int updateById(Ceshi ceshi);
List<Ceshi> selectAll(Ceshi ceshi);
@Delete("delete from ceshi where id = #{id}")
int deleteById(Integer id);
Ceshi selectById(Integer id);
Ceshi selectByYuyueid(Integer yuyueid);
}

@ -0,0 +1,21 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Collections;
import com.xin.lcyxjy.entity.Param;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface CollectionsMapper {
int insert(Collections collection);
int updateById(Collections collection);
List<Collections> selectAll(Collections collection);
@Delete("delete from collection where id = #{id}")
int deleteById(Integer id);
Collections selectById(Integer id);
Collections selectByuserid(Param param);
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Grade;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface GradeMapper {
int insert(Grade grade);
int updateById(Grade grade);
List<Grade> selectAll(Grade grade);
@Delete("delete from grade where id = #{id}")
int deleteById(Integer id);
Grade selectById(Integer id);
Grade selectByCidUid(Integer cid,Integer userid);
}

@ -0,0 +1,20 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Jieguo;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface JieguoMapper {
int insert(Jieguo jieguo);
int updateById(Jieguo jieguo);
List<Jieguo> selectAll(Jieguo jieguo);
@Delete("delete from jieguo where id = #{id}")
int deleteById(Integer id);
Jieguo selectById(Integer id);
Jieguo selectByname(String name);
}

@ -0,0 +1,18 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Notice;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import java.util.List;
public interface NoticeMapper {
int insert(Notice notice);
int updateById(Notice notice);
List<Notice> selectAll(Notice notice);
@Delete("delete from notice where id = #{id}")
int deleteById(Integer id);
Notice selectById(Integer id);
Notice selectBytitle(String title);
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Question;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface QuestionMapper {
int insert(Question question);
int updateById(Question question);
List<Question> selectAll(Question question);
@Delete("delete from question where id = #{id}")
int deleteById(Integer id);
Question selectById(Integer id);
Question selectByname(String name);
}

@ -0,0 +1,32 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.entity.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List;
@Mapper
public interface UserMapper {
List<User> selectAll(User user);
User selectByUserName(String name);
void insert(User user);
void updateUser(User user);
@Delete("delete from user where id = #{id}")
void deleteUserById(Integer id);
User selectById(Integer id);
@Update("update user set password =#{newPassword} where id = #{id}")
void updatePassword(Account account);
}

@ -0,0 +1,17 @@
package com.xin.lcyxjy.mapper;
import com.xin.lcyxjy.entity.Wenzhang;
import org.apache.ibatis.annotations.Delete;
import java.util.List;
public interface WenzhangMapper {
int insert(Wenzhang wenzhang);
int updateById(Wenzhang wenzhang);
List<Wenzhang> selectAll(Wenzhang wenzhang);
@Delete("delete from wenzhang where id = #{id}")
int deleteById(Integer id);
Wenzhang selectById(Integer id);
Wenzhang selectBytitle(String title);
}

@ -0,0 +1,21 @@
package com.xin.lcyxjy.service;
import com.xin.lcyxjy.common.DeepSeekUtil;
import org.springframework.stereotype.Service;
@Service
public class AIService {
public String selectSearch(String content) {
String apiKey = "sk-33584ae9a87a4a5a9c8abe1dd90697dc";
String userInput =content;
try {
String reply = DeepSeekUtil.chatWithDeepSeek(apiKey, userInput);
System.out.println("AI回复" + reply);
return reply;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

@ -0,0 +1,66 @@
package com.xin.lcyxjy.service;
import cn.hutool.core.util.ObjectUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Constants;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import com.xin.lcyxjy.common.enums.RoleEnum;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.entity.Admin;
import com.xin.lcyxjy.entity.Notice;
import com.xin.lcyxjy.exception.CustomException;
import com.xin.lcyxjy.mapper.AdminMapper;
import com.xin.lcyxjy.utils.TokenUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class AdminService {
@Resource
private AdminMapper adminMapper;
public void updateById(Admin admin)
{
adminMapper.updateById(admin);
}
public Account login(Account account) {
Account dbAdmin = adminMapper.selectByUsername(account.getName());
System.out.println(dbAdmin+"11");
if (ObjectUtil.isNull(dbAdmin)) {
throw new CustomException(ResultCodeEnum.USER_NOT_EXIST_ERROR);
}
if (!account.getPassword().equals(dbAdmin.getPassword())) {
throw new CustomException(ResultCodeEnum.USER_ACCOUNT_ERROR);
}
// 生成token
String tokenData = dbAdmin.getId() + "-" + RoleEnum.ADMIN.name();
String token = TokenUtils.createToken(tokenData, dbAdmin.getPassword());
System.out.println(token);
dbAdmin.setToken(token);
return dbAdmin;
}
public Admin selectById(Integer id)
{
return adminMapper.selectById(id);
}
public void updatePassword(Account account) {
Admin dbAdmin = adminMapper.selectByUsername(account.getName());
if (ObjectUtil.isNull(dbAdmin)) {
throw new CustomException(ResultCodeEnum.USER_NOT_EXIST_ERROR);
}
if (!account.getPassword().equals(dbAdmin.getPassword())) {
throw new CustomException(ResultCodeEnum.PARAM_PASSWORD_ERROR);
} dbAdmin.setPassword(account.getName());
adminMapper.updateById(dbAdmin);
}
}

@ -0,0 +1,41 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Ceshi;
import com.xin.lcyxjy.mapper.CeshiMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class CeshiService {
@Resource
private CeshiMapper ceshiMapper;
public void add(Ceshi ceshi) {
ceshiMapper.insert(ceshi);
}
public void deleteById(Integer id)
{
ceshiMapper.deleteById(id);
}
public void updateById(Ceshi ceshi)
{
ceshiMapper.updateById(ceshi);
}
public Ceshi selectById(Integer id)
{
return ceshiMapper.selectById(id);
}
public List<Ceshi> selectAll(Ceshi ceshi) {
List<Ceshi> list=ceshiMapper.selectAll(ceshi);
return list;
}
public PageInfo<Ceshi> selectPage(Ceshi ceshi, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Ceshi> list=ceshiMapper.selectAll(ceshi);
return PageInfo.of(list);
}
}

@ -0,0 +1,85 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Collections;
import com.xin.lcyxjy.entity.Param;
import com.xin.lcyxjy.mapper.CollectionsMapper;
import com.xin.lcyxjy.mapper.UserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class CollectionService {
@Resource
private CollectionsMapper collectionMapper;
@Resource
private UserMapper userMapper;
public void add(Collections collection) {
// Collection collection1=new Collection();
// collection1.setYuyueid(collection.getYuyueid());
// collection1.setType(collection.getType());
// collection1.setContent(collection.getContent());
// String now= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
// collection1.setTime(now);
collectionMapper.insert(collection);
}
public void deleteById(Integer id)
{
collectionMapper.deleteById(id);
}
public void updateById(Collections collection)
{
collectionMapper.updateById(collection);
}
public void updatestatus(Collections collection)
{
if(collection.getStatus()==1)
{
collection.setStatus(0);
}
else {
collection.setStatus(1);
}
collectionMapper.updateById(collection);
}
public Collections selectById(Integer id)
{
return collectionMapper.selectById(id);
}
public Collections selectByuserid(Param param) {
Collections collection = collectionMapper.selectByuserid(param);
return collection;
}
public List<Collections> selectAll(Collections collection) {
List<Collections> list=collectionMapper.selectAll(collection);
for (Collections collection1:list)
{
System.out.println(collection1.getUserid());
// collection1.setUserid( yuyueMapper.selectById(collection1.getYuyueid()).getUserid());
collection1.setUsername( userMapper.selectById(collection1.getUserid()).getName());
// collection1.setUserimg( userMapper.selectById(collection1.getUserid()).getImg());
//
// collection1.setTeacherid( yuyueMapper.selectById(collection1.getYuyueid()).getTeacherid());
// collection1.setTeachername( teacherMapper.selectById(collection1.getTeacherid()).getName());
// collection1.setTeacherimg( teacherMapper.selectById(collection1.getTeacherid()).getImg());
}
return list;
}
public PageInfo<Collections> selectPage(Collections collection, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Collections> list=collectionMapper.selectAll(collection);
for (Collections collection1:list)
{
System.out.println(collection1.getUserid());
collection1.setUsername( userMapper.selectById(collection1.getUserid()).getName());
}
return PageInfo.of(list);
}
}

@ -0,0 +1,69 @@
package com.xin.lcyxjy.service;
import cn.hutool.core.util.ObjectUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Grade;
import com.xin.lcyxjy.mapper.CeshiMapper;
import com.xin.lcyxjy.mapper.GradeMapper;
import com.xin.lcyxjy.mapper.UserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class GradeService {
@Resource
private GradeMapper gradeMapper;
@Resource
private UserMapper userMapper;
@Resource
private CeshiMapper ceshiMapper;
public void add(Grade grade) {
//首先判断是否已存在
Grade grade1 = gradeMapper.selectByCidUid(grade.getCid(),grade.getUserid());
if (ObjectUtil.isNotEmpty(grade1)) {
grade1.setScore(grade.getScore());
System.out.println("--------存在");
updateById(grade1);
}
else
{
gradeMapper.insert(grade);
}
}
public void deleteById(Integer id)
{
gradeMapper.deleteById(id);
}
public void updateById(Grade grade)
{
gradeMapper.updateById(grade);
}
public Grade selectById(Integer id)
{
return gradeMapper.selectById(id);
}
public List<Grade> selectAll(Grade grade) {
List<Grade> list=gradeMapper.selectAll(grade);
for (Grade grade1:list)
{
grade1.setUsername( userMapper.selectById(grade1.getUserid()).getName());
grade1.setCname(ceshiMapper.selectById(grade1.getCid()).getName());
}
return list;
}
public PageInfo<Grade> selectPage(Grade grade, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Grade> list=gradeMapper.selectAll(grade);
for (Grade grade1:list)
{
grade1.setUsername(userMapper.selectById(grade1.getUserid()).getName());
grade1.setCname(ceshiMapper.selectById(grade1.getCid()).getName());
}
return PageInfo.of(list);
}
}

@ -0,0 +1,58 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Jieguo;
import com.xin.lcyxjy.mapper.JieguoMapper;
import com.xin.lcyxjy.mapper.UserMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class JieguoService {
@Resource
private JieguoMapper jieguoMapper;
@Resource
private UserMapper userMapper;
public void add(Jieguo jieguo) {
jieguoMapper.insert(jieguo);
}
public void deleteById(Integer id)
{
jieguoMapper.deleteById(id);
}
public void deleteBatch(List<Integer> ids) {
for (Integer id : ids) {
jieguoMapper.deleteById(id);
}
}
public void updateById(Jieguo jieguo)
{
jieguoMapper.updateById(jieguo);
}
public Jieguo selectById(Integer id)
{
return jieguoMapper.selectById(id);
}
public List<Jieguo> selectAll(Jieguo jieguo) {
List<Jieguo> jieguos= jieguoMapper.selectAll( jieguo);
for (Jieguo jieguo1:jieguos)
{
System.out.println(jieguo1.getUserid());
jieguo1.setUsername( userMapper.selectById(jieguo1.getUserid()).getName());
}
return jieguos;
}
public PageInfo<Jieguo> selectPage(Jieguo jieguo, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Jieguo> list=jieguoMapper.selectAll(jieguo);
return PageInfo.of(list);
}
}

@ -0,0 +1,50 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Notice;
import com.xin.lcyxjy.mapper.NoticeMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class NoticeService {
@Resource
private NoticeMapper noticeMapper;
public void add(Notice admin) {
noticeMapper.insert(admin);
}
public void deleteById(Integer id)
{
noticeMapper.deleteById(id);
}
public void deleteBatch(List<Integer> ids) {
for (Integer id : ids) {
noticeMapper.deleteById(id);
}
}
public void updateById(Notice notice)
{
noticeMapper.updateById(notice);
}
public Notice selectById(Integer id)
{
return noticeMapper.selectById(id);
}
public List<Notice> selectAll(Notice notice) {
return noticeMapper.selectAll( notice);
}
public PageInfo<Notice> selectPage(Notice notice, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Notice> list=noticeMapper.selectAll(notice);
return PageInfo.of(list);
}
}

@ -0,0 +1,93 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Jieguo;
import com.xin.lcyxjy.entity.Question;
import com.xin.lcyxjy.mapper.CeshiMapper;
import com.xin.lcyxjy.mapper.JieguoMapper;
import com.xin.lcyxjy.mapper.QuestionMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*;
@Service
public class QuestionService {
@Resource
private QuestionMapper questionMapper;
@Resource
private CeshiMapper ceshiMapper;
@Resource
private JieguoMapper jieguoMapper;
public void add(Question question) {
questionMapper.insert(question);
}
public void deleteById(Integer id)
{
questionMapper.deleteById(id);
}
public void deleteBatch(List<Integer> ids) {
for (Integer id : ids) {
questionMapper.deleteById(id);
}
}
public void updateById(Question question)
{
questionMapper.updateById(question);
}
public Question selectById(Integer id)
{
return questionMapper.selectById(id);
}
public List<Question> selectAll(Question question) {
List<Question> questionList=questionMapper.selectAll( question);
for (Question question1:questionList)
{
question1.setCeshidata( ceshiMapper.selectById(question1.getCeshiid()));
}
return questionList;
}
public PageInfo<Question> selectPage(Question question, Integer pageNum, Integer pageSize ) {
PageHelper.startPage(pageNum,pageSize);
List<Question>list =questionMapper.selectAll(question);
for (Question question1:list)
{
question1.setCeshidata( ceshiMapper.selectById(question1.getCeshiid()));
}
return PageInfo.of(list);
}
public List<Question> forntselectAll(Question question,Integer userid) {
List<Question> list1=questionMapper.selectAll(question);
Jieguo jieguo=new Jieguo();
jieguo.setUserid(userid);
List<Jieguo> jieguos=jieguoMapper.selectAll(jieguo);
List<Question> list2=new ArrayList<>();
for (int i=0;i<list1.size();i++)
{
int flag=0;
for (Jieguo jieguo1:jieguos)
{
if (list1.get(i).getId()==jieguo1.getQid())
{
flag=1;
break;
}
}
if(flag==0)
{
list2.add(list1.get(i));
}
}
return list2;
}
}

@ -0,0 +1,132 @@
package com.xin.lcyxjy.service;
import cn.hutool.core.util.ObjectUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.common.Constants;
import com.xin.lcyxjy.common.enums.ResultCodeEnum;
import com.xin.lcyxjy.common.enums.RoleEnum;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.entity.User;
import com.xin.lcyxjy.exception.CustomException;
import com.xin.lcyxjy.mapper.UserMapper;
import com.xin.lcyxjy.utils.TokenUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
*
**/
@Service
public class UserService {
@Autowired
private UserMapper userMapper;
public List<User> selectAll(User user) {
List<User> userList = userMapper.selectAll(user);
if (ObjectUtil.isNotEmpty(userList)) {
for (User user1:userList)
{
}
return userList;
}
return null;
}
public PageInfo<User> selectPage(User user, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum, pageSize);
List<User> userList = userMapper.selectAll(user);
if (ObjectUtil.isNotEmpty(userList)) {
for (User user1:userList)
{
}
return PageInfo.of(userList);
}
return null;
}
public void addUser(User user) {
//首先判断用户名是否已存在
User selectByUserName = userMapper.selectByUserName(user.getName());
if (ObjectUtil.isNotEmpty(selectByUserName)) {
throw new CustomException(ResultCodeEnum.USER_EXIST_ERROR);
}
user.setRole(RoleEnum.USER.name());
userMapper.insert(user);
}
public void register(Account account) {
User user = new User();
//首先判断当前要注册的用户是否已被注册
User selectByUserName = userMapper.selectByUserName(account.getName());
if (ObjectUtil.isNotEmpty(selectByUserName)) {
throw new CustomException(ResultCodeEnum.USER_EXIST_ERROR);
}
//设置用户的级别
account.setRole(RoleEnum.USER.name());
BeanUtils.copyProperties(account,user);
userMapper.insert(user);
}
public void updatePassword(Account account) {
User user = userMapper.selectById(account.getId());
if (!account.getPassword().equals(user.getPassword())){
throw new CustomException(ResultCodeEnum.PARAM_PASSWORD_ERROR);
}
userMapper.updatePassword(account);
}
public void updateUser(User user) {
userMapper.updateUser(user);
}
public void deleteUserById(Integer id) {
userMapper.deleteUserById(id);
}
public void deleteUserBatch(List<Integer> ids) {
for (Integer id : ids) {
userMapper.deleteUserById(id);
}
}
public Account login(Account account) {
//首先判断用户是否存在
User user = userMapper.selectByUserName(account.getName());
if (ObjectUtil.isEmpty(user)) {
throw new CustomException(ResultCodeEnum.USER_NOT_EXIST_ERROR);
}
//判断用户密码是否输入正确
if (!user.getPassword().equals(account.getPassword())) {
throw new CustomException(ResultCodeEnum.USER_ACCOUNT_ERROR);
}
// 生成token
String tokenData = user.getId() + "-" + RoleEnum.USER.name();
String token = TokenUtils.createToken(tokenData, user.getPassword());
user.setToken(token);
return user;
}
public Account selectById(Integer id) {
User user = userMapper.selectById(id);
return user;
}
}

@ -0,0 +1,50 @@
package com.xin.lcyxjy.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xin.lcyxjy.entity.Wenzhang;
import com.xin.lcyxjy.mapper.WenzhangMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class WenzhangService {
@Resource
private WenzhangMapper wenzhangMapper;
public void add(Wenzhang wenzhang) {
wenzhangMapper.insert(wenzhang);
}
public void deleteById(Integer id)
{
wenzhangMapper.deleteById(id);
}
public void deleteBatch(List<Integer> ids) {
for (Integer id : ids) {
wenzhangMapper.deleteById(id);
}
}
public void updateById(Wenzhang wenzhang)
{
wenzhangMapper.updateById(wenzhang);
}
public Wenzhang selectById(Integer id)
{
return wenzhangMapper.selectById(id);
}
public List<Wenzhang> selectAll(Wenzhang wenzhang) {
return wenzhangMapper.selectAll( wenzhang);
}
public PageInfo<Wenzhang> selectPage(Wenzhang wenzhang, Integer pageNum, Integer pageSize) {
PageHelper.startPage(pageNum,pageSize);
List<Wenzhang> list=wenzhangMapper.selectAll(wenzhang);
return PageInfo.of(list);
}
}

@ -0,0 +1,89 @@
package com.xin.lcyxjy.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.log.Log;
import cn.hutool.log.LogFactory;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import com.xin.lcyxjy.common.Constants;
import com.xin.lcyxjy.common.enums.RoleEnum;
import com.xin.lcyxjy.entity.Account;
import com.xin.lcyxjy.service.AdminService;
import com.xin.lcyxjy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
@Component
public class TokenUtils {
private static AdminService staticAdminService;
// private static HotelService staticHotelService;
private static UserService staticUserService;
@Resource
AdminService adminService;
@Autowired
UserService userService;
//@Resource
// HotelService hotelService;
private static final Log log= LogFactory.get();
@PostConstruct
public void setUserService() {
staticAdminService = adminService;
// staticHotelService = hotelService;
staticUserService= userService;
}
public static String createToken(String data, String sign) {
return JWT.create().withAudience(data) // 将 userId-rle 保存到 token 里面,作为载荷
.withExpiresAt(DateUtil.offsetHour(new Date(), 2))
.sign(Algorithm.HMAC256(sign));
}
/**
*
*/
public static Account getCurrentUser() {
try {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String token = request.getHeader(Constants.TOKEN);
System.out.println("获取"+token);
if (ObjectUtil.isNotEmpty(token)) {
String userRole = JWT.decode(token).getAudience().get(0);
String userId = userRole.split("-")[0]; // 获取用户id
String role = userRole.split("-")[1]; // 获取角色
System.out.println("获取"+userId);
if (RoleEnum.ADMIN.name().equals(role)) {
System.out.println("获取"+userId);
System.out.println(userId+"---"+staticAdminService.selectById(Integer.valueOf(userId)));
return staticAdminService.selectById(Integer.valueOf(userId));
}
// if (RoleEnum.HOTEL.name().equals(role)) {
// return staticHotelService.selectById(Integer.valueOf(userId));
// }
if (RoleEnum.USER.name().equals(role)) {
return staticUserService.selectById(Integer.valueOf(userId));
}
}
} catch (Exception e) {
log.error("获取当前用户信息出错", e);
}
return new Account(); // 返回空的账号对象
}
}

@ -0,0 +1,25 @@
server:
port: 9999
spring:
datasource:
password: root
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/xinliai?useUnicode=true&useSSL=false&characterEncoding=utf8&serverTimezone=GMT%2b8
username: root
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.xin.lcyxjy.entity
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case: true
pagehelper:
helper-dialect: mysql
reasonable: true
support-methods-arguments: true
params: count=countSql
ip: localhost

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.AdminMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="com.xin.lcyxjy.entity.Admin" id="exampaperMap">
<result property="id" column="id"/>
<result property="password" column="password"/>
<result property="name" column="name"/>
<result property="role" column="role"/>
</resultMap>
<select id="selectByUsername" parameterType="com.xin.lcyxjy.entity.User" resultMap="exampaperMap">
select * from admin
<where>
<if test="name != null"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectById" parameterType="com.xin.lcyxjy.entity.User" resultMap="exampaperMap">
select * from admin
where id = #{id}
</select>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Admin">
update admin
<set>
<if test="password != null">
password = #{password},
</if>
<if test="name != null">
name = #{name},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.CeshiMapper">
<resultMap type="com.xin.lcyxjy.entity.Ceshi" id="paperMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="descr" column="descr"/>
<result property="sex" column="sex"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from ceshi
<where>
<if test="id != null"> and id= {id}</if>
<if test="name != null"> and name= #{name}</if>
<if test="descr != null"> and descr= #{descr}</if>
<if test="sex != null"> and sex= #{sex}</if>
</where>
order by id asc
</select>
<select id="selectById" resultMap="paperMap">
select *
from ceshi
where id = #{id}
</select>
<select id="selectByYuyueid" resultMap="paperMap">
select *
from ceshi
where name = #{name}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Ceshi" useGeneratedKeys="true">
insert into ceshi
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="descr != null">descr,</if>
<if test="sex != null">sex,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="descr != null">#{descr},</if>
<if test="sex != null">#{sex},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Ceshi">
update ceshi
<set>
<if test="name != null">
name = #{name},
</if>
<if test="descr != null">
descr = #{descr},
</if>
<if test="sex != null">
sex = #{sex},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.CollectionsMapper">
<resultMap type="com.xin.lcyxjy.entity.Collections" id="paperMap">
<result property="id" column="id"/>
<result property="userid" column="userid"/>
<result property="collectionid" column="collectionid"/>
<result property="source" column="source"/>
<result property="status" column="status"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from collection
<where>
<if test="id != null"> and id= {id}</if>
<if test="userid != null"> and userid= #{userid}</if>
<if test="collectionid != null"> and collectionid= #{collectionid}</if>
<if test="source != null"> and source= #{source}</if>
<if test="status != null"> and status= #{status}</if>
</where>
order by source asc
</select>
<select id="selectById" resultMap="paperMap">
select *
from collection
where id = #{id}
</select>
<select id="selectByuserid" resultMap="paperMap">
select *
from collection
where userid = #{userid} and collectionid = #{collectionid} and source = #{source}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Collections" useGeneratedKeys="true">
insert into collection
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userid != null">userid,</if>
<if test="collectionid != null">collectionid,</if>
<if test="source != null">source,</if>
<if test="status != null">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userid != null">#{userid},</if>
<if test="collectionid != null">#{collectionid},</if>
<if test="source != null">#{source},</if>
<if test="status != null">#{status},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Collections">
update collection
<set>
<if test="userid != null">
userid = #{userid},
</if>
<if test="collectionid != null">
collectionid = #{collectionid},
</if>
<if test="source != null">
source = #{source},
</if>
<if test="status != null">
status = #{status},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.GradeMapper">
<resultMap type="com.xin.lcyxjy.entity.Grade" id="paperMap">
<result property="id" column="id"/>
<result property="cid" column="cid"/>
<result property="userid" column="userid"/>
<result property="score" column="score"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from grade
<where>
<if test="id != null"> and id= #{id}</if>
<if test="cid != null"> and cid= #{cid}</if>
<if test="userid != null"> and userid= #{userid}</if>
<if test="score != 0"> and score= #{score}</if>
</where>
order by id asc
</select>
<select id="selectById" resultMap="paperMap">
select *
from grade
where id = #{id}
</select>
<select id="selectByCidUid" resultMap="paperMap">
select *
from grade
where userid = #{userid} and cid = #{cid}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Grade" useGeneratedKeys="true">
insert into grade
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="cid != null">cid,</if>
<if test="userid != null">userid,</if>
<if test="score != null">score,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="cid != null">#{cid},</if>
<if test="userid != null">#{userid},</if>
<if test="score != null">#{score},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Grade">
update grade
<set>
<if test="userid != null">
userid = #{userid},
</if>
<if test="cid != null">
cid = #{cid},
</if>
<if test="score != null">
score = #{score},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.JieguoMapper">
<resultMap type="com.xin.lcyxjy.entity.Jieguo" id="paperMap">
<result property="id" column="id"/>
<result property="qid" column="qid"/>
<result property="name" column="name"/>
<result property="a" column="a"/>
<result property="b" column="b"/>
<result property="c" column="c"/>
<result property="d" column="d"/>
<result property="right" column="right"/>
<result property="userid" column="userid"/>
<result property="ans" column="ans"/>
<result property="cid" column="cid"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from jieguo
<where>
<if test="id != null"> and id= {id}</if>
<if test="name != null"> and name like concat('%', #{name}, '%')</if>
<if test="userid != null"> and userid =#{userid}</if>
<if test="cid != null"> and cid= {cid}</if>
</where>
order by id
</select>
<select id="selectById" resultMap="paperMap">
select *
from jieguo
where id = #{id}
</select>
<select id="selectByname" resultMap="paperMap">
select *
from jieguo
where name like concat('%', #{name}, '%')
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Jieguo" useGeneratedKeys="true">
insert into jieguo
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="qid != null">qid,</if>
<if test="name != null">name,</if>
<if test="a != null">a,</if>
<if test="b != null">b,</if>
<if test="c != null">c,</if>
<if test="d != null">d,</if>
<if test="right != null">right,</if>
<if test="userid != null">userid,</if>
<if test="ans != null">ans,</if>
<if test="cid != null">cid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="qid != null">#{qid},</if>
<if test="name != null">#{name},</if>
<if test="a != null">#{a},</if>
<if test="b != null">#{b},</if>
<if test="c != null">#{c},</if>
<if test="d != null">#{d},</if>
<if test="right != null">#{right},</if>
<if test="userid != null">#{userid},</if>
<if test="ans != null">#{ans},</if>
<if test="cid != null">#{cid},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Jieguo">
update jieguo
<set>
<if test="qid != null">
qid = #{qid},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="a != null">
a = #{a},
</if>
<if test="b != null">
b = #{b},
</if>
<if test="c != null">
c = #{c},
</if>
<if test="d != null">
d = #{d},
</if>
<if test="right != null">
right = #{right},
</if>
<if test="userid != null">
userid = #{userid},
</if>
<if test="ans != null">
ans = #{ans},
</if>
<if test="cid != null">
cid = #{cid},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.NoticeMapper">
<resultMap type="com.xin.lcyxjy.entity.Notice" id="paperMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from notice
<where>
<if test="id != null"> and id= {id}</if>
<if test="title != null"> and title like concat('%', #{title}, '%')</if>
<if test="content != null"> and content= #{content}</if>
</where>
order by id desc
</select>
<select id="selectById" resultMap="paperMap">
select *
from notice
where id = #{id}
</select>
<select id="selectBytitle" resultMap="paperMap">
select *
from notice
where title = #{title}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Notice" useGeneratedKeys="true">
insert into notice
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Notice">
update notice
<set>
<if test="title != null">
title = #{title},
</if>
<if test="content != null">
content = #{content},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.QuestionMapper">
<resultMap type="com.xin.lcyxjy.entity.Question" id="paperMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="a" column="a"/>
<result property="b" column="b"/>
<result property="c" column="c"/>
<result property="d" column="d"/>
<result property="right" column="right"/>
<result property="ceshiid" column="ceshiid"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from question
<where>
<if test="id != null"> and id= #{id}</if>
<if test="name != null"> and name like concat('%', #{name}, '%')</if>
<if test="ceshiid != null"> and ceshiid =#{ceshiid}</if>
</where>
order by ceshiid asc
</select>
<select id="selectById" resultMap="paperMap">
select *
from question
where id = #{id}
</select>
<select id="selectByname" resultMap="paperMap">
select *
from question
where name = #{name}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Question" useGeneratedKeys="true">
insert into question
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null">name,</if>
<if test="a != null">a,</if>
<if test="b != null">b,</if>
<if test="c != null">c,</if>
<if test="d != null">d,</if>
<if test="right != null">right,</if>
<if test="ceshiid != null">ceshiid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null">#{name},</if>
<if test="a != null">#{a},</if>
<if test="b != null">#{b},</if>
<if test="c != null">#{c},</if>
<if test="d != null">#{d},</if>
<if test="right != null">#{right},</if>
<if test="ceshiid != null">#{ceshiid},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Question">
update question
<set>
<if test="name != null">
name = #{name},
</if>
<if test="a != null">
a = #{a},
</if>
<if test="b != null">
b = #{b},
</if>
<if test="c != null">
c = #{c},
</if>
<if test="d != null">
d = #{d},
</if>
<if test="right != null">
right = #{right},
</if>
<if test="ceshiid != null">
ceshiid = #{ceshiid},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.UserMapper">
<resultMap type="com.xin.lcyxjy.entity.User" id="paperMap">
<result property="id" column="id"/>
<result property="password" column="password"/>
<result property="name" column="name"/>
<result property="sex" column="sex"/>
<result property="birth" column="birthday"/>
<result property="img" column="img"/>
<result property="role" column="role"/>
</resultMap>
<select id="selectAll" parameterType="com.xin.lcyxjy.entity.User" resultMap="paperMap">
select * from user
<where>
<if test="id != null"> and id= #{id}</if>
<if test="name != null"> and name like concat('%', #{name}, '%')</if>
</where>
</select>
<select id="selectById" parameterType="com.xin.lcyxjy.entity.User" resultMap="paperMap">
select * from user
where id = #{id}
</select>
<select id="selectByUserName" parameterType="com.xin.lcyxjy.entity.User" resultMap="paperMap">
select * from user
where name =#{name}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.User">
insert into user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="password != null">password,</if>
<if test="name != null">name,</if>
<if test="sex != null">sex,</if>
<if test="birth != null">birthday,</if>
<if test="role != null">role,</if>
<if test="img != null">img,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="password != null">#{password},</if>
<if test="name != null">#{name},</if>
<if test="sex != null">#{sex},</if>
<if test="birth != null">#{birth},</if>
<if test="role != null">#{role},</if>
<if test="img != null">#{img},</if>
</trim>
</insert>
<update id="updateUser" parameterType="com.xin.lcyxjy.entity.User">
update user
<set>
<if test="password != null">
password = #{password},
</if>
<if test="name != null">
name = #{name},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="birth != null">
birthday = #{birth},
</if>
<if test="img != null">
img = #{img},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xin.lcyxjy.mapper.WenzhangMapper">
<resultMap type="com.xin.lcyxjy.entity.Wenzhang" id="paperMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="time" column="time"/>
<result property="img" column="img"/>
<result property="type" column="type"/>
</resultMap>
<select id="selectAll" resultMap="paperMap">
select *
from wenzhang
<where>
<if test="id != null"> and id= #{id}</if>
<if test="title != null"> and title like concat('%', #{title}, '%')</if>
<if test="content != null"> and content= like concat('%', #{content}, '%')</if>
</where>
</select>
<select id="selectById" resultMap="paperMap">
select *
from wenzhang
where id = #{id}
</select>
<select id="selectBytitle" resultMap="paperMap">
select *
from wenzhang
where title = #{title}
</select>
<insert id="insert" parameterType="com.xin.lcyxjy.entity.Wenzhang" useGeneratedKeys="true">
insert into wenzhang
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="title != null">title,</if>
<if test="content != null">content,</if>
<if test="time != null">time,</if>
<if test="img != null">img,</if>
<if test="type != null">type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="title != null">#{title},</if>
<if test="content != null">#{content},</if>
<if test="time != null">#{time},</if>
<if test="img != null">#{img},</if>
<if test="type != null">#{type},</if>
</trim>
</insert>
<update id="updateById" parameterType="com.xin.lcyxjy.entity.Wenzhang">
update wenzhang
<set>
<if test="title != null">
title = #{title},
</if>
<if test="content != null">
content = #{content},
</if>
<if test="time != null">
time = #{time},
</if>
<if test="img != null">
img = #{img},
</if>
<if test="type != null">
type = #{type},
</if>
</set>
where id = #{id}
</update>
</mapper>

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../acorn/bin/acorn" "$@"
ret=$?
else
node "$basedir/../acorn/bin/acorn" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\acorn\bin\acorn" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../acorn/bin/acorn" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../acorn/bin/acorn" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../ansi-html-community/bin/ansi-html" "$@"
ret=$?
else
node "$basedir/../ansi-html-community/bin/ansi-html" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\ansi-html-community\bin\ansi-html" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../ansi-html-community/bin/ansi-html" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../ansi-html-community/bin/ansi-html" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../autoprefixer/bin/autoprefixer" "$@"
ret=$?
else
node "$basedir/../autoprefixer/bin/autoprefixer" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\autoprefixer\bin\autoprefixer" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../autoprefixer/bin/autoprefixer" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../browserslist/cli.js" "$@"
ret=$?
else
node "$basedir/../browserslist/cli.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\browserslist\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../browserslist/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../browserslist/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../cssesc/bin/cssesc" "$@"
ret=$?
else
node "$basedir/../cssesc/bin/cssesc" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\cssesc\bin\cssesc" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../cssesc/bin/cssesc" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../cssesc/bin/cssesc" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../he/bin/he" "$@"
ret=$?
else
node "$basedir/../he/bin/he" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\he\bin\he" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../he/bin/he" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../he/bin/he" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../cli-highlight/bin/highlight" "$@"
ret=$?
else
node "$basedir/../cli-highlight/bin/highlight" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\cli-highlight\bin\highlight" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../cli-highlight/bin/highlight" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../cli-highlight/bin/highlight" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../html-minifier-terser/cli.js" "$@"
ret=$?
else
node "$basedir/../html-minifier-terser/cli.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\html-minifier-terser\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../html-minifier-terser/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../html-minifier-terser/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../is-docker/cli.js" "$@"
ret=$?
else
node "$basedir/../is-docker/cli.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\is-docker\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../is-docker/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../is-docker/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../jsesc/bin/jsesc" "$@"
ret=$?
else
node "$basedir/../jsesc/bin/jsesc" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\jsesc\bin\jsesc" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../jsesc/bin/jsesc" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../jsesc/bin/jsesc" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../json5/lib/cli.js" "$@"
ret=$?
else
node "$basedir/../json5/lib/cli.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\json5\lib\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../json5/lib/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

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

Loading…
Cancel
Save