Commit 9c245060 authored by liyongjie's avatar liyongjie 👶🏿

第一次提交(未加入SpringSecurity)

parent 0dc76998
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar
This diff is collapsed.
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM https://www.apache.org/licenses/LICENSE-2.0
@REM
@REM Unless required by applicable law or agreed to in writing,
@REM software distributed under the License is distributed on an
@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@REM KIND, either express or implied. See the License for the
@REM specific language governing permissions and limitations
@REM under the License.
@REM ----------------------------------------------------------------------------
@REM ----------------------------------------------------------------------------
@REM Maven Start Up Batch script
@REM
@REM Required ENV vars:
@REM JAVA_HOME - location of a JDK home dir
@REM
@REM Optional ENV vars
@REM M2_HOME - location of maven2's installed home dir
@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
@REM e.g. to debug Maven itself, use
@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
@REM ----------------------------------------------------------------------------
@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
@echo off
@REM set title of command window
title %0
@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
@REM set %HOME% to equivalent of $HOME
if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
@REM Execute a user defined script before this one
if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
@REM check for pre script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_pre.bat" call "%USERPROFILE%\mavenrc_pre.bat" %*
if exist "%USERPROFILE%\mavenrc_pre.cmd" call "%USERPROFILE%\mavenrc_pre.cmd" %*
:skipRcPre
@setlocal
set ERROR_CODE=0
@REM To isolate internal variables from possible post scripts, we use another setlocal
@setlocal
@REM ==== START VALIDATION ====
if not "%JAVA_HOME%" == "" goto OkJHome
echo.
echo Error: JAVA_HOME not found in your environment. >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
:OkJHome
if exist "%JAVA_HOME%\bin\java.exe" goto init
echo.
echo Error: JAVA_HOME is set to an invalid directory. >&2
echo JAVA_HOME = "%JAVA_HOME%" >&2
echo Please set the JAVA_HOME variable in your environment to match the >&2
echo location of your Java installation. >&2
echo.
goto error
@REM ==== END VALIDATION ====
:init
@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
@REM Fallback to current working directory if not found.
set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
set EXEC_DIR=%CD%
set WDIR=%EXEC_DIR%
:findBaseDir
IF EXIST "%WDIR%"\.mvn goto baseDirFound
cd ..
IF "%WDIR%"=="%CD%" goto baseDirNotFound
set WDIR=%CD%
goto findBaseDir
:baseDirFound
set MAVEN_PROJECTBASEDIR=%WDIR%
cd "%EXEC_DIR%"
goto endDetectBaseDir
:baseDirNotFound
set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
cd "%EXEC_DIR%"
:endDetectBaseDir
IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
@setlocal EnableExtensions EnableDelayedExpansion
for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
:endReadAdditionalConfig
SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
FOR /F "usebackq tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
)
@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
if exist %WRAPPER_JAR% (
if "%MVNW_VERBOSE%" == "true" (
echo Found %WRAPPER_JAR%
)
) else (
if not "%MVNW_REPOURL%" == "" (
SET DOWNLOAD_URL="%MVNW_REPOURL%/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar"
)
if "%MVNW_VERBOSE%" == "true" (
echo Couldn't find %WRAPPER_JAR%, downloading it ...
echo Downloading from: %DOWNLOAD_URL%
)
powershell -Command "&{"^
"$webclient = new-object System.Net.WebClient;"^
"if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
"$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
"}"^
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
"}"
if "%MVNW_VERBOSE%" == "true" (
echo Finished downloading %WRAPPER_JAR%
)
)
@REM End of extension
@REM Provide a "standardized" way to retrieve the CLI args that will
@REM work with both Windows and non-Windows executions.
set MAVEN_CMD_LINE_ARGS=%*
%MAVEN_JAVA_EXE% ^
%JVM_CONFIG_MAVEN_PROPS% ^
%MAVEN_OPTS% ^
%MAVEN_DEBUG_OPTS% ^
-classpath %WRAPPER_JAR% ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
if ERRORLEVEL 1 goto error
goto end
:error
set ERROR_CODE=1
:end
@endlocal & set ERROR_CODE=%ERROR_CODE%
if not "%MAVEN_SKIP_RC%"=="" goto skipRcPost
@REM check for post script, once with legacy .bat ending and once with .cmd ending
if exist "%USERPROFILE%\mavenrc_post.bat" call "%USERPROFILE%\mavenrc_post.bat"
if exist "%USERPROFILE%\mavenrc_post.cmd" call "%USERPROFILE%\mavenrc_post.cmd"
:skipRcPost
@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
if "%MAVEN_BATCH_PAUSE%"=="on" pause
if "%MAVEN_TERMINATE_CMD%"=="on" exit %ERROR_CODE%
cmd /C exit /B %ERROR_CODE%
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>back</artifactId>
<version>0.0.1-SNAPSHOSwaggerConfigT</version>
<name>back</name>
<description>back</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>3.4.3.4</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-support</artifactId>
<version>2.1.8</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-extension</artifactId>
<version>3.4.3.4</version>
</dependency>
<!-- 执行sql 分析打印 依赖-->
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
<version>3.8.2</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.75</version>
</dependency>
<!-- swagger3.0-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<!--easyExcel-->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
package com.example.back;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import springfox.documentation.oas.annotations.EnableOpenApi;
@SpringBootApplication
@EnableCaching
@MapperScan("com.example.back.dao")
@EnableOpenApi
public class BackApplication {
public static void main(String[] args) {
SpringApplication.run(BackApplication.class, args);
}
}
package com.example.back.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
@Configuration
@EnableWebMvc
public class SwaggerConfig {
@Bean
public Docket applicationAPI(){
return new Docket(DocumentationType.OAS_30)
.enable(true)
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.back.controller"))
.paths(PathSelectors.any())
.build()
.apiInfo(myApi());
}
private ApiInfo myApi(){
return new ApiInfoBuilder().title("考勤管理项目服务接口")
.contact(new Contact("my","http://www.baidu.com","123qq.com"))
.version("1.1")
.description("接口调用及测试文档")
.build();
}
}
package com.example.back.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.Attendance;
import com.example.back.model.AttendanceExcel;
import com.example.back.service.AttendanceService;
import com.example.back.utils.EasyExcelUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
@RestController
public class AttendanceController {
@Autowired
private AttendanceService attendanceService;
@GetMapping("/getAttendanceAll")
public List<Attendance>getAttendanceAll(){
return attendanceService.getAttendanceAll();
}
@ApiOperation(value = "分页查询信息")
@RequestMapping(value = "/getAttendanceAllByPage/{currentPage}/{size}",method = RequestMethod.POST)
public JSONObject getAttendanceAllByPage(@PathVariable("currentPage") int currentPage, @PathVariable("size") int size){
return attendanceService.getAttendanceAllByPage(currentPage, size);
}
@RequestMapping(value = "/queryAttendanceByConditions/{userId}",method = RequestMethod.POST)
public List<Attendance> queryAttendanceByConditions(@PathVariable("userId")Integer userId)
{
return attendanceService.queryAttendanceByConditions(userId);
}
@RequestMapping(value = "/exportAttendance",method = RequestMethod.GET)
public void exportFlight(HttpServletResponse response, String fileName) throws IOException {
List<AttendanceExcel>users=attendanceService.exportAttendance();
EasyExcelUtil.exportDefaultExcel(response,fileName,AttendanceExcel.class,users);
}
}
package com.example.back.controller;
import java.io.File;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import com.example.back.utils.UuidUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@CrossOrigin//解决跨域问题
@RestController
@RequestMapping("/file")
public class FileController {
@Value("${file.uploadFolder}")
private String uploadFolder;
@RequestMapping("/upload")
public String FileUpdate (HttpServletRequest request,MultipartFile file) {
//配置文件设置想保存的路径
String str=uploadFolder;
//得到上传时的文件名字
String originalname=file.getOriginalFilename();
System.out.println("上传时的文件名字:"+originalname);
//substring(originalname.lastIndexOf(".")截取图片名后缀
String newName= originalname.substring(originalname.lastIndexOf("."));
System.out.println("图片名字:"+originalname);
System.out.println("截取图片名后缀:"+newName);
String frontNewName= originalname.substring(0,originalname.lastIndexOf("."));
System.out.println("图片名字:"+originalname);
System.out.println("截取图片名前缀:"+frontNewName);
//利用UUidUtil工具类生成新的文件名字
newName = UuidUtil.getUUID()+newName;
System.out.println(newName);
System.out.println(str);
File newFile=new File(str,newName);
//获得文件目录,判断是否存在
if(!newFile.getParentFile().exists()) {
//如果path路径不存在,创建一个文件夹,存在则使用当前文件夹
newFile.getParentFile().mkdirs();
}
try {
//保存文件到指定路径之中
file.transferTo(newFile);
} catch (IllegalStateException | IOException e) {
e.printStackTrace();
}
System.out.println("上传的文件路径:"+str+newName);
return newName;
}
}
\ No newline at end of file
package com.example.back.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.Leave;
import com.example.back.model.User;
import com.example.back.service.LeaveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "请假管理相关接口")
@RestController
@RequestMapping("/leave")
public class LeaveController {
@Autowired
private LeaveService leaveService;
@ApiOperation(value = "查询全部请假单信息")
@RequestMapping(value = "/getLeaveAllByPage/{currentPage}/{size}",method = RequestMethod.POST)
public JSONObject getLeaveAll(@PathVariable("currentPage") int currentPage, @PathVariable("size") int size){
return leaveService.getLeaveAllByPage(currentPage, size);
}
@ApiOperation(value = "查询全部请假时间信息")
@RequestMapping(value = "/getleaveTimes/{userId}",method = RequestMethod.POST)
public List<Leave> getleaveTimes(@PathVariable("userId")Integer userId){
return leaveService.leaveTimes(userId);
}
@ApiOperation(value = "查询全部批假单信息")
@RequestMapping(value = "/getSetLeaveAllByPage/{currentPage}/{size}",method = RequestMethod.POST)
public JSONObject getSetLeaveAllByPage(@PathVariable("currentPage") int currentPage, @PathVariable("size") int size){
return leaveService.getSetLeaveAllByPage(currentPage, size);
}
@ApiOperation(value = "根据条件查询请假信息")
@RequestMapping(value = "/queryLeaveByConditions/{leaveTypeId}/{startTime}/{endTime}",method = RequestMethod.POST)
public List<Leave> queryLeaveByConditions(@PathVariable("leaveTypeId") Integer leaveTypeId,
@PathVariable("startTime") String startTime,
@PathVariable("endTime") String endTime){
return leaveService.queryLeaveByConditions(leaveTypeId,startTime,endTime);
}
@ApiOperation(value = "根据条件查询批假信息")
@RequestMapping(value = "/queryLeaveByConditionsSetLeave/{userId}/{leaveTypeId}/{startTime}/{endTime}/{status}",method = RequestMethod.POST)
public List<Leave> queryLeaveByConditionsSetLeave(
@PathVariable("userId") Integer userId,
@PathVariable("leaveTypeId") Integer leaveTypeId,
@PathVariable("startTime") String startTime,
@PathVariable("endTime") String endTime,
@PathVariable("status") String status
){
return leaveService.queryLeaveByConditionsSetLeave(userId,leaveTypeId,startTime,endTime,status);
}
@ApiOperation(value = "新建请假单")
@RequestMapping(value = "/insertLeave",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
public String insertLeave(@RequestBody Leave leave){
return leaveService.insertLeave(leave);
}
@ApiOperation(value = "编辑请假单")
@RequestMapping(value = "/updateLeave",method = RequestMethod.PUT,produces = "application/json;charset=UTF-8")
public String updateLeave(@RequestBody Leave leave){
return leaveService.updateLeave(leave);
}
@ApiOperation(value = "删除请假单")
@RequestMapping(value = "/deleteLeaveById/{id}",method = RequestMethod.DELETE,produces = "application/json;charset=UTF-8")
public String deleteLeaveById(@PathVariable("id")Integer id){
return leaveService.deleteLeaveById(id);
}
}
package com.example.back.controller;
import com.example.back.model.LeaveType;
import com.example.back.service.LeaveTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = "leaveType")
public class LeaveTypeController {
@Autowired
private LeaveTypeService leaveTypeService;
@RequestMapping(value = "/getLeaveTypeAll",method = RequestMethod.GET)
public List<LeaveType> getLeaveTypeAll(){
return leaveTypeService.getLeaveTypeAll();
}
}
//package com.example.back.controller;
//
//import com.example.back.model.Admin;
//import com.example.back.service.AdminService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//@RestController
//public class LoginController {
//
// @Autowired
// private AdminService adminService;
//
// @PostMapping("/login")
// public String login(@RequestBody Admin admin){
// return adminService.login(admin.getUsername(),admin.getPassword());
// }
//}
package com.example.back.controller;
import com.example.back.model.Role;
import com.example.back.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping(value = "/role")
public class RoleContoller {
@Autowired
private RoleService roleService;
@RequestMapping(value = "/getRoleAll",method = RequestMethod.GET)
public List<Role>getRoleAll(){
return roleService.selectRoleAll();
}
}
package com.example.back.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.User;
import com.example.back.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@Api(tags = "用户相关接口")
@RestController
@RequestMapping(value = "/user")
public class UserController {
@Autowired
private UserService userService;
@ApiOperation(value = "登录操作")
@RequestMapping(value = "/login",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
public Map userLogin(@RequestBody User user){
return userService.login(user.getLinkNum(),user.getPassword());
}
@ApiOperation(value = "查询全部用户信息")
@RequestMapping(value = "/getUser",method = RequestMethod.GET)
public List<User> getUser(){
return userService.getUser();
}
@ApiOperation(value = "查询全部用户信息")
@RequestMapping(value = "/getUserAll",method = RequestMethod.GET)
public List<User> getUserAll(){
return userService.findUserAll();
}
/**
* 分页查询
*/
@PostMapping("/getUserAllByPage/{currentPage}/{size}")
public JSONObject getUserAllByPage(@PathVariable("currentPage") int currentPage, @PathVariable("size") int size) {
return userService.getUserAllByPage(currentPage, size);
}
@ApiOperation(value = "根据条件查询用户信息")
@RequestMapping(value = "/queryUserByConditions/{username}/{linknum}",method = RequestMethod.POST)
public List<User> queryUserByConditions(@PathVariable("username") String username,@PathVariable("linknum") String linknum){
return userService.queryUserByConditions(username,linknum);
}
@ApiOperation(value = "根据id查询用户信息")
@RequestMapping(value = "/getUserById/{userId}",method = RequestMethod.POST)
public User getUserById(@PathVariable("userId") Integer userId){
return userService.getUserById(userId);
}
@ApiOperation(value = "新增用户")
@RequestMapping(value = "/insertUser",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
public String insertUser(@RequestBody User user){
return userService.insertUser(user);
}
@ApiOperation(value = "编辑用户")
@RequestMapping(value = "/updateUser",method = RequestMethod.PUT,produces = "application/json;charset=UTF-8")
public String updateUser(@RequestBody User user){
return userService.updateUser(user);
}
@ApiOperation(value = "删除一个用户")
@RequestMapping(value = "/deleteUserById/{id}",method = RequestMethod.DELETE,produces = "application/json;charset=UTF-8")
public String deleteUserById(@PathVariable("id")Integer id){
return userService.deleteUserById(id);
}
}
package com.example.back.controller;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.Leave;
import com.example.back.model.User;
import com.example.back.model.WorkOverTime;
import com.example.back.service.WorkOvertimeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api(tags = "加班管理相关接口")
@RestController
@RequestMapping(value = "/workOvertime")
public class WorkOvertimeController {
@Autowired
private WorkOvertimeService workOvertimeService;
/**
* 分页查询
*/
@PostMapping("/getWorkOverTimeAllByPage/{currentPage}/{size}")
public JSONObject getWorkOverTimeAllByPage(@PathVariable("currentPage") int currentPage, @PathVariable("size") int size) {
return workOvertimeService.getWorkOverTimeAllByPage(currentPage, size);
}
@ApiOperation(value = "查询全部加班时间信息")
@RequestMapping(value = "/getOverTimes/{userId}",method = RequestMethod.POST)
public List<Leave> getOverTimes(@PathVariable("userId")Integer userId){
return workOvertimeService.overTimes(userId);
}
/**
* 员工分页查询
*/
@PostMapping("/getWorkOverTimeUserAllByPage/{userId}/{currentPage}/{size}")
public JSONObject getWorkOverTimeUserAllByPage(@PathVariable("userId")Integer userId, @PathVariable("currentPage") int currentPage, @PathVariable("size") int size) {
return workOvertimeService.getWorkOverTimeUserAllByPage(userId,currentPage, size);
}
@ApiOperation(value = "查询所有加班信息")
@RequestMapping(value = "/getWorkOverTimeAll",method = RequestMethod.GET)
public List<WorkOverTime> getWorkOverTimeAll(){
return workOvertimeService.findWorkOverTimeAll();
}
@ApiOperation(value = "根据条件查询加班信息")
@RequestMapping(value = "/queryWorkOvertimeByConditions/{userName}/{startTime}/{endTime}",method = RequestMethod.POST)
public List<WorkOverTime> queryWorkOvertimeByConditions(@PathVariable("userName") String userName,
@PathVariable("startTime") String startTime,
@PathVariable("endTime") String endTime){
return workOvertimeService.queryWorkOvertimeByConditions(userName,startTime,endTime);
}
@ApiOperation(value = "根据条件查询用户加班信息")
@RequestMapping(value = "/queryUserWorkOvertimeByConditions/{startTime}/{endTime}",method = RequestMethod.POST)
public List<WorkOverTime> queryUserWorkOvertimeByConditions(
@PathVariable("startTime") String startTime,
@PathVariable("endTime") String endTime){
return workOvertimeService.queryUserWorkOvertimeByConditions(startTime,endTime);
}
@ApiOperation(value = "新增用户")
@RequestMapping(value = "/insertWorkOverTime",method = RequestMethod.POST,produces = "application/json;charset=UTF-8")
public String insertWorkOverTime(@RequestBody WorkOverTime workOverTime){
return workOvertimeService.insertWorkOverTime(workOverTime);
}
@ApiOperation(value = "编辑用户")
@RequestMapping(value = "/updateWorkOverTime",method = RequestMethod.PUT,produces = "application/json;charset=UTF-8")
public String updateWorkOverTime(@RequestBody WorkOverTime workOverTime){
return workOvertimeService.updateWorkOverTime(workOverTime);
}
@ApiOperation(value = "删除一个用户")
@RequestMapping(value = "/deleteWorkOverTimeById/{id}",method = RequestMethod.DELETE,produces = "application/json;charset=UTF-8")
public String deleteWorkOverTimeById(@PathVariable("id")Integer id){
return workOvertimeService.deleteWorkOverTimeById(id);
}
}
//package com.example.back.dao;
//
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
//import com.example.back.model.Admin;
//import org.apache.ibatis.annotations.Param;
//import org.springframework.stereotype.Repository;
//
//import java.util.List;
//
//@Repository
//public interface AdminMapper extends BaseMapper<Admin> {
// public Admin login(@Param("username") String username, @Param("password") String password);
//}
package com.example.back.dao;
import com.example.back.model.Attendance;
import com.example.back.model.AttendanceExcel;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AttendanceMapper {
List<Attendance>getAttendanceAll();
List<Attendance>getAttendanceAllByPage(Integer Page,Integer size);
int selectAttendanceCount();
int insert(Integer userId);
int updateLeave(Integer userId,Integer leaveCounts);
int updateOvertime(Integer userId,Integer overDays);
// 条件时间查询 String startTime,String endTime
List<Attendance> queryAttendanceByConditions(Integer userId);
List<AttendanceExcel>exportAttendance();
}
package com.example.back.dao;
import com.example.back.model.Leave;
import io.swagger.models.auth.In;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LeaveMapper {
int insertLeave(Leave leave);
int insertLeaveUserId(Integer userId);
int updateLeave(Leave leave);
int deleteLeaveById(Integer id);
List<Leave> getLeaveAllByPage(int Page, int size);
int selectCount();
List<Leave>leaveTimes(Integer userId);
List<Leave> queryLeaveByConditions(Integer leaveTypeId,String startTime, String endTime);
List<Leave>queryUserLeaveByConditions(Integer userId,Integer leaveTypeId,String startTime, String endTime);
List<Leave> getSetLeaveAllByPage(int Page, int size);
int selectSetLeaveCount();
List<Leave>queryLeaveByConditionsSetLeave(Integer userId,Integer leaveTypeId,String startTime, String endTime,String status);
}
package com.example.back.dao;
import com.example.back.model.LeaveType;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface LeaveTypeMapper {
List<LeaveType> getLeaveTypeAll();
}
package com.example.back.dao;
import com.example.back.model.Role;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface RoleMapper {
List<Role> selectRoleAll();
}
package com.example.back.dao;
import com.example.back.model.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface UserMapper {
User login( String linkNum, String password);
List<User> getUserAll();
int insertUser(User user);
Integer getUserId();
int updateUser(User user);
int deleteUserById(Integer id);
List<User>getUser();
User getUserById(Integer userId);
List<User> queryUserByConditions(String username, String linknum);
//分页查询
public List<User> getUserAllByPage(@Param("Page") int Page, @Param("size") int size);
//查出用户数量
int selectCount();
}
package com.example.back.dao;
import com.example.back.model.Leave;
import com.example.back.model.WorkOverTime;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface WorkOvertimeMapper {
List<WorkOverTime> getWorkOverTimeAll();
int insertWorkOverTime(WorkOverTime workOverTime);
int insertOvertimeUserId(Integer userId);
int updateWorkOverTime(WorkOverTime workOverTime);
int deleteWorkOverTimeById(Integer id);
List overTimes(Integer userId);
List<WorkOverTime>getWorkOverTimeAllByPage(int Page, int size);
List<WorkOverTime>getWorkOverTimeUserAllByPage(Integer userId,int Page, int size);
int selectCount();
List<WorkOverTime>queryWorkOvertimeByConditions(String userName,String startTime, String endTime);
List<WorkOverTime> queryUserWorkOvertimeByConditions(String startTime, String endTime);
}
package com.example.back.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName("admin")
public class Admin {
@TableId(value = "admin_id", type = IdType.AUTO)
private Integer adminId;
private String username;
private String password;
}
package com.example.back.model;
import lombok.Data;
@Data
public class Attendance {
private Integer recordId;
private Integer userId;
private String userName;
private Integer requiredDays;
private Integer actualDays;
private Integer overtimeDays;
}
package com.example.back.model;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class AttendanceExcel {
@ExcelProperty(value = "姓名",index = 0)
private String userName;
@ExcelProperty(value = "应出勤天数",index = 1)
private Integer requiredDays;
@ExcelProperty(value = "实际出勤天数(不含加班)",index = 2)
private Integer actualDays;
@ExcelProperty(value = "加班天数",index = 3)
private Integer overtimeDays;
}
\ No newline at end of file
package com.example.back.model;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
public class Leave implements Serializable {
private Integer leaveId;
private Integer leaveTypeId;
private String leaveTypeName;
private String startTime;
private String endTime;
private String times;
private String status;
private Boolean showIf;
private String cancelThings;
private Integer leaveCounts;
private String leaveThings;
private String leaveUrl;
private Integer userId;
private String userName;
}
package com.example.back.model;
import lombok.Data;
@Data
public class LeaveType {
private Integer leaveTypeId;
private String leaveTypeName;
}
package com.example.back.model;
import lombok.Data;
@Data
public class Role {
private Integer roleId;
private String roleName;
}
package com.example.back.model;
import lombok.Data;
@Data
public class User {
private Integer userId;
private String userName;
private String linkNum;
private String password;
private Integer roleId;
private String roleName;
}
package com.example.back.model;
import lombok.Data;
@Data
public class WorkOverTime {
private Integer workOvertimeId;
private String startTime;
private String endTime;
private String workOvertimeTime;
private String workOvertimeThings;
private Integer userId;
private String userName;
private Integer overDays;
}
//package com.example.back.service;
//
//
//import com.baomidou.mybatisplus.extension.service.IService;
//import com.example.back.model.Admin;
//import org.apache.ibatis.annotations.Param;
//
//public interface AdminService {
//
// String login(String username, String password);
//}
package com.example.back.service;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.Attendance;
import com.example.back.model.AttendanceExcel;
import java.util.List;
public interface AttendanceService {
List<Attendance> getAttendanceAll();
JSONObject getAttendanceAllByPage(int currentPage, int size);
// 时间查询 String startTime,String endTime
List<Attendance> queryAttendanceByConditions(Integer userId);
List<AttendanceExcel>exportAttendance();
}
package com.example.back.service;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.Leave;
import java.util.List;
public interface LeaveService {
String insertLeave(Leave leave);
String updateLeave(Leave leave);
String deleteLeaveById(Integer id);
JSONObject getLeaveAllByPage(int currentPage, int size);
List<Leave>leaveTimes(Integer userId);
List<Leave> queryUserLeaveByConditions(Integer userId,Integer leaveTypeId,String startTime, String endTime);
JSONObject getSetLeaveAllByPage(int currentPage, int size);
List<Leave> queryLeaveByConditions(Integer leaveTypeId,String startTime, String endTime);
List<Leave> queryLeaveByConditionsSetLeave(Integer userId, Integer leaveTypeId, String startTime, String endTime, String status);
}
package com.example.back.service;
import com.example.back.model.LeaveType;
import java.util.List;
public interface LeaveTypeService {
List<LeaveType> getLeaveTypeAll();
}
package com.example.back.service;
import com.example.back.model.Role;
import java.util.List;
public interface RoleService {
List<Role> selectRoleAll();
}
package com.example.back.service;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.User;
import java.util.List;
import java.util.Map;
public interface UserService {
Map login(String linkNum, String password);
List<User> findUserAll();
String insertUser(User user);
String updateUser(User user);
String deleteUserById(Integer id);
List<User> queryUserByConditions(String username,String linknum);
JSONObject getUserAllByPage(int currentPage, int size);
List<User> getUser();
User getUserById(Integer userId);
}
package com.example.back.service;
import com.alibaba.fastjson.JSONObject;
import com.example.back.model.WorkOverTime;
import io.swagger.models.auth.In;
import java.util.List;
public interface WorkOvertimeService {
List<WorkOverTime> findWorkOverTimeAll();
List overTimes(Integer userId);
String insertWorkOverTime(WorkOverTime workOverTime);
String updateWorkOverTime(WorkOverTime workOverTime);
String deleteWorkOverTimeById(Integer id);
JSONObject getWorkOverTimeAllByPage(int currentPage, int size);
JSONObject getWorkOverTimeUserAllByPage(Integer userId, int currentPage, int size);
List<WorkOverTime>queryWorkOvertimeByConditions(String userName,String startTime, String endTime);
List<WorkOverTime>queryUserWorkOvertimeByConditions(String startTime, String endTime);
}
//package com.example.back.service.impl;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.example.back.dao.AdminMapper;
//import com.example.back.model.Admin;
//import com.example.back.service.AdminService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class AdminServiceImpl implements AdminService {
//
// @Autowired
// private AdminMapper adminMapper;
//
// @Override
// public String login(String username, String password){
// String msg=null;
// Admin login = adminMapper.login(username, password);
// if (login!=null){
// msg="登录成功";
// }else {
// msg="用户名或密码错误";
// }
// return msg;
// }
//
//}
package com.example.back.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.example.back.dao.AttendanceMapper;
import com.example.back.model.Attendance;
import com.example.back.model.AttendanceExcel;
import com.example.back.model.Leave;
import com.example.back.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class AttendanceServiceImpl implements AttendanceService {
@Autowired
private AttendanceMapper attendanceMapper;
@Override
public List<Attendance> getAttendanceAll() {
return attendanceMapper.getAttendanceAll();
}
@Override
public JSONObject getAttendanceAllByPage(int currentPage, int size) {
int Page=(currentPage-1)*size;
List<Attendance> attendances = attendanceMapper.getAttendanceAllByPage(Page, size);
int total = attendanceMapper.selectAttendanceCount();
JSONObject res=new JSONObject();
res.put("attendanceInfo",attendances);
res.put("total",total);
return res;
}
// 时间String startTime, String endTime
@Override
public List<Attendance> queryAttendanceByConditions(Integer userId) {
return attendanceMapper.queryAttendanceByConditions(userId);
}
@Override
public List<AttendanceExcel> exportAttendance() {
return attendanceMapper.exportAttendance();
}
}
package com.example.back.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.example.back.dao.AttendanceMapper;
import com.example.back.dao.LeaveMapper;
import com.example.back.dao.WorkOvertimeMapper;
import com.example.back.model.Attendance;
import com.example.back.model.Leave;
import com.example.back.model.User;
import com.example.back.service.LeaveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
@Service
public class LeaveServiceImpl implements LeaveService {
@Autowired
private LeaveMapper leaveMapper;
@Autowired
private AttendanceMapper attendanceMapper;
@Autowired
private WorkOvertimeMapper workOvertimeMapper;
@Override
// @Cacheable(cacheNames = "getLeaveAllByPage",unless = "#result==null")
public JSONObject getLeaveAllByPage(int currentPage, int size) {
int Page=(currentPage-1)*size;
List<Leave> leaves = leaveMapper.getLeaveAllByPage(Page, size);
int total = leaveMapper.selectCount();
JSONObject res=new JSONObject();
res.put("leaveInfo",leaves);
res.put("total",total);
return res;
}
@Override
public List<Leave> leaveTimes(Integer userId) {
return leaveMapper.leaveTimes(userId);
}
@Override
public JSONObject getSetLeaveAllByPage(int currentPage, int size) {
int Page=(currentPage-1)*size;
List<Leave> leaves = leaveMapper.getSetLeaveAllByPage(Page, size);
int total = leaveMapper.selectSetLeaveCount();
JSONObject res=new JSONObject();
res.put("leaveInfo",leaves);
res.put("total",total);
return res;
}
@Override
public List<Leave> queryLeaveByConditions(Integer leaveTypeId,String startTime, String endTime) {
return leaveMapper.queryLeaveByConditions(leaveTypeId,startTime,endTime);
}
@Override
public List<Leave> queryUserLeaveByConditions(Integer userId,Integer leaveTypeId,String startTime, String endTime) {
return leaveMapper.queryUserLeaveByConditions(userId,leaveTypeId,startTime,endTime);
}
@Override
public List<Leave> queryLeaveByConditionsSetLeave(Integer userId, Integer leaveTypeId, String startTime, String endTime, String status) {
return leaveMapper.queryLeaveByConditionsSetLeave(userId,leaveTypeId,startTime,endTime,status);
}
@Override
public String insertLeave(Leave leave) {
String msg=null;
int i = leaveMapper.insertLeave(leave);
attendanceMapper.updateLeave(leave.getUserId(),leave.getLeaveCounts());
// System.out.println(leave.getUserId());
//
//// 查看考勤表是否有相应的userId
// Attendance attendance = attendanceMapper.selectAttendanceUserId(leave.getUserId());
// if(!Objects.isNull(attendance)){
// // 如果这个userId在考勤表中存在的话说明要判断这条数据的leaveId是否为空 若为空则需插入这个leaveId
// Integer leaveId = attendance.getLeaveId();
// if(leaveId==null){
// attendanceMapper.insertAttendanceLeave(leave.getLeaveId());
// }else{
// // leaveId不为空说明要把此次请假单天数加到这条考勤数据上
// attendanceMapper.updateAttendanceLeave(leave.getUserId(),leave.getLeaveId());
// }
// }
// System.out.println(leave.getLeaveId());
if (i>0){
msg="新增成功";
}else {
msg="新增失败";
}
return msg;
}
@Override
public String updateLeave(Leave leave) {
String msg=null;
int i = leaveMapper.updateLeave(leave);
if (i>0){
msg="修改成功";
}else {
msg="修改失败";
}
return msg;
}
@Override
public String deleteLeaveById(Integer id) {
String msg=null;
int i = leaveMapper.deleteLeaveById(id);
if (i>0){
msg="删除成功";
}else {
msg="删除失败";
}
return msg;
}
}
package com.example.back.service.impl;
import com.example.back.dao.LeaveMapper;
import com.example.back.dao.LeaveTypeMapper;
import com.example.back.model.LeaveType;
import com.example.back.service.LeaveTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class LeaveTypeServiceImpl implements LeaveTypeService {
@Autowired
private LeaveTypeMapper leaveTypeMapper;
@Override
public List<LeaveType> getLeaveTypeAll() {
return leaveTypeMapper.getLeaveTypeAll();
}
}
package com.example.back.service.impl;
import com.example.back.dao.RoleMapper;
import com.example.back.model.Role;
import com.example.back.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {
@Autowired
private RoleMapper roleMapper;
@Override
public List<Role> selectRoleAll() {
return roleMapper.selectRoleAll();
}
}
package com.example.back.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.example.back.dao.AttendanceMapper;
import com.example.back.dao.UserMapper;
import com.example.back.model.User;
import com.example.back.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class UserServiceImpl implements UserService {
@Autowired
private UserMapper userMapper;
@Autowired
private AttendanceMapper attendanceMapper;
@Override
public Map<String, Object> login(String linkNum, String password) {
HashMap<String, Object> map = new HashMap<>();
String msg=null;
User login = userMapper.login(linkNum, password);
if (login!=null){
msg="登录成功";
map.put("roleId",login.getRoleId());
map.put("userId",login.getUserId());
}else {
msg="用户名或密码错误";
}
map.put("msg",msg);
System.out.println(login);
return map;
}
@Override
public List<User> findUserAll() {
return userMapper.getUserAll();
}
@Override
public String insertUser(User user) {
String msg=null;
int i = userMapper.insertUser(user);
if (i>0){
attendanceMapper.insert(userMapper.getUserId());
msg="新增成功";
}else {
msg="新增失败";
}
return msg;
}
@Override
public String updateUser(User user) {
String msg=null;
int i = userMapper.updateUser(user);
if (i>0){
msg="修改成功";
}else {
msg="修改失败";
}
return msg;
}
@Override
public String deleteUserById(Integer id) {
String msg=null;
int i = userMapper.deleteUserById(id);
if (i>0){
msg="删除成功";
}else {
msg="删除失败";
}
return msg;
}
@Override
public List<User> queryUserByConditions(String username,String linknum) {
return userMapper.queryUserByConditions(username,linknum);
}
@Override
public JSONObject getUserAllByPage(int currentPage, int size) {
int Page=(currentPage-1)*size;
List<User> users = userMapper.getUserAllByPage(Page, size);
int total = userMapper.selectCount();
JSONObject res=new JSONObject();
res.put("userInfo",users);
res.put("total",total);
return res;
}
@Override
public List<User> getUser() {
return userMapper.getUser();
}
@Override
public User getUserById(Integer userId) {
return userMapper.getUserById(userId);
}
}
package com.example.back.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.example.back.dao.AttendanceMapper;
import com.example.back.dao.LeaveMapper;
import com.example.back.dao.WorkOvertimeMapper;
import com.example.back.model.WorkOverTime;
import com.example.back.service.WorkOvertimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Objects;
@Service
@Transactional
public class WorkOvertimeServiceImpl implements WorkOvertimeService {
@Autowired
private WorkOvertimeMapper workOvertimeMapper;
@Autowired
private AttendanceMapper attendanceMapper;
@Override
public List<WorkOverTime> findWorkOverTimeAll() {
return workOvertimeMapper.getWorkOverTimeAll();
}
@Override
public List overTimes(Integer userId) {
return workOvertimeMapper.overTimes(userId);
}
@Override
public String insertWorkOverTime(WorkOverTime workOverTime) {
String msg=null;
int i = workOvertimeMapper.insertWorkOverTime(workOverTime);
attendanceMapper.updateOvertime(workOverTime.getUserId(),workOverTime.getOverDays());
if (i>0){
msg="新增成功";
}else {
msg="新增失败";
}
return msg;
}
@Override
public String updateWorkOverTime(WorkOverTime workOverTime) {
String msg=null;
int i = workOvertimeMapper.updateWorkOverTime(workOverTime);
if (i>0){
msg="修改成功";
}else {
msg="修改失败";
}
return msg;
}
@Override
public String deleteWorkOverTimeById(Integer id) {
String msg=null;
int i = workOvertimeMapper.deleteWorkOverTimeById(id);
if (i>0){
msg="删除成功";
}else {
msg="删除失败";
}
return msg;
}
@Override
public JSONObject getWorkOverTimeAllByPage(int currentPage, int size) {
int Page=(currentPage-1)*size;
JSONObject res=new JSONObject();
List<WorkOverTime> workOverTimes=workOvertimeMapper.getWorkOverTimeAllByPage(Page,size);
int total=workOvertimeMapper.selectCount();
res.put("workOvertimeInfo",workOverTimes);
res.put("total",total);
return res;
}
@Override
public JSONObject getWorkOverTimeUserAllByPage(Integer userId, int currentPage, int size) {
int Page=(currentPage-1)*size;
JSONObject res=new JSONObject();
List<WorkOverTime> workOverTimeUsers=workOvertimeMapper.getWorkOverTimeUserAllByPage(userId,Page,size);
int total=workOvertimeMapper.selectCount();
res.put("workOvertimeUserInfo",workOverTimeUsers);
res.put("total",total);
return res;
}
@Override
public List<WorkOverTime> queryWorkOvertimeByConditions(String userName, String startTime, String endTime) {
return workOvertimeMapper.queryWorkOvertimeByConditions(userName,startTime,endTime);
}
@Override
public List<WorkOverTime> queryUserWorkOvertimeByConditions(String startTime, String endTime) {
return workOvertimeMapper.queryUserWorkOvertimeByConditions(startTime,endTime);
}
}
package com.example.back.utils;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 解决跨域问题CORS 接受前段参数传参
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer
{
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")//所有接口都支持跨域
.allowedOriginPatterns("*")//所有地址都可访问
.allowCredentials(true)
.allowedMethods("*")//"GET","HEAD","POST","PUT","DELETE","OPTIONS"
.maxAge(3600);//允许跨域时间
}
}
\ No newline at end of file
package com.example.back.utils;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.List;
public class EasyExcelUtil {
/**
* 下载文件
* @param response
* @param exportFileName 文件名
* @param head 实体类
* @param dataList 数据
* @throws IOException
*/
public static void exportDefaultExcel(HttpServletResponse response, String exportFileName, Class head, List<?> dataList) throws IOException {
// 这里注意 使用swagger 会导致各种问题,请直接用浏览器或者用postman
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder.encode(exportFileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
EasyExcel.write(response.getOutputStream(), head)
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()).sheet("Sheet1").doWrite(dataList);
}
}
\ No newline at end of file
package com.example.back.utils;
import com.alibaba.excel.metadata.Head;
import com.alibaba.excel.metadata.data.WriteCellData;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Sheet;
import java.util.List;
public class ExcelWidthStyleStrategy extends AbstractColumnWidthStyleStrategy {
// 统计setColumnWidth被调用多少次
private static int count = 0;
@Override
protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List<WriteCellData<?>> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) {
// 简单设置
Sheet sheet = writeSheetHolder.getSheet();
sheet.setColumnWidth(cell.getColumnIndex(), 5000);
System.out.println(count++);
}
}
\ No newline at end of file
package com.example.back.utils;
import java.util.UUID;
/**
*
* @项目: mail--cc.ccoder.mail.utils
* @TODO: 生成随机字符串的工具类 uuid
*/
public class UuidUtil {
public static String getUUID(){
return UUID.randomUUID().toString().replace("-", "");
}
public static void main(String[] args) {
System.out.println("格式前的UUID : " + UUID.randomUUID().toString());
System.out.println("格式化后的UUID :" + getUUID());
}
}
# mysql
spring:
datasource:
#MySQL配置
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/attendance
username: root
password: root
redis:
host: 127.0.0.1
port: 6379
password:
server:
port: 8091
mybatis:
mapper-locations: classpath:mapper/*.xml
#配置日志 打印sql语句
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#上传文件到vue路径中
file:
uploadFolder: C:\Users\iMac\Desktop\front\src\image\
#上传文件的配置
servlet:
multipart:
enable: true
#指定单个文件大小 默认为1M
max-file-size: 20MB
#设置总上传的数据大小
#max-request-size: 10MB
# 当文件到达多少时进行磁盘写入
#file-size-threshold: 20MB
#设置临时目录
# Linux系统
#location: /home/AllFile/Image
#Windows系统
#location: C://image
<?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.example.back.dao.AdminMapper">
<!--使用insert,update,select,delete标签写sql语句-->
<select id="login" resultType="com.example.back.model.Admin">
select * from admin where username=#{username} and password=#{password}
</select>
</mapper>
<?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.example.back.dao.AttendanceMapper">
<!--使用insert,update,select,delete标签写sql语句-->
<select id="getAttendanceAll" resultType="com.example.back.model.Attendance">
select * from attendance
</select>
<!--分页-->
<select id="getAttendanceAllByPage" resultType="com.example.back.model.Attendance">
select userId,user_name,requiredDays,actualDays,overtimeDays
from record,user where record.userId=user.user_id
order by userId
LIMIT #{Page},#{size};
</select>
<!--查询用户数-->
<select id="selectAttendanceCount" resultType="java.lang.Integer">
select count(*)
from record
</select>
<insert id="insert">
insert into record(userId) values (#{userId})
</insert>
<update id="updateLeave">
update record
set
actualDays=actualDays-#{leaveCounts}
where userId=#{userId}
</update>
<update id="updateOvertime">
update record
set
overtimeDays=overtimeDays+#{overDays}
where userId=#{userId}
</update>
<!-- 根据名字和日期条件查询-->
<select id="queryAttendanceByConditions" resultType="com.example.back.model.Attendance">
select recordId,userId,user_name,requiredDays,actualDays,overtimeDays
from record,user where record.userId=user.user_id
and userId=#{userId}
</select>
<!-- 导出excel-->
<select id="exportAttendance" resultType="com.example.back.model.AttendanceExcel">
select user_name,requiredDays,actualDays,overtimeDays
from record,user where record.userId=user.user_id
</select>
</mapper>
<?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.example.back.dao.LeaveMapper">
<!--使用insert,update,select,delete标签写sql语句-->
<resultMap id="LeaveMap" type="com.example.back.model.Leave">
<id property="leaveId" column="leave_id" />
<result property="leaveTypeId" column="leave_type_id"/>
<result property="leaveTypeName" column="leave_type_name"/>
<result property="leaveTime" column="leave_time"/>
<result property="leaveCounts" column="leave_counts"/>
<result property="leaveThings" column="leave_things"/>
<result property="leaveUrl" column="leave_url"/>
<result property="startTime" column="startTime"/>
<result property="endTime" column="endTime"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
</resultMap>
<select id="getLeaveAllByPage" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id and leave_url!='ceshi'
order by leave_id asc
LIMIT #{Page},#{size};
</select>
<!-- (员工分页查看)-->
<select id="getLeaveAllByPage" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where user_id=#{userId} and leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id
order by leave_id asc
LIMIT #{Page},#{size};
</select>
<!--查询用户数(请假)-->
<select id="selectCount" resultType="java.lang.Integer">
SELECT count(*) from leaves where leave_url!='ceshi'
</select>
<select id="leaveTimes" resultType="java.lang.String">
select concat(concat(startTime,'-'),endTime) as times
from leaves
where not isnull(startTime) and user_id=#{userId}
</select>
<!-- setLeave页面(管理员驳回的信息不显示)-->
<select id="getSetLeaveAllByPage" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id and status != '已驳回' and leave_url!='ceshi'
order by leave_id asc
LIMIT #{Page},#{size};
</select>
<!--查询用户数(批假)-->
<select id="selectSetLeaveCount" resultType="java.lang.Integer">
SELECT count(*) from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id
and leaves.user_id=user.user_id and status != '已驳回' and leave_url!='ceshi'
</select>
<select id="getAttendanceAllByPage" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id and status != '已驳回'
order by leave_id asc
LIMIT #{Page},#{size};
</select>
<!-- 根据条件查询(请假管理)-->
<select id="queryLeaveByConditions" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id
and leave_type.leave_type_id=#{leaveTypeId} and startTime like '${startTime}%' and endTime like '${endTime}%'
</select>
<!-- 根据条件查询(请假管理)(用户)-->
<select id="queryUserLeaveByConditions" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id
and user_id=#{userId} and leave_type.leave_type_id=#{leaveTypeId} and startTime like '${startTime}%' and endTime like '${endTime}%'
</select>
<!-- 根据条件查询(批假管理)-->
<select id="queryLeaveByConditionsSetLeave" resultMap="LeaveMap">
select leave_id,leave_type.leave_type_id,leave_type.leave_type_name, concat(concat(startTime,'-'),endTime) as times,status,leave_counts,leave_things,leave_url,user.user_id,user.user_name,showIf,cancelThings
from leaves,leave_type,user
where leaves.leave_type_id=leave_type.leave_type_id and leaves.user_id=user.user_id and leave_things!=''
and leave_type.leave_type_id=#{leaveTypeId} and startTime like '${startTime}%' and endTime like '${endTime}%' and user.user_id=#{userId} and status=#{status}
</select>
<insert id="insertLeave" parameterType="com.example.back.model.Leave" >
insert into leaves(leave_id,leave_type_id,startTime,endTime,leave_things,leave_url,status,user_id,leave_counts,showIf)
values(#{leaveId},#{leaveTypeId},#{startTime},#{endTime},#{leaveThings},#{leaveUrl},#{status},#{userId},#{leaveCounts},#{showIf})
</insert>
<insert id="insertLeaveUserId">
insert into leaves(user_id) values (#{userId})
</insert>
<update id="updateLeave" parameterType="com.example.back.model.Leave">
update leaves
<set>
<if test="leaveTypeId!=null and leaveTypeId!=''">
leave_type_id=#{leaveTypeId},
</if>
<if test="startTime!=null and startTime!=''">
startTime=#{startTime},
</if>
<if test="endTime!=null and endTime!=''">
endTime=#{endTime},
</if>
<if test="leaveCounts!=null and leaveCounts!=''">
leave_counts=#{leaveCounts},
</if>
<if test="leaveThings!=null and leaveThings!=''">
leave_things=#{leaveThings},
</if>
<if test="leaveUrl!=null and leaveUrl!=''">
leave_url=#{leaveUrl},
</if>
<if test="status!=null and status!=''">
status=#{status},
</if>
<if test="showIf!=null ">
showIf=#{showIf,jdbcType=TINYINT},
</if>
<if test="cancelThings!=null and cancelThings!=''">
cancelThings=#{cancelThings},
</if>
</set>
where leave_id=#{leaveId}
</update>
<delete id="deleteLeaveById">
delete from leaves
where leave_id=#{leaveId}
</delete>
</mapper>
<?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.example.back.dao.LeaveTypeMapper">
<resultMap id="LeaveTypeMap" type="com.example.back.model.LeaveType">
<id property="leaveTypeId" column="leave_type_id"/>
<result property="leaveTypeName" column="leave_type_name"/>
</resultMap>
<!--使用insert,update,select,delete标签写sql语句-->
<select id="getLeaveTypeAll" resultMap="LeaveTypeMap">
select leave_type_id,leave_type_name
from leave_type
</select>
</mapper>
<?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.example.back.dao.RoleMapper">
<resultMap id="RoleMap" type="com.example.back.model.Role">
<id property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/>
</resultMap>
<!--使用insert,update,select,delete标签写sql语句-->
<select id="selectRoleAll" resultMap="RoleMap">
select role_id,role_name
from role
</select>
</mapper>
<?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.example.back.dao.UserMapper">
<!--使用insert,update,select,delete标签写sql语句-->
<resultMap id="UserMap" type="com.example.back.model.User">
<id column="user_id" property="userId"/>
<result property="userName" column="user_name"/>
<result column="link_num" property="linkNum"/>
<result property="password" column="password"/>
<result property="roleId" column="role_id"/>
<result property="roleName" column="role_name"/>
</resultMap>
<!-- 用户管理员登录-->
<select id="login" resultMap="UserMap">
select user_id,user_name,link_num,password,r.role_id
from user u,role r
where u.role_id=r.role_id and
link_num=#{linkNum} and password=#{password}
</select>
<select id="getUserId" resultType="java.lang.Integer" >
SELECT max(user_id)
FROM `user`
order by user_id
</select>
<!-- 查询userId ,userName-->
<select id="getUser" resultMap="UserMap">
select user_id,user_name
from user u
</select>
<select id="getUserAll" resultMap="UserMap">
select user_id,user_name,link_num,password,r.role_id,r.role_name
from user u,role r
where u.role_id=r.role_id
</select>
<select id="getUserById" resultMap="UserMap">
select password
from user
where user_id=#{userId}
</select>
<!--分页-->
<select id="getUserAllByPage" resultMap="UserMap">
select user_id,user_name,link_num,password,r.role_id,r.role_name
from user u,role r
where u.role_id=r.role_id
order by user_id ASC
LIMIT #{Page},#{size};
</select>
<!--查询用户数-->
<select id="selectCount" resultType="java.lang.Integer">
SELECT count(*) from user
</select>
<!-- 根据条件查询-->
<select id="queryUserByConditions" resultMap="UserMap">
select user_id,user_name,link_num,password,r.role_id,r.role_name
from user u,role r
where u.role_id=r.role_id and user_name=#{username} and link_num=#{linknum}
</select>
<insert id="insertUser" parameterType="com.example.back.model.User">
insert into user(user_id,user_name,link_num,password,role_id)
values(#{userId},#{userName},#{linkNum},#{password},#{roleId})
</insert>
<update id="updateUser" parameterType="com.example.back.model.User">
update user
<set>
<if test="userName!=null and userName!=''">
user_name=#{userName},
</if>
<if test="linkNum!=null and linkNum!=''">
link_num=#{linkNum},
</if>
<if test="password!=null and password!=''">
password=#{password},
</if>
<if test="roleId!=null and roleId!=''">
role_id=#{roleId},
</if>
</set>
where user_id=#{userId}
</update>
<delete id="deleteUserById">
delete from user
where user_id=#{userId}
</delete>
</mapper>
<?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.example.back.dao.WorkOvertimeMapper">
<!--使用insert,update,select,delete标签写sql语句-->
<resultMap id="WorkOverTimeMap" type="com.example.back.model.WorkOverTime">
<id property="workOvertimeId" column="work_overtime_id" />
<result property="startTime" column="startTime"/>
<result property="endTime" column="endTime"/>
<result property="workOvertimeTime" column="work_overtime_time"/>
<result property="workOvertimeThings" column="work_overtime_things"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
</resultMap>
<select id="getWorkOverTimeAllByPage" resultMap="WorkOverTimeMap">
select work_overtime_id,user.user_id,user_name,work_overtime_id,concat(concat(startTime,'-'),endTime) as work_overtime_time,startTime,endTime,work_overtime_things
from work_overtime,user
where work_overtime.user_id=user.user_id and work_overtime_things!=''
order by work_overtime_id ASC
LIMIT #{Page},#{size};
</select>
<select id="overTimes" resultType="java.lang.String">
select concat(concat(startTime,'-'),endTime) as work_overtime_time
from work_overtime
where user_id=#{userId}
order by work_overtime_id ASC
</select>
<!-- 员工查看加班-->
<select id="getWorkOverTimeUserAllByPage" resultMap="WorkOverTimeMap">
select work_overtime_id,user.user_id,user_name,work_overtime_id,concat(concat(startTime,'-'),endTime) as work_overtime_time,startTime,endTime,work_overtime_things
from work_overtime,user
where work_overtime.user_id=user.user_id and work_overtime_things!='' and work_overtime.user_id=#{userId}
order by work_overtime_id ASC
LIMIT #{Page},#{size};
</select>
<!--查询加班数-->
<select id="selectCount" resultType="java.lang.Integer">
SELECT count(*) from work_overtime where work_overtime_things!=''
</select>
<!-- 根据条件查询-->
<select id="queryWorkOvertimeByConditions" resultMap="WorkOverTimeMap">
select user.user_id,user_name,work_overtime_id,concat(concat(startTime,'-'),endTime) as work_overtime_time,startTime,endTime,work_overtime_things
from work_overtime,user
where work_overtime.user_id=user.user_id
and user.user_name=#{userName} and startTime like '${startTime}%' and endTime like '${endTime}%'
</select>
<!-- 根据条件查询(员工)-->
<select id="queryUserWorkOvertimeByConditions" resultMap="WorkOverTimeMap">
select user.user_id,user_name,work_overtime_id,concat(concat(startTime,'-'),endTime) as work_overtime_time,startTime,endTime,work_overtime_things
from work_overtime,user
where work_overtime.user_id=user.user_id
and startTime like '${startTime}%' and endTime like '${endTime}%'
</select>
<insert id="insertWorkOverTime" parameterType="com.example.back.model.WorkOverTime" >
insert into work_overtime(user_id,work_overtime_id,work_overtime_time,work_overtime_things,startTime,endTime,overDays)
values(#{userId},#{workOvertimeId},#{workOvertimeTime},#{workOvertimeThings},#{startTime},#{endTime},#{overDays})
</insert>
<insert id="insertOvertimeUserId">
insert into work_overtime(user_id) values (#{userId})
</insert>
<update id="updateWorkOverTime" parameterType="com.example.back.model.WorkOverTime">
update work_overtime
<set>
<if test="workOvertimeTime!=null and workOvertimeTime!=''">
work_overtime_time=#{workOvertimeTime},
</if>
<if test="workOvertimeThings!=null and workOvertimeThings!=''">
work_overtime_things=#{workOvertimeThings},
</if>
</set>
where work_overtime_id=#{workOvertimeId}
</update>
<delete id="deleteWorkOverTimeById">
delete from work_overtime
where work_overtime_id=#{workOvertimeId}
</delete>
</mapper>
//package com.example.back;
//
//import com.example.back.dao.AdminMapper;
//import com.example.back.model.Admin;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//import java.util.List;
//
//@SpringBootTest
//class BackApplicationTests {
//
// @Autowired
// private AdminMapper adminMapper;
// @Test
// void contextLoads() {
// }
//
//}
package com.example.back;
import com.example.back.dao.AttendanceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class Test {
@Autowired
private AttendanceMapper attendanceMapper;
@org.junit.jupiter.api.Test
public void test(){
attendanceMapper.insertAttendanceLeave(66);
}
}
//package com.example.back;
//
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.example.back.dao.AdminMapper;
//import com.example.back.model.Admin;
//import org.junit.jupiter.api.Test;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.boot.test.context.SpringBootTest;
//
//import java.util.List;
//
//@SpringBootTest
//public class TestMapper {
//
// @Autowired
// private AdminMapper adminMapper;
//
//}
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
# front
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}
\ No newline at end of file
This diff is collapsed.
{
"name": "front",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build"
},
"dependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"axios": "^0.27.2",
"core-js": "^3.6.5",
"element-ui": "^2.15.8",
"moment": "^2.29.3",
"store": "^2.0.12",
"url-loader": "^4.1.1",
"validate.js": "^0.13.1",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"vuex-persistedstate": "^4.1.0",
"webpack": "^5.73.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.15",
"@vue/cli-plugin-router": "~4.5.15",
"@vue/cli-plugin-vuex": "~4.5.15",
"@vue/cli-service": "~4.5.15",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>
<%= htmlWebpackPlugin.options.title %>
</title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<style>
body {
padding: 0%;
margin: 0%;
}
</style>
</html>
\ No newline at end of file
<template>
<div id="app">
<router-view />
</div>
</template>
<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
height: 100vh;
width: 100vw;
padding: 0%;
margin: 0%;
}
#nav {
padding: 30px;
}
#nav a {
font-weight: bold;
color: #2c3e50;
}
#nav a.router-link-exact-active {
color: #42b983;
}
</style>
<template>
<div class="hello">
<h1>{{ msg }}</h1>
<p>
For a guide and recipes on how to configure / customize this project,<br>
check out the
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
</p>
<h3>Installed CLI Plugins</h3>
<ul>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-router" target="_blank" rel="noopener">router</a></li>
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-vuex" target="_blank" rel="noopener">vuex</a></li>
</ul>
<h3>Essential Links</h3>
<ul>
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
</ul>
<h3>Ecosystem</h3>
<ul>
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
</ul>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h3 {
margin: 40px 0 0;
}
ul {
list-style-type: none;
padding: 0;
}
li {
display: inline-block;
margin: 0 10px;
}
a {
color: #42b983;
}
</style>
/*
Navicat Premium Data Transfer
Source Server : root
Source Server Type : MySQL
Source Server Version : 80026
Source Host : localhost:3306
Source Schema : attendance
Target Server Type : MySQL
Target Server Version : 80026
File Encoding : 65001
Date: 08/06/2022 17:30:19
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for attendance
-- ----------------------------
DROP TABLE IF EXISTS `attendance`;
CREATE TABLE `attendance` (
`id` int NOT NULL AUTO_INCREMENT,
`userName` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`requiredDays` int NULL DEFAULT 22,
`actualDays` int NULL DEFAULT NULL,
`overtimeDays` int NULL DEFAULT NULL,
`work_overtime_id` int NULL DEFAULT NULL,
`user_id` int NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `userName`(`userName`) USING BTREE,
INDEX `work_overtime_id`(`work_overtime_id`) USING BTREE,
INDEX `attendance_ibfk_4`(`user_id`) USING BTREE,
CONSTRAINT `attendance_ibfk_1` FOREIGN KEY (`userName`) REFERENCES `user` (`user_name`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `attendance_ibfk_2` FOREIGN KEY (`work_overtime_id`) REFERENCES `work_overtime` (`work_overtime_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `attendance_ibfk_4` FOREIGN KEY (`user_id`) REFERENCES `work_overtime` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of attendance
-- ----------------------------
INSERT INTO `attendance` VALUES (1, '李', 22, 23, 1, 1, 2);
INSERT INTO `attendance` VALUES (3, '王菲 ', 22, 26, 4, 21, 11);
INSERT INTO `attendance` VALUES (4, '王', 22, 26, 4, 30, 34);
INSERT INTO `attendance` VALUES (5, 'mm', 22, 26, 4, 32, 31);
INSERT INTO `attendance` VALUES (7, NULL, 22, NULL, NULL, 34, 10);
INSERT INTO `attendance` VALUES (28, NULL, 22, NULL, NULL, NULL, 25);
SET FOREIGN_KEY_CHECKS = 1;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment