Commit 960449c5 by 涂亚平

start...

1 parent 029cd9e4
Showing with 6193 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);
}
}
package com.subsidy.util;
import com.amdelamar.jhash.Hash;
import com.amdelamar.jhash.algorithms.Type;
import com.amdelamar.jhash.exception.InvalidHashException;
public class EncryptUtil {
/**
* 设置密文密码
*
* @param password 原始密码
* @return 加密密码
*/
public static String encrypt(String password) {
char[] chars = password.toCharArray();
return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).create();
}
/**
* 验证加密密码
*
* @param encryptedPassword 密文密码
* @param plainPassword 明文密码
* @return 验证是否成功
*/
public static boolean verify(String encryptedPassword, String plainPassword) {
char[] chars = plainPassword.toCharArray();
try {
return Hash.password(chars).algorithm(Type.PBKDF2_SHA256).verify(encryptedPassword);
} catch (InvalidHashException e) {
return false;
}
}
}
package com.subsidy.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
import java.util.Map;
/**
* http请求
*/
public class HttpUtil {
/**
* GET 请求
* @param params
* @param url
* @return
*/
public static JSONObject get(Map<String, Object> params, String url) {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.getForEntity(url, String.class, params);
String body = responseEntity.getBody();
JSONObject object = JSON.parseObject(body);
return object;
}
/**
* POST 请求
* @param params
* @param url
* @return
*/
public static JSONObject post(Map<String, Object> params, String url) {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, params, String.class);
String body = responseEntity.getBody();
JSONObject object = JSON.parseObject(body);
return object;
}
/**
* POST 请求 带Token
*
* @param param
* @param token
* @param url
* @return
*/
public static JSONObject sendPost(Map<String, Object> param, String token, String url, Object obj) {
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("Accept", MediaType.ALL_VALUE);
headers.add("Authorization", "Bearer " + token);
HttpEntity<String> formEntity = new HttpEntity<String>(param.toString(), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, formEntity, String.class, obj);
String body = responseEntity.getBody();
JSONObject object = JSON.parseObject(body);
return object;
}
}
package com.subsidy.util;
import com.auth0.jwt.JWT;
import com.auth0.jwt.JWTVerifier;
import com.auth0.jwt.algorithms.Algorithm;
import com.auth0.jwt.interfaces.Claim;
import java.util.Date;
import java.util.Map;
/**
* <p>
* Token工具
* </p>
*
* @author DengMin
* @since 2021/4/14
*/
public class JwtUtil {
private static Long EXPIRE_TIME = 24 * 60 * 60 * 1000L;
private static String SECRET = "PBKDF2SHA256:64000:18:24:N:GFHZ6Y0PTEUDYCJI3K6SOOXWYEKPOZED:WBWFJMX5DF252E0HR3BF3P/D";
/**
* 生成Token
* @param id
* @return
*/
public static String generateToken(Long id, String type) {
Date expireDate = new Date(System.currentTimeMillis() + EXPIRE_TIME);
return JWT.create()
.withClaim("id", id)
.withClaim("type", type)
.withAudience()
.withExpiresAt(expireDate)
.withIssuedAt(new Date())
.sign(Algorithm.HMAC256(SECRET));
}
/**
* 检验token是否正确
* @param token
* @return
*/
public static boolean verifyToken(String token) {
try {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
verifier.verify(token);
return true;
} catch (Exception e) {
return false;
}
}
/**
* 获取用户自定义Claim集合
* @param token
* @return
*/
public static Map<String, Claim> getClaims(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
JWTVerifier verifier = JWT.require(algorithm).build();
Map<String, Claim> claims = verifier.verify(token).getClaims();
return claims;
}
/**
* 获取过期时间
* @param token
* @return
*/
public static Date getExpiresAt(String token) {
Algorithm algorithm = Algorithm.HMAC256(SECRET);
return JWT
.require(algorithm)
.build()
.verify(token)
.getExpiresAt();
}
/**
* 验证token是否失效
* @param token
* @return true: 过期, false: 没过期
*/
public static boolean isExpired(String token) {
try {
final Date expiration = getExpiresAt(token);
return expiration.before(new Date());
} catch (Exception e) {
return true;
}
}
}
package com.subsidy.util;
import org.scilab.forge.jlatexmath.TeXConstants;
import org.scilab.forge.jlatexmath.TeXFormula;
import org.scilab.forge.jlatexmath.TeXIcon;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
/**
* @author: tuyp
* @create: 2020-08-08 21:19
*/
public class LatexUtils {
/**
* @Description: 将base64编码字符串转换为图片
* @Author:
* @CreateTime:
* @param imgStr
* base64编码字符串
* @param path
* 图片路径-具体到文件
* @return
*/
public static boolean generateImage(String imgStr, String path) {
if (imgStr == null) {
return false;
}
// BASE64Decoder decoder = new BASE64Decoder();
try {
// byte[] b = decoder.decodeBuffer(imgStr);
// for (int i = 0; i < b.length; i++) {
// if (b[i] < 0) {
// b[i] += 256;
// }
// }
// OutputStream out = new FileOutputStream(path);
// out.write(b);
// out.flush();
// out.close();
return true;
} catch (Exception e) {
// TODO: handle exception
return false;
}
}
/**
* @Description: 根据图片地址转换为base64编码字符串
* @Author:
* @CreateTime:
* @return
*/
// public static String getImageStr(String imgFile) {
// InputStream inputStream = null;
// byte[] data = null;
// try {
// inputStream = new FileInputStream(imgFile);
// data = new byte[inputStream.available()];
// inputStream.read(data);
// inputStream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// // 加密
// BASE64Encoder encoder = new BASE64Encoder();
// return encoder.encode(data);
// }
// latex 转 imgbase64
public static String latex2Png(String latex) {
try {
TeXFormula formula = new TeXFormula(latex);
// render the formla to an icon of the same size as the formula.
TeXIcon icon = formula.createTeXIcon(TeXConstants.STYLE_DISPLAY, 20);
// insert a border
icon.setInsets(new Insets(1, 1, 1, 1));
// now create an actual image of the rendered equation
BufferedImage image = new BufferedImage(icon.getIconWidth(), icon.getIconHeight(), BufferedImage.TYPE_BYTE_GRAY);
Graphics2D g2 = image.createGraphics();
g2.setColor(Color.white);
g2.fillRect(0, 0, icon.getIconWidth(), icon.getIconHeight());
JLabel jl = new JLabel();
jl.setForeground(new Color(0, 0, 0));
icon.paintIcon(jl, g2, 0, 0);
// at this point the image is created, you could also save it with ImageIO
// saveImage(image, "png", "F:\\b.png");
// ImageIO.write(image, "png", new File("F:\\c.png"));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
try {
ImageIO.write(image, "png", outputStream);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
byte[] buffer = outputStream.toByteArray();
// BASE64Encoder encoder = new BASE64Encoder();
return ("data:image/png;base64,");
} catch (Exception e) {
// e.printStackTrace();
// ExceptionUtil.log(log, e);
System.err.println("公式解析有误:\n" + latex);
// e.printStackTrace();
return null;
}
}
public static void main(String[] args) {
String str = latex2Png("\\(\\sqrt[3]{2+x}\\)");
System.out.println(str);
// String omml =Latex_Word.latexToWord(str);
// System.out.println(omml);
}
}
package com.subsidy.util;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Localstorage {
private static final ThreadLocal<Object> local = ThreadLocal.withInitial(() -> null);
public static void setUser(Object admin) {
Localstorage.local.set(admin);
}
public static Object getUser() {
return Localstorage.local.get();
}
public static void remove() {
Localstorage.local.remove();
}
}
package com.subsidy.util;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Random;
public class MathUtil {
public static String getRandomCode(int randomLength) {
StringBuilder str = new StringBuilder();
Random random = new Random();
for (int i = 0; i < randomLength; i++) {
str.append(random.nextInt(10));
}
return str.toString();
}
public static String getRandomString(int length) {
StringBuilder val = new StringBuilder();
Random random = new Random();
for (int i = 0; i < length; ++i) {
String charOrNum = random.nextInt(3) % 3 == 0 ? "num" : "char";
if ("char".equalsIgnoreCase(charOrNum)) {
int temp = random.nextInt(2) % 2 == 0 ? 65 : 97;
val.append((char) (random.nextInt(26) + temp));
} else {
val.append(random.nextInt(10));
}
}
return val.toString();
}
//习题/视频 ==> 秒钟向上取整
public static String ceilSecond(int length) {
return String.valueOf((int) Math.ceil((double) length / 60));
}
//视频秒数处理
public static String vodLength(int i) {
if (i > 60) {
if (i % 60 >= 10) {
return i / 60 + ":" + i % 60;
} else {
return i / 60 + ":0" + i % 60;
}
} else {
if (i % 60 >= 10) {
return "00:" + i;
} else {
return "00:0" + i;
}
}
}
//文件大小处理
public static String fileUnit(int i) {
if (i / 1024 > 1024) {
return String.format("%.2f", (double) i / 1024 / 1024) + "M";
} else {
return String.format("%.2f", (double) i / 1024) + "K";
}
}
//单个题目秒数处理
public static String exerciseLength(int i) {
if (i >= 60 * 60) {
return i / 60 / 60 + "时" + (i - 60 * 60) / 60 + "分" + i % 60 + "秒";
} else if (i >= 60) {
return i / 60 + "分" + i % 60 + "秒";
} else {
return i % 60 + "秒";
}
}
// 除法取整
public static String getAvgIndex(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total)) {
return "0";
} else {
return counts.divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString();
}
}
//百分比 取整 返回字符串
public static String getPercentAvgIndex(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0%";
} else {
return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString() + "%";
}
}
//百分比 不带%输出
public static String getPercentAvgIndexWithPercent(BigDecimal counts, BigDecimal total) {
if (BigDecimal.ZERO.equals(total) || BigDecimal.ZERO.equals(counts)) {
return "0";
} else {
return counts.multiply(new BigDecimal(100)).divide(total, RoundingMode.CEILING).stripTrailingZeros().toPlainString();
}
}
//习题序号生成规则 sid 从数据取出某科目某知识点的最大的序号
public static String getExeCode(String sid) {
Integer integer = Integer.valueOf(sid.substring(9));
return sid.substring(0, 9) + (++integer);
}
// 整型a 整型b a/b 向上取整
public static Integer intDivCeil(long a, int b) {
return (int) Math.ceil((double) a / b);
}
// 整型a 整型b a/b 向下取整
public static Integer intDivFloorPercent(long a, int b) {
return (int) Math.floor((double) a * 100 / b);
}
public static Integer getRandomNum(Integer i){
Random random = new Random();
return random.nextInt(i);
}
// public static void main(String[] args) {
// for (int i= 1;i<100;i++){
// System.out.println(getRandomNum(2));
// }
// }
}
package com.subsidy.util;
import java.util.Random;
public class RandomUtil {
public static int getCode() {
return (int)((Math.random() * 9 + 1) * 100000);
}
public static String getRandomCode(int randomLength) {
StringBuilder str = new StringBuilder();
Random random = new Random();
for (int i = 0; i < randomLength; i++) {
str.append(random.nextInt(10));
}
return str.toString();
}
}
package com.subsidy.util;
import com.aliyuncs.CommonRequest;
import com.aliyuncs.CommonResponse;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.subsidy.common.configure.AliyunSmsProperties;
import com.subsidy.common.exception.HttpException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 短信发送工具类
*/
@Component
public class SMSUtils {
@Autowired
private AliyunSmsProperties aliyunSmsProperties;
public SendSmsResponse send(String phone, String code) {
try {
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", aliyunSmsProperties.getAccessKeyId(), aliyunSmsProperties.getAccessKeySecret());
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", aliyunSmsProperties.getProduct(), aliyunSmsProperties.getDomain());
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(phone);
//必填:短信签名-可在短信控制台中找到
request.setSignName("有课互联");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_190945394");
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\""+ code +"\"}");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse sendSmsResponse = acsClient.getAcsResponse(request);
if(sendSmsResponse != null && sendSmsResponse.getCode().equals("OK")) {
return sendSmsResponse;
}
throw new Exception(sendSmsResponse.getMessage());
} catch (Exception e) {
throw new HttpException(70011);
}
}
/**
* 发送验证码短信
* @param templateId 短信模板id
* @param telephone 手机号
* @return
*/
public static String sendVerifySMS(String templateId,String telephone,String param){
DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET);
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
request.putQueryParameter("RegionId",ConstantUtils.REGION_ID);
request.putQueryParameter("PhoneNumbers",telephone);
request.putQueryParameter("SignName",ConstantUtils.VERIFY_NAME);
request.putQueryParameter("TemplateCode",templateId);
// if (StringUtils.isEmpty(param)){
// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}");
// }
request.putQueryParameter("TemplateParam",param);
CommonResponse response = null;
try {
response = client.getCommonResponse(request);
return ConstantUtils.SUCCESS_SEND_OUT;
} catch(Exception e) {
e.printStackTrace();
return ConstantUtils.FAIL_SEND_OUT;
}
}
/**
* 发送通知短信
* @param templateId 短信模板id
* @param telephone 手机号
* @return
*/
public static String sendNoticeSMS(String templateId,String telephone,String param){
DefaultProfile profile = DefaultProfile.getProfile(ConstantUtils.REGION_ID, ConstantUtils.ACCESS_KEY_ID, ConstantUtils.SECRET);
IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest();
request.setSysMethod(MethodType.POST);
request.setSysDomain("dysmsapi.aliyuncs.com");
request.setSysVersion("2017-05-25");
request.setSysAction("SendSms");
request.putQueryParameter("RegionId",ConstantUtils.REGION_ID);
request.putQueryParameter("PhoneNumbers",telephone);
request.putQueryParameter("SignName",ConstantUtils.NOTICE_NAME);
request.putQueryParameter("TemplateCode",templateId);
// if (StringUtils.isEmpty(param)){
// request.putQueryParameter("TemplateParam","{ \"code\":\""+verifyCode +"\"}");
// }
request.putQueryParameter("TemplateParam",param);
CommonResponse response = null;
try
{
response = client.getCommonResponse(request);
return ConstantUtils.SUCCESS_SEND_OUT;
} catch(
Exception e)
{
e.printStackTrace();
return ConstantUtils.FAIL_SEND_OUT;
}
}
public static void main(String[] args) {
String param = "{ \"company\":\""+"基金会"+ "\",\"time\":\""+"2020-01-02" +"\",\"address\":\""+"上海市" +"\"}";
sendNoticeSMS("SMS_215336604","15201936167",param);
}
}
package com.subsidy.util;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.UUID;
public class SecretUtils {
/**
* 对用户登录密码进行MD5加密
*
* @param str
* @return
*/
public static String getMD5String(String str) {
try {
// 生成一个MD5加密计算摘要
MessageDigest md = MessageDigest.getInstance("MD5");
// 计算md5函数
md.update(str.getBytes());
// digest()最后确定返回md5 hash值,返回值为8位字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符
// BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值
//一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方)
return new BigInteger(1, md.digest()).toString(16);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 对字符串进行SHA加密
*
* @param
*/
public static String getSHAString(String str) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
byte[] byteArray = str.getBytes(StandardCharsets.UTF_8);
byte[] md5Bytes = sha.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++) {
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16) {
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
} catch (Exception e) {
return null;
}
}
private static byte[] md5(String s)
{
MessageDigest algorithm;
try
{
algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(s.getBytes("UTF-8"));
byte[] messageDigest = algorithm.digest();
return messageDigest;
}
catch (Exception e)
{
}
return null;
}
private static final String toHex(byte hash[])
{
if (hash == null)
{
return null;
}
StringBuffer buf = new StringBuffer(hash.length * 2);
int i;
for (i = 0; i < hash.length; i++)
{
if ((hash[i] & 0xff) < 0x10)
{
buf.append("0");
}
buf.append(Long.toString(hash[i] & 0xff, 16));
}
return buf.toString();
}
public static String hash(String s)
{
try
{
return new String(toHex(md5(s)).getBytes("UTF-8"), "UTF-8");
}
catch (Exception e)
{
return s;
}
}
public static void main(String[] args) {
String uuid = UUID.randomUUID().toString();
System.out.println(uuid);
System.out.println(hash(uuid+"ixihs"));
}
}
\ No newline at end of file
package com.subsidy.util;
import sun.misc.BASE64Encoder;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;
/**
* @author: tuyp
* @create: 2020-07-29 12:42
*/
public class Signature {
private String secretId;
private String secretKey;
private long currentTime;
private int random;
private int signValidDuration;
private static final String HMAC_ALGORITHM = "HmacSHA1";
private static final String CONTENT_CHARSET = "UTF-8";
public static byte[] byteMerger(byte[] byte1, byte[] byte2) {
byte[] byte3 = new byte[byte1.length + byte2.length];
System.arraycopy(byte1, 0, byte3, 0, byte1.length);
System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length);
return byte3;
}
public String getUploadSignature() throws Exception {
String strSign = "";
String contextStr = "";
long endTime = (currentTime + signValidDuration);
contextStr += "secretId=" + java.net.URLEncoder.encode(secretId, "utf8");
contextStr += "&currentTimeStamp=" + currentTime;
contextStr += "&expireTime=" + endTime;
contextStr += "&random=" + random;
try {
Mac mac = Mac.getInstance(HMAC_ALGORITHM);
SecretKeySpec secretKey = new SecretKeySpec(this.secretKey.getBytes(CONTENT_CHARSET), mac.getAlgorithm());
mac.init(secretKey);
byte[] hash = mac.doFinal(contextStr.getBytes(CONTENT_CHARSET));
byte[] sigBuf = byteMerger(hash, contextStr.getBytes(StandardCharsets.UTF_8));
strSign = base64Encode(sigBuf);
strSign = strSign.replace(" ", "").replace("\n", "").replace("\r", "");
} catch (Exception e) {
throw e;
}
return strSign;
}
private String base64Encode(byte[] buffer) {
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(buffer);
}
public void setSecretId(String secretId) {
this.secretId = secretId;
}
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
}
public void setCurrentTime(long currentTime) {
this.currentTime = currentTime;
}
public void setRandom(int random) {
this.random = random;
}
public void setSignValidDuration(int signValidDuration) {
this.signValidDuration = signValidDuration;
}
}
package com.subsidy.util;
import java.security.MessageDigest;
import java.util.Random;
public class TestMain {
public static void main(String[] args) {
String password = "123456";
String saltCode = getRandomCharAndNumr(5);
String encryptString = encrypt("91ebn" + password);
System.out.println(encryptString);
}
public static String encrypt(String string) {
String encryptedString = string;
char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
try {
byte[] btInput = string.getBytes();
MessageDigest mdInst = MessageDigest.getInstance("MD5");
mdInst.update(btInput);
byte[] md = mdInst.digest();
int j = md.length;
char[] str = new char[j * 2];
int k = 0;
for (int i = 0; i < j; i++) {
byte byte0 = md[i];
str[k++] = hexDigits[byte0 >>> 4 & 0xf];
str[k++] = hexDigits[byte0 & 0xf];
}
encryptedString = new String(str);
return encryptedString;
} catch (Exception e) {
e.printStackTrace();
return encryptedString;
}
}
/**
* 获取随机字母数字组合
*
* @param length
* 字符串长度
* @return
*/
public static String getRandomCharAndNumr(Integer length) {
String str = "";
Random random = new Random();
for (int i = 0; i < length; i++) {
boolean b = random.nextBoolean();
if (b) { // 字符串
// int choice = random.nextBoolean() ? 65 : 97; 取得65大写字母还是97小写字母
str += (char) (97 + random.nextInt(26));// 取得大写字母
} else { // 数字
str += String.valueOf(random.nextInt(10));
}
}
return str;
}
}
package com.subsidy.util.excel;
import java.lang.annotation.*;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExcelColumn {
String value() default "";
int col() default 1;
}
package com.subsidy.util.excel;
import java.lang.annotation.*;
/**
* <p>
* excel 字段
* </p>
*
* @author DengMin
* @date Created in 2020/08/28
*/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExcelColumnUtil {
String value() default "";
int col() default 0;
}
package com.subsidy.util.excel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.CharUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Excel工具
*
* @author DengMin
* @date 2019/08/27 13:57
**/
@Slf4j
public class ExcelUtil {
private final static String EXCEL2003 = "xls";
private final static String EXCEL2007 = "xlsx";
/**
* 导入excel文件
* @param path
* @param cls
* @param file
* @param <T>
* @return
*/
public static <T> List<T> readExcel(String path, Class<T> cls, MultipartFile file) {
String fileName = file.getOriginalFilename();
if(!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) {
log.info("上传文件格式不正确");
// throw new HTTPException(10022);
}
List<T> dataList = new ArrayList<>();
Workbook workbook = null;
try {
InputStream is = file.getInputStream();
if (fileName.endsWith(EXCEL2007)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new XSSFWorkbook(is);
}
if(fileName.endsWith(EXCEL2003)) {
// FileInputStream is = new FileInputStream(new File(path));
workbook = new HSSFWorkbook(is);
}
if (workbook != null) {
Map<String, List<Field>> classMap = new HashMap<>();
List<Field> fields = Stream.of(cls.getDeclaredFields()).collect(Collectors.toList());
fields.forEach(field -> {
ExcelColumnUtil annotation = field.getAnnotation(ExcelColumnUtil.class);
if (annotation != null) {
String value = annotation.value();
if(StringUtils.isBlank(value)) {
return;
}
if(!classMap.containsKey(value)) {
classMap.put(value, new ArrayList<>());
}
field.setAccessible(true);
classMap.get(value).add(field);
}
});
//索引-->columns
Map<Integer, List<Field>> reflectionMap = new HashMap<>();
//默认读取第一个sheet
Sheet sheet = workbook.getSheetAt(0);
boolean firstRow = true;
for (int i = 0; i <= sheet.getLastRowNum(); i++) {
Row row = sheet.getRow(i);
//提取标题
if (firstRow) {
for (int j = 0; j <= row.getLastCellNum(); j++) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (classMap.containsKey(cellValue)) {
reflectionMap.put(j, classMap.get(cellValue));
}
}
firstRow = false;
} else {
//忽略空白行
if (row == null) {
continue;
}
try {
T t = cls.newInstance();
//判断是否为空白行
boolean allBlank = true;
for (int j = 0; j <= row.getLastCellNum(); j++) {
if (reflectionMap.containsKey(j)) {
Cell cell = row.getCell(j);
String cellValue = getCellValue(cell);
if (StringUtils.isNotBlank(cellValue)) {
allBlank = false;
}
List<Field> fieldList = reflectionMap.get(j);
fieldList.forEach(x -> {
try {
handleField(t, cellValue, x);
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("reflect field:%s value:%s exception!", x.getName(), cellValue), e);
}
});
}
}
if(!allBlank) {
dataList.add(t);
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse row:%s exception!", i), e);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (Exception e) {
e.printStackTrace();
log.error(String.format("parse excel exception!"), e);
}
}
}
return dataList;
}
/**
* 导出excel文件
* @param list
* @param cls
* @param <T>
*/
public static <T> void writeExcel(List<T> list, Class cls) {
ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
HttpServletResponse response = servletRequestAttributes.getResponse();
Field[] fields = cls.getDeclaredFields();
List<Field> fieldList = Arrays.stream(fields).filter(field -> {
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
if(annotation != null) {
field.setAccessible(true);
return true;
}
return false;
}).sorted(Comparator.comparing(field -> {
int col = 0;
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
if(annotation != null) {
col = annotation.col();
}
return col;
})).collect(Collectors.toList());
Workbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();
AtomicInteger ai = new AtomicInteger();
{
Row row = sheet.createRow(ai.getAndIncrement());
AtomicInteger at = new AtomicInteger();
fieldList.forEach(field -> {
ExcelColumn annotation = field.getAnnotation(ExcelColumn.class);
String columnName = "";
if (annotation != null) {
columnName = annotation.value();
}
Cell cell = row.createCell(at.getAndIncrement());
CellStyle cellStyle = wb.createCellStyle();
cellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
Font font = wb.createFont();
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
cellStyle.setFont(font);
cell.setCellStyle(cellStyle);
cell.setCellValue(columnName);
});
if (list != null) {
list.forEach(data -> {
Row r = sheet.createRow(ai.getAndIncrement());
AtomicInteger a = new AtomicInteger();
fieldList.forEach(field -> {
try {
Class<?> type = field.getType();
Object value = field.get(data);
Cell cell = r.createCell(a.getAndIncrement());
if (value != null) {
cell.setCellValue(value.toString());
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
});
});
for (int i = 0; i < list.size(); i++) {
sheet.autoSizeColumn(i);
}
}
String fileName = String.valueOf(new Date().getTime());
buildExcelDocument(fileName + "." + EXCEL2007, wb, response);
}
}
private static void setStyle(CellStyle cellStyle) {
// 水平居中
cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
// 垂直居中
cellStyle.setVerticalAlignment(CellStyle.ALIGN_CENTER);
// 边框
cellStyle.setBorderTop(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderLeft(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderRight(CellStyle.BORDER_THIN);
// 边框
cellStyle.setBorderBottom(CellStyle.BORDER_THIN);
}
private static <T> void handleField(T t, String value, Field field) throws Exception {
Class<?> type = field.getType();
if (type == null || type == void.class || StringUtils.isBlank(value)) {
return;
}
if (type == Object.class) {
field.set(t, value);
//数字类型
} else if (type.getSuperclass() == null || type.getSuperclass() == Number.class) {
if (type == int.class || type == Integer.class) {
field.set(t, NumberUtils.toInt(value));
} else if (type == long.class || type == Long.class) {
field.set(t, NumberUtils.toLong(value));
} else if (type == byte.class || type == Byte.class) {
field.set(t, NumberUtils.toByte(value));
} else if (type == short.class || type == Short.class) {
field.set(t, NumberUtils.toShort(value));
} else if (type == double.class || type == Double.class) {
field.set(t, NumberUtils.toDouble(value));
} else if (type == float.class || type == Float.class) {
field.set(t, NumberUtils.toFloat(value));
} else if (type == char.class || type == Character.class) {
field.set(t, CharUtils.toChar(value));
} else if (type == boolean.class) {
field.set(t, BooleanUtils.toBoolean(value));
} else if (type == BigDecimal.class) {
field.set(t, new BigDecimal(value));
}
} else if (type == Boolean.class) {
field.set(t, BooleanUtils.toBoolean(value));
} else if (type == Date.class) {
//
field.set(t, value);
} else if (type == String.class) {
field.set(t, value);
} else {
Constructor<?> constructor = type.getConstructor(String.class);
field.set(t, constructor.newInstance(value));
}
}
private static String getCellValue(Cell cell) {
if (cell == null) {
return "";
}
if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
if (DateUtil.isCellDateFormatted(cell)) {
return HSSFDateUtil.getJavaDate(cell.getNumericCellValue()).toString();
} else {
return new BigDecimal(cell.getNumericCellValue()).toString();
}
} else if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
return StringUtils.trimToEmpty(cell.getStringCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
return StringUtils.trimToEmpty(cell.getCellFormula());
} else if (cell.getCellType() == Cell.CELL_TYPE_BLANK) {
return "";
} else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
return String.valueOf(cell.getBooleanCellValue());
} else if (cell.getCellType() == Cell.CELL_TYPE_ERROR) {
return "ERROR";
} else {
return cell.toString().trim();
}
}
private static void buildExcelDocument(String fileName, Workbook wb, HttpServletResponse response){
try {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-Disposition", "attachment;filename="+ URLEncoder.encode(fileName, "utf-8"));
response.flushBuffer();
wb.write(response.getOutputStream());
} catch (IOException e) {
log.error(String.format("downLoad excel exception"), e);
}
}
private static void buildExcelFile(String path, Workbook wb){
File file = new File(path);
if (file.exists()) {
file.delete();
}
try {
wb.write(new FileOutputStream(file));
} catch (Exception e) {
log.error(String.format("downLoad excel exception"), e);
}
}
}
package com.subsidy.util.tree;
import lombok.Data;
@Data
public class Node implements Comparable<Node> {
//主键
private String id;
//同级节点第几个元素
private String number;
//1.1
private String text;
//父节点
private String parentId;
private int level;
public Node(String id, String number, String parentId, int level) {
this.id = id;
this.number = number;
this.parentId = parentId;
this.level = level;
}
@Override
public int compareTo(Node o) {
if (this.level != o.level) {
return o.level - this.level;
} else {
if(this.number==null){
return -1;
}
return this.number.compareTo(o.number);
}
}
}
package com.subsidy.util.tree;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class NumberTree {
private String id;
private List<Node> nodeList;
private String separator;
private int idSeq;
private SerialNumber number;
public NumberTree(String separator, SerialNumber number) {
init();
this.separator = separator;
this.number = number;
}
public void init() {
idSeq = 1;
this.separator = ".";
if (this.nodeList == null) {
nodeList = new ArrayList<Node>();
}
}
/**
* <p>功能描述:根据父节点获取所有子节点。</p>
*/
public List<Node> getChildNodes(Node pNode) {
String pId = pNode.getId();
return getChildNodes(pId);
}
/**
* <p>功能描述:根据父节点获取所有子节点。</p>
*/
public List<Node> getChildNodes(String pId) {
List<Node> childNodes = new ArrayList<Node>();
for (Node n : nodeList) {
if (pId.equals(n.getParentId())) {
childNodes.add(n);
}
}
return childNodes;
}
/**
* <p>功能描述:获取本级值最大的节点。</p>
*/
public Node getMaxNodeForThisLevel(Node pNode) {
List<Node> childList = getChildNodes(pNode);
Node root = getRoot(nodeList);
if (childList.size() <= 0) {
return null;
}
Node maxNode = root;
for (Node node : childList) {
if (maxNode.getNumber().compareTo(node.getNumber()) < 0) {
maxNode = node;
}
}
return maxNode;
}
/**
* <p>功能描述:生成下一个子节点。</p>
*/
public Node generateNextChildNode(Node node) {
Node newNode = null;
Node maxNode = getMaxNodeForThisLevel(node);
String nextNumber = number.firstNumber();
int level = node.getLevel();
if (maxNode != null && !"0".equals(maxNode.getId())) {//本级存在子节点,且非根节点
nextNumber = number.produceNext(maxNode.getNumber());
level = maxNode.getLevel();
}
newNode = new Node(String.valueOf(++idSeq), nextNumber, node.getId(), level);
generateNodeText(newNode, nextNumber);
return newNode;
}
/**
*
* <p>功能描述:获取父节点。</p>
*/
public Node getParentNode(Node node) {
for (Node n : nodeList) {
if (node.getParentId() == n.getId()) {
return n;
}
}
return node;
}
/**
* <p>功能描述:生成节点路径。</p>
*/
public void generateNodeText(Node node, String text) {
if (node == null || "0".equals(node.getId())) {
return;
}
Node pNode = getParentNode(node);
if (!"0".equals(pNode.getId())) {
text = pNode.getText() + separator + text;
}
node.setText(text);
}
/**
* <p>功能描述:遍历所有树节点。</p>
*/
public void traverseNodeList(Node node) {
if(node==null){
node = getRoot(nodeList);
}
List<Node> childNodes = getChildNodes(node);
System.out.println(node.getText());
if (childNodes.size() > 0) {
for (Node n : childNodes) {
traverseNodeList(n);
}
}
}
public static void main(String[] args) {
SerialNumber number = new SerialNumber();
NumberTree treeNode = new NumberTree(".", number);
addSomeNodes(treeNode);
treeNode.traverseNodeList(null);
}
/**
* <p>功能描述:获取根节点。</p>
*/
public Node getRoot(List<Node> nodeList) {
Node root = null;
if (nodeList.size() <= 0 || (root = getNodeById(nodeList, "0")) == null) {
root = createRoot();
nodeList.add(root);
}
return root;
}
private Node getNodeById(List<Node> nodeList, String id) {
Node node = null;
if(id!=null){
for (Node n : nodeList) {
if (id.equals(n.getId())) {
node = n;
break;
}
}
}
return node;
}
private Node createRoot() {
Node root = new Node("0", number.rootNumber(), "-1", 0);
root.setText("0");
return root;
}
/**
* <p>功能描述:测试添加节点。</p>
*/
private static Node addSomeNodes(NumberTree tree) {
Node root = tree.getRoot(tree.nodeList);
Node node1 = getNextNode(tree, root);//1
Node node2 = getNextNode(tree, root);//2
Node node3 = getNextNode(tree, root);//3
Node node11 = getNextNode(tree, node1);//1.1
Node node12 = getNextNode(tree, node1);//1.2
Node node21 = getNextNode(tree, node2);//2.1
Node node211 = getNextNode(tree, node21);//2.1.1
Node node212 = getNextNode(tree, node21);//2.1.2
Node node22 = getNextNode(tree, node2);//2.2
Node node221 = getNextNode(tree, node22);//2.2.1
Node node31 = getNextNode(tree, node3);
Node node32 = getNextNode(tree, node3);
Node node311 = getNextNode(tree, node31);
Node node3111 = getNextNode(tree, node311);
return root;
}
public static Node getNextNode(NumberTree tree, Node pNode) {
Node node = tree.generateNextChildNode(pNode);
if (node != null) {
tree.nodeList.add(node);
}
return node;
}
}
package com.subsidy.util.tree;
public class SerialNumber{
public String produceNext(String crrnt) {
String next = "0";
if (crrnt != null) {
try {
int crrntNum = Integer.parseInt(crrnt);
next = String.valueOf(crrntNum + 1);
} catch (Exception e) {
System.err.println("非数字类型的字符串!");
}
}
return next;
}
public String rootNumber() {
return "0";
}
public String firstNumber() {
return "1";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.AdministerMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.AdministerDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="telephone" property="telephone" />
<result column="password" property="password" />
<result column="user_name" property="userName" />
<result column="short_name" property="shortName" />
<result column="img" property="img" />
<result column="banner" property="banner" />
<result column="status" property="status" />
<result column="field" property="field" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, telephone, password, user_name, short_name, img, banner, status, field
</sql>
<select id="getPermissions" resultType="com.subsidy.vo.administer.PermissionsVO">
SELECT DISTINCT
t4.*
FROM
role_administer_mapping t
LEFT JOIN role_dict t2 ON t.role_id = t2.id
LEFT JOIN role_permission_mapping t3 ON t2.id = t3.role_id
LEFT JOIN permissions_dict t4 ON t3.permission_id = t4.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t3.delete_date IS NULL
AND t4.delete_date IS NULL
<if test="id !=null and id !=''">
and t.administer_id = #{id}
</if>
</select>
<select id="operators" resultType="com.subsidy.vo.administer.OperatorsVO">
SELECT
t.id,
t.telephone,
t.user_name,
t.field,
t.banner,
t.short_name
FROM
administer t
WHERE
t.delete_date IS NULL
AND t.account_type = #{accountType}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.CategoryMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CategoryDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="name" property="name" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, name
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.ClassDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.ClassDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="class_name" property="className" />
<result column="course_id" property="courseId" />
<result column="start_date" property="startDate" />
<result column="end_date" property="endDate" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, class_name, course_id, start_date, end_date
</sql>
<select id="getAllClasses" resultType="com.subsidy.vo.classdict.GetAllClassesVO">
SELECT
t.id,
t.class_name,
t2.course_name,
t.start_date,
t.end_date,
t4.cnt
FROM
class_dict t
LEFT JOIN course_dict t2 ON t.course_id = t2.id
LEFT JOIN ( SELECT t3.class_id, sum( 1 ) AS cnt FROM class_member_mapping t3 WHERE t3.delete_date IS NULL GROUP BY t3.class_id ) t4 ON t.id = t4.class_id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
and t.company_id = #{companyId}
and t.class_name like concat('%',#{className} ,'%')
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.ClassMemberMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.ClassMemberMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="member_id" property="memberId" />
<result column="class_id" property="classId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, member_id, class_id
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.CourseContentMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CourseContentDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="course_id" property="courseId" />
<result column="content" property="content" />
<result column="order_no" property="orderNo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, course_id, content, order_no
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.CourseDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.CourseDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="course_name" property="courseName" />
<result column="category_id" property="categoryId" />
<result column="course_type" property="courseType" />
<result column="course_source" property="courseSource" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, course_name, category_id, course_type, course_source
</sql>
<select id="queryCourses" resultType="com.subsidy.model.CourseDictDO">
SELECT
*
FROM
course_dict t
WHERE
t.delete_date IS NULL
AND t.category_id = #{categoryId}
AND t.course_name like concat('%',#{courseName} ,'%')
AND t.course_source = #{courseName}
AND t.course_type = #{courseType}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.DepartmentDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.DepartmentDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="department_name" property="departmentName" />
<result column="parent_id" property="parentId" />
<result column="children" property="children" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, department_name, department_leader_id, parent_id, children
</sql>
<select id="getDepartments" parameterType="long" resultType="com.subsidy.dto.department.GetDepartmentsVO">
SELECT
t.*,
t2.cnt
FROM
department_dict t
LEFT JOIN ( SELECT id, sum( 1 ) AS cnt FROM member t WHERE t.delete_date IS NULL GROUP BY t.department_id ) t2 ON t.id = t2.id
WHERE
t.delete_date IS NULL
AND t.company_id =#{companyId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.ExerciseDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.ExerciseDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="exercise_type" property="exerciseType" />
<result column="course_id" property="courseId" />
<result column="difficulty" property="difficulty" />
<result column="title" property="title" />
<result column="items" property="items" />
<result column="right_answer" property="rightAnswer" />
<result column="detail" property="detail" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, exercise_type, course_id, difficulty, title, items, right_answer, detail
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.FileDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.FileDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="content_id" property="contentId" />
<result column="file_name" property="fileName" />
<result column="file_size" property="fileSize" />
<result column="order_no" property="orderNo" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, content_id, file_name, file_size, order_no
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.MemberMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.MemberDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="user_name" property="userName" />
<result column="telephone" property="telephone" />
<result column="password" property="password" />
<result column="gender" property="gender" />
<result column="image" property="image" />
<result column="id_card" property="idCard" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, user_name, telephone, password, gender, image, id_card
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.PermissionsDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.PermissionsDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="parent_id" property="parentId" />
<result column="name" property="name" />
<result column="children" property="children" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, parent_id, name, children
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RoleAdministerMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.RoleAdministerMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="administer_id" property="administerId" />
<result column="role_id" property="roleId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, administer_id, role_id
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RoleDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.RoleDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="role" property="role" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, role
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.RolePermissionMappingMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.RolePermissionMappingDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="role_id" property="roleId" />
<result column="permission_id" property="permissionId" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, role_id, permission_id
</sql>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.VodDictMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.subsidy.model.VodDictDO">
<id column="id" property="id" />
<result column="create_date" property="createDate" />
<result column="update_date" property="updateDate" />
<result column="delete_date" property="deleteDate" />
<result column="content_id" property="contentId" />
<result column="vod_name" property="vodName" />
<result column="vod_length" property="vodLength" />
<result column="vod_type" property="vodType" />
<result column="vod_size" property="vodSize" />
<result column="vod_url" property="vodUrl" />
<result column="vod_code" property="vodCode" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
create_date,
update_date,
delete_date,
id, content_id, vod_name, vod_length, vod_type, vod_size, vod_url, vod_code
</sql>
<select id="getContendVods" parameterType="com.subsidy.model.VodDictDO" resultType="com.subsidy.vo.vod.GetContendVodsVO">
SELECT
t.*,
t2.content
FROM
vod_dict t
LEFT JOIN course_content t2 ON t.content_id = t2.id
WHERE
t.delete_date IS NULL
AND t2.delete_date IS NULL
AND t.content_id = #{contentId}
and vod_name like concat('%',#{vodName} ,'%')
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!