Commit 960449c5 by 涂亚平

start...

1 parent 029cd9e4
Showing with 4187 additions and 0 deletions
package com.subsidy;
import com.alibaba.druid.support.http.StatViewServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;
@RestController
@SpringBootApplication
@MapperScan(basePackages = {"com.meishu.mapper"})
@EnableScheduling
@EnableAsync
public class MeishuApplication {
public static void main(String[] args) {
SpringApplication.run(MeishuApplication.class, args);
}
@Bean
public ServletRegistrationBean druidStatViewServlet() {
//先配置管理后台的servLet,访问的入口为/druid/
ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(
new StatViewServlet(), "/druid/*");
// IP白名单 (没有配置或者为空,则允许所有访问)
servletRegistrationBean.addInitParameter("allow", "127.0.0.1");
// IP黑名单 (存在共同时,deny优先于allow)
servletRegistrationBean.addInitParameter("deny", "");
servletRegistrationBean.addInitParameter("loginUsername", "admin");
servletRegistrationBean.addInitParameter("loginPassword", "yhkl1234");
servletRegistrationBean.addInitParameter("resetEnable", "false");
return servletRegistrationBean;
}
}
package com.subsidy.common;
public enum Code {
USERNAMENOTFOUND(10001, "用户不存在"),
BADCREDENTIALS(10002,"账户或者密码错误"),
ACCOUNTEXPIRED(10003,"账户过期"),
LOCKEDEXCEPTION(10004, "账户已锁定"),
DISABLEDEXCEPTION(10005,"账户已禁用"),
ACCESSDENIED(10006,"无权限访问"),
AUTHENTICATION(10007,"身份验证异常"),
NOHANDLERFOUND(10008,"找不到相应的视图处理器"),
PARAM_INVALID(10009, "参数不合法"),
TOKEN_EXCEPTION(10010, "Token不合法"),
TOKEN_EXPIRED(10011, "Token已过期"),
OSS_ERROR(10012, "OSS文件上传异常"),
Network_ERROR(90000, "网络请求失败"),
SERVER_INTERNAL_ERROR(99999, "服务器内部错误"),
;
private Integer code;
private String message;
Code(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
package com.subsidy.common;
import com.subsidy.common.configure.RemoteProperties;
import lombok.Data;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
/**
* 返回数据
*
* @author DengMin
* @date 2019/08/27 13:57
**/
@Data
@EnableConfigurationProperties(RemoteProperties.class)
public class ResponseData {
public static <T> ResponseVO<T> generateCreatedResponse(int code) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(RemoteProperties.getMessage(code))
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, T data) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.data(data)
.build();
}
public static <T> ResponseVO<T> generateCreatedResponse(int code, String message, String path) {
return (ResponseVO<T>) ResponseVO.builder()
.code(code)
.message(message)
.path(path)
.build();
}
}
\ No newline at end of file
package com.subsidy.common;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ResponseVO<T> {
private Integer code;
private String message;
private T data;
private String path;
}
\ No newline at end of file
package com.subsidy.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "sms")
public class AliyunSmsProperties {
private String product;
private String domain;
private String accessKeyId;
private String accessKeySecret;
}
package com.subsidy.common.configure;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.subsidy.common.handler.MetaHandler;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author: tuyp
* @create: 2020-08-12 12:01
*/
@Configuration
@ConditionalOnClass(value = {PaginationInterceptor.class})
public class MybatisPlusConfig {
/**
* 分页
* @return
*/
@Bean
public PaginationInterceptor paginationInterceptor(){
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
paginationInterceptor.setDialectType(DbType.MYSQL.getDb());
return paginationInterceptor;
}
//
// /**
// * 打印 sql
// */
// @Bean
// public PerformanceInterceptor performanceInterceptor() {
// PerformanceInterceptor performanceInterceptor = new PerformanceInterceptor();
// //格式化sql语句
// Properties properties = new Properties();
// properties.setProperty("format", "false");
// performanceInterceptor.setProperties(properties);
// return performanceInterceptor;
// }
/**
* 自动填充功能
* @return
*/
@Bean
public GlobalConfig globalConfig() {
GlobalConfig globalConfig = new GlobalConfig();
globalConfig.setMetaObjectHandler(new MetaHandler());
return globalConfig;
}
}
package com.subsidy.common.configure;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 读取状态码
* </p>
*
* @author DengMin
* @date Created in 2020/08/24
*/
@Component
@ConfigurationProperties(prefix = "meishu")
@PropertySource(value = "classpath:code.properties", encoding = "UTF-8")
public class RemoteProperties {
private static Map<Integer, String> codeMessage = new HashMap<>();
public static String getMessage(Integer code) {
return codeMessage.get(code);
}
public Map<Integer, String> getCodeMessage() {
return codeMessage;
}
public void setCodeMessage(Map<Integer, String> codeMessage) {
RemoteProperties.codeMessage = codeMessage;
}
}
\ No newline at end of file
package com.subsidy.common.configure;
import org.springframework.context.annotation.Bean;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.util.ArrayList;
import java.util.List;
@Component
public class RestTemplateConfig {
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new WxMappingJackson2HttpMessageConverter());
return restTemplate;
}
public class WxMappingJackson2HttpMessageConverter extends MappingJackson2HttpMessageConverter {
public WxMappingJackson2HttpMessageConverter(){
List<MediaType> mediaTypes = new ArrayList<>();
mediaTypes.add(MediaType.TEXT_PLAIN);
mediaTypes.add(MediaType.TEXT_HTML);
setSupportedMediaTypes(mediaTypes);
}
}
}
package com.subsidy.common.configure;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.pathMapping("/")
.select()
.apis(RequestHandlerSelectors.basePackage("com.meishu"))
.paths(PathSelectors.any())
.build().apiInfo(new ApiInfoBuilder()
.title("市西cms")
.description("接口文档规范")
.version("1.0")
// .contact(new Contact("啊啊啊啊","www.youkehulian.com","tcp@meishu.com"))
// .license("The Apache License")
// .licenseUrl("http://www.baidu.com")
.build());
}
}
package com.subsidy.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author: tuyp
* @create: 2020-06-01 16:46
*/
@Component
@Data
@ConfigurationProperties(prefix = "vod")
public class VODConfig {
private String appId;
private String secretId;
private String secretKey;
private String api;
private String region;
}
package com.subsidy.common.configure;
import com.subsidy.common.interceptor.AuthenticationInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* @author DengMin
* @date 2020/07/06
**/
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Autowired
private AuthenticationInterceptor authenticationInterceptor;
/**
* 跨域支持
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
// .allowCredentials(true)
.allowedOrigins("*")
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
.maxAge(3600);
}
/**
* Swagger
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
/**
* 鉴权
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(authenticationInterceptor)
.excludePathPatterns("/static/*")
.addPathPatterns("/**");
}
}
\ No newline at end of file
package com.subsidy.common.configure;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
@Aspect
@Component
public class WebLogAspect {
private final Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
@Pointcut("execution(public * com.subsidy.controller.*.*(..))")//切入点描述 这个是controller包的切入点
public void controllerLog(){}//签名,可以理解成这个切入点的一个名称
@Pointcut("execution(public * com.subsidy.controller.*.*(..))")
public void serviceImplLog(){}
@Before("controllerLog()") //在切入点的方法run之前要干的
public void logBeforeController(JoinPoint joinPoint) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
//这个RequestContextHolder是Springmvc提供来获得请求的东西
HttpServletRequest request = ((ServletRequestAttributes)requestAttributes).getRequest();
// 记录下请求内容
logger.info("####requestUrl : " + request.getRequestURL().toString());
logger.info("####requestParam : " + Arrays.toString(joinPoint.getArgs()));
}
// @Around("serviceImplLog()")
// public Object afterController(ProceedingJoinPoint proceedingJoinPoint) {
//
// Object result = null;
//
// try{
// result = proceedingJoinPoint.proceed();
// logger.info("====reulst"+result);
// }catch (Throwable e){
// MyException myException =(MyException)e;
// throw myException;
// }
// return result;
// }
}
\ No newline at end of file
package com.subsidy.common.configure;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration
@ConfigurationProperties(prefix = "wechat")
public class WechatConfig {
private String appId;
private String appSecret;
private String msgUrl;
private String templateId;
private String agentId;
}
package com.subsidy.common.constant;
public class AttendanceConstant {
/**
* 创建预约api
*/
public static final String CREATE_TOPIC_URL = "https://open.api.roomis.com.cn/api/my/booking/spaces/{spaceId}/events";
/**
* 考勤api
*/
public static final String GET_ATTENDANCE_URL = "https://open.api.roomis.com.cn/api/attendance/{id}";
/**
* 创建人ID
*/
public static Long organizerId = 200000222L;
/**
* 开始时间
*/
public static String startTime = "07:00:00";
/**
* 结束时间
*/
public static String endTime = "21:00:00";
}
package com.subsidy.common.constant;
import lombok.Getter;
@Getter
public enum Code {
USERNAMENOTFOUND(1001, "用户不存在"),
BADCREDENTIALS(1002,"账户或者密码错误"),
ACCOUNTEXPIRED(1003,"账户过期"),
LOCKEDEXCEPTION(1004, "账户已锁定"),
DISABLEDEXCEPTION(1005,"账户已禁用"),
ACCESSDENIED(1006,"无权限访问"),
AUTHENTICATION(1007,"身份验证异常"),
NOHANDLERFOUND(1008,"找不到相应的视图处理器"),
PARAM_INVALID(1009, "参数不合法"),
TOKEN_EXCEPTION(1010, "无效的令牌"),
TOKEN_EXPIRED(1011, "令牌已过期"),
TOKEN_VERIFICATION_FAILED(1013, "令牌验证失败"),
OSS_ERROR(1012, "OSS文件上传异常"),
Network_ERROR(9000, "网络请求失败"),
SERVER_INTERNAL_ERROR(99999, "服务器内部错误"),
;
private Integer code;
private String message;
Code(Integer code, String message) {
this.code = code;
this.message = message;
}
}
package com.subsidy.common.constant;
public class WxConstant {
/**
* app id
*/
public static final String APPID = "wx75ec06e9ce50ef73";
/**
* 秘钥
*/
public static final String SECRENT = "c039d32804278503474dfcf7cb3944b9";
/**
* 获取访问用户身份
*/
public static final String GETUSERINFO = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token={access_token}&code={code}";
/**
* 读取成员
*/
public static final String GET = "https://qyapi.weixin.qq.com/cgi-bin/user/get?access_token={access_token}&userid={userid}";
/**
* 获取access_token
*/
public static final String GET_SUITE_TOKEN = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={appid}&secret={secret}";
/**
* 扫码登陆回调地址
*/
public static final String QR_REDIRECT_URL = "http://massadmin.youkehulian.com";
}
package com.subsidy.common.exception;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.configure.RemoteProperties;
import com.subsidy.common.constant.Code;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.validation.BindException;
import org.springframework.web.HttpRequestMethodNotSupportedException;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.NoHandlerFoundException;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
/**
* 异常处理
* @author DengMin
* @date 2020/07/14
**/
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
/**
* 自定义异常
* @param e
* @return
*/
@ExceptionHandler(value = HttpException.class)
public ResponseVO<T> handlerException(HttpServletRequest request, HttpException e) {
String message = RemoteProperties.getMessage(e.getCode());
if(StringUtils.isBlank(message)) {
message = e.getMessage();
}
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(e.getCode(), message, url);
}
/**
* 404
* @param request
* @return
*/
@ExceptionHandler(value = NoHandlerFoundException.class)
public ResponseVO<T> NoHandlerFoundException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 请求方式错误
* @param request
* @return
*/
@ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
public ResponseVO<T> HttpRequestMethodNotSupportedException(HttpServletRequest request) {
String url = request.getRequestURI();
return ResponseData.generateCreatedResponse(Code.NOHANDLERFOUND.getCode(), Code.NOHANDLERFOUND.getMessage(), url);
}
/**
* 参数不合法
* @param e
* @return
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseVO<T> validateException(MethodArgumentNotValidException e){
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* JSON 序列化异常
* @param e
* @return
*/
@ExceptionHandler(HttpMessageNotReadableException.class)
public ResponseVO<T> exceptionHandler(HttpMessageNotReadableException e) {
log.error(e.getMessage());
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage()+":{"+e.getMessage()+"}");
}
/**
* 校验异常
* @param e
* @return
*/
@ExceptionHandler(BindException.class)
public ResponseVO<T> BindException(BindException e){
final List<String> errList = new ArrayList<>();
e.getBindingResult().getAllErrors().stream().forEach(x -> {
errList.add(x.getDefaultMessage());
});
return ResponseData.generateCreatedResponse(Code.PARAM_INVALID.getCode(), Code.PARAM_INVALID.getMessage(), errList.toString());
}
/**
* 服务器内部错误
* @return
*/
@ExceptionHandler(value = Exception.class)
public ResponseVO<T> serverInternalError(Exception e, HttpServletRequest request) {
String url = request.getRequestURI();
log.error("path:"+url);
log.error("---- error message: ---"+e.toString());
return ResponseData.generateCreatedResponse(Code.SERVER_INTERNAL_ERROR.getCode(), Code.SERVER_INTERNAL_ERROR.getMessage(), url);
}
}
\ No newline at end of file
package com.subsidy.common.exception;
import com.subsidy.common.configure.RemoteProperties;
/**
* 异常处理
* @author DengMin
* @date 2020/08/12
**/
public class HttpException extends RuntimeException{
private Integer code;
private String message;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
@Override
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public HttpException(Integer code) {
super(RemoteProperties.getMessage(code));
String message = RemoteProperties.getMessage(code);
this.message = message;
this.code = code;
}
public HttpException(Integer code, String message) {
this.message = message;
this.code = code;
}
}
package com.subsidy.common.handler;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
/**
* 填充配置
* @author DengMin
* @date 2020/07/21
**/
@Component
public class MetaHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.setFieldValByName("createDate", LocalDateTime.now(), metaObject);
}
@Override
public void updateFill(MetaObject metaObject) {
this.setFieldValByName("updateDate", LocalDateTime.now(), metaObject);
}
}
package com.subsidy.common.interceptor;
import com.auth0.jwt.interfaces.Claim;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.subsidy.common.exception.HttpException;
import com.subsidy.util.JwtUtil;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import java.util.Map;
/**
* <p>
* 鉴权拦截器
* </p>
*
* @author DengMin
* @since 2021/4/14
*/
@Component
public class AuthenticationInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
// 不需要进行拦截
if (!(handler instanceof HandlerMethod)) {
return true;
}
HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod();
LoginRequired methodAnnotation = method.getAnnotation(LoginRequired.class);
if (methodAnnotation != null) {
String authorization = request.getHeader("Authorization");
if (!StringUtils.isBlank(authorization)) {
String token = authorization;
if (authorization.startsWith("Bearer")) {
token = authorization.replace("Bearer ", "");
}
/*Token不存在*/
if (token == null || JwtUtil.isExpired(token) || !JwtUtil.verifyToken(token)) {
throw new HttpException(1010);
}
Map<String, Claim> claimMap = JwtUtil.getClaims(token);
if (claimMap != null) {
String[] role = methodAnnotation.value();
String type = claimMap.get("type").asString();
if (role.length > 0) {
if ("administer".equals(type)) {
//AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong());
//if (administerDO != null) {
// Localstorage.setUser(administerDO);
// return true;
//}
} else {
throw new HttpException(1010);
}
} else {
//AdministerDO administerDO = administerMapper.selectById(claimMap.get("id").asLong());
//if (administerDO != null) {
// Localstorage.setUser(administerDO);
// return true;
//}
}
}
// return true;
}
throw new HttpException(1010);
}
return true;
}
}
package com.subsidy.common.interceptor;
import java.lang.annotation.*;
/**
* <p>
* 自定义验证登陆注解
* </p>
*
* @author DengMin
* @since 2020/12/18
*/
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
public @interface LoginRequired {
String[] value();
}
\ No newline at end of file
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.service.AdministerService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 管理平台用户 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "管理平台用户")
@RequestMapping("/administer")
public class AdministerController {
@Autowired
private AdministerService administerService;
@PostMapping("/login")
@ApiOperation("登录接口 telephone password")
public ResponseVO login(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.login(administerDO));
}
@PostMapping("/getPermissions")
@ApiOperation("权限查询")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getPermissions() {
return ResponseData.generateCreatedResponse(0, administerService.getPermissions());
}
@PostMapping("/administers")
@ApiOperation("运营者/企业查询 {pageNum pageSize accountType 0:运营者管理 1:企业管理}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO operators(@RequestBody OperatorsDTO operatorsDTO){
return ResponseData.generateCreatedResponse(0,administerService.operators(operatorsDTO));
}
@PostMapping("addAdminister")
@ApiOperation("添加运营者/企业 {telephone:账号 userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域 accountType:账号类型}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addOperator(@RequestBody AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.addOperator(administerDO));
}
@PostMapping("deleteAdminister")
@ApiOperation("删除运营者/企业 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteAdminister(AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.deleteAdminister(administerDO));
}
@PostMapping("updateAdminister")
@ApiOperation("修改运营者,企业 id userName:成员名称/企业名称 shortName 简称 banner:标语 field:领域")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateAdminister(AdministerDO administerDO){
return ResponseData.generateCreatedResponse(0,administerService.updateAdminister(administerDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.subsidy.service.CategoryService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 类目名称 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "类目")
@RequestMapping("/category")
public class CategoryController {
@Autowired
private CategoryService categoryService;
@PostMapping("getCategories")
@ApiOperation("查询类目 name 类目名称 pageSize pageNum")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getCategories(@RequestBody GetCategoriesDTO getCategoriesDTO){
return ResponseData.generateCreatedResponse(0,categoryService.getCategories(getCategoriesDTO));
}
@PostMapping("getAll")
@ApiOperation("查询所有类目")
public ResponseVO getAll(){
return ResponseData.generateCreatedResponse(0,categoryService.getAll());
}
@PostMapping("addCategory")
@ApiOperation("新增类目 name")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.addCategory(categoryDO));
}
@PostMapping("deleteCategory")
@ApiOperation("删除类目 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.deleteCategory(categoryDO));
}
@PostMapping("updateCategory")
@ApiOperation("修改类目 id name")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCategory(@RequestBody CategoryDO categoryDO){
return ResponseData.generateCreatedResponse(0,categoryService.updateCategory(categoryDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.ClassDictDO;
import com.subsidy.service.ClassDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 班级id 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@RestController
@Api(tags = "班级")
@RequestMapping("/classDict")
public class ClassDictController {
@Autowired
private ClassDictService classDictService;
@PostMapping("getAllClasses")
@ApiOperation("获取某企业下的所有课程 companyId")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.getAllClasses(classDictDO));
}
@PostMapping("deleteClasses")
@ApiOperation("删除课程 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteClasses(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.deleteClasses(classDictDO));
}
@PostMapping("addClass")
@ApiOperation("添加课程 companyId courseId className startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addClass(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.addClass(classDictDO));
}
@PostMapping("updateClass")
@ApiOperation("添加课程 id companyId courseId className startDate endDate")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateClass(@RequestBody ClassDictDO classDictDO){
return ResponseData.generateCreatedResponse(0,classDictService.updateClass(classDictDO));
}
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 班级成员映射表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@RestController
@Api(tags = "班级成员映射表")
@RequestMapping("/class-member-mapping-do")
public class ClassMemberMappingController {
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.CourseContentDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.CourseContentService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 课程目录表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "课程目录表")
@RequestMapping("/courseContent")
public class CourseContentController {
@Autowired
private CourseContentService courseContentService;
@PostMapping("getContents")
@ApiOperation("获取课程目录 {courseId}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContents(@RequestBody CourseContentDO courseContentDO){
return ResponseData.generateCreatedResponse(0,courseContentService.getContents(courseContentDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.service.CourseDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "课程表")
@RequestMapping("/courseDict")
public class CourseDictController {
@Autowired
private CourseDictService courseDictService;
@PostMapping("addCourse")
@ApiOperation("添加课程 courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.addCourse(courseDictDO));
}
@PostMapping("deleteCourse")
@ApiOperation("删除课程 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteCourse(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.deleteCourse(courseDictDO));
}
@PostMapping("queryCourses")
@ApiOperation("查询课程 courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO queryCourses(@RequestBody QueryCoursesDTO queryCoursesDTO){
return ResponseData.generateCreatedResponse(0,courseDictService.queryCourses(queryCoursesDTO));
}
@PostMapping("updateCourses")
@ApiOperation("编辑课程 id courseName categoryId courseType courseSource")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateCourses(@RequestBody CourseDictDO courseDictDO){
return ResponseData.generateCreatedResponse(0,courseDictService.updateCourses(courseDictDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.service.DepartmentDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 部门字典表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "部门字典表")
@RequestMapping("/departmentDict")
public class DepartmentDictController {
@Autowired
private DepartmentDictService departmentDictService;
@PostMapping("getDepartments")
@ApiOperation("获取所有部门 companyId 企业id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getDepartments(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.getDepartments(departmentDictDO));
}
@PostMapping("addDepartment")
@ApiOperation("添加部门 companyId departmentName leaderName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.addDepartment(departmentDictDO));
}
@PostMapping("deleteDepartment")
@ApiOperation("删除部门 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.deleteDepartment(departmentDictDO));
}
@PostMapping("updateDepartment")
@ApiOperation("编辑部门 id companyId departmentName leaderName")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateDepartment(@RequestBody DepartmentDictDO departmentDictDO){
return ResponseData.generateCreatedResponse(0,departmentDictService.updateDepartment(departmentDictDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.model.ExerciseDictDO;
import com.subsidy.service.ExerciseDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 习题库 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@RestController
@Api(tags = "习题库")
@RequestMapping("/exerciseDict")
public class ExerciseDictController {
@Autowired
private ExerciseDictService exerciseDictService;
@PostMapping("getAllExercises")
@ApiOperation("查询所有题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 pageSize pageNum}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAllExercises(@RequestBody GetAllExercisesDTO getAllExercisesDTO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.getAllExercises(getAllExercisesDTO));
}
@PostMapping("addExercise")
@ApiOperation("添加题目 {courseId 课程id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案 }")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addExercise(@RequestBody ExerciseDictDO exerciseDictDO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.addExercise(exerciseDictDO));
}
@PostMapping("deleteExercise")
@ApiOperation("删除题目 id")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteExercise(@RequestBody ExerciseDictDO exerciseDictDO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.deleteExercise(exerciseDictDO));
}
@PostMapping("updateExercise")
@ApiOperation("修改题目 id exerciseType 题目类型 difficulty 难度 title题目 items 选项 rightAnswer 正确答案")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateExercise(@RequestBody ExerciseDictDO exerciseDictDO){
return ResponseData.generateCreatedResponse(0,exerciseDictService.updateExercise(exerciseDictDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.FileDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.FileDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 课件表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "课件表")
@RequestMapping("/fileDict")
public class FileDictController {
@Autowired
private FileDictService fileDictService;
@PostMapping("getContendFiles")
@ApiOperation("获取目录下的视频 {contentId vodName}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContendFiles(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.getContendFiles(fileDictDO));
}
@PostMapping("deleteFile")
@ApiOperation("删除视频 id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteFile(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.deleteFile(fileDictDO));
}
@PostMapping("addFile")
@ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addFile(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.addFile(fileDictDO));
}
@PostMapping("updateFile")
@ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateFile(@RequestBody FileDictDO fileDictDO){
return ResponseData.generateCreatedResponse(0,fileDictService.updateFile(fileDictDO));
}
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.model.MemberDO;
import com.subsidy.service.MemberService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 学生表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "学生表")
@RequestMapping("/member")
public class MemberController {
@Autowired
private MemberService memberService;
@PostMapping("getAll")
@ApiOperation("查询某部门成员 pageNum pageSize userName status")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getAll(@RequestBody GetAllDTO getAllDTO){
return ResponseData.generateCreatedResponse(0,memberService.getAll(getAllDTO));
}
@PostMapping("deleteMember")
@ApiOperation("删除成员 id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteMember(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.deleteMember(memberDO));
}
@PostMapping("addMember")
@ApiOperation("新增成员 departmentId userName accountName telephone gender image idCard")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addMember(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.addMember(memberDO));
}
@PostMapping("updateMember")
@ApiOperation("编辑成员 {id departmentId userName accountName telephone gender image idCard}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateMember(@RequestBody MemberDO memberDO){
return ResponseData.generateCreatedResponse(0,memberService.updateMember(memberDO));
}
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 权限表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "权限表")
@RequestMapping("/permissions-dict-do")
public class PermissionsDictController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "")
@RequestMapping("/role-administer-mapping-do")
public class RoleAdministerMappingController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 角色表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "角色表")
@RequestMapping("/role-dict-do")
public class RoleDictController {
}
package com.subsidy.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
/**
* <p>
* 系统用户角色表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "系统用户角色表")
@RequestMapping("/role-permission-mapping-do")
public class RolePermissionMappingController {
}
package com.subsidy.controller;
import com.subsidy.common.ResponseData;
import com.subsidy.common.ResponseVO;
import com.subsidy.common.interceptor.LoginRequired;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.VodDictService;
import com.subsidy.util.ConstantUtils;
import io.swagger.annotations.ApiOperation;
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;
import io.swagger.annotations.Api;
/**
* <p>
* 视频表 前端控制器
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@RestController
@Api(tags = "视频表")
@RequestMapping("/vodDict")
public class VodDictController {
@Autowired
private VodDictService vodDictService;
@PostMapping("/signature")
@ApiOperation("获取签名")
public ResponseVO signature()throws Exception{
return ResponseData.generateCreatedResponse(0,vodDictService.signature());
}
@PostMapping("getContendVods")
@ApiOperation("获取目录下的视频 {contentId vodName}")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO getContendVods(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.getContendVods(vodDictDO));
}
@PostMapping("deleteVod")
@ApiOperation("删除视频 id ")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO deleteVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.deleteVod(vodDictDO));
}
@PostMapping("addVod")
@ApiOperation("新增视频 contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO addVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.addVod(vodDictDO));
}
@PostMapping("updateVod")
@ApiOperation("新增视频 id contentId vodName vodLength vodType vodSize vodUrl vodCode")
@LoginRequired(value = {ConstantUtils.ADMINISTER_TERMINATE})
public ResponseVO updateVod(@RequestBody VodDictDO vodDictDO){
return ResponseData.generateCreatedResponse(0,vodDictService.updateVod(vodDictDO));
}
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 管理平台用户 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface AdministerMapper extends BaseMapper<AdministerDO> {
List<PermissionsVO> getPermissions(Long id);
IPage<OperatorsVO> operators(IPage page,String accountType);
}
package com.subsidy.mapper;
import com.subsidy.model.CategoryDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 类目名称 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface CategoryMapper extends BaseMapper<CategoryDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.ClassDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.classdict.GetAllClassesVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 班级id Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Repository
public interface ClassDictMapper extends BaseMapper<ClassDictDO> {
List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO);
}
package com.subsidy.mapper;
import com.subsidy.model.ClassMemberMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 班级成员映射表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Repository
public interface ClassMemberMappingMapper extends BaseMapper<ClassMemberMappingDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.CourseContentDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 课程目录表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface CourseContentMapper extends BaseMapper<CourseContentDO> {
}
package com.subsidy.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.model.CourseDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface CourseDictMapper extends BaseMapper<CourseDictDO> {
IPage<CourseDictDO> queryCourses(IPage page,String courseName,Long categoryId,String courseType,String courseSource);
}
package com.subsidy.mapper;
import com.subsidy.dto.department.GetDepartmentsVO;
import com.subsidy.model.DepartmentDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 部门字典表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface DepartmentDictMapper extends BaseMapper<DepartmentDictDO> {
List<GetDepartmentsVO> getDepartments(DepartmentDictDO departmentDictDO);
}
package com.subsidy.mapper;
import com.subsidy.model.ExerciseDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 习题库 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Repository
public interface ExerciseDictMapper extends BaseMapper<ExerciseDictDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.FileDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 课件表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface FileDictMapper extends BaseMapper<FileDictDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.MemberDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 学生表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface MemberMapper extends BaseMapper<MemberDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.PermissionsDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 权限表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface PermissionsDictMapper extends BaseMapper<PermissionsDictDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.RoleAdministerMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface RoleAdministerMappingMapper extends BaseMapper<RoleAdministerMappingDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.RoleDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 角色表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface RoleDictMapper extends BaseMapper<RoleDictDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.RolePermissionMappingDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
* 系统用户角色表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface RolePermissionMappingMapper extends BaseMapper<RolePermissionMappingDO> {
}
package com.subsidy.mapper;
import com.subsidy.model.VodDictDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subsidy.vo.vod.GetContendVodsVO;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 视频表 Mapper 接口
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Repository
public interface VodDictMapper extends BaseMapper<VodDictDO> {
List<GetContendVodsVO> getContendVods(VodDictDO vodDictDO);
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 管理平台用户
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("administer")
public class AdministerDO extends BaseModel {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 手机号/企业账号
*/
private String telephone;
/**
* 密码
*/
private String password;
/**
* 成员名称/企业名称
*/
private String userName;
/**
* 简称
*/
private String shortName;
/**
* 头像
*/
private String img;
/**
* 标语
*/
private String banner;
/**
* 1:启用 0:禁用
*/
private String status;
/**
* 领域
*/
private String field;
/**
* 账户类型
*/
private String accountType;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 类目名称
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("category")
public class CategoryDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 类目名称
*/
private String name;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 班级id
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("class_dict")
public class ClassDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 企业id
*/
private Long companyId;
/**
* 班级名称
*/
private String className;
/**
* 课程id
*/
private Long courseId;
private LocalDateTime startDate;
private LocalDateTime endDate;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 班级成员映射表
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("class_member_mapping")
public class ClassMemberMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
private Long id;
/**
* 成员id
*/
private Long memberId;
/**
* 班级id
*/
private Long classId;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 课程目录表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("course_content")
public class CourseContentDO extends BaseModel {
private static final long serialVersionUID = 1L;
private Long id;
private Long courseId;
/**
* 目录
*/
private String content;
/**
* 排序
*/
private Integer orderNo;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("course_dict")
public class CourseDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 课程名称
*/
private String courseName;
/**
* 类目id
*/
private Long categoryId;
/**
* 课程类型
*/
private String courseType;
/**
* 课程来源
*/
private String courseSource;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 部门字典表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("departmentDict")
public class DepartmentDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 企业id
*/
private Long companyId;
/**
* 部门名称
*/
private String departmentName;
/**
* 部门负责人id
*/
private String leaderName;
/**
* 父节点id
*/
private Long parentId;
/**
* 为写程序方便,数据库里为null
*/
private String children;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 习题库
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("exercise_dict")
public class ExerciseDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 题目类型:单选/多选/是非
*/
private String exerciseType;
/**
* 课程id
*/
private Long courseId;
/**
* 难度:容易/适中/困难
*/
private String difficulty;
/**
* 题目
*/
private String title;
/**
* 选项
*/
private String items;
/**
* 正确答案
*/
private String rightAnswer;
/**
* 解析
*/
private String detail;
/**
* 排序
*/
private Integer orderNo;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 课件表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("file_dict")
public class FileDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 目录id
*/
private Long contentId;
/**
* 文件名称
*/
private String fileName;
/**
* 文件大小
*/
private String fileSize;
/**
* 排序
*/
private Integer orderNo;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 学生表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("member")
public class MemberDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 部门id
*/
private Long departmentId;
/**
* 账号
*/
private String accountName;
/**
* 姓名
*/
private String userName;
/**
* 手机号
*/
private String telephone;
/**
* 密码
*/
private String password;
/**
* 性别
*/
private String gender;
/**
* 头像
*/
private String image;
/**
* 身份证号
*/
private String idCard;
/**
* 状态
*/
private String status;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 权限表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("permissions_dict")
public class PermissionsDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 父级ID
*/
private Long parentId;
/**
* 名称
*/
private String name;
private String children;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
*
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_administer_mapping")
public class RoleAdministerMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long administerId;
private Long roleId;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 角色表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_dict")
public class RoleDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 角色
*/
private String role;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 系统用户角色表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("role_permission_mapping")
public class RolePermissionMappingDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 权限ID
*/
private Long roleId;
/**
* 角色ID
*/
private Long permissionId;
}
package com.subsidy.model;
import com.subsidy.util.BaseModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 视频表
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("vod_dict")
public class VodDictDO extends BaseModel {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 目录id
*/
private Long contentId;
/**
* 视频名称
*/
private String vodName;
/**
* 视频时长
*/
private Integer vodLength;
/**
* 视频格式
*/
private String vodType;
/**
* 视频大小
*/
private String vodSize;
/**
* 视频地址
*/
private String vodUrl;
/**
* 视频编码
*/
private String vodCode;
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.administer.AdministerPermissionVO;
import com.subsidy.vo.administer.LoginVO;
import com.subsidy.vo.administer.OperatorsVO;
import java.util.List;
/**
* <p>
* 管理平台用户 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface AdministerService extends IService<AdministerDO> {
LoginVO login(AdministerDO administerDO);
AdministerPermissionVO getPermissions();
IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO);
String addOperator(AdministerDO administerDO);
String deleteAdminister(AdministerDO administerDO);
String updateAdminister(AdministerDO administerDO);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 类目名称 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface CategoryService extends IService<CategoryDO> {
IPage<CategoryDO> getCategories(GetCategoriesDTO getCategoriesDTO);
List<CategoryDO> getAll();
String addCategory(CategoryDO categoryDO);
String deleteCategory(CategoryDO categoryDO);
String updateCategory(CategoryDO categoryDO);
}
package com.subsidy.service;
import com.subsidy.model.ClassDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.classdict.GetAllClassesVO;
import java.util.List;
/**
* <p>
* 班级id 服务类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
public interface ClassDictService extends IService<ClassDictDO> {
List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO);
String deleteClasses(ClassDictDO classDictDO);
String addClass(ClassDictDO classDictDO);
String updateClass(ClassDictDO classDictDO);
}
package com.subsidy.service;
import com.subsidy.model.ClassMemberMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 班级成员映射表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
public interface ClassMemberMappingService extends IService<ClassMemberMappingDO> {
}
package com.subsidy.service;
import com.subsidy.controller.CourseDictController;
import com.subsidy.model.CourseContentDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.vo.vod.GetContendVodsVO;
import java.util.List;
/**
* <p>
* 课程目录表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface CourseContentService extends IService<CourseContentDO> {
List<CourseContentDO> getContents(CourseContentDO courseContentDO);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.model.CourseDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface CourseDictService extends IService<CourseDictDO> {
String addCourse(CourseDictDO courseDictDO);
String deleteCourse(CourseDictDO courseDictDO);
IPage queryCourses(QueryCoursesDTO queryCoursesDTO);
String updateCourses(CourseDictDO courseDictDO);
}
package com.subsidy.service;
import com.subsidy.dto.department.GetDepartmentsVO;
import com.subsidy.model.DepartmentDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 部门字典表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface DepartmentDictService extends IService<DepartmentDictDO> {
List<GetDepartmentsVO> getDepartments(DepartmentDictDO departmentDictDO);
String addDepartment(DepartmentDictDO departmentDictDO);
String deleteDepartment(DepartmentDictDO departmentDictDO);
String updateDepartment(DepartmentDictDO departmentDictDO);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.model.ExerciseDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 习题库 服务类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
public interface ExerciseDictService extends IService<ExerciseDictDO> {
IPage<ExerciseDictDO> getAllExercises(GetAllExercisesDTO getAllExercisesDTO);
String addExercise(ExerciseDictDO exerciseDictDO);
String deleteExercise(ExerciseDictDO exerciseDictDO);
String updateExercise(ExerciseDictDO exerciseDictDO);
}
package com.subsidy.service;
import com.subsidy.model.FileDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* <p>
* 课件表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface FileDictService extends IService<FileDictDO> {
List<FileDictDO> getContendFiles(FileDictDO fileDictDO);
String deleteFile(FileDictDO fileDictDO);
String addFile(FileDictDO fileDictDO);
String updateFile(FileDictDO fileDictDO);
}
package com.subsidy.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.model.MemberDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 学生表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface MemberService extends IService<MemberDO> {
IPage<MemberDO> getAll(GetAllDTO getAllDTO);
String deleteMember(MemberDO memberDO);
String addMember(MemberDO memberDO);
String updateMember(MemberDO memberDO);
}
package com.subsidy.service;
import com.subsidy.model.PermissionsDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 权限表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface PermissionsDictService extends IService<PermissionsDictDO> {
}
package com.subsidy.service;
import com.subsidy.model.RoleAdministerMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface RoleAdministerMappingService extends IService<RoleAdministerMappingDO> {
}
package com.subsidy.service;
import com.subsidy.model.RoleDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 角色表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface RoleDictService extends IService<RoleDictDO> {
}
package com.subsidy.service;
import com.subsidy.model.RolePermissionMappingDO;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 系统用户角色表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface RolePermissionMappingService extends IService<RolePermissionMappingDO> {
}
package com.subsidy.service;
import com.subsidy.model.VodDictDO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
import java.util.List;
/**
* <p>
* 视频表 服务类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
public interface VodDictService extends IService<VodDictDO> {
SignatureVO signature()throws Exception;
List<GetContendVodsVO> getContendVods(VodDictDO vodDictDO);
String deleteVod(VodDictDO vodDictDO);
String addVod(VodDictDO vodDictDO);
String updateVod(VodDictDO vodDictDO);
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.administer.OperatorsDTO;
import com.subsidy.model.AdministerDO;
import com.subsidy.mapper.AdministerMapper;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.service.AdministerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.JwtUtil;
import com.subsidy.util.Localstorage;
import com.subsidy.vo.administer.AdministerPermissionVO;
import com.subsidy.vo.administer.LoginVO;
import com.subsidy.vo.administer.OperatorsVO;
import com.subsidy.vo.administer.PermissionsVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 管理平台用户 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class AdministerServiceImpl extends ServiceImpl<AdministerMapper, AdministerDO> implements AdministerService {
public LoginVO login(AdministerDO administerDO) {
LoginVO loginVO = new LoginVO();
AdministerDO administerDO1 = this.baseMapper.selectOne(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getTelephone, administerDO.getTelephone()));
if (null != administerDO1) {
if (administerDO.getPassword().equals(administerDO1.getPassword())) {
String token = JwtUtil.generateToken(administerDO.getId(), ConstantUtils.ADMINISTER_TERMINATE);
loginVO.setToken(token);
return loginVO;
}else {
throw new HttpException(10004);
}
} else {
throw new HttpException(10011);
}
}
public AdministerPermissionVO getPermissions() {
AdministerPermissionVO administerPermissionVO = new AdministerPermissionVO();
AdministerDO administerDO = (AdministerDO) Localstorage.getUser();
if (administerDO == null) {
throw new HttpException(10012);
}
BeanUtils.copyProperties(administerDO, administerPermissionVO);
List<PermissionsVO> list = this.baseMapper.getPermissions(administerDO.getId());
List<PermissionsVO> treeList = new ArrayList();
if (list != null) {
list.forEach(permission -> {
if (permission.getParentId() == null) {
treeList.add(permission);
}
list.forEach(p -> {
if (null != p.getParentId() && p.getParentId().equals(permission.getId())) {
if (permission.getChildren() == null) {
permission.setChildren(new ArrayList<>());
}
permission.getChildren().add(p);
}
});
});
}
administerPermissionVO.setPermissions(treeList);
return administerPermissionVO;
}
public IPage<OperatorsVO> operators(OperatorsDTO operatorsDTO){
Page pager = new Page(operatorsDTO.getPageNum(), operatorsDTO.getPageSize());
return this.baseMapper.operators(pager,operatorsDTO.getAccountType());
}
public String addOperator(AdministerDO administerDO){
Integer count = this.baseMapper.selectCount(new QueryWrapper<AdministerDO>()
.lambda()
.eq(AdministerDO::getAccountType,administerDO.getAccountType())
.eq(AdministerDO::getTelephone,administerDO.getTelephone()));
if (count>0){
throw new HttpException(10014);
}
administerDO.setPassword("admin123");
administerDO.setStatus("1");
this.baseMapper.insert(administerDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteAdminister(AdministerDO administerDO){
this.baseMapper.deleteById(administerDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateAdminister(AdministerDO administerDO){
this.baseMapper.updateById(administerDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.category.GetCategoriesDTO;
import com.subsidy.model.CategoryDO;
import com.subsidy.mapper.CategoryMapper;
import com.subsidy.service.CategoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 类目名称 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, CategoryDO> implements CategoryService {
public IPage<CategoryDO> getCategories(GetCategoriesDTO getCategoriesDTO){
Page pager = new Page(getCategoriesDTO.getPageNum(), getCategoriesDTO.getPageSize());
return this.baseMapper.selectPage(pager,new QueryWrapper<CategoryDO>()
.lambda()
.like(CategoryDO::getName,getCategoriesDTO.getName()));
}
public List<CategoryDO> getAll(){
return this.baseMapper.selectList(null);
}
public String addCategory(CategoryDO categoryDO){
Integer count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getName,categoryDO.getName()));
if (count > 0 ){
throw new HttpException(90001);
}
this.baseMapper.insert(categoryDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteCategory(CategoryDO categoryDO){
this.baseMapper.deleteById(categoryDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateCategory(CategoryDO categoryDO){
int count = this.baseMapper.selectCount(new QueryWrapper<CategoryDO>()
.lambda()
.eq(CategoryDO::getName,categoryDO.getName()));
if (count>2){
throw new HttpException(90001);
}
this.baseMapper.updateById(categoryDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.model.ClassDictDO;
import com.subsidy.mapper.ClassDictMapper;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.service.ClassDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.classdict.GetAllClassesVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 班级id 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Service
public class ClassDictServiceImpl extends ServiceImpl<ClassDictMapper, ClassDictDO> implements ClassDictService {
@Autowired
private ClassMemberMappingMapper classMemberMappingMapper;
public List<GetAllClassesVO> getAllClasses(ClassDictDO classDictDO){
return this.baseMapper.getAllClasses(classDictDO);
}
@Transactional
public String deleteClasses(ClassDictDO classDictDO){
this.baseMapper.deleteById(classDictDO.getId());
classMemberMappingMapper.delete(new QueryWrapper<ClassMemberMappingDO>()
.lambda()
.eq(ClassMemberMappingDO::getClassId,classDictDO.getId()));
return ConstantUtils.DELETE_SUCCESS;
}
public String addClass(ClassDictDO classDictDO){
this.baseMapper.insert(classDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateClass(ClassDictDO classDictDO){
this.baseMapper.updateById(classDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.subsidy.model.ClassMemberMappingDO;
import com.subsidy.mapper.ClassMemberMappingMapper;
import com.subsidy.service.ClassMemberMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 班级成员映射表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Service
public class ClassMemberMappingServiceImpl extends ServiceImpl<ClassMemberMappingMapper, ClassMemberMappingDO> implements ClassMemberMappingService {
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.controller.CourseContentController;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.model.CourseContentDO;
import com.subsidy.mapper.CourseContentMapper;
import com.subsidy.model.CourseDictDO;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.CourseContentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.vod.GetContendVodsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 课程目录表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class CourseContentServiceImpl extends ServiceImpl<CourseContentMapper, CourseContentDO> implements CourseContentService {
@Autowired
private VodDictMapper vodDictMapper;
public List<CourseContentDO> getContents(CourseContentDO courseContentDO) {
return this.baseMapper.selectList(new QueryWrapper<CourseContentDO>()
.lambda()
.eq(CourseContentDO::getCourseId, courseContentDO.getCourseId())
.orderByAsc(CourseContentDO::getOrderNo)
.orderByAsc(CourseContentDO::getCreateDate));
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.course.QueryCoursesDTO;
import com.subsidy.model.CourseDictDO;
import com.subsidy.mapper.CourseDictMapper;
import com.subsidy.service.CourseDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class CourseDictServiceImpl extends ServiceImpl<CourseDictMapper, CourseDictDO> implements CourseDictService {
public String addCourse(CourseDictDO courseDictDO){
int count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
.lambda()
.eq(CourseDictDO::getCourseName,courseDictDO.getCourseName()));
if (count >0){
throw new HttpException(20001);
}
this.baseMapper.insert(courseDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteCourse(CourseDictDO courseDictDO){
this.baseMapper.deleteById(courseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public IPage queryCourses(QueryCoursesDTO queryCoursesDTO){
Page pager = new Page(queryCoursesDTO.getPageNum(), queryCoursesDTO.getPageSize());
return this.baseMapper.queryCourses(pager,queryCoursesDTO.getCourseName(),queryCoursesDTO.getCategoryId(),queryCoursesDTO.getCourseType(),queryCoursesDTO.getCourseSource());
}
public String updateCourses(CourseDictDO courseDictDO){
int count = this.baseMapper.selectCount(new QueryWrapper<CourseDictDO>()
.lambda()
.eq(CourseDictDO::getCourseName,courseDictDO.getCourseName()));
if (count >1){
throw new HttpException(20001);
}
this.baseMapper.updateById(courseDictDO);
return ConstantUtils.DELETE_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.department.GetDepartmentsVO;
import com.subsidy.model.DepartmentDictDO;
import com.subsidy.mapper.DepartmentDictMapper;
import com.subsidy.service.DepartmentDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 部门字典表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class DepartmentDictServiceImpl extends ServiceImpl<DepartmentDictMapper, DepartmentDictDO> implements DepartmentDictService {
public List<GetDepartmentsVO> getDepartments(DepartmentDictDO departmentDictDO) {
return this.baseMapper.getDepartments(departmentDictDO);
}
public String addDepartment(DepartmentDictDO departmentDictDO) {
Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>()
.lambda()
.eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId())
.eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName()));
if (counter > 0) {
throw new HttpException(30001);
}
this.baseMapper.insert(departmentDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteDepartment(DepartmentDictDO departmentDictDO) {
this.baseMapper.deleteById(departmentDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateDepartment(DepartmentDictDO departmentDictDO) {
Integer counter = this.baseMapper.selectCount(new QueryWrapper<DepartmentDictDO>()
.lambda()
.eq(DepartmentDictDO::getCompanyId, departmentDictDO.getCompanyId())
.eq(DepartmentDictDO::getDepartmentName, departmentDictDO.getDepartmentName())
.ne(DepartmentDictDO::getId, departmentDictDO.getId()));
if (counter > 0) {
throw new HttpException(30001);
}
this.baseMapper.updateById(departmentDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.dto.exercise.GetAllExercisesDTO;
import com.subsidy.model.ExerciseDictDO;
import com.subsidy.mapper.ExerciseDictMapper;
import com.subsidy.service.ExerciseDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.apache.tomcat.util.bcel.Const;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 习题库 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-12
*/
@Service
public class ExerciseDictServiceImpl extends ServiceImpl<ExerciseDictMapper, ExerciseDictDO> implements ExerciseDictService {
public IPage<ExerciseDictDO> getAllExercises(GetAllExercisesDTO getAllExercisesDTO) {
Page pager = new Page(getAllExercisesDTO.getPageNum(), getAllExercisesDTO.getPageSize());
return this.baseMapper.selectPage(pager, new QueryWrapper<ExerciseDictDO>()
.lambda()
.eq(ExerciseDictDO::getCourseId, getAllExercisesDTO.getCourseId())
.like(ExerciseDictDO::getDifficulty, getAllExercisesDTO.getDifficulty())
.like(ExerciseDictDO::getExerciseType, getAllExercisesDTO.getExerciseType())
.like(ExerciseDictDO::getTitle, getAllExercisesDTO.getExerciseType())
.orderByAsc(ExerciseDictDO::getOrderNo));
}
public String addExercise(ExerciseDictDO exerciseDictDO){
List<ExerciseDictDO> exerciseDictDOS = this.baseMapper.selectList(new QueryWrapper<ExerciseDictDO>()
.lambda()
.eq(ExerciseDictDO::getCourseId,exerciseDictDO.getCourseId())
.orderByDesc(ExerciseDictDO::getOrderNo));
int orderNo = 1;
if (exerciseDictDOS.size() >0){
orderNo = exerciseDictDOS.get(0).getOrderNo()+1;
}
exerciseDictDO.setOrderNo(orderNo);
this.baseMapper.insert(exerciseDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String deleteExercise(ExerciseDictDO exerciseDictDO){
this.baseMapper.deleteById(exerciseDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String updateExercise(ExerciseDictDO exerciseDictDO){
this.baseMapper.updateById(exerciseDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.subsidy.model.FileDictDO;
import com.subsidy.mapper.FileDictMapper;
import com.subsidy.model.VodDictDO;
import com.subsidy.service.FileDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.vo.vod.GetContendVodsVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 课件表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class FileDictServiceImpl extends ServiceImpl<FileDictMapper, FileDictDO> implements FileDictService {
public List<FileDictDO> getContendFiles(FileDictDO fileDictDO) {
return this.baseMapper.selectList(new QueryWrapper<FileDictDO>()
.lambda()
.eq(FileDictDO::getContentId,fileDictDO.getContentId())
.like(FileDictDO::getFileName,fileDictDO.getFileName()));
}
public String deleteFile(FileDictDO fileDictDO) {
this.baseMapper.deleteById(fileDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addFile(FileDictDO fileDictDO) {
this.baseMapper.insert(fileDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateFile(FileDictDO fileDictDO) {
this.baseMapper.updateById(fileDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subsidy.common.exception.HttpException;
import com.subsidy.dto.member.GetAllDTO;
import com.subsidy.model.MemberDO;
import com.subsidy.mapper.MemberMapper;
import com.subsidy.service.MemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import org.springframework.stereotype.Service;
/**
* <p>
* 学生表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class MemberServiceImpl extends ServiceImpl<MemberMapper, MemberDO> implements MemberService {
public IPage<MemberDO> getAll(GetAllDTO getAllDTO) {
Page pager = new Page(getAllDTO.getPageNum(), getAllDTO.getPageSize());
return this.baseMapper.selectPage(pager, new QueryWrapper<MemberDO>()
.lambda()
.like(MemberDO::getUserName, getAllDTO.getUserName())
.like(MemberDO::getStatus, getAllDTO.getStatus()));
}
public String deleteMember(MemberDO memberDO) {
this.baseMapper.deleteById(memberDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addMember(MemberDO memberDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getTelephone, memberDO.getTelephone())
.eq(MemberDO::getDepartmentId, memberDO.getDepartmentId()));
if (count > 0) {
throw new HttpException(20002);
}
Integer count1 = this.baseMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getIdCard, memberDO.getIdCard())
.eq(MemberDO::getDepartmentId, memberDO.getDepartmentId()));
if (count1 > 0) {
throw new HttpException(20002);
}
memberDO.setPassword("123456");
memberDO.setStatus("启用");
this.baseMapper.insert(memberDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateMember(MemberDO memberDO) {
Integer count = this.baseMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getTelephone, memberDO.getTelephone())
.eq(MemberDO::getDepartmentId, memberDO.getDepartmentId())
.ne(MemberDO::getId, memberDO.getId()));
if (count > 0) {
throw new HttpException(20002);
}
Integer count1 = this.baseMapper.selectCount(new QueryWrapper<MemberDO>()
.lambda()
.eq(MemberDO::getIdCard, memberDO.getIdCard())
.eq(MemberDO::getDepartmentId, memberDO.getDepartmentId())
.ne(MemberDO::getId, memberDO.getId()));
if (count1 > 0) {
throw new HttpException(20002);
}
this.baseMapper.updateById(memberDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.service.impl;
import com.subsidy.model.PermissionsDictDO;
import com.subsidy.mapper.PermissionsDictMapper;
import com.subsidy.service.PermissionsDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 权限表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class PermissionsDictServiceImpl extends ServiceImpl<PermissionsDictMapper, PermissionsDictDO> implements PermissionsDictService {
}
package com.subsidy.service.impl;
import com.subsidy.model.RoleAdministerMappingDO;
import com.subsidy.mapper.RoleAdministerMappingMapper;
import com.subsidy.service.RoleAdministerMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class RoleAdministerMappingServiceImpl extends ServiceImpl<RoleAdministerMappingMapper, RoleAdministerMappingDO> implements RoleAdministerMappingService {
}
package com.subsidy.service.impl;
import com.subsidy.model.RoleDictDO;
import com.subsidy.mapper.RoleDictMapper;
import com.subsidy.service.RoleDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 角色表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class RoleDictServiceImpl extends ServiceImpl<RoleDictMapper, RoleDictDO> implements RoleDictService {
}
package com.subsidy.service.impl;
import com.subsidy.model.RolePermissionMappingDO;
import com.subsidy.mapper.RolePermissionMappingMapper;
import com.subsidy.service.RolePermissionMappingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 系统用户角色表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class RolePermissionMappingServiceImpl extends ServiceImpl<RolePermissionMappingMapper, RolePermissionMappingDO> implements RolePermissionMappingService {
}
package com.subsidy.service.impl;
import com.subsidy.common.configure.VODConfig;
import com.subsidy.model.VodDictDO;
import com.subsidy.mapper.VodDictMapper;
import com.subsidy.service.VodDictService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.subsidy.util.ConstantUtils;
import com.subsidy.util.Signature;
import com.subsidy.vo.vod.GetContendVodsVO;
import com.subsidy.vo.vod.SignatureVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
* <p>
* 视频表 服务实现类
* </p>
*
* @author DengMin
* @since 2021-10-11
*/
@Service
public class VodDictServiceImpl extends ServiceImpl<VodDictMapper, VodDictDO> implements VodDictService {
@Autowired
private VODConfig vodConfig;
public SignatureVO signature() throws Exception {
//
SignatureVO signatureVO = new SignatureVO();
Signature signature = new Signature();
signature.setSecretId(vodConfig.getSecretId());
signature.setSecretKey(vodConfig.getSecretKey());
signature.setCurrentTime(System.currentTimeMillis());
signature.setRandom(new Random().nextInt(Integer.MAX_VALUE));
signature.setSignValidDuration(3600 * 24 * 2);
String sign = "";
try {
sign = signature.getUploadSignature();
signatureVO.setSign(sign);
} catch (Exception ex) {
ex.printStackTrace();
// throw new MyException(ResultEnum.UNKNOWN_ERROR);
}
return signatureVO;
}
public List<GetContendVodsVO> getContendVods(VodDictDO vodDictDO) {
return this.baseMapper.getContendVods(vodDictDO);
}
public String deleteVod(VodDictDO vodDictDO) {
this.baseMapper.deleteById(vodDictDO.getId());
return ConstantUtils.DELETE_SUCCESS;
}
public String addVod(VodDictDO vodDictDO) {
this.baseMapper.insert(vodDictDO);
return ConstantUtils.ADD_SUCCESS;
}
public String updateVod(VodDictDO vodDictDO) {
this.baseMapper.updateById(vodDictDO);
return ConstantUtils.SET_SUCCESS;
}
}
package com.subsidy.util;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public abstract class BaseModel {
/**
* 创建时间
*/
@JsonIgnore
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "create_date", fill = FieldFill.INSERT)
private LocalDateTime createDate;
/**
* 更新时间
*/
@JsonIgnore
@TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER, value = "update_date", fill = FieldFill.UPDATE)
private LocalDateTime updateDate;
/**
* 删除时间
*/
@JsonIgnore
@TableLogic
private LocalDateTime deleteDate;
}
package com.subsidy.util;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
import com.baomidou.mybatisplus.core.toolkit.StringPool;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.InjectionConfig;
import com.baomidou.mybatisplus.generator.config.*;
import com.baomidou.mybatisplus.generator.config.po.TableInfo;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;
import java.util.Scanner;
/**
* Mybatis-Plus CodeGenerator
*
* @author DengMin
* @date 2020/07/02
**/
public class CodeGenerator {
public static String scanner(String tip) {
StringBuilder help = new StringBuilder();
help.append("1.生成全部表 2.输入需要生成表名");
System.out.println(help.toString());
Scanner scanner = new Scanner(System.in);
Integer ipt = Integer.valueOf(scanner.next());
if(ipt == 1) {
return "";
} else if(ipt == 2) {
StringBuilder help1 = new StringBuilder();
help1.append("请输入" + tip + ":");
System.out.println(help1.toString());
Scanner scanner1 = new Scanner(System.in);
if (scanner1.hasNext()) {
String name = scanner1.next();
if (StringUtils.isNotEmpty(name)) {
return name;
}
}
throw new MybatisPlusException("请输入正确的" + tip + "!");
}
return scanner(tip);
}
public static void main(String[] args) {
final ResourceBundle rb = ResourceBundle.getBundle("mybatis-plus");
// 代码生成器
AutoGenerator mpg = new AutoGenerator();
// 全局配置
GlobalConfig gc = new GlobalConfig();
gc.setOutputDir(System.getProperty("user.dir") + rb.getString("outputDir"));
gc.setOpen(false);
gc.setBaseResultMap(true);
gc.setBaseColumnList(true);
gc.setAuthor(rb.getString("author"));
gc.setMapperName("%sMapper");
gc.setEntityName("%sDO");
gc.setServiceName("%sService");
gc.setServiceImplName("%sServiceImpl");
gc.setControllerName("%sController");
mpg.setGlobalConfig(gc);
// 数据源配置
DataSourceConfig dsc = new DataSourceConfig();
dsc.setDbType(DbType.MYSQL);
dsc.setUrl(rb.getString("url"));
dsc.setDriverName(rb.getString("driverName"));
dsc.setUsername(rb.getString("userName"));
dsc.setPassword(rb.getString("password"));
mpg.setDataSource(dsc);
// 包配置
PackageConfig pc = new PackageConfig();
pc.setParent(rb.getString("setParent"));
pc.setController("controller");
pc.setService("service");
pc.setServiceImpl("service.impl");
pc.setEntity("model");
pc.setMapper("mapper");
mpg.setPackageInfo(pc);
// 自定义配置
InjectionConfig cfg = new InjectionConfig() {
@Override
public void initMap() {
// to do nothing
}
};
List<FileOutConfig> focList = new ArrayList<>();
focList.add(new FileOutConfig("/templates/mapper.xml.ftl") {
@Override
public String outputFile(TableInfo tableInfo) {
// 自定义输入文件名称
return System.getProperty("user.dir")+ rb.getString("mapperPath") + tableInfo.getMapperName() + StringPool.DOT_XML;
}
});
cfg.setFileOutConfigList(focList);
mpg.setCfg(cfg);
mpg.setTemplate(new TemplateConfig().setXml(null));
// 策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setNaming(NamingStrategy.underline_to_camel);
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
strategy.setSuperEntityClass(BaseModel.class);
strategy.setEntityLombokModel(true);
strategy.setRestControllerStyle(true);
String [] tables = scanner("表名,多个英文逗号分割").split(",");
if(StringUtils.isNotBlank(tables[0])) {
strategy.setInclude(tables);
}
strategy.setControllerMappingHyphenStyle(true);
mpg.setStrategy(strategy);
mpg.setTemplateEngine(new FreemarkerTemplateEngine());
mpg.execute();
}
}
\ No newline at end of file
package com.subsidy.util;
/**
* 枚举类
*/
public class ConstantUtils {
public static final String DELETE_SUCCESS = "删除成功";
public static final String UPLOAD_FAIL = "上传失败";
public static final String ADD_SUCCESS = "新增成功";
public static final String COMMIT_SUCCESS = "提交成功";
public static final String SUCCESS_SEND_OUT = "发送成功";
public static final String FAIL_SEND_OUT = "发送失败";
public static final String SAVE_SUCCESS = "保存成功";
public static final String SHARE_SUCCESS = "共享成功";
public static final String SUBMIT_SUCCESS = "提交成功";
public static final String SUCCESS_UPDATE = "更新成功";
public static final String FAIL_UPDATE = "更新失败";
public static final String SET_SUCCESS = "设置成功";
public static final String SUCCESS_VERIFY = "验证成功";
public static final String FAIL_VERIFY = "验证失败";
public static final String COMPANY_NAME = "TeachAI";
public static final String ALREADY_DONE = "已完成";
public static final String ALREADY_RECOMMEND = "已推荐";
public static final String VERIFY_NAME = "有课互联";
public static final String NOTICE_NAME = "有课进度通知";
public static final String PUBLISH_SUCCESS = "发布成功";
public static final String LOGIN_OUT ="登出成功";
public static final String COMPRESS_SUCCESS = "压缩成功";
public static final String SCHOOL = "上海市市西中学";
public static final String CHECK_STATUS = "审核通过";
/**
* 短信模板---验证模板
*/
public static final String TEMPLATE_CODE = "SMS_190945394";
/**
* 短信 地域ID
*/
public static final String REGION_ID = "cn-hangzhou";
/**
* 短信 RAM账号AccessKey ID
*/
public static final String ACCESS_KEY_ID = "LTAIOrpFKrDqsQ2c";
/**
* 短信 RAM账号AccessKey Secret
*/
public static final String SECRET = "1Qp8huLETbWiBBJvHXJ7MOIhtKuA1G";
/**
* 腾讯云点播视频转码模板
*/
public static final Long TEMPLATE_VOD = 100030L;
/**
* 手机端token
*/
public static final String MOBILE_TERMINATE = "mobile";
public static final String ADMINISTER_TERMINATE = "administer";
}
package com.subsidy.util;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 处理时间工具
*
* @author DengMin
* @date 2019/08/27 13:56
**/
public class DateFormatUtil {
public final static String YEAR = "yyyy";
public final static String FMT_sdf14_L = "yyyy-MM-dd HH:mm:ss";
public final static String FMT_sdf_yMd = "yyyy-MM-dd";
public final static String FMT_sdf_yM = "yyyy-M";
public final static String FMT_sdf_yMM = "yyyy-MM";
public final static String FMT_sdf_Hm = "H:mm";
public final static String FMT_sdf_HHmm = "HH:mm";
public final static String cron = "s m H d M ? yyyy";
/**
* Date转String,自定义格式
* @param date
* @param pattern
* @return
*/
public static String format(Date date, String pattern) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* String转Date,自定义格式
* @param date
* @param pattern
* @return
*/
public static Date parse(String date, String pattern) {
try {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.parse(date);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 比较两个时间
* .after 大于
* .before 小于
* @param d1
* @param d2
* @return
*/
public static boolean compare(Date d1, Date d2 ) {
if(d1.after(d2)) {
return false;
}
return true;
}
/**
* Data转Cron
* @param date
* @return
*/
public static String getCron(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("s m H d M ? yyyy");
return sdf.format(date);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!