Commit 4c3d0f57 authored by 郭建文's avatar 郭建文

分年级教学目标

parents
package com.chineseall.teachgoal;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
package com.chineseall.teachgoal;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class SpringBootStartApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
\ No newline at end of file
package com.chineseall.teachgoal;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
/**
* Created by guojw on 2020/4/10.
*/
@Configuration
@EnableSwagger2
public class Swagger2{
@Bean
public Docket createRestApi() {
ParameterBuilder ticketPar = new ParameterBuilder();
List<Parameter> pars = new ArrayList<Parameter>();
ticketPar.name("token").description("user token")
.modelRef(new ModelRef("string")).parameterType("header")
.required(false).build(); //header中的ticket参数非必填,传空也可以
ParameterBuilder userIdPar = new ParameterBuilder();
userIdPar.name("x-userId").description("user id")
.modelRef(new ModelRef("string")).parameterType("header")
.required(false).build();
pars.add(ticketPar.build()); //根据每个方法名也知道当前方法在设置什么参数
pars.add(userIdPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.chineseall.teachgoal.web"))
.build()
.globalOperationParameters(pars)
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("分年级教学目标API平台")
.description("")
.version("1.0")
.build();
}
}
package com.chineseall.teachgoal.configurer;
import org.springframework.stereotype.Component;
import com.chineseall.teachgoal.model.User;
/**
* 拦截器
* @ 用来判断用户的
*1. 当preHandle方法返回false时,从当前拦截器往回执行所有拦截器的afterCompletion方法,再退出拦截器链。也就是说,请求不继续往下传了,直接沿着来的链往回跑。
2.当preHandle方法全为true时,执行下一个拦截器,直到所有拦截器执行完。再运行被拦截的Controller。然后进入拦截器链,运
行所有拦截器的postHandle方法,完后从最后一个拦截器往回执行所有拦截器的afterCompletion方法.
*/
//@component (把普通pojo实例化到spring容器中,相当于配置文件中的
@Component
public class HostHolder {
private static ThreadLocal<User> users = new ThreadLocal<User>();
public static User getUser() {
return users.get();
}
public static void setUser(User user) {
users.set(user);
}
public static void clear() {
users.remove();
}
}
package com.chineseall.teachgoal.configurer;
import com.github.pagehelper.PageHelper;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import tk.mybatis.spring.mapper.MapperScannerConfigurer;
import javax.sql.DataSource;
import java.util.Properties;
import static com.chineseall.teachgoal.core.ProjectConstant.*;
/**
* Mybatis & Mapper & PageHelper 配置
*/
@Configuration
public class MybatisConfigurer {
@Bean
public SqlSessionFactory sqlSessionFactoryBean(DataSource dataSource) throws Exception {
SqlSessionFactoryBean factory = new SqlSessionFactoryBean();
factory.setDataSource(dataSource);
factory.setTypeAliasesPackage(MODEL_PACKAGE);
//配置分页插件,详情请查阅官方文档
PageHelper pageHelper = new PageHelper();
Properties properties = new Properties();
properties.setProperty("pageSizeZero", "true");//分页尺寸为0时查询所有纪录不再执行分页
properties.setProperty("reasonable", "true");//页码<=0 查询第一页,页码>=总页数查询最后一页
properties.setProperty("supportMethodsArguments", "true");//支持通过 Mapper 接口参数来传递分页参数
pageHelper.setProperties(properties);
//添加插件
factory.setPlugins(new Interceptor[]{pageHelper});
//添加XML目录
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
factory.setMapperLocations(resolver.getResources("classpath:mapper/*.xml"));
return factory.getObject();
}
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setSqlSessionFactoryBeanName("sqlSessionFactoryBean");
mapperScannerConfigurer.setBasePackage(MAPPER_PACKAGE);
//配置通用Mapper,详情请查阅官方文档
Properties properties = new Properties();
properties.setProperty("mappers", MAPPER_INTERFACE_REFERENCE);
properties.setProperty("notEmpty", "false");//insert、update是否判断字符串类型!='' 即 test="str != null"表达式内是否追加 and str != ''
properties.setProperty("IDENTITY", "MYSQL");
mapperScannerConfigurer.setProperties(properties);
return mapperScannerConfigurer;
}
}
package com.chineseall.teachgoal.configurer;
import com.alibaba.fastjson.JSON;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* 拦截器
* @ 用来判断用户的
*1. 当preHandle方法返回false时,从当前拦截器往回执行所有拦截器的afterCompletion方法,再退出拦截器链。也就是说,请求不继续往下传了,直接沿着来的链往回跑。
2.当preHandle方法全为true时,执行下一个拦截器,直到所有拦截器执行完。再运行被拦截的Controller。然后进入拦截器链,运
行所有拦截器的postHandle方法,完后从最后一个拦截器往回执行所有拦截器的afterCompletion方法.
*/
@Component
public class PassportInterceptor extends HandlerInterceptorAdapter {
private final Logger logger = LoggerFactory.getLogger(PassportInterceptor.class);
@Value("${http.PlatCallUrl}")
private String platCallUrl;
//判断然后进行用户拦截
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
if (request.getMethod().equals("OPTIONS")) {
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "*");
//response.setHeader("Access-Control-Allow-Headers", "Content-Type,token");
response.setHeader("Access-Control-Allow-Headers", "*");
response.setHeader("Access-Control-Expose-Headers", "*");
response.setStatus(HttpStatus.OK.value());
return false;
}
//getHeadersInfo(request);
/*String tickets = null;
String clientId=null;
String userId=null;
if(request.getCookies() != null){
for(Cookie cookie : request.getCookies()){
if(cookie.getName().equals("token")){
tickets = cookie.getValue();
break;
}
}
}
if(request.getHeader("token") != null){
tickets=(String) request.getHeaders("token").nextElement();
if(request.getParameter("clientId")!=null) {
clientId = request.getParameter("clientId");
}
else
{
clientId ="a29ed28f90d54689af1886ca12e899b6";
}
}
else{
return validTokenFalse(request, response,"token为空");
}
if(request.getHeader("x-userId") != null){
userId=(String) request.getHeaders("x-userId").nextElement();
}
else{
return validTokenFalse(request, response,"userId为空");
}
if(tickets != null){
//LoginTicket loginTickets = loginService.selectLoginTicketByTicket(tickets);
//if(loginTickets == null || loginTickets.getExpired().before(new Date()) || loginTickets.getStatus() ==false){
// return validTokenFalse(request, response,"token过期,请重新登录");
//}
//String url = "http://support.etextbook.cn/support/api/2/valid_token";
String url =platCallUrl+"/api/2/valid_token";
Map<String, String> headerMap = new HashMap<String, String>();
headerMap.put("token", tickets);
headerMap.put("Content-Type", "application/json;charset=UTF-8");
Map<String, String> param = new HashMap<String, String>();
param.put("clientId",clientId);
String requestBody= HttpClientUtil.send(url, param, headerMap,"GET", "UTF-8");
//JSONObject object=JSON.parseObject(requestBody);
JSONObject jsonx = JSON.parseObject(requestBody);
JSONObject jo = jsonx.getJSONObject("data");
String valid = jo.getString("valid");
if(!"1".equals(valid)){
return validTokenFalse(request, response,"token过期,请重新登录");
}
}
*/
return true;
}
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//就是为了能够在渲染之前所有的freemaker模板能够访问这个对象user,就是在所有的controller渲染之前将这个user加进去
if(modelAndView != null){
//这个其实就和model.addAttribute一样的功能,就是把这个变量与前端视图进行交互 //就是与header.html页面的user对应
//modelAndView.addObject("user",HostHolder.getUser());
}
}
@Override
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
//HostHolder.clear(); //当执行完成之后呢需要将变量清空
}
private Boolean validTokenFalse(HttpServletRequest request, HttpServletResponse response,String message)
{
logger.warn("认证失败,请求接口:{},请求IP:{},请求参数:{}",
request.getRequestURI(), getIpAddress(request), JSON.toJSONString(request.getParameterMap()));
Result result = new Result();
result.setCode(ResultCode.UNAUTHORIZED).setMessage(message);
responseResult(response, result);
return false;
}
private void responseResult(HttpServletResponse response, Result result) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setStatus(403);
//try {
//response.getWriter().write(JSON.toJSONString(result));
//} catch (IOException ex) {
// logger.error(ex.getMessage());
//}
}
private String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
// 如果是多级代理,那么取第一个ip为客户端ip
if (ip != null && ip.indexOf(",") != -1) {
ip = ip.substring(0, ip.indexOf(",")).trim();
}
return ip;
}
}
package com.chineseall.teachgoal.configurer;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultCode;
import com.chineseall.teachgoal.core.ServiceException;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.NoHandlerFoundException;
import org.springframework.web.servlet.config.annotation.*;
/**
* Spring MVC 配置
*/
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurationSupport {
private final Logger logger = LoggerFactory.getLogger(WebMvcConfigurer.class);
@Value("${spring.profiles.active}")
private String env;//当前激活的配置文件
//使用阿里 FastJson 作为JSON MessageConverter
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
FastJsonHttpMessageConverter converter = new FastJsonHttpMessageConverter();
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(SerializerFeature.WriteMapNullValue);//保留空的字段
//SerializerFeature.WriteNullStringAsEmpty,//String null -> ""
//SerializerFeature.WriteNullNumberAsZero//Number null -> 0
// 按需配置,更多参考FastJson文档哈
converter.setFastJsonConfig(config);
converter.setDefaultCharset(Charset.forName("UTF-8"));
converter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8));
converters.add(converter);
}
//统一异常处理
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers) {
exceptionResolvers.add(new HandlerExceptionResolver() {
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) {
Result result = new Result();
if (e instanceof ServiceException) {//业务失败的异常,如“账号或密码错误”
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
logger.info(e.getMessage());
} else if (e instanceof NoHandlerFoundException) {
result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + request.getRequestURI() + "] 不存在");
} else if (e instanceof ServletException) {
result.setCode(ResultCode.FAIL).setMessage(e.getMessage());
} else {
result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("接口 [" + request.getRequestURI() + "] 内部错误,请联系管理员");
String message;
if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler;
message = String.format("接口 [%s] 出现异常,方法:%s.%s,异常摘要:%s",
request.getRequestURI(),
handlerMethod.getBean().getClass().getName(),
handlerMethod.getMethod().getName(),
e.getMessage());
} else {
message = e.getMessage();
}
logger.error(message, e);
}
responseResult(response, result);
return new ModelAndView();
}
});
}
//解决跨域问题
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").
allowedOrigins("*").
allowedMethods("DELETE","GET", "POST", "OPTIONS", "PUT")
.allowedHeaders("*")
.exposedHeaders("access-control-allow-headers",
"access-control-allow-methods",
"access-control-allow-origin",
"access-control-max-age",
"X-Frame-Options")
.allowCredentials(true).maxAge(3600);
}
/*@Bean
public PassportInterceptor passportInterceptor() {
return new PassportInterceptor();
}*/
//添加拦截器
/*@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(passportInterceptor()).addPathPatterns("/**")
.excludePathPatterns("/swagger-resources/**","/webjars/**","/v2/**","/swagger-ui.html/**","/api/2/login/**","/teach/templateforclient/**","/book/catalog/noLogin/**","/url/**");
super.addInterceptors(registry);
//接口签名认证拦截器,该签名认证比较简单,实际项目中可以使用Json Web Token或其他更好的方式替代。
if (!"dev".equals(env) && !"test".equals(env) && !"prod".equals(env)) { //开发环境忽略签名认证
registry.addInterceptor(new HandlerInterceptorAdapter() {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//验证签名
boolean pass = validateSign(request);
if (pass) {
return true;
} else {
logger.warn("签名认证失败,请求接口:{},请求IP:{},请求参数:{}",
request.getRequestURI(), getIpAddress(request), JSON.toJSONString(request.getParameterMap()));
Result result = new Result();
result.setCode(ResultCode.UNAUTHORIZED).setMessage("签名认证失败");
responseResult(response, result);
return false;
}
}
});
}
}*/
private void responseResult(HttpServletResponse response, Result result) {
response.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setStatus(200);
try {
response.getWriter().write(JSON.toJSONString(result));
} catch (IOException ex) {
logger.error(ex.getMessage());
}
}
/**
* 一个简单的签名认证,规则:
* 1. 将请求参数按ascii码排序
* 2. 拼接为a=value&b=value...这样的字符串(不包含sign)
* 3. 混合密钥(secret)进行md5获得签名,与请求的签名进行比较
*/
private boolean validateSign(HttpServletRequest request) {
String requestSign = request.getParameter("sign");//获得请求签名,如sign=19e907700db7ad91318424a97c54ed57
if (StringUtils.isEmpty(requestSign)) {
return false;
}
List<String> keys = new ArrayList<String>(request.getParameterMap().keySet());
keys.remove("sign");//排除sign参数
Collections.sort(keys);//排序
StringBuilder sb = new StringBuilder();
for (String key : keys) {
sb.append(key).append("=").append(request.getParameter(key)).append("&");//拼接字符串
}
String linkString = sb.toString();
linkString = StringUtils.substring(linkString, 0, linkString.length() - 1);//去除最后一个'&'
String secret = "Potato";//密钥,自己修改
String sign = DigestUtils.md5Hex(linkString + secret);//混合密钥md5
return StringUtils.equals(sign, requestSign);//比较
}
private String getIpAddress(HttpServletRequest request) {
String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
// 如果是多级代理,那么取第一个ip为客户端ip
if (ip != null && ip.indexOf(",") != -1) {
ip = ip.substring(0, ip.indexOf(",")).trim();
}
return ip;
}
/**
* 防止@EnableMvc把默认的静态资源路径覆盖了,手动设置的方式
* @param registry
*/
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/").setCachePeriod(0);
//super.addResourceHandlers(registry);
}
@Value("${http.maxTotal}")
private Integer maxTotal;
@Value("${http.defaultMaxPerRoute}")
private Integer defaultMaxPerRoute;
@Value("${http.connectTimeout}")
private Integer connectTimeout;
@Value("${http.connectionRequestTimeout}")
private Integer connectionRequestTimeout;
@Value("${http.socketTimeout}")
private Integer socketTimeout;
@Value("${http.staleConnectionCheckEnabled}")
private boolean staleConnectionCheckEnabled;
/**
* 首先实例化一个连接池管理器,设置最大连接数、并发连接数
* @return
*/
@Bean(name = "httpClientConnectionManager")
public PoolingHttpClientConnectionManager getHttpClientConnectionManager(){
PoolingHttpClientConnectionManager httpClientConnectionManager = new PoolingHttpClientConnectionManager();
//最大连接数
httpClientConnectionManager.setMaxTotal(maxTotal);
//并发数
httpClientConnectionManager.setDefaultMaxPerRoute(defaultMaxPerRoute);
return httpClientConnectionManager;
}
/**
* 实例化连接池,设置连接池管理器。
* 这里需要以参数形式注入上面实例化的连接池管理器
* @param httpClientConnectionManager
* @return
*/
@Bean(name = "httpClientBuilder")
public HttpClientBuilder getHttpClientBuilder(@Qualifier("httpClientConnectionManager")PoolingHttpClientConnectionManager httpClientConnectionManager){
//HttpClientBuilder中的构造方法被protected修饰,所以这里不能直接使用new来实例化一个HttpClientBuilder,可以使用HttpClientBuilder提供的静态方法create()来获取HttpClientBuilder对象
HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
httpClientBuilder.setConnectionManager(httpClientConnectionManager);
return httpClientBuilder;
}
/**
* 注入连接池,用于获取httpClient
* @param httpClientBuilder
* @return
*/
@Bean
public CloseableHttpClient getCloseableHttpClient(@Qualifier("httpClientBuilder") HttpClientBuilder httpClientBuilder){
return httpClientBuilder.build();
}
/**
* Builder是RequestConfig的一个内部类
* 通过RequestConfig的custom方法来获取到一个Builder对象
* 设置builder的连接信息
* 这里还可以设置proxy,cookieSpec等属性。有需要的话可以在此设置
* @return
*/
@Bean(name = "builder")
public RequestConfig.Builder getBuilder(){
RequestConfig.Builder builder = RequestConfig.custom();
return builder.setConnectTimeout(connectTimeout)
.setConnectionRequestTimeout(connectionRequestTimeout)
.setSocketTimeout(socketTimeout)
.setStaleConnectionCheckEnabled(staleConnectionCheckEnabled);
}
/**
* 使用builder构建一个RequestConfig对象
* @param builder
* @return
*/
@Bean
public RequestConfig getRequestConfig(@Qualifier("builder") RequestConfig.Builder builder){
return builder.build();
}
}
package com.chineseall.teachgoal.convert;
/**
* 对象转换类
* 说明:根据入参和方法名To后面转换后的对象类型区分,
*/
public class Convert {
}
package com.chineseall.teachgoal.core;
import org.apache.ibatis.exceptions.TooManyResultsException;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Condition;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.List;
/**
* 基于通用MyBatis Mapper插件的Service接口的实现
*/
public abstract class AbstractService<T> implements Service<T> {
@Autowired
protected Mapper<T> mapper;
private Class<T> modelClass; // 当前泛型真实类型的Class
public AbstractService() {
ParameterizedType pt = (ParameterizedType) this.getClass().getGenericSuperclass();
modelClass = (Class<T>) pt.getActualTypeArguments()[0];
}
public void save(T model) {
mapper.insertSelective(model);
}
public void save(List<T> models) {
mapper.insertList(models);
}
public void deleteById(Long id) {
mapper.deleteByPrimaryKey(id);
}
public void deleteByIds(String ids) {
mapper.deleteByIds(ids);
}
public void update(T model) {
mapper.updateByPrimaryKeySelective(model);
}
public T findById(Long id) {
return mapper.selectByPrimaryKey(id);
}
@Override
public T findBy(String fieldName, Object value) throws TooManyResultsException {
try {
T model = modelClass.newInstance();
Field field = modelClass.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(model, value);
return mapper.selectOne(model);
} catch (ReflectiveOperationException e) {
throw new ServiceException(e.getMessage(), e);
}
}
public List<T> findByIds(String ids) {
return mapper.selectByIds(ids);
}
public List<T> findByCondition(Condition condition) {
return mapper.selectByCondition(condition);
}
public List<T> findAll() {
return mapper.selectAll();
}
}
package com.chineseall.teachgoal.core;
import java.util.Collection;
import java.util.Map;
/**
* Assert class
*
* @author guojw
* @description 断言判空类
* @date 2019/4/24 10:43
*/
public class Assert {
public static boolean isEmpty(Object obj){
return obj == null ;
}
public static boolean isEmpty(Collection obj){
return (obj == null || obj.isEmpty());
}
public static boolean isEmpty(Map obj)
{
return obj == null || obj.isEmpty();
}
public static boolean isEmpty(Object obj[]){
return obj == null || obj.length == 0 ;
}
public static boolean notEmpty(Object obj){
return !isEmpty(obj);
}
public static boolean notEmpty(Collection obj){
return !isEmpty(obj);
}
public static boolean notEmpty(Map obj)
{
return !isEmpty(obj);
}
public static boolean notEmpty(Object obj[]){
return !isEmpty(obj);
}
}
package com.chineseall.teachgoal.core;
import org.modelmapper.ModelMapper;
import org.modelmapper.TypeToken;
import org.modelmapper.convention.MatchingStrategies;
import java.util.List;
/**
* 转换javabean到目标类Util
*/
public class AutoMapperUtil {
public static <T> T mapperToModel(Object o, Class<T> clazz) {
if(o == null){
return null;
}
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setFullTypeMatchingRequired(true);
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
T t = modelMapper.map(o,clazz);
return t;
}
public static <T> List<T> mapperToBean(Object o, TypeToken typeToken) {
if(o == null){
return null;
}
ModelMapper modelMapper = new ModelMapper();
modelMapper.getConfiguration().setFullTypeMatchingRequired(true);
modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
return modelMapper.map(o, typeToken.getType());
}
}
/*
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.configurer.HostHolder;
*/
/**
* Service 层 基础接口,其他Service 接口 请继承该接口
*//*
public class BaseController {
protected Long getUserId() {
return HostHolder.getUser().getId();
}
protected String getOrgId() {
return HostHolder.getUser().getOrgId();
}
protected String getToken() {
return HostHolder.getUser().getToken();
}
}
*/
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.service.impl.client.ClientEService;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import sun.misc.BASE64Encoder;
import java.util.List;
public class BaseNoLoginController {
@Autowired
ClientEService clientEService;
@Value("${security.switch}")
private String isSecurity;
protected String validClientId(String tClientId,String timeStamp,String sign,String versionNo) {
if(versionNo!=null || "T".equals(isSecurity)) {
if(tClientId == null || timeStamp==null || sign==null)
{
return "SIGNFAIL";
}
if (tClientId != null) {
List<Client> clientCount = clientEService.selectByClientId(tClientId);
if (clientCount == null || clientCount.size() == 0) {
return "NOCLIENT";
}
String signdata = DigestUtils.sha1Hex(tClientId + timeStamp);
System.out.println(signdata);
if (!sign.equals(signdata)) {
return "SIGNFAIL";
}
}
}
return "SUCCESS";
}
public static String encryptBASE64(String key) {
byte[] bt = key.getBytes();
return (new BASE64Encoder()).encodeBuffer(bt);
}
}
package com.chineseall.teachgoal.core;
import java.util.*;
/**
* Created by zhangqing on 2018/9/11.
*/
public class CollectionUtils{
public static boolean isEmpty(Collection<?> coll) {
return coll == null || coll.isEmpty();
}
public static boolean isNotEmpty(Collection<?> coll) {
return !isEmpty(coll);
}
}
package com.chineseall.teachgoal.core;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* Created by zhangqing on 2018/9/11.
*/
public class DateUtil{
public static String getIndexDateTime() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmssSSS");
Date Now = new Date();
String NDate = formatter.format(Now);
return NDate;
}
/**
* 解析纯日期文本
* @param dateStr
* @return
*/
public static Date getDate(String dateStr) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = sdf.parse(dateStr);
return date;
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
/**
* 设置日期起始时分秒
* @param date
* @return
*/
public static Date setBeginTime(Date date) {
Calendar cal1 = Calendar.getInstance();
cal1.setTime(date);
cal1.set(Calendar.HOUR_OF_DAY, 0);
cal1.set(Calendar.MINUTE, 00);
cal1.set(Calendar.SECOND, 00);
return cal1.getTime();
}
/**
* 设置日期结束时分秒
* @param date
* @return
*/
public static Date setFinishTime(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
/**
* 获取时间时分秒字符串格式
* @param date
* @return
*/
public static String getStrDateTime(Date date){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String strDate = sdf.format(date);
return strDate;
}
}
package com.chineseall.teachgoal.core;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class ExcelUtil {
public static Workbook getWorkbok(InputStream in,String suffix) throws IOException{
Workbook wb = null;
if(suffix.equals("xls")){ //Excel 2003
wb = new HSSFWorkbook(in);
}else if(suffix.equals("xlsx")){ // Excel 2007/2010
wb = new XSSFWorkbook(in);
}
return wb;
}
public static Map<String,Object> getExcelContent(InputStream in,String suffix){
Map<String,Object> map = new HashMap<>();
List<Map<Object,Object>> list = new ArrayList<>();
Map<Integer,Object> cloumnMap = new HashMap<>();
try {
// 同时支持Excel 2003、2007
Workbook workbook = getWorkbok(in,suffix);
//Workbook workbook = WorkbookFactory.create(is); // 这种方式 Excel2003/2007/2010都是可以处理的
/**
* 设置当前excel中sheet的下标:0开始
*/
Sheet sheet = workbook.getSheetAt(0);
// 为跳过第一行目录设置count
int count = 0;
for (Row row : sheet) {
Map<Object,Object> rowList = new HashMap<>();
try {
// 跳过第一和第二行的目录
// if(count < 2 ) {
// count++;
// continue;
// }
if(row.getCell(0) == null || row.getCell(0).toString().equals("")){
continue;
}
count ++;
int end = row.getLastCellNum();
for (int i = 0; i < end; i++) {
Cell cell = row.getCell(i);
Object obj = "";
if(cell == null) {
}else{
obj = getValue(cell);
}
if(count == 1){
if(obj != "" && obj != null){
if(obj !=null && !"".equals(obj.toString())) {
Pattern p = Pattern.compile("\\s*|\t|\r|\n");
Matcher m = p.matcher(obj.toString());
obj = m.replaceAll("");
}
cloumnMap.put(i,obj);
}
}else {
if(cloumnMap.get(i) != null){
rowList.put(cloumnMap.get(i),obj);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
if(count != 1) {
list.add(rowList);
}
}
} catch (Exception e) {
e.printStackTrace();
}
List<Object> cloumnList = new ArrayList<>();
Set<Integer> set = cloumnMap.keySet();
for (Integer integer:set
) {
cloumnList.add(cloumnMap.get(integer));
}
map.put("cloumns",cloumnList);
map.put("items",list);
return map;
}
public static Object getValue(Cell cell) {
Object obj = "";
if(cell.getCellType().equals(CellType.BOOLEAN)){
obj = cell.getBooleanCellValue();
}else if(cell.getCellType().equals(CellType.ERROR)){
obj = cell.getErrorCellValue();
}else if(cell.getCellType().equals(CellType.NUMERIC)){
obj = cell.getNumericCellValue();
}else if(cell.getCellType().equals(CellType.STRING)){
obj = cell.getStringCellValue();
}else if(cell.getCellType().equals(CellType.FORMULA)){
obj = cell.getCellFormula();
}
return obj;
}
}
package com.chineseall.teachgoal.core;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
/**
* httpClient封装工具类
*
* @author hades
* @date 2017年6月1日 上午10:05:29
*/
public class HttpClientUtil {
/** 请求方式:GET */
public static final String METHOD_GET = "GET";
/** 请求方式:POST */
public static final String METHOD_POST = "POST";
/** 默认字符集:UTF-8 */
public static final String DEFAULT_CHARSET = "UTF-8";
/**
* 拼接URL参数
*
* @param url
* @param param
* @param encode
* @return
* @throws UnsupportedEncodingException
*/
public static String parseParam(String url, Map<String, String> param, String encode) throws UnsupportedEncodingException {
if (param != null && !param.isEmpty()) {
StringBuilder out = StringUtils.isBlank(url) ? new StringBuilder() : new StringBuilder(url).append(url.contains("?") ? "&" : "?");
for (Map.Entry<String, String> entry : param.entrySet()) {
out.append(entry.getKey());
out.append("=");
out.append(StringUtils.isBlank(encode) ? entry.getValue() : URLEncoder.encode(entry.getValue(), encode));
out.append("&");
}
return StringUtils.substringBeforeLast(out.toString(), "&");
}
return url;
}
/**
* 构造json格式字符串
*
* @param param
* @param encode
* @return
* @throws UnsupportedEncodingException
*/
public static String parseParamToJson(Map<String, String> param, String encode) throws UnsupportedEncodingException {
if (param != null && !param.isEmpty()) {
StringBuilder out = new StringBuilder();
out.append("{");
for (Map.Entry<String, String> entry : param.entrySet()) {
out.append("\"").append(entry.getKey()).append("\":");
out.append("\"").append(StringUtils.isBlank(encode) ? entry.getValue() : URLEncoder.encode(entry.getValue(), encode)).append("\"");
out.append(",");
}
return StringUtils.substringBeforeLast(out.toString(), ",") + "}";
}
return "{}";
}
/**
* 封装发送请求的基本方法
*
* @param url 请求地址。
* @param param 输入参数
* @param headerMap 覆盖默认请求头map
* @param requestMethod 请求方法。POST, GET
* @param charset
* @return
*/
public static String send(String url, Map<String, String> param, Map<String, String> headerMap, String requestMethod, String charset,
String... dataFormat) {
PrintWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
// GET请求,拼接参数
if (param != null && !param.isEmpty() && StringUtils.equals(requestMethod, METHOD_GET)) {
url = parseParam(url, param, charset);
}
HttpURLConnection conn = getConnection(url);
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 覆盖通用的请求属性
if (headerMap != null && !headerMap.isEmpty()) {
for (String key : headerMap.keySet()) {
conn.setRequestProperty(key, headerMap.get(key));
}
}
// 设置请求方法
conn.setRequestMethod(requestMethod);
// 设置连接主机超时时间(单位:毫秒)
conn.setConnectTimeout(60 * 1000);
// 设置从主机读取数据超时时间(单位:毫秒)
conn.setReadTimeout(60 * 1000);
// 设置从HttpURLConnection读入
conn.setDoInput(true);
// POST请求,拼接参数
if (param != null && !param.isEmpty() && StringUtils.equals(requestMethod, METHOD_POST)) {
// 设置向HttpURLConnection输出
conn.setDoOutput(true);
// 获取URLConnection对象对应的输出流
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
if (dataFormat != null && dataFormat.length == 1 && "json".equals(dataFormat[0])) {
out.print(parseParamToJson(param, null));
} else {
out.print(parseParam(null, param, null));
}
// flush输出流的缓冲
out.flush();
}
// 调用conn.getInputStream(),就将请求发送出去
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
// 关闭输出流
if (out != null) {
out.close();
}
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result.toString();
}
/**
* 向指定URL发送POST方式请求
*
* @param url
* @param param
* @return
*/
public static String post(String url, Map<String, String> param) {
return send(url, param, null, METHOD_POST, DEFAULT_CHARSET);
}
/**
* 向指定URL发送POST方式请求
*
* @param url
* @param param
* @param headerMap
* @return
*/
public static String post(String url, Map<String, String> param, Map<String, String> headerMap) {
return send(url, param, headerMap, METHOD_POST, DEFAULT_CHARSET);
}
/**
* 向指定URL发送POST方式请求
*
* @param url
* @param param
* @param headerMap
* @return
*/
public static String postJson(String url, Map<String, String> param) {
return send(url, param, null, METHOD_POST, DEFAULT_CHARSET, "json");
}
/**
* 向指定URL发送POST方式请求
*
* @param url
* @param param
* @param headerMap
* @return
*/
public static String postJson(String url, Map<String, String> param, Map<String, String> headerMap) {
return send(url, param, headerMap, METHOD_POST, DEFAULT_CHARSET, "json");
}
/**
* 向指定URL发送GET方式请求
*
* @param url
* @param param
* @return
*/
public static String get(String url, Map<String, String> param) {
return send(url, param, null, METHOD_GET, DEFAULT_CHARSET);
}
/**
* 通过Response向指定URL提交表单
*
* @param response
* @param url
* @param param
* @param method
*/
public static void form(HttpServletResponse response, String url, Map<String, String> param, String method) {
StringBuilder html = new StringBuilder();
html.append("<html><body onload=\"document.getElementById('form').submit()\">");
html.append("<form id='form' action='").append(url).append("' method='").append(method).append("'>");
if (param != null) {
for (Map.Entry<String, String> entry : param.entrySet()) {
html.append("<input type='hidden' name='").append(entry.getKey()).append("' value='").append(entry.getValue()).append("' />");
}
}
html.append("</form></body></html>");
try {
write(response, html.toString());
} catch (Throwable e) {
e.printStackTrace();
}
}
/**
* 向客户端输出内容
*
* @param response
* @param content
* @throws Throwable
*/
private static void write(HttpServletResponse response, String content) throws Throwable {
OutputStream os = null;
InputStream is = null;
try {
response.reset();
response.setContentType("text/html; charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
os = new BufferedOutputStream(response.getOutputStream());
os.write(((String) content).getBytes());
} finally {
if (is != null) {
is.close();
}
if (os != null) {
os.flush();
os.close();
}
}
}
public static String uploadFile(String url, Map<String, String> headerMap, File file) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
BufferedReader in = null;
FileInputStream fis = null;
StringBuilder result = new StringBuilder();
try {
// 打开和URL之间的连接
HttpURLConnection conn = getConnection(url);
// 设置通用的请求属性
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
// 覆盖通用的请求属性
if (headerMap != null && !headerMap.isEmpty()) {
for (String key : headerMap.keySet()) {
conn.setRequestProperty(key, headerMap.get(key));
}
}
// 设置请求方法
conn.setRequestMethod(METHOD_POST);
// 设置连接主机超时时间(单位:毫秒)
conn.setConnectTimeout(60 * 1000);
// 设置从主机读取数据超时时间(单位:毫秒)
conn.setReadTimeout(60 * 1000);
// 设置从HttpURLConnection读入
conn.setDoInput(true);
// 设置向HttpURLConnection输出
conn.setDoOutput(true);
// 获取URLConnection对象对应的输出流
bos = new BufferedOutputStream(conn.getOutputStream());
// 将文件写入到输出流
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
int len = -1;
byte[] b = new byte[1024];
while ((len = bis.read(b)) != -1) {
bos.write(b, 0, len);
}
// flush输出流的缓冲
bos.flush();
// 调用conn.getInputStream(),就将请求发送出去
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), DEFAULT_CHARSET));
String line;
while ((line = in.readLine()) != null) {
result.append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (bos != null) {
bos.close();
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
bos = null;
}
try {
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
in = null;
}
try {
if (bis != null) {
bis.close();
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
bis = null;
}
try {
if (fis != null) {
fis.close();
}
} catch (IOException ex) {
ex.printStackTrace();
} finally {
fis = null;
}
}
return result.toString();
}
/**
* 获取连接
*
* @param url
* @return
*/
public static HttpURLConnection getConnection(String url) {
try {
URL realUrl = new URL(url);
if ("https".equalsIgnoreCase(realUrl.getProtocol())) {
TrustManager tm = new CustomTrustManager();
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, new TrustManager[] { tm }, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
});
}
// 打开和URL之间的连接
return (HttpURLConnection) realUrl.openConnection();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
static class CustomTrustManager implements TrustManager, X509TrustManager {
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public boolean isServerTrusted(java.security.cert.X509Certificate[] certs) {
return true;
}
public boolean isClientTrusted(java.security.cert.X509Certificate[] certs) {
return true;
}
public void checkServerTrusted(java.security.cert.X509Certificate[] certs, String authType) throws java.security.cert.CertificateException {
return;
}
public void checkClientTrusted(java.security.cert.X509Certificate[] certs, String authType) throws java.security.cert.CertificateException {
return;
}
}
//public static void main(String[] args) throws UnsupportedEncodingException {
// String storageUrl = "https://127.0.0.1:9091/cas/getMenuJson?appCode=0000";
// String storageUrl = "http://gd-cas.etextbook.cn/support/api/2/upload_user_icon";
// File file = new File("C:\\Users\\Administrator\\Desktop\\发行平台\\发行平台\\3101644_075445358000_2.png");
// Map<String, String> headerMap = new HashMap<String, String>();
// headerMap.put("Content-Type", "application/json; charset=UTF-8");
// headerMap.put("content_md5", MD5Util.getMD5(file));
// headerMap.put("user_id", "445100000621");
// headerMap.put("client_id", "21de42f12e654eaab8ab100121877183");
// headerMap.put("file_name", URLEncoder.encode(file.getName(), "UTF-8"));
// headerMap.put("token", "45c53c9a966b4c7993020678cf2b5edf");
// System.out.println(uploadFile(storageUrl, headerMap, file));
// System.out.println(get(storageUrl, null));
//}
}
package com.chineseall.teachgoal.core;
import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by zhangqing on 2018/9/11.
*/
public class JavaBeanUtil{
private static Logger logger = LoggerFactory.getLogger(JavaBeanUtil.class);
/**
* 实体类转map
* @param obj
* @return
*/
public static Map<String, Object> convertBeanToMap(Object obj) {
if (obj == null) {
return null;
}
Map<String, Object> map = new HashMap<String, Object>();
try {
BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor property : propertyDescriptors) {
String key = property.getName();
// 过滤class属性
if (!key.equals("class")) {
// 得到property对应的getter方法
Method getter = property.getReadMethod();
Object value = getter.invoke(obj);
if(null==value){
map.put(key,"");
}else{
map.put(key,value);
}
}
}
} catch (Exception e) {
logger.error("convertBean2Map Error {}" ,e);
}
return map;
}
/**
* map 转实体类
* @param clazz
* @param map
* @param <T>
* @return
*/
public static <T> T convertMapToBean(Class<T> clazz, Map<String,Object> map) {
T obj = null;
try {
BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
obj = clazz.newInstance(); // 创建 JavaBean 对象
// 给 JavaBean 对象的属性赋值
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++) {
PropertyDescriptor descriptor = propertyDescriptors[i];
String propertyName = descriptor.getName();
if (map.containsKey(propertyName)) {
// 下面一句可以 try 起来,这样当一个属性赋值失败的时候就不会影响其他属性赋值。
Object value = map.get(propertyName);
if ("".equals(value)) {
value = null;
}
Object[] args = new Object[1];
args[0] = value;
descriptor.getWriteMethod().invoke(obj, args);
}
}
} catch (IllegalAccessException e) {
logger.error("convertMapToBean 实例化JavaBean失败 Error{}" ,e);
} catch (IntrospectionException e) {
logger.error("convertMapToBean 分析类属性失败 Error{}" ,e);
} catch (IllegalArgumentException e) {
logger.error("convertMapToBean 映射错误 Error{}" ,e);
} catch (InstantiationException e) {
logger.error("convertMapToBean 实例化 JavaBean 失败 Error{}" ,e);
}catch (InvocationTargetException e){
logger.error("convertMapToBean字段映射失败 Error{}" ,e);
}catch (Exception e){
logger.error("convertMapToBean Error{}" ,e);
}
return (T) obj;
}
//将map通过反射转化为实体
public static Object MapToModel(Map<String,Object> map,Object o) throws Exception{
if (!map.isEmpty()) {
for (String k : map.keySet()) {
Object v =null;
if (!k.isEmpty()) {
v = map.get(k);
}
Field[] fields = null;
fields = o.getClass().getDeclaredFields();
String clzName = o.getClass().getSimpleName();
for (Field field : fields) {
int mod = field.getModifiers();
if (field.getName().toUpperCase().equals(k.toUpperCase())) {
field.setAccessible(true);
//region--进行类型判断
String type=field.getType().toString();
if (type.endsWith("String")){
if (v!=null){
v=v.toString();
}else {
v="";
}
}
if (type.endsWith("Date")){
v=new Date(v.toString());
}
if (type.endsWith("Boolean")){
v=Boolean.getBoolean(v.toString());
}
if (type.endsWith("int")){
v=new Integer(v.toString());
}
if (type.endsWith("Long")){
v=new Long(v.toString());
}
//endregion
field.set(o, v);
}
}
}
}
return o;
}
/**
* 实体对象转成Map
* @param obj 实体对象
* @return
*/
public static Map<String, Object> object2Map(Object obj) {
Map<String, Object> map = new HashMap<>();
if (obj == null) {
return map;
}
Class clazz = obj.getClass();
Field[] fields = clazz.getDeclaredFields();
try {
for (Field field : fields) {
field.setAccessible(true);
map.put(field.getName(), field.get(obj));
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
/**
* Map转成实体对象
* @param map map实体对象包含属性
* @param clazz 实体对象类型
* @return
*/
public static Object map2Object(Map<String, Object> map, Class<?> clazz) {
if (map == null) {
return null;
}
Object obj = null;
try {
obj = clazz.newInstance();
Field[] fields = obj.getClass().getDeclaredFields();
for (Field field : fields) {
int mod = field.getModifiers();
if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
continue;
}
field.setAccessible(true);
field.set(obj, map.get(field.getName()));
}
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
package com.chineseall.teachgoal.core;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Aspect
@Component
public class LogManage {
//匹配com.chineseall.web路径下所有以Controller结尾的类,所有匹配类中的方法都会进行记录
@Pointcut("execution(* com.chineseall.teachgoal.web.*Controller..*(..))")
public void executeService() {
}
private final Logger logger = LoggerFactory.getLogger(this.getClass());
/**
* 前置通知:方法执行之前执行此操作,用来记录输入的参数信息
* @param joinPoint
*/
@Before("executeService()")
public void addBeforeLogger(JoinPoint joinPoint){
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
//获取参数
String[] paramNames = signature.getParameterNames();
StringBuilder nameStr = new StringBuilder();
Object[] objs = joinPoint.getArgs();
for (int i = 0; i < paramNames.length; i++) {
nameStr.append("{" + paramNames[i] + ":");
if (objs[i] != null) {
nameStr.append(objs[i].toString() + "},");
} else {
nameStr.append("null},");
}
}
logger.info(signature.toString());
logger.info("Args:" + nameStr);
}
/**
* 后置返回通知 方法结束后执行此操作,用来记录返回值信息
* 这里需要注意的是:
* 如果参数中的第一个参数为JoinPoint,则第二个参数为返回值的信息
* 如果参数中的第一个参数不为JoinPoint,则第一个参数为returning中对应的参数
* returning 限定了只有目标方法返回值与通知方法相应参数类型时才能执行后置返回通知,否则不执行,对于returning对应的通知方法参数为Object类型将匹配任何目标返回值
*/
@AfterReturning(value = "executeService()",returning = "result")
public void addAfterReturningLogger(JoinPoint joinPoint,Object result){
if (result != null) {
logger.info(joinPoint.getSignature().getName() + ".result:" + result.toString());
} else {
logger.info(joinPoint.getSignature().getName() + ".result:null");
}
}
/**
* 异常通知 当方法抛出异常后会执行此操作,记录异常信息
* @param joinPoint 切点
* @param ex 异常
*/
@AfterThrowing(value = "executeService()", throwing ="ex")
public void addAfterThrowingLogger(JoinPoint joinPoint,Exception ex){
logger.error(joinPoint.getSignature().getName() + ex.getMessage());
}
}
package com.chineseall.teachgoal.core;
import tk.mybatis.mapper.common.BaseMapper;
import tk.mybatis.mapper.common.ConditionMapper;
import tk.mybatis.mapper.common.IdsMapper;
import tk.mybatis.mapper.common.special.InsertListMapper;
/**
* 定制版MyBatis Mapper插件接口,如需其他接口参考官方文档自行添加。
*/
public interface Mapper<T>
extends
BaseMapper<T>,
ConditionMapper<T>,
IdsMapper<T>,
InsertListMapper<T> {
}
package com.chineseall.teachgoal.core;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.io.IOException;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.model.CopyObjectResult;
import com.aliyun.oss.model.ObjectMetadata;
//Created by zhangqing on 2018/9/11.
public class ObsClientUtil {
public static void upload(File tempFile, String objectName)throws IOException{
// Endpoint以杭州为例,其它Region请按实际情况填写。
String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
// 云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用RAM子账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建。
String accessKeyId = "LTAIcnfFEMg0vX1B";
String accessKeySecret = "uZyZJ8cJPu190Z6Orz245fHBKNqaFO";
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 上传文件流。
InputStream inputStream = new FileInputStream(tempFile);
ossClient.putObject("press-annotation-file-test", objectName, inputStream);
// 关闭OSSClient。
ossClient.shutdown();
}
public static void uploadFile(String endpoint,
String accessKeyId,
String accessKeySecret,
String bucket,
String fileName,
File tempFile,
String objectName)throws IOException{
// Endpoint以杭州为例,其它Region请按实际情况填写。
//String endpoint = "http://oss-cn-shanghai.aliyuncs.com";
// 云账号AccessKey有所有API访问权限,建议遵循阿里云安全最佳实践,创建并使用RAM子账号进行API访问或日常运维,请登录 https://ram.console.aliyun.com 创建。
//String accessKeyId = "LTAIcnfFEMg0vX1B";
//String accessKeySecret = "uZyZJ8cJPu190Z6Orz245fHBKNqaFO";
// 创建上传Object的Metadata
ObjectMetadata meta = new ObjectMetadata();
meta.setContentDisposition("attachment;filename=\""+new String(fileName.getBytes(),"utf-8")+"\"");
//meta.setContentDisposition("attachment;filename=\""+URLEncoder.encode(fileName, "utf-8")+"\"");
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 上传文件流。
InputStream inputStream = new FileInputStream(tempFile);
ossClient.putObject(bucket, objectName, inputStream,meta);
// 关闭OSSClient。
ossClient.shutdown();
}
public static URL getDownLoadUrl(String endpoint,
String accessKeyId,
String accessKeySecret,
String bucketName,
String objectName) {
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 设置URL过期时间为1小时。
Date expiration = new Date(System.currentTimeMillis() + 3600 * 1000);
// 生成以GET方法访问的签名URL,访客可以直接通过浏览器访问相关内容。
URL url = ossClient.generatePresignedUrl(bucketName, objectName, expiration);
// 关闭OSSClient。
ossClient.shutdown();
return url;
}
public static void copyFile(String endpoint,
String accessKeyId,
String accessKeySecret,
String sourceBucketName,
String sourceObject,
String destinationBucketName,
String destinationObject)throws IOException{
// 创建OSSClient实例。
OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret);
// 拷贝文件。
CopyObjectResult result = ossClient.copyObject(sourceBucketName,sourceObject,destinationBucketName,destinationObject);
System.out.println("ETag: " + result.getETag() + " LastModified: " + result.getLastModified());
// AddBucketReplicationRequest request = new AddBucketReplicationRequest(sourceBucketName);
// request.setReplicationRuleID("");
// request.setTargetBucketName(destinationBucketName);
// // 目标Endpoint以北京为例。
// request.setTargetBucketLocation("oss-cn-shanghai");
// // 设置禁止同步历史数据。默认会同步历史数据。
// request.setEnableHistoricalObjectReplication(false);
// ossClient.addBucketReplication(request);
// 关闭OSSClient。
ossClient.shutdown();
}
}
package com.chineseall.teachgoal.core;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.service.impl.client.ClientEService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
public class OtherBaseController {
@Resource
private ClientEService clientEService;
protected String validClientId(HttpServletRequest request)
{
List<String> list = new ArrayList<>();
String clientCode = null;
Map<String, String> keyMap = new HashMap<String, String>();
Enumeration params = request.getParameterNames();
String timestamp = null;
while (params.hasMoreElements())
{
String key = (String) params.nextElement();
if (key.equals("sign")) continue;
String value = request.getParameter(key);
if (StringUtils.isNotEmpty(value))
{
list.add(key);
keyMap.put(key, value);
// System.out.println(key + "=" + value);
}
if (key.equals("clientCode"))
{
clientCode = value;
}
else if (key.equals("timestamp"))
{
timestamp = request.getParameter("timestamp");
}
}
Client client=clientEService.getByClientId(clientCode);
if(client==null) {
return "NOCLIENT";
}
if (StringUtils.isEmpty(timestamp))
{
// System.out.println("没有时间戳参数");
return "NOTIMESTAMP";
}
Collections.sort(list);
String sign1 = "";
for (int i = 0; i < list.size(); i++)
{
if (i > 0) sign1 += "&";
sign1 += list.get(i) + "=" + keyMap.get(list.get(i));
}
String sign = request.getParameter("sign");
//String key = "f67964c178b9402bacbsism09dlpwld";
sign1 += "&key=" + client.getClientKey();
System.out.println(sign1);
//sign1 = org.apache.commons.codec.digest.DigestUtils.md5Hex(sign1).toUpperCase();
sign1 =org.springframework.util.DigestUtils.md5DigestAsHex(sign1.getBytes()).toUpperCase();
System.out.println(sign1);
if (sign != null && sign.equals(sign1))
{
return "SUCCESS";
}
// System.out.println("签名错误");
return "SIGNFAIL";
}
}
package com.chineseall.teachgoal.core;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import java.util.function.Function;
/**
* @author Qbit
*/
@ApiModel("分页查询返回")
public class PageOut<V> {
@ApiModelProperty("一页条数")
private int pageSize = 10;
@ApiModelProperty("当前页码")
private int pageNumber = 1;
@ApiModelProperty("记录总条数")
private long totalSize;
@ApiModelProperty("总页数")
private long totalPage;
@ApiModelProperty("数据列表")
private List<V> data;
public PageOut()
{
}
/**
* 把page helper返回的page对象 转换成 pageOut 只能 转换泛型 一致的
*
*
* @param page
* @author ming
* @date 2018-03-22 15:38
*/
public static <V> PageOut<V> convertPageToPageOut(Page<V> page) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(page.getPageSize());
voPageOut.setPageNumber(page.getPageNum());
voPageOut.setTotalSize((int) page.getTotal());
voPageOut.setData(page.getResult());
return voPageOut;
}
/**
* page 转换为pageOut 类型不一致 使用 function格式的lambda即可
*
* @param page
* @param function 将 o 转换为v 的lambda函数表达式
* @author ming
* @date 2018-05-23 09:11
*/
public static <O, V> PageOut<V> convertPageToPageOut(Page<O> page, Function<O, V> function) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(page.getPageSize());
voPageOut.setPageNumber(page.getPageNum());
voPageOut.setTotalSize((int) page.getTotal());
//转换 o -> v
List<V> resultList = Lists.newArrayList();
page.getResult().forEach(f -> {
resultList.add(function.apply(f));
});
voPageOut.setData(resultList);
return voPageOut;
}
/**
* PageInfo 对象 转换成 pageOut 只能 转换泛型 一致的
*
*
* @param pageInfo
* @author liupy
* @date 2018-06-07
*/
public static <V> PageOut<V> convertPageToPageOut(PageInfo<V> pageInfo) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(pageInfo.getPageSize());
voPageOut.setPageNumber(pageInfo.getPageNum());
voPageOut.setTotalSize((int) pageInfo.getTotal());
voPageOut.setData(pageInfo.getList());
return voPageOut;
}
/**
* page 转换为pageOut 类型不一致 使用 function格式的lambda即可
*
* @param pageInfo
* @param function 将 o 转换为v 的lambda函数表达式
* @author ming
* @date 2018-05-23 09:11
*/
public static <O, V> PageOut<V> convertPageToPageOut(PageInfo<O> pageInfo, Function<O, V> function) {
PageOut<V> voPageOut = new PageOut<>();
voPageOut.setPageSize(pageInfo.getPageSize());
voPageOut.setPageNumber(pageInfo.getPageNum());
voPageOut.setTotalSize((int) pageInfo.getTotal());
//转换 o -> v
List<V> resultList = Lists.newArrayList();
pageInfo.getList().forEach(f -> {
resultList.add(function.apply(f));
});
voPageOut.setData(resultList);
return voPageOut;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNumber() {
return pageNumber;
}
public void setPageNumber(int pageNumber) {
this.pageNumber = pageNumber;
}
public long getTotalSize() {
return totalSize;
}
public void setTotalSize(long totalSize) {
this.totalSize = totalSize;
}
public long getTotalPage() {
return totalSize % pageSize == 0 ? totalSize / pageSize : (totalSize / pageSize + 1);
}
public List<V> getData() {
return data;
}
public void setData(List<V> data) {
this.data = data;
}
}
package com.chineseall.teachgoal.core;
/**
* 项目常量
*/
public final class ProjectConstant {
public static final String BASE_PACKAGE = "com.chineseall.teachgoal";//生成代码所在的基础包名称,可根据自己公司的项目修改(注意:这个配置修改之后需要手工修改src目录项目默认的包路径,使其保持一致,不然会找不到类)
public static final String MODEL_PACKAGE = BASE_PACKAGE + ".model";//生成的Model所在包
public static final String MAPPER_PACKAGE = BASE_PACKAGE + ".dao";//生成的Mapper所在包
public static final String SERVICE_PACKAGE = BASE_PACKAGE + ".service";//生成的Service所在包
public static final String SERVICE_IMPL_PACKAGE = SERVICE_PACKAGE + ".impl";//生成的ServiceImpl所在包
public static final String CONTROLLER_PACKAGE = BASE_PACKAGE + ".web";//生成的Controller所在包
public static final String MAPPER_INTERFACE_REFERENCE = BASE_PACKAGE + ".core.Mapper";//Mapper插件基础接口的完全限定名
}
package com.chineseall.teachgoal.core;
import com.alibaba.fastjson.JSON;
/**
* 统一API响应结果封装
*/
public class Result<T> {
private int code;
private String message;
private T data;
public Result setCode(ResultCode resultCode) {
this.code = resultCode.code();
return this;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public Result setMessage(String message) {
this.message = message;
return this;
}
public T getData() {
return data;
}
public Result setData(T data) {
this.data = data;
return this;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
package com.chineseall.teachgoal.core;
/**
* 响应码枚举,参考HTTP状态码的语义
*/
public enum ResultCode {
SUCCESS(0),//成功
FAIL(400),//失败
UNAUTHORIZED(401),//未认证(签名错误)
NOT_FOUND(404),//接口不存在
NOT_CLIENTID(9005),//接口不存在
NOT_SIGNFAIL(9006),//接口不存在接口不存在
INTERNAL_SERVER_ERROR(500);//服务器内部错误
private final int code;
ResultCode(int code) {
this.code = code;
}
public int code() {
return code;
}
}
package com.chineseall.teachgoal.core;
/**
* 响应结果生成工具
*/
public class ResultGenerator {
private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
private static final String LOGIN_SUCCESS_MESSAGE = "登录成功!";
public static Result genSuccessResult() {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE);
}
public static <T> Result<T> genSuccessResult(T data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(DEFAULT_SUCCESS_MESSAGE)
.setData(data);
}
public static <T> Result<T> genLoginSuccessResult(T data) {
return new Result()
.setCode(ResultCode.SUCCESS)
.setMessage(LOGIN_SUCCESS_MESSAGE)
.setData(data);
}
public static Result genFailResult(String message) {
return new Result()
.setCode(ResultCode.FAIL)
.setMessage(message);
}
public static Result genNoClientIdResult(String message) {
return new Result()
.setCode(ResultCode.NOT_CLIENTID)
.setMessage(message);
}
public static Result genSignFailResult(String message) {
return new Result()
.setCode(ResultCode.NOT_SIGNFAIL)
.setMessage(message);
}
}
package com.chineseall.teachgoal.core;
import sun.misc.BASE64Encoder;
/**
* Created by zhangqing on 2018/9/11.
*/
public class SecurityUtils{
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(String key) {
byte[] bt = key.getBytes();
return (new BASE64Encoder()).encodeBuffer(bt);
}
}
package com.chineseall.teachgoal.core;
import org.apache.ibatis.exceptions.TooManyResultsException;
import tk.mybatis.mapper.entity.Condition;
import java.util.List;
/**
* Service 层 基础接口,其他Service 接口 请继承该接口
*/
public interface Service<T> {
void save(T model);//持久化
void save(List<T> models);//批量持久化
void deleteById(Long id);//通过主鍵刪除
void deleteByIds(String ids);//批量刪除 eg:ids -> “1,2,3,4”
void update(T model);//更新
T findById(Long id);//通过ID查找
T findBy(String fieldName, Object value) throws TooManyResultsException; //通过Model中某个成员变量名称(非数据表中column的名称)查找,value需符合unique约束
List<T> findByIds(String ids);//通过多个ID查找//eg:ids -> “1,2,3,4”
List<T> findByCondition(Condition condition);//根据条件查找
List<T> findAll();//获取所有
}
package com.chineseall.teachgoal.core;
/**
* 服务(业务)异常如“ 账号或密码错误 ”,该异常只做INFO级别的日志记录 @see WebMvcConfigurer
*/
public class ServiceException extends RuntimeException {
public ServiceException() {
}
public ServiceException(String message) {
super(message);
}
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
}
package com.chineseall.teachgoal.core;
import java.io.IOException;
import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Created by zhangqing on 2018/11/30.
*/
public class SignUtils {
private static String UTF_8 = "UTF-8";
public static String sign(Map<String, String> paramValues, String secret) {
return sign(paramValues, null, secret);
}
public static String sign(Map<String, String> paramValues, List<String> ignoreParamNames, String secret) {
try {
StringBuilder sb = new StringBuilder();
List<String> paramNames = new ArrayList<String>(paramValues.size());
paramNames.addAll(paramValues.keySet());
if (ignoreParamNames != null && ignoreParamNames.size() > 0) {
for (String ignoreParamName : ignoreParamNames) {
paramValues.remove(ignoreParamName);
}
}
Collections.sort(paramNames);
for(int i = 0; i < paramNames.size(); i++) {
if (i > 0) {
sb.append("&");
}
sb.append(paramNames.get(i));
sb.append("=");
sb.append(paramValues.get(paramNames.get(i)));
}
sb.append("&key");
sb.append("=");
sb.append(secret);
byte[] MD5Digest = getMD5Digest(sb.toString());
return byte2hex(MD5Digest);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
private static byte[] getMD5Digest(String data) throws IOException {
byte[] bytes = null;
try {
MessageDigest md = MessageDigest.getInstance("md5");
bytes = md.digest(data.getBytes(UTF_8));
} catch (GeneralSecurityException gse) {
throw new IOException(gse.getMessage());
}
return bytes;
}
/**
* 二进制转十六进制字符串
*
* @param bytes
* @return
*/
private static String byte2hex(byte[] bytes) {
StringBuilder sign = new StringBuilder();
for (int i = 0; i < bytes.length; i++) {
String hex = Integer.toHexString(bytes[i] & 0xFF);
if (hex.length() == 1) {
sign.append("0");
}
sign.append(hex.toUpperCase());
}
return sign.toString();
}
}
package com.chineseall.teachgoal.core;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by zhangqing on 2018/9/11.
*/
public class StringUtils{
public static boolean isBlank(CharSequence cs) {
int strLen;
if(cs != null && (strLen = cs.length()) != 0) {
for(int i = 0; i < strLen; ++i) {
if(!Character.isWhitespace(cs.charAt(i))) {
return false;
}
}
return true;
} else {
return true;
}
}
public static boolean isNotBlank(CharSequence cs) {
return !isBlank(cs);
}
public static boolean isEmpty(CharSequence cs) {
return cs == null || cs.length() == 0;
}
public static boolean isNotEmpty(CharSequence cs) {
return !isEmpty(cs);
}
public static Date convertToDate(String strDate) throws Exception
{
SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //加上时间
return sDateFormat.parse(strDate);
}
}
package com.chineseall.teachgoal.core;
import java.util.*;
/**
* Created by Administrator on 2018/9/11.
*/
public class UuidGenerator {
public static String getUUID32(){
String uuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
return uuid;
}
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.AliBucket;
public interface AliBucketMapper extends Mapper<AliBucket> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.AliBucket;
import org.apache.ibatis.annotations.Param;
public interface AliBucketMapperE {
AliBucket selectByCode(@Param("code") String code);
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.BasicData;
public interface BasicDataMapper extends Mapper<BasicData> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.VO.BasicDataVO;
import java.util.Date;
import java.util.List;
public interface BasicDataMapperE {
List<BasicDataVO> getDictByType(List list);
List<BasicDataVO> listDict(Date updateTime);
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.Client;
public interface ClientMapper extends Mapper<Client> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.VO.CourseStandardApiVO;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface CourseStandardApiMapperE {
List<CourseStandardApiVO> getCourseStandardList(@Param("standardCodeList") List<String> standardCodeList);
/**
* 根据最近更新日期获取课标列表
* @param lastUpdateTime
* @return
*/
List<CourseStandardApiVO> getCourseStandardListByLastUpdateTime(@Param("lastUpdateTime") Date lastUpdateTime);
List<CourseStandardApiVO> listCourseStandards(@Param("gmtModified") Date gmtModified);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.CourseStandardList;
public interface CourseStandardListMapper extends Mapper<CourseStandardList> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.CourseStandardList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CourseStandardListMapperE {
Long saveAndBackId(@Param("item") CourseStandardList list);
List<CourseStandardList> queryDrafts();
void deleteCourseStandard(@Param("id") Long id);
List<CourseStandardList> queryAll();
void addDrafts(@Param("id") Long id);
CourseStandardList findById(@Param("id") Long id);
CourseStandardList findLastOne();
void upperShelf(@Param("id") Long id);
Long findByCondition(@Param("studyStage") String studyStage,
@Param("curType") String curType,
@Param("subject") String subject);
List<CourseStandardList> queryTeachGoalByCondition(@Param("status") Integer status,
@Param("studyStage") String studyStage,
@Param("curType") String curType,
@Param("subject") String subject);
}
package com.chineseall.teachgoal.dao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExcelNameMapperE {
List<String> listGrade();
List<String> listSubject(@Param("grade") String grade);
List<String> listType(@Param("grade") String grade,
@Param("subject") String subject);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.MathHighNationOne;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ImportMathMapperE {
// 高中数学excel导入
void saveHighNationOne(@Param("list") List<MathHighNationOne> list, @Param("id") Long id);
}
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
public interface MathPrimaryCourseContentMapper extends Mapper<MathPrimaryCourseContent> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
public interface MathPrimaryCourseTargetMapper extends Mapper<MathPrimaryCourseTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryStageTarget;
public interface MathPrimaryStageTargetMapper extends Mapper<MathPrimaryStageTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.MathPrimaryTeachTarget;
public interface MathPrimaryTeachTargetMapper extends Mapper<MathPrimaryTeachTarget> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.SysDict;
public interface SysDictMapper extends Mapper<SysDict> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.core.Mapper;
import com.chineseall.teachgoal.model.User;
public interface UserMapper extends Mapper<User> {
}
\ No newline at end of file
package com.chineseall.teachgoal.dao.client;
import com.chineseall.teachgoal.model.Client;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ClientEMapper {
List<Client> selectByClientId(@Param("clientId") String clientId);
Client getByCode(@Param("code") String code);
Client getByClientId(@Param("clientId") String clientId);
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.http.*;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class HttpAPIService {
@Autowired
private HttpClient httpClient;
@Autowired
private RequestConfig config;
/**
* 不带参数的get请求,如果状态码为200,则返回body,如果不为200,则返回null
*
* @param url
* @return
* @throws Exception
*/
public String doGet(String url) throws Exception {
// 声明 http get 请求
HttpGet httpGet = new HttpGet(url);
// 装载配置信息
httpGet.setConfig(config);
// 发起请求
HttpResponse response = this.httpClient.execute(httpGet);
// 判断状态码是否为200
if (response.getStatusLine().getStatusCode() == 200) {
// 返回响应体的内容
return EntityUtils.toString(response.getEntity(), "UTF-8");
}
return null;
}
/**
* 带参数的get请求,如果状态码为200,则返回body,如果不为200,则返回null
*
* @param url
* @return
* @throws Exception
*/
public String doGet(String url, Map<String, Object> map) throws Exception {
URIBuilder uriBuilder = new URIBuilder(url);
if (map != null) {
// 遍历map,拼接请求参数
for (Map.Entry<String, Object> entry : map.entrySet()) {
uriBuilder.setParameter(entry.getKey(), entry.getValue().toString());
}
}
// 调用不带参数的get请求
return this.doGet(uriBuilder.build().toString());
}
/**
* 带参数的post请求
*
* @param url
* @param map
* @return
* @throws Exception
*/
public HttpResult doPost(String url, Map<String, Object> map) throws Exception {
HttpResult result=null;
// 获取连接客户端工具
CloseableHttpClient httpClient = HttpClients.createDefault();
String entityStr = null;
CloseableHttpResponse response = null;
try {
// 创建POST请求对象
HttpPost httpPost = new HttpPost(url);
/*
* 添加请求参数
*/
// 判断map是否为空,不为空则进行遍历,封装from表单对象
if (map != null) {
List<NameValuePair> list = new ArrayList<NameValuePair>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
list.add(new BasicNameValuePair(entry.getKey(), entry.getValue().toString()));
}
// 构造from表单对象
UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(list, "UTF-8");
// 把表单放到post里
httpPost.setEntity(urlEncodedFormEntity);
// 浏览器表示
httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)");
// 传输的类型
httpPost.addHeader("Content-Type", "application/json");
}
// 执行请求
response = httpClient.execute(httpPost);
// 获得响应的实体对象
HttpEntity entity = response.getEntity();
// 使用Apache提供的工具类进行转换成字符串
entityStr = EntityUtils.toString(entity, "UTF-8");
// System.out.println(Arrays.toString(response.getAllHeaders()));
return new HttpResult(response.getStatusLine().getStatusCode(), entityStr);
} catch (ClientProtocolException e) {
System.err.println("Http协议出现问题");
e.printStackTrace();
} catch (ParseException e) {
System.err.println("解析错误");
e.printStackTrace();
} catch (IOException e) {
System.err.println("IO异常");
e.printStackTrace();
} finally {
// 释放连接
if (null != response) {
try {
response.close();
httpClient.close();
} catch (IOException e) {
System.err.println("释放连接出错");
e.printStackTrace();
}
}
}
return result;
}
private static final String APPLICATION_JSON = "application/json";
private static final String CONTENT_TYPE_TEXT_JSON = "text/json";
public HttpResult doPost(String url, String json)throws Exception
{
// 将JSON进行UTF-8编码,以便传输中文
String encoderJson = URLEncoder.encode(json, "utf-8");
// 获取连接客户端工具
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON);
StringEntity se = new StringEntity(encoderJson);
se.setContentType(CONTENT_TYPE_TEXT_JSON);
se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, APPLICATION_JSON));
httpPost.setEntity(se);
CloseableHttpResponse response = null;
response =httpClient.execute(httpPost);
return new HttpResult(response.getStatusLine().getStatusCode(), EntityUtils.toString(response.getEntity(), "UTF-8"));
}
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
public class HttpResult {
// 响应码
private Integer code;
// 响应体
private String body;
public HttpResult() {
super();
}
public HttpResult(Integer code, String body) {
super();
this.code = code;
this.body = body;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.http;
import org.apache.http.conn.HttpClientConnectionManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class IdleConnectionEvictor extends Thread {
@Autowired
private HttpClientConnectionManager connMgr;
private volatile boolean shutdown;
public IdleConnectionEvictor() {
super();
super.start();
}
@Override
public void run() {
try {
while (!shutdown) {
synchronized (this) {
wait(5000);
// 关闭失效的连接
connMgr.closeExpiredConnections();
}
}
} catch (InterruptedException ex) {
// 结束
}
}
//关闭清理无效连接的线程
public void shutdown() {
shutdown = true;
synchronized (this) {
notifyAll();
}
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "ali_bucket")
public class AliBucket {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String region;
@Column(name = "access_key_id")
private String accessKeyId;
@Column(name = "access_key_secret")
private String accessKeySecret;
private String bucket;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modified")
private Date gmtModified;
private Long creator;
private String code;
@Column(name = "role_arn")
private String roleArn;
private String endpoint;
private String catalogue;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return region
*/
public String getRegion() {
return region;
}
/**
* @param region
*/
public void setRegion(String region) {
this.region = region;
}
/**
* @return access_key_id
*/
public String getAccessKeyId() {
return accessKeyId;
}
/**
* @param accessKeyId
*/
public void setAccessKeyId(String accessKeyId) {
this.accessKeyId = accessKeyId;
}
/**
* @return access_key_secret
*/
public String getAccessKeySecret() {
return accessKeySecret;
}
/**
* @param accessKeySecret
*/
public void setAccessKeySecret(String accessKeySecret) {
this.accessKeySecret = accessKeySecret;
}
/**
* @return bucket
*/
public String getBucket() {
return bucket;
}
/**
* @param bucket
*/
public void setBucket(String bucket) {
this.bucket = bucket;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modified
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* @return creator
*/
public Long getCreator() {
return creator;
}
/**
* @param creator
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return role_arn
*/
public String getRoleArn() {
return roleArn;
}
/**
* @param roleArn
*/
public void setRoleArn(String roleArn) {
this.roleArn = roleArn;
}
/**
* @return endpoint
*/
public String getEndpoint() {
return endpoint;
}
/**
* @param endpoint
*/
public void setEndpoint(String endpoint) {
this.endpoint = endpoint;
}
/**
* @return catalogue
*/
public String getCatalogue() {
return catalogue;
}
/**
* @param catalogue
*/
public void setCatalogue(String catalogue) {
this.catalogue = catalogue;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import lombok.Data;
@Data
public class AllExcelField {
// 国标编码
private String nationCode;
// 上海教学基本要求编码
private String regionCode;
// 学段
private String studyStage;
// 学科核心素养序号
private String subjectCoreShitsukeNumber;
// 学科核心素养
private String subjectCoreShitsuke;
// 具体内容序号
private String specificContentNumber;
// 具体内容
private String specificContent;
// 课程目标序号
private String courseTargetNumber;
// 课程目标
private String courseTarget;
// 课程类型
private String courseType;
// 主题序号
private String themeNumber;
// 主题
private String theme;
// 单元序号
private String unitNumber;
// 单元
private String unit;
// 一级内容序号
private String oneContentRequireNumber;
// 一级内容
private String oneContentRequire;
// 二级内容要求序号
private String twoContentRequireNumber;
// 二级内容要求
private String twoContentRequire;
// 三级内容要求序号
private String threeContentRequireNumber;
// 三级内容要求
private String threeContentRequire;
// 学习内容序号
private String studyRequireNumber;
// 学习内容
private String studyRequire;
// 学习任务群序号
private String studyTaskGroupNumber;
// 学习任务群
private String studyTaskGroup;
// 课程阶段
private String coursePhase;
// 学习目标与内容序号
private String studyTargetNumber;
// 学习目标与内容
private String studyTarget;
// 课程目标要求
private String courseTargetRequire;
// 模块
private String module;
// 教学提示序号
private String teachHitNumber;
// 教学提示
private String teachHit;
// 内容要求序号
private String contentRequireNumber;
// 内容要求
private String contentRequire;
// 实验课程类型
private String experimentCourseType;
// 学生必做实验序号
private String studentExperimentNumber;
// 学生必做实验
private String studentExperiment;
// 学业要求序号
private String academicRequireNumber;
// 学业要求
private String academicRequire;
// 水平
private String level;
// 标准维度
private String standardDimension;
// 一级主题
private String themeOne;
// 二级主题
private String themeTwo;
// 具体要求序号
private String specificRequireNumber;
// 具体要求
private String specificRequire;
// 要素
private String element;
// 目标序号
private String targetNumber;
// 目标
private String target;
// 标准序号
private String standardNumber;
// 标准
private String standard;
// 学习水平
private String studyLevel;
// 级别
private String ranks;
// 目标描述
private String targetDescribe;
// 分类
private String classify;
// 标准描述一级
private String standardDescribeOne;
// 标准描述二级
private String standardDescribeTwo;
// 标准描述三级
private String standardDescribeThree;
// 学习内容1
private String studyContent;
// 学习内容1.1
private String studyContentOne;
// 学习内容1.1.1
private String studyContentTwo;
// 学习内容1.1.1.1
private String studyContentThree;
// 学习内容1.1.1.1.1
private String studyContentFour;
// 能力
private String capacity;
// 课程内容
private String courseContent;
// 科学内容一级
private String scienceContentOne;
// 科学内容二级
private String scienceContentTwo;
// 科学探究要素
private String scienceElement;
// 具体要求1
private String specificRequireOne;
// 具体要求2序号
private String specificRequireTwoNumber;
// 具体要求2
private String specificRequireTwo;
// 课程内容一级
private String courseContentOne;
// 课程内容二级
private String courseContentTwo;
// 课程内容三级序号
private String courseContentThreeNumber;
// 课程内容三级
private String courseContentThree;
// 课程内容四级序号
private String courseContentFourNumber;
// 课程内容四级
private String courseContentFour;
// 学习内容模块
private String studyContentModule;
// 内涵
private String connotation;
// 表现序号
private String expressionNumber;
// 表现
private String expression;
// 模块内容
private String moduleContent;
// 模块学习目标
private String moduleStudyTarget;
// 素养维度
private String shitsukeDimension;
// 具体内容一级序号
private String specificContentOneNumber;
// 具体内容一级
private String specificContentOne;
// 具体内容二级序号
private String specificContentTwoNumber;
// 具体内容二级
private String specificContentTwo;
// 策略
private String strategy;
// 主题语境
private String themeContextual;
// 主题群
private String themeGroup;
// 语言知识要素
private String languageKnowledgeElement;
// 课程类别
private String courseCategory;
// 语言技能
private String languageSkill;
// 模块序号
private String moduleNumber;
// 概念序号
private String conceptNumber;
// 概念
private String concept;
// 系列序号
private String seriesNumber;
// 系列
private String series;
// 模块组成
private String moduleConstitute;
// 学段目标序号
private String stageTargetNumber;
// 学段目标
private String stageTarget;
//课程总目标国标编码
private String courseTargetCode;
//课程目标国标编码
private String stageTargetCode;
//课程内容国标编码
private String courseContentCode;
//年级
private String grade;
// //关键要素
// private String element;
// private String theme;
// //目标分层(水平)
// private String level;
//分年级教学目标序号
private String teachTargetNumber;
//分年级教学目标
private String teachTarget;
public String getConnotation() {
return connotation;
}
public void setConnotation(String connotation) {
this.connotation = connotation;
}
public String getExpressionNumber() {
return expressionNumber;
}
public void setExpressionNumber(String expressionNumber) {
this.expressionNumber = expressionNumber;
}
public String getExpression() {
return expression;
}
public void setExpression(String expression) {
this.expression = expression;
}
public String getModuleContent() {
return moduleContent;
}
public void setModuleContent(String moduleContent) {
this.moduleContent = moduleContent;
}
public String getModuleStudyTarget() {
return moduleStudyTarget;
}
public void setModuleStudyTarget(String moduleStudyTarget) {
this.moduleStudyTarget = moduleStudyTarget;
}
public String getShitsukeDimension() {
return shitsukeDimension;
}
public void setShitsukeDimension(String shitsukeDimension) {
this.shitsukeDimension = shitsukeDimension;
}
public String getSpecificContentOneNumber() {
return specificContentOneNumber;
}
public void setSpecificContentOneNumber(String specificContentOneNumber) {
this.specificContentOneNumber = specificContentOneNumber;
}
public String getSpecificContentOne() {
return specificContentOne;
}
public void setSpecificContentOne(String specificContentOne) {
this.specificContentOne = specificContentOne;
}
public String getSpecificContentTwoNumber() {
return specificContentTwoNumber;
}
public void setSpecificContentTwoNumber(String specificContentTwoNumber) {
this.specificContentTwoNumber = specificContentTwoNumber;
}
public String getSpecificContentTwo() {
return specificContentTwo;
}
public void setSpecificContentTwo(String specificContentTwo) {
this.specificContentTwo = specificContentTwo;
}
public String getStrategy() {
return strategy;
}
public void setStrategy(String strategy) {
this.strategy = strategy;
}
public String getThemeContextual() {
return themeContextual;
}
public void setThemeContextual(String themeContextual) {
this.themeContextual = themeContextual;
}
public String getThemeGroup() {
return themeGroup;
}
public void setThemeGroup(String themeGroup) {
this.themeGroup = themeGroup;
}
public String getLanguageKnowledgeElement() {
return languageKnowledgeElement;
}
public void setLanguageKnowledgeElement(String languageKnowledgeElement) {
this.languageKnowledgeElement = languageKnowledgeElement;
}
public String getCourseCategory() {
return courseCategory;
}
public void setCourseCategory(String courseCategory) {
this.courseCategory = courseCategory;
}
public String getLanguageSkill() {
return languageSkill;
}
public void setLanguageSkill(String languageSkill) {
this.languageSkill = languageSkill;
}
public String getNationCode() {
return nationCode;
}
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
public String getRegionCode() {
return regionCode;
}
public void setRegionCode(String regionCode) {
this.regionCode = regionCode;
}
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getSubjectCoreShitsukeNumber() {
return subjectCoreShitsukeNumber;
}
public void setSubjectCoreShitsukeNumber(String subjectCoreShitsukeNumber) {
this.subjectCoreShitsukeNumber = subjectCoreShitsukeNumber;
}
public String getSubjectCoreShitsuke() {
return subjectCoreShitsuke;
}
public void setSubjectCoreShitsuke(String subjectCoreShitsuke) {
this.subjectCoreShitsuke = subjectCoreShitsuke;
}
public String getSpecificContentNumber() {
return specificContentNumber;
}
public void setSpecificContentNumber(String specificContentNumber) {
this.specificContentNumber = specificContentNumber;
}
public String getSpecificContent() {
return specificContent;
}
public void setSpecificContent(String specificContent) {
this.specificContent = specificContent;
}
public String getCourseTargetNumber() {
return courseTargetNumber;
}
public void setCourseTargetNumber(String courseTargetNumber) {
this.courseTargetNumber = courseTargetNumber;
}
public String getCourseTarget() {
return courseTarget;
}
public void setCourseTarget(String courseTarget) {
this.courseTarget = courseTarget;
}
public String getCourseType() {
return courseType;
}
public void setCourseType(String courseType) {
this.courseType = courseType;
}
public String getThemeNumber() {
return themeNumber;
}
public void setThemeNumber(String themeNumber) {
this.themeNumber = themeNumber;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getUnitNumber() {
return unitNumber;
}
public void setUnitNumber(String unitNumber) {
this.unitNumber = unitNumber;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getOneContentRequireNumber() {
return oneContentRequireNumber;
}
public void setOneContentRequireNumber(String oneContentRequireNumber) {
this.oneContentRequireNumber = oneContentRequireNumber;
}
public String getOneContentRequire() {
return oneContentRequire;
}
public void setOneContentRequire(String oneContentRequire) {
this.oneContentRequire = oneContentRequire;
}
public String getTwoContentRequireNumber() {
return twoContentRequireNumber;
}
public void setTwoContentRequireNumber(String twoContentRequireNumber) {
this.twoContentRequireNumber = twoContentRequireNumber;
}
public String getTwoContentRequire() {
return twoContentRequire;
}
public void setTwoContentRequire(String twoContentRequire) {
this.twoContentRequire = twoContentRequire;
}
public String getThreeContentRequireNumber() {
return threeContentRequireNumber;
}
public void setThreeContentRequireNumber(String threeContentRequireNumber) {
this.threeContentRequireNumber = threeContentRequireNumber;
}
public String getThreeContentRequire() {
return threeContentRequire;
}
public void setThreeContentRequire(String threeContentRequire) {
this.threeContentRequire = threeContentRequire;
}
public String getStudyRequireNumber() {
return studyRequireNumber;
}
public void setStudyRequireNumber(String studyRequireNumber) {
this.studyRequireNumber = studyRequireNumber;
}
public String getStudyRequire() {
return studyRequire;
}
public void setStudyRequire(String studyRequire) {
this.studyRequire = studyRequire;
}
public String getStudyTaskGroupNumber() {
return studyTaskGroupNumber;
}
public void setStudyTaskGroupNumber(String studyTaskGroupNumber) {
this.studyTaskGroupNumber = studyTaskGroupNumber;
}
public String getStudyTaskGroup() {
return studyTaskGroup;
}
public void setStudyTaskGroup(String studyTaskGroup) {
this.studyTaskGroup = studyTaskGroup;
}
public String getCoursePhase() {
return coursePhase;
}
public void setCoursePhase(String coursePhase) {
this.coursePhase = coursePhase;
}
public String getStudyTargetNumber() {
return studyTargetNumber;
}
public void setStudyTargetNumber(String studyTargetNumber) {
this.studyTargetNumber = studyTargetNumber;
}
public String getStudyTarget() {
return studyTarget;
}
public void setStudyTarget(String studyTarget) {
this.studyTarget = studyTarget;
}
public String getCourseTargetRequire() {
return courseTargetRequire;
}
public void setCourseTargetRequire(String courseTargetRequire) {
this.courseTargetRequire = courseTargetRequire;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public String getTeachHitNumber() {
return teachHitNumber;
}
public void setTeachHitNumber(String teachHitNumber) {
this.teachHitNumber = teachHitNumber;
}
public String getTeachHit() {
return teachHit;
}
public void setTeachHit(String teachHit) {
this.teachHit = teachHit;
}
public String getContentRequireNumber() {
return contentRequireNumber;
}
public void setContentRequireNumber(String contentRequireNumber) {
this.contentRequireNumber = contentRequireNumber;
}
public String getContentRequire() {
return contentRequire;
}
public void setContentRequire(String contentRequire) {
this.contentRequire = contentRequire;
}
public String getExperimentCourseType() {
return experimentCourseType;
}
public void setExperimentCourseType(String experimentCourseType) {
this.experimentCourseType = experimentCourseType;
}
public String getStudentExperimentNumber() {
return studentExperimentNumber;
}
public void setStudentExperimentNumber(String studentExperimentNumber) {
this.studentExperimentNumber = studentExperimentNumber;
}
public String getStudentExperiment() {
return studentExperiment;
}
public void setStudentExperiment(String studentExperiment) {
this.studentExperiment = studentExperiment;
}
public String getAcademicRequireNumber() {
return academicRequireNumber;
}
public void setAcademicRequireNumber(String academicRequireNumber) {
this.academicRequireNumber = academicRequireNumber;
}
public String getAcademicRequire() {
return academicRequire;
}
public void setAcademicRequire(String academicRequire) {
this.academicRequire = academicRequire;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getStandardDimension() {
return standardDimension;
}
public void setStandardDimension(String standardDimension) {
this.standardDimension = standardDimension;
}
public String getThemeOne() {
return themeOne;
}
public void setThemeOne(String themeOne) {
this.themeOne = themeOne;
}
public String getThemeTwo() {
return themeTwo;
}
public void setThemeTwo(String themeTwo) {
this.themeTwo = themeTwo;
}
public String getSpecificRequireNumber() {
return specificRequireNumber;
}
public void setSpecificRequireNumber(String specificRequireNumber) {
this.specificRequireNumber = specificRequireNumber;
}
public String getSpecificRequire() {
return specificRequire;
}
public void setSpecificRequire(String specificRequire) {
this.specificRequire = specificRequire;
}
public String getElement() {
return element;
}
public void setElement(String element) {
this.element = element;
}
public String getTargetNumber() {
return targetNumber;
}
public void setTargetNumber(String targetNumber) {
this.targetNumber = targetNumber;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getStandardNumber() {
return standardNumber;
}
public void setStandardNumber(String standardNumber) {
this.standardNumber = standardNumber;
}
public String getStandard() {
return standard;
}
public void setStandard(String standard) {
this.standard = standard;
}
public String getStudyLevel() {
return studyLevel;
}
public void setStudyLevel(String studyLevel) {
this.studyLevel = studyLevel;
}
public String getStudyContentOne() {
return studyContentOne;
}
public void setStudyContentOne(String studyContentOne) {
this.studyContentOne = studyContentOne;
}
public String getStudyContentTwo() {
return studyContentTwo;
}
public void setStudyContentTwo(String studyContentTwo) {
this.studyContentTwo = studyContentTwo;
}
public String getRanks() {
return ranks;
}
public void setRanks(String ranks) {
this.ranks = ranks;
}
public String getTargetDescribe() {
return targetDescribe;
}
public void setTargetDescribe(String targetDescribe) {
this.targetDescribe = targetDescribe;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getStandardDescribeOne() {
return standardDescribeOne;
}
public void setStandardDescribeOne(String standardDescribeOne) {
this.standardDescribeOne = standardDescribeOne;
}
public String getStandardDescribeTwo() {
return standardDescribeTwo;
}
public void setStandardDescribeTwo(String standardDescribeTwo) {
this.standardDescribeTwo = standardDescribeTwo;
}
public String getStandardDescribeThree() {
return standardDescribeThree;
}
public void setStandardDescribeThree(String standardDescribeThree) {
this.standardDescribeThree = standardDescribeThree;
}
public String getStudyContent() {
return studyContent;
}
public void setStudyContent(String studyContent) {
this.studyContent = studyContent;
}
public String getStudyContentThree() {
return studyContentThree;
}
public void setStudyContentThree(String studyContentThree) {
this.studyContentThree = studyContentThree;
}
public String getStudyContentFour() {
return studyContentFour;
}
public void setStudyContentFour(String studyContentFour) {
this.studyContentFour = studyContentFour;
}
public String getCapacity() {
return capacity;
}
public void setCapacity(String capacity) {
this.capacity = capacity;
}
public String getCourseContent() {
return courseContent;
}
public void setCourseContent(String courseContent) {
this.courseContent = courseContent;
}
public String getScienceContentOne() {
return scienceContentOne;
}
public void setScienceContentOne(String scienceContentOne) {
this.scienceContentOne = scienceContentOne;
}
public String getScienceContentTwo() {
return scienceContentTwo;
}
public void setScienceContentTwo(String scienceContentTwo) {
this.scienceContentTwo = scienceContentTwo;
}
public String getScienceElement() {
return scienceElement;
}
public void setScienceElement(String scienceElement) {
this.scienceElement = scienceElement;
}
public String getSpecificRequireOne() {
return specificRequireOne;
}
public void setSpecificRequireOne(String specificRequireOne) {
this.specificRequireOne = specificRequireOne;
}
public String getSpecificRequireTwoNumber() {
return specificRequireTwoNumber;
}
public void setSpecificRequireTwoNumber(String specificRequireTwoNumber) {
this.specificRequireTwoNumber = specificRequireTwoNumber;
}
public String getSpecificRequireTwo() {
return specificRequireTwo;
}
public void setSpecificRequireTwo(String specificRequireTwo) {
this.specificRequireTwo = specificRequireTwo;
}
public String getCourseContentOne() {
return courseContentOne;
}
public void setCourseContentOne(String courseContentOne) {
this.courseContentOne = courseContentOne;
}
public String getCourseContentTwo() {
return courseContentTwo;
}
public void setCourseContentTwo(String courseContentTwo) {
this.courseContentTwo = courseContentTwo;
}
public String getCourseContentThree() {
return courseContentThree;
}
public void setCourseContentThree(String courseContentThree) {
this.courseContentThree = courseContentThree;
}
public String getCourseContentFourNumber() {
return courseContentFourNumber;
}
public void setCourseContentFourNumber(String courseContentFourNumber) {
this.courseContentFourNumber = courseContentFourNumber;
}
public String getCourseContentFour() {
return courseContentFour;
}
public void setCourseContentFour(String courseContentFour) {
this.courseContentFour = courseContentFour;
}
public String getCourseContentThreeNumber() {
return courseContentThreeNumber;
}
public void setCourseContentThreeNumber(String courseContentThreeNumber) {
this.courseContentThreeNumber = courseContentThreeNumber;
}
public String getStudyContentModule() {
return studyContentModule;
}
public void setStudyContentModule(String studyContentModule) {
this.studyContentModule = studyContentModule;
}
public String getModuleNumber() {
return moduleNumber;
}
public void setModuleNumber(String moduleNumber) {
this.moduleNumber = moduleNumber;
}
public String getConceptNumber() {
return conceptNumber;
}
public void setConceptNumber(String conceptNumber) {
this.conceptNumber = conceptNumber;
}
public String getConcept() {
return concept;
}
public void setConcept(String concept) {
this.concept = concept;
}
public String getSeriesNumber() {
return seriesNumber;
}
public void setSeriesNumber(String seriesNumber) {
this.seriesNumber = seriesNumber;
}
public String getSeries() {
return series;
}
public void setSeries(String series) {
this.series = series;
}
public String getModuleConstitute() {
return moduleConstitute;
}
public void setModuleConstitute(String moduleConstitute) {
this.moduleConstitute = moduleConstitute;
}
}
package com.chineseall.teachgoal.model;
import javax.persistence.*;
import java.util.Date;
@Table(name = "basic_data")
public class BasicData {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 全称
*/
private String title;
/**
* 简称
*/
@Column(name = "shortTitle")
private String shorttitle;
/**
* 编码
*/
private String code;
/**
* 排序
*/
@Column(name = "orderIndex")
private Integer orderindex;
/**
* 0:正常 1:停用
*/
private Integer status;
/**
* 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
private String type;
/**
* 创建时间
*/
@Column(name = "createTime")
private Date createtime;
/**
* 更新时间
*/
@Column(name = "updateTime")
private Date updatetime;
private String remark;
@Column(name = "sheetName")
private String sheetname;
@Column(name = "excelPath")
private String excelpath;
@Column(name = "excelName")
private String excelname;
/**
* @return id
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取全称
*
* @return title - 全称
*/
public String getTitle() {
return title;
}
/**
* 设置全称
*
* @param title 全称
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取简称
*
* @return shortTitle - 简称
*/
public String getShorttitle() {
return shorttitle;
}
/**
* 设置简称
*
* @param shorttitle 简称
*/
public void setShorttitle(String shorttitle) {
this.shorttitle = shorttitle;
}
/**
* 获取编码
*
* @return code - 编码
*/
public String getCode() {
return code;
}
/**
* 设置编码
*
* @param code 编码
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取排序
*
* @return orderIndex - 排序
*/
public Integer getOrderindex() {
return orderindex;
}
/**
* 设置排序
*
* @param orderindex 排序
*/
public void setOrderindex(Integer orderindex) {
this.orderindex = orderindex;
}
/**
* 获取0:正常 1:停用
*
* @return status - 0:正常 1:停用
*/
public Integer getStatus() {
return status;
}
/**
* 设置0:正常 1:停用
*
* @param status 0:正常 1:停用
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @return type - 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public String getType() {
return type;
}
/**
* 设置类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @param type 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public void setType(String type) {
this.type = type;
}
/**
* 获取创建时间
*
* @return createTime - 创建时间
*/
public Date getCreatetime() {
return createtime;
}
/**
* 设置创建时间
*
* @param createtime 创建时间
*/
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
/**
* 获取更新时间
*
* @return updateTime - 更新时间
*/
public Date getUpdatetime() {
return updatetime;
}
/**
* 设置更新时间
*
* @param updatetime 更新时间
*/
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
/**
* @return remark
*/
public String getRemark() {
return remark;
}
/**
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* @return sheetName
*/
public String getSheetname() {
return sheetname;
}
/**
* @param sheetname
*/
public void setSheetname(String sheetname) {
this.sheetname = sheetname;
}
/**
* @return excelPath
*/
public String getExcelpath() {
return excelpath;
}
/**
* @param excelpath
*/
public void setExcelpath(String excelpath) {
this.excelpath = excelpath;
}
/**
* @return excelName
*/
public String getExcelname() {
return excelname;
}
/**
* @param excelname
*/
public void setExcelname(String excelname) {
this.excelname = excelname;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
public class Client {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "client_name")
private String clientName;
private String code;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modified")
private Date gmtModified;
private Long creator;
@Column(name = "is_deleted")
private Boolean isDeleted;
@Column(name = "client_id")
private String clientId;
private Date expired;
@Column(name = "client_key")
private String clientKey;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return client_name
*/
public String getClientName() {
return clientName;
}
/**
* @param clientName
*/
public void setClientName(String clientName) {
this.clientName = clientName;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modified
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* @return creator
*/
public Long getCreator() {
return creator;
}
/**
* @param creator
*/
public void setCreator(Long creator) {
this.creator = creator;
}
/**
* @return is_deleted
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* @return client_id
*/
public String getClientId() {
return clientId;
}
/**
* @param clientId
*/
public void setClientId(String clientId) {
this.clientId = clientId;
}
/**
* @return expired
*/
public Date getExpired() {
return expired;
}
/**
* @param expired
*/
public void setExpired(Date expired) {
this.expired = expired;
}
/**
* @return client_key
*/
public String getClientKey() {
return clientKey;
}
/**
* @param clientKey
*/
public void setClientKey(String clientKey) {
this.clientKey = clientKey;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import com.alibaba.fastjson.annotation.JSONField;
import javax.persistence.*;
import java.util.Date;
@Table(name = "course_standard_list")
public class CourseStandardList {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* uuid
*/
private String code;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 科目
*/
private String subject;
/**
* 课标类型
*/
@Column(name = "cur_type")
private String curType;
/**
* 状态
*/
private Boolean status;
/**
* 是否上架
*/
@Column(name = "upper_shelf")
private Boolean upperShelf;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取uuid
*
* @return code - uuid
*/
public String getCode() {
return code;
}
/**
* 设置uuid
*
* @param code uuid
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取科目
*
* @return subject - 科目
*/
public String getSubject() {
return subject;
}
/**
* 设置科目
*
* @param subject 科目
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* 获取课标类型
*
* @return cur_type - 课标类型
*/
public String getCurType() {
return curType;
}
/**
* 设置课标类型
*
* @param curType 课标类型
*/
public void setCurType(String curType) {
this.curType = curType;
}
/**
* 获取状态
*
* @return status - 状态
*/
public Boolean getStatus() {
return status;
}
/**
* 设置状态
*
* @param status 状态
*/
public void setStatus(Boolean status) {
this.status = status;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
public Boolean getUpperShelf() {
return upperShelf;
}
public void setUpperShelf(Boolean upperShelf) {
this.upperShelf = upperShelf;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.DTO;
import com.chineseall.teachgoal.model.AllExcelField;
import java.util.List;
public class UploadDTO {
private String studyStage;
private String subject;
private String curType;
private List<AllExcelField> list;
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCurType() {
return curType;
}
public void setCurType(String curType) {
this.curType = curType;
}
public List<AllExcelField> getList() {
return list;
}
public void setList(List<AllExcelField> list) {
this.list = list;
}
}
package com.chineseall.teachgoal.model;
import java.util.List;
public class DictTypeList {
private List<String> dictTypeList;
public List<String> getDictTypeList() {
return dictTypeList;
}
public void setDictTypeList(List<String> dictTypeList) {
this.dictTypeList = dictTypeList;
}
}
package com.chineseall.teachgoal.model;
import javax.persistence.*;
@Table(name = "excel_name")
public class ExcelName {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* exvel表明
*/
private String name;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 科目
*/
private String subject;
/**
* 类型
*/
@Column(name = "cur_type")
private String curType;
/**
* 获取主键
*
* @return id - 主键
*/
public Integer getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取exvel表明
*
* @return name - exvel表明
*/
public String getName() {
return name;
}
/**
* 设置exvel表明
*
* @param name exvel表明
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取科目
*
* @return subject - 科目
*/
public String getSubject() {
return subject;
}
/**
* 设置科目
*
* @param subject 科目
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* 获取类型
*
* @return cur_type - 类型
*/
public String getCurType() {
return curType;
}
/**
* 设置类型
*
* @param curType 类型
*/
public void setCurType(String curType) {
this.curType = curType;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import javax.persistence.*;
import java.util.Date;
@Table(name = "math_high_nation_one")
public class MathHighNationOne {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 唯一标识
*/
private String code;
/**
* 国标编码
*/
@Column(name = "nation_code")
private String nationCode;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 学科核心素养序号
*/
@Column(name = "subject_core_shitsuke_number")
private String subjectCoreShitsukeNumber;
/**
* 学科核心素养
*/
@Column(name = "subject_core_shitsuke")
private String subjectCoreShitsuke;
/**
* 具体内容序号
*/
@Column(name = "specific_content_number")
private String specificContentNumber;
/**
* 具体内容
*/
@Column(name = "specific_content")
private String specificContent;
/**
* 对应的课标标的主键
*/
private Long pid;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取唯一标识
*
* @return code - 唯一标识
*/
public String getCode() {
return code;
}
/**
* 设置唯一标识
*
* @param code 唯一标识
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取国标编码
*
* @return nation_code - 国标编码
*/
public String getNationCode() {
return nationCode;
}
/**
* 设置国标编码
*
* @param nationCode 国标编码
*/
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取学科核心素养序号
*
* @return subject_core_shitsuke_number - 学科核心素养序号
*/
public String getSubjectCoreShitsukeNumber() {
return subjectCoreShitsukeNumber;
}
/**
* 设置学科核心素养序号
*
* @param subjectCoreShitsukeNumber 学科核心素养序号
*/
public void setSubjectCoreShitsukeNumber(String subjectCoreShitsukeNumber) {
this.subjectCoreShitsukeNumber = subjectCoreShitsukeNumber;
}
/**
* 获取学科核心素养
*
* @return subject_core_shitsuke - 学科核心素养
*/
public String getSubjectCoreShitsuke() {
return subjectCoreShitsuke;
}
/**
* 设置学科核心素养
*
* @param subjectCoreShitsuke 学科核心素养
*/
public void setSubjectCoreShitsuke(String subjectCoreShitsuke) {
this.subjectCoreShitsuke = subjectCoreShitsuke;
}
/**
* 获取具体内容序号
*
* @return specific_content_number - 具体内容序号
*/
public String getSpecificContentNumber() {
return specificContentNumber;
}
/**
* 设置具体内容序号
*
* @param specificContentNumber 具体内容序号
*/
public void setSpecificContentNumber(String specificContentNumber) {
this.specificContentNumber = specificContentNumber;
}
/**
* 获取具体内容
*
* @return specific_content - 具体内容
*/
public String getSpecificContent() {
return specificContent;
}
/**
* 设置具体内容
*
* @param specificContent 具体内容
*/
public void setSpecificContent(String specificContent) {
this.specificContent = specificContent;
}
/**
* 获取对应的课标标的主键
*
* @return pid - 对应的课标标的主键
*/
public Long getPid() {
return pid;
}
/**
* 设置对应的课标标的主键
*
* @param pid 对应的课标标的主键
*/
public void setPid(Long pid) {
this.pid = pid;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "math_primary_course_content")
public class MathPrimaryCourseContent {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 唯一标识
*/
private String code;
/**
* 国标编码
*/
@Column(name = "nation_code")
private String nationCode;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 课程内容一级
*/
@Column(name = "course_content_one")
private String courseContentOne;
/**
* 课程内容二级
*/
@Column(name = "course_content_two")
private String courseContentTwo;
/**
* 课程内容三级序号
*/
@Column(name = "course_content_three_number")
private String courseContentThreeNumber;
/**
* 课程内容三级
*/
@Column(name = "course_content_three")
private String courseContentThree;
/**
* 学习水平
*/
@Column(name = "study_level")
private String studyLevel;
/**
* 对应课标列表的id
*/
private Long pid;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取唯一标识
*
* @return code - 唯一标识
*/
public String getCode() {
return code;
}
/**
* 设置唯一标识
*
* @param code 唯一标识
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取国标编码
*
* @return nation_code - 国标编码
*/
public String getNationCode() {
return nationCode;
}
/**
* 设置国标编码
*
* @param nationCode 国标编码
*/
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取课程内容一级
*
* @return course_content_one - 课程内容一级
*/
public String getCourseContentOne() {
return courseContentOne;
}
/**
* 设置课程内容一级
*
* @param courseContentOne 课程内容一级
*/
public void setCourseContentOne(String courseContentOne) {
this.courseContentOne = courseContentOne;
}
/**
* 获取课程内容二级
*
* @return course_content_two - 课程内容二级
*/
public String getCourseContentTwo() {
return courseContentTwo;
}
/**
* 设置课程内容二级
*
* @param courseContentTwo 课程内容二级
*/
public void setCourseContentTwo(String courseContentTwo) {
this.courseContentTwo = courseContentTwo;
}
/**
* 获取课程内容三级序号
*
* @return course_content_three_number - 课程内容三级序号
*/
public String getCourseContentThreeNumber() {
return courseContentThreeNumber;
}
/**
* 设置课程内容三级序号
*
* @param courseContentThreeNumber 课程内容三级序号
*/
public void setCourseContentThreeNumber(String courseContentThreeNumber) {
this.courseContentThreeNumber = courseContentThreeNumber;
}
/**
* 获取课程内容三级
*
* @return course_content_three - 课程内容三级
*/
public String getCourseContentThree() {
return courseContentThree;
}
/**
* 设置课程内容三级
*
* @param courseContentThree 课程内容三级
*/
public void setCourseContentThree(String courseContentThree) {
this.courseContentThree = courseContentThree;
}
/**
* 获取学习水平
*
* @return study_level - 学习水平
*/
public String getStudyLevel() {
return studyLevel;
}
/**
* 设置学习水平
*
* @param studyLevel 学习水平
*/
public void setStudyLevel(String studyLevel) {
this.studyLevel = studyLevel;
}
/**
* 获取对应课标列表的id
*
* @return pid - 对应课标列表的id
*/
public Long getPid() {
return pid;
}
/**
* 设置对应课标列表的id
*
* @param pid 对应课标列表的id
*/
public void setPid(Long pid) {
this.pid = pid;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "math_primary_course_target")
public class MathPrimaryCourseTarget {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 唯一标识
*/
private String code;
/**
* 国标编码
*/
@Column(name = "nation_code")
private String nationCode;
/**
* 标准维度
*/
@Column(name = "standard_dimension")
private String standardDimension;
/**
* 课程目标序号
*/
@Column(name = "course_target_number")
private String courseTargetNumber;
/**
* 课程目标
*/
@Column(name = "course_target")
private String courseTarget;
/**
* 对应的课标标的主键
*/
private Long pid;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取唯一标识
*
* @return code - 唯一标识
*/
public String getCode() {
return code;
}
/**
* 设置唯一标识
*
* @param code 唯一标识
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取国标编码
*
* @return nation_code - 国标编码
*/
public String getNationCode() {
return nationCode;
}
/**
* 设置国标编码
*
* @param nationCode 国标编码
*/
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
/**
* 获取标准维度
*
* @return standard_dimension - 标准维度
*/
public String getStandardDimension() {
return standardDimension;
}
/**
* 设置标准维度
*
* @param standardDimension 标准维度
*/
public void setStandardDimension(String standardDimension) {
this.standardDimension = standardDimension;
}
/**
* 获取课程目标序号
*
* @return course_target_number - 课程目标序号
*/
public String getCourseTargetNumber() {
return courseTargetNumber;
}
/**
* 设置课程目标序号
*
* @param courseTargetNumber 课程目标序号
*/
public void setCourseTargetNumber(String courseTargetNumber) {
this.courseTargetNumber = courseTargetNumber;
}
/**
* 获取课程目标
*
* @return course_target - 课程目标
*/
public String getCourseTarget() {
return courseTarget;
}
/**
* 设置课程目标
*
* @param courseTarget 课程目标
*/
public void setCourseTarget(String courseTarget) {
this.courseTarget = courseTarget;
}
/**
* 获取对应的课标标的主键
*
* @return pid - 对应的课标标的主键
*/
public Long getPid() {
return pid;
}
/**
* 设置对应的课标标的主键
*
* @param pid 对应的课标标的主键
*/
public void setPid(Long pid) {
this.pid = pid;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "math_primary_stage_target")
public class MathPrimaryStageTarget {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 唯一标识
*/
private String code;
/**
* 国标编码
*/
@Column(name = "nation_code")
private String nationCode;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 标准维度
*/
@Column(name = "standard_dimension")
private String standardDimension;
/**
* 学段目标序号
*/
@Column(name = "stage_target_number")
private String stageTargetNumber;
/**
* 学段目标
*/
@Column(name = "stage_target")
private String stageTarget;
/**
* 对应的课标标的主键
*/
private Long pid;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取唯一标识
*
* @return code - 唯一标识
*/
public String getCode() {
return code;
}
/**
* 设置唯一标识
*
* @param code 唯一标识
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取国标编码
*
* @return nation_code - 国标编码
*/
public String getNationCode() {
return nationCode;
}
/**
* 设置国标编码
*
* @param nationCode 国标编码
*/
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取标准维度
*
* @return standard_dimension - 标准维度
*/
public String getStandardDimension() {
return standardDimension;
}
/**
* 设置标准维度
*
* @param standardDimension 标准维度
*/
public void setStandardDimension(String standardDimension) {
this.standardDimension = standardDimension;
}
/**
* 获取学段目标序号
*
* @return stage_target_number - 学段目标序号
*/
public String getStageTargetNumber() {
return stageTargetNumber;
}
/**
* 设置学段目标序号
*
* @param stageTargetNumber 学段目标序号
*/
public void setStageTargetNumber(String stageTargetNumber) {
this.stageTargetNumber = stageTargetNumber;
}
/**
* 获取学段目标
*
* @return stage_target - 学段目标
*/
public String getStageTarget() {
return stageTarget;
}
/**
* 设置学段目标
*
* @param stageTarget 学段目标
*/
public void setStageTarget(String stageTarget) {
this.stageTarget = stageTarget;
}
/**
* 获取对应的课标标的主键
*
* @return pid - 对应的课标标的主键
*/
public Long getPid() {
return pid;
}
/**
* 设置对应的课标标的主键
*
* @param pid 对应的课标标的主键
*/
public void setPid(Long pid) {
this.pid = pid;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import java.util.Date;
import javax.persistence.*;
@Table(name = "math_primary_teach_target")
public class MathPrimaryTeachTarget {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/**
* 唯一标识
*/
private String code;
/**
* 国标编码
*/
@Column(name = "nation_code")
private String nationCode;
/**
* 学段
*/
@Column(name = "study_stage")
private String studyStage;
/**
* 课程总目标国标编码
*/
@Column(name = "course_target_code")
private String courseTargetCode;
/**
* 课程目标国标编码
*/
@Column(name = "stage_target_code")
private String stageTargetCode;
/**
* 课程内容国标编码
*/
@Column(name = "course_content_code")
private String courseContentCode;
/**
* 年级
*/
private String grade;
/**
* 关键要素
*/
private String element;
/**
* 主题
*/
private String theme;
/**
* 目标分层(水平)
*/
private String level;
/**
* 分年级教学目标序号
*/
@Column(name = "teach_target_number")
private String teachTargetNumber;
/**
* 分年级教学目标
*/
@Column(name = "teach_target")
private String teachTarget;
/**
* 对应的课标标的主键
*/
private Long pid;
/**
* 是否删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Long getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Long id) {
this.id = id;
}
/**
* 获取唯一标识
*
* @return code - 唯一标识
*/
public String getCode() {
return code;
}
/**
* 设置唯一标识
*
* @param code 唯一标识
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取国标编码
*
* @return nation_code - 国标编码
*/
public String getNationCode() {
return nationCode;
}
/**
* 设置国标编码
*
* @param nationCode 国标编码
*/
public void setNationCode(String nationCode) {
this.nationCode = nationCode;
}
/**
* 获取学段
*
* @return study_stage - 学段
*/
public String getStudyStage() {
return studyStage;
}
/**
* 设置学段
*
* @param studyStage 学段
*/
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
/**
* 获取课程总目标国标编码
*
* @return course_target_code - 课程总目标国标编码
*/
public String getCourseTargetCode() {
return courseTargetCode;
}
/**
* 设置课程总目标国标编码
*
* @param courseTargetCode 课程总目标国标编码
*/
public void setCourseTargetCode(String courseTargetCode) {
this.courseTargetCode = courseTargetCode;
}
/**
* 获取课程目标国标编码
*
* @return stage_target_code - 课程目标国标编码
*/
public String getStageTargetCode() {
return stageTargetCode;
}
/**
* 设置课程目标国标编码
*
* @param stageTargetCode 课程目标国标编码
*/
public void setStageTargetCode(String stageTargetCode) {
this.stageTargetCode = stageTargetCode;
}
/**
* 获取课程内容国标编码
*
* @return course_content_code - 课程内容国标编码
*/
public String getCourseContentCode() {
return courseContentCode;
}
/**
* 设置课程内容国标编码
*
* @param courseContentCode 课程内容国标编码
*/
public void setCourseContentCode(String courseContentCode) {
this.courseContentCode = courseContentCode;
}
/**
* 获取年级
*
* @return grade - 年级
*/
public String getGrade() {
return grade;
}
/**
* 设置年级
*
* @param grade 年级
*/
public void setGrade(String grade) {
this.grade = grade;
}
/**
* 获取关键要素
*
* @return element - 关键要素
*/
public String getElement() {
return element;
}
/**
* 设置关键要素
*
* @param element 关键要素
*/
public void setElement(String element) {
this.element = element;
}
/**
* 获取主题
*
* @return theme - 主题
*/
public String getTheme() {
return theme;
}
/**
* 设置主题
*
* @param theme 主题
*/
public void setTheme(String theme) {
this.theme = theme;
}
/**
* 获取目标分层(水平)
*
* @return level - 目标分层(水平)
*/
public String getLevel() {
return level;
}
/**
* 设置目标分层(水平)
*
* @param level 目标分层(水平)
*/
public void setLevel(String level) {
this.level = level;
}
/**
* 获取分年级教学目标序号
*
* @return teach_target_number - 分年级教学目标序号
*/
public String getTeachTargetNumber() {
return teachTargetNumber;
}
/**
* 设置分年级教学目标序号
*
* @param teachTargetNumber 分年级教学目标序号
*/
public void setTeachTargetNumber(String teachTargetNumber) {
this.teachTargetNumber = teachTargetNumber;
}
/**
* 获取分年级教学目标
*
* @return teach_target - 分年级教学目标
*/
public String getTeachTarget() {
return teachTarget;
}
/**
* 设置分年级教学目标
*
* @param teachTarget 分年级教学目标
*/
public void setTeachTarget(String teachTarget) {
this.teachTarget = teachTarget;
}
/**
* 获取对应的课标标的主键
*
* @return pid - 对应的课标标的主键
*/
public Long getPid() {
return pid;
}
/**
* 设置对应的课标标的主键
*
* @param pid 对应的课标标的主键
*/
public void setPid(Long pid) {
this.pid = pid;
}
/**
* 获取是否删除
*
* @return is_delete - 是否删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除
*
* @param isDelete 是否删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.Query;
import lombok.Data;
/**
* TeachGoalQuery class
*
* @author guojw
* @description
* @date 2020/4/8 16:34
*/
@Data
public class TeachGoalQuery {
private String studyStage;
private String subject;
private String curType;
private Integer status;
}
package com.chineseall.teachgoal.model;
import javax.persistence.*;
import java.util.Date;
@Table(name = "sys_dict")
public class SysDict {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "dict_value")
private String dictValue;
@Column(name = "dict_text")
private String dictText;
@Column(name = "dict_type")
private String dictType;
@Column(name = "order_index")
private Byte orderIndex;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modifie")
private Date gmtModifie;
@Column(name = "is_deleted")
private Boolean isDeleted;
@Column(name = "dict_type_name")
private String dictTypeName;
@Column(name = "dict_desc")
private String dictDesc;
@Column(name = "dict_default_value")
private String dictDefaultValue;
private String code;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return dict_value
*/
public String getDictValue() {
return dictValue;
}
/**
* @param dictValue
*/
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
/**
* @return dict_text
*/
public String getDictText() {
return dictText;
}
/**
* @param dictText
*/
public void setDictText(String dictText) {
this.dictText = dictText;
}
/**
* @return dict_type
*/
public String getDictType() {
return dictType;
}
/**
* @param dictType
*/
public void setDictType(String dictType) {
this.dictType = dictType;
}
/**
* @return order_index
*/
public Byte getOrderIndex() {
return orderIndex;
}
/**
* @param orderIndex
*/
public void setOrderIndex(Byte orderIndex) {
this.orderIndex = orderIndex;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modifie
*/
public Date getGmtModifie() {
return gmtModifie;
}
/**
* @param gmtModifie
*/
public void setGmtModifie(Date gmtModifie) {
this.gmtModifie = gmtModifie;
}
/**
* @return is_deleted
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* @return dict_type_name
*/
public String getDictTypeName() {
return dictTypeName;
}
/**
* @param dictTypeName
*/
public void setDictTypeName(String dictTypeName) {
this.dictTypeName = dictTypeName;
}
/**
* @return dict_desc
*/
public String getDictDesc() {
return dictDesc;
}
/**
* @param dictDesc
*/
public void setDictDesc(String dictDesc) {
this.dictDesc = dictDesc;
}
/**
* @return dict_default_value
*/
public String getDictDefaultValue() {
return dictDefaultValue;
}
/**
* @param dictDefaultValue
*/
public void setDictDefaultValue(String dictDefaultValue) {
this.dictDefaultValue = dictDefaultValue;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.Date;
public class User {
/**
* 主键
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 登录名
*/
@Column(name = "login_name")
private String loginName;
/**
* 密码
*/
private String password;
/**
* 是否删除 0:未删除 1:已删除
*/
@Column(name = "is_delete")
private Boolean isDelete;
/**
* 创建时间
*/
@Column(name = "gmt_create")
private Date gmtCreate;
/**
* 修改时间
*/
@Column(name = "gmt_modified")
private Date gmtModified;
/**
* 获取主键
*
* @return id - 主键
*/
public Integer getId() {
return id;
}
/**
* 设置主键
*
* @param id 主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取登录名
*
* @return login_name - 登录名
*/
public String getLoginName() {
return loginName;
}
/**
* 设置登录名
*
* @param loginName 登录名
*/
public void setLoginName(String loginName) {
this.loginName = loginName;
}
/**
* 获取密码
*
* @return password - 密码
*/
public String getPassword() {
return password;
}
/**
* 设置密码
*
* @param password 密码
*/
public void setPassword(String password) {
this.password = password;
}
/**
* 获取是否删除 0:未删除 1:已删除
*
* @return is_delete - 是否删除 0:未删除 1:已删除
*/
public Boolean getIsDelete() {
return isDelete;
}
/**
* 设置是否删除 0:未删除 1:已删除
*
* @param isDelete 是否删除 0:未删除 1:已删除
*/
public void setIsDelete(Boolean isDelete) {
this.isDelete = isDelete;
}
/**
* 获取创建时间
*
* @return gmt_create - 创建时间
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* 设置创建时间
*
* @param gmtCreate 创建时间
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* 获取修改时间
*
* @return gmt_modified - 修改时间
*/
public Date getGmtModified() {
return gmtModified;
}
/**
* 设置修改时间
*
* @param gmtModified 修改时间
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.VO;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.Date;
public class BasicDataExportVO {
private Integer id;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private String remark;
private Integer status;
private Integer orderIndex;
private String code;
private String type;
private String title;
private String shortTitle;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getOrderIndex() {
return orderIndex;
}
public void setOrderIndex(Integer orderIndex) {
this.orderIndex = orderIndex;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getShortTitle() {
return shortTitle;
}
public void setShortTitle(String shortTitle) {
this.shortTitle = shortTitle;
}
}
package com.chineseall.teachgoal.model.VO;
import javax.persistence.*;
import java.util.Date;
@Table(name = "basic_data")
public class BasicDataVO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 全称
*/
private String title;
/**
* 简称
*/
@Column(name = "shortTitle")
private String shorttitle;
/**
* 编码
*/
private String code;
/**
* 排序
*/
@Column(name = "orderIndex")
private Integer orderindex;
/**
* 0:正常 1:停用
*/
private Integer status;
/**
* 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
private String type;
/**
* 创建时间
*/
@Column(name = "createTime")
private Date createtime;
/**
* 更新时间
*/
@Column(name = "updateTime")
private Date updatetime;
private String remark;
@Column(name = "sheetName")
private String sheetname;
@Column(name = "excelPath")
private String excelpath;
@Column(name = "excelName")
private String excelname;
/**
* @return id
*/
public Integer getId() {
return id;
}
/**
* @param id
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取全称
*
* @return title - 全称
*/
public String getTitle() {
return title;
}
/**
* 设置全称
*
* @param title 全称
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取简称
*
* @return shortTitle - 简称
*/
public String getShorttitle() {
return shorttitle;
}
/**
* 设置简称
*
* @param shorttitle 简称
*/
public void setShorttitle(String shorttitle) {
this.shorttitle = shorttitle;
}
/**
* 获取编码
*
* @return code - 编码
*/
public String getCode() {
return code;
}
/**
* 设置编码
*
* @param code 编码
*/
public void setCode(String code) {
this.code = code;
}
/**
* 获取排序
*
* @return orderIndex - 排序
*/
public Integer getOrderindex() {
return orderindex;
}
/**
* 设置排序
*
* @param orderindex 排序
*/
public void setOrderindex(Integer orderindex) {
this.orderindex = orderindex;
}
/**
* 获取0:正常 1:停用
*
* @return status - 0:正常 1:停用
*/
public Integer getStatus() {
return status;
}
/**
* 设置0:正常 1:停用
*
* @param status 0:正常 1:停用
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 获取类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @return type - 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public String getType() {
return type;
}
/**
* 设置类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*
* @param type 类型:类型:ZW07 学科 2 出版社 3 年级 4 学期 5 册 6 教材类型 7 使用年份 8 课程类型 9 使用地区 10 修订年份 11 出版情况 12 介质类型 13 电子书格式 14 教材配套品种 15 发行情况
*/
public void setType(String type) {
this.type = type;
}
/**
* 获取创建时间
*
* @return createTime - 创建时间
*/
public Date getCreatetime() {
return createtime;
}
/**
* 设置创建时间
*
* @param createtime 创建时间
*/
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
/**
* 获取更新时间
*
* @return updateTime - 更新时间
*/
public Date getUpdatetime() {
return updatetime;
}
/**
* 设置更新时间
*
* @param updatetime 更新时间
*/
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
/**
* @return remark
*/
public String getRemark() {
return remark;
}
/**
* @param remark
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* @return sheetName
*/
public String getSheetname() {
return sheetname;
}
/**
* @param sheetname
*/
public void setSheetname(String sheetname) {
this.sheetname = sheetname;
}
/**
* @return excelPath
*/
public String getExcelpath() {
return excelpath;
}
/**
* @param excelpath
*/
public void setExcelpath(String excelpath) {
this.excelpath = excelpath;
}
/**
* @return excelName
*/
public String getExcelname() {
return excelname;
}
/**
* @param excelname
*/
public void setExcelname(String excelname) {
this.excelname = excelname;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.VO;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* CourseStandardApiVO class
*
* @author guojw
* @description
* @date 2019/5/20 13:50
*/
public class CourseStandardApiVO {
private String code;
private String standardCode;
private Long pid;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private String gmtCreate;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private String gmtModified;
private String subject;
private String curType;
private Boolean status;
private Boolean upperShelf;
private Boolean isDeleted;
private String studyStage;
private String standardDimension;
private String ranks;
private String courseTargetNumber;
private String courseTarget;
private String themeOne;
private String themeTwo;
private String element;
private String targetNumber;
private String target;
private String standardNumber;
private String standard;
private String unit;
private String courseContent;
private String scienceContentOne;
private String scienceContentTwo;
private String scienceElement;
private String studyContentOne;
private String studyContentTwo;
private String studyContentThree;
private String studyContentFour;
private String courseContentOne;
private String courseContentTwo;
private String courseContentThreeNumber;
private String courseContentThree;
private String courseContentFourNumber;
private String courseContentFour;
private String studyContentModule;
private String targetDescribe;
private String classify;
private String module;
private String capacity;
private String standardDescribeOne;
private String standardDescribeTwo;
private String standardDescribeThree;
private String studyContent;
private String studyLevel;
private String specificRequireOneNumber;
private String specificRequireOne;
private String specificRequireTwoNumber;
private String specificRequireTwo;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getStandardCode() {
return standardCode;
}
public void setStandardCode(String standardCode) {
this.standardCode = standardCode;
}
public Long getPid() {
return pid;
}
public void setPid(Long pid) {
this.pid = pid;
}
public String getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(String gmtCreate) {
this.gmtCreate = gmtCreate;
}
public String getGmtModified() {
return gmtModified;
}
public void setGmtModified(String gmtModified) {
this.gmtModified = gmtModified;
}
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getStandardDimension() {
return standardDimension;
}
public void setStandardDimension(String standardDimension) {
this.standardDimension = standardDimension;
}
public String getRanks() {
return ranks;
}
public void setRanks(String ranks) {
this.ranks = ranks;
}
public String getCourseTargetNumber() {
return courseTargetNumber;
}
public void setCourseTargetNumber(String courseTargetNumber) {
this.courseTargetNumber = courseTargetNumber;
}
public String getCourseTarget() {
return courseTarget;
}
public void setCourseTarget(String courseTarget) {
this.courseTarget = courseTarget;
}
public String getThemeOne() {
return themeOne;
}
public void setThemeOne(String themeOne) {
this.themeOne = themeOne;
}
public String getThemeTwo() {
return themeTwo;
}
public void setThemeTwo(String themeTwo) {
this.themeTwo = themeTwo;
}
public String getElement() {
return element;
}
public void setElement(String element) {
this.element = element;
}
public String getTargetNumber() {
return targetNumber;
}
public void setTargetNumber(String targetNumber) {
this.targetNumber = targetNumber;
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getStandardNumber() {
return standardNumber;
}
public void setStandardNumber(String standardNumber) {
this.standardNumber = standardNumber;
}
public String getStandard() {
return standard;
}
public void setStandard(String standard) {
this.standard = standard;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getCourseContent() {
return courseContent;
}
public void setCourseContent(String courseContent) {
this.courseContent = courseContent;
}
public String getScienceContentOne() {
return scienceContentOne;
}
public void setScienceContentOne(String scienceContentOne) {
this.scienceContentOne = scienceContentOne;
}
public String getScienceContentTwo() {
return scienceContentTwo;
}
public void setScienceContentTwo(String scienceContentTwo) {
this.scienceContentTwo = scienceContentTwo;
}
public String getScienceElement() {
return scienceElement;
}
public void setScienceElement(String scienceElement) {
this.scienceElement = scienceElement;
}
public String getStudyContentOne() {
return studyContentOne;
}
public void setStudyContentOne(String studyContentOne) {
this.studyContentOne = studyContentOne;
}
public String getStudyContentTwo() {
return studyContentTwo;
}
public void setStudyContentTwo(String studyContentTwo) {
this.studyContentTwo = studyContentTwo;
}
public String getStudyContentThree() {
return studyContentThree;
}
public void setStudyContentThree(String studyContentThree) {
this.studyContentThree = studyContentThree;
}
public String getStudyContentFour() {
return studyContentFour;
}
public void setStudyContentFour(String studyContentFour) {
this.studyContentFour = studyContentFour;
}
public String getCourseContentOne() {
return courseContentOne;
}
public void setCourseContentOne(String courseContentOne) {
this.courseContentOne = courseContentOne;
}
public String getCourseContentTwo() {
return courseContentTwo;
}
public void setCourseContentTwo(String courseContentTwo) {
this.courseContentTwo = courseContentTwo;
}
public String getCourseContentThreeNumber() {
return courseContentThreeNumber;
}
public void setCourseContentThreeNumber(String courseContentThreeNumber) {
this.courseContentThreeNumber = courseContentThreeNumber;
}
public String getCourseContentThree() {
return courseContentThree;
}
public void setCourseContentThree(String courseContentThree) {
this.courseContentThree = courseContentThree;
}
public String getCourseContentFourNumber() {
return courseContentFourNumber;
}
public void setCourseContentFourNumber(String courseContentFourNumber) {
this.courseContentFourNumber = courseContentFourNumber;
}
public String getCourseContentFour() {
return courseContentFour;
}
public void setCourseContentFour(String courseContentFour) {
this.courseContentFour = courseContentFour;
}
public String getStudyContentModule() {
return studyContentModule;
}
public void setStudyContentModule(String studyContentModule) {
this.studyContentModule = studyContentModule;
}
public String getTargetDescribe() {
return targetDescribe;
}
public void setTargetDescribe(String targetDescribe) {
this.targetDescribe = targetDescribe;
}
public String getClassify() {
return classify;
}
public void setClassify(String classify) {
this.classify = classify;
}
public String getModule() {
return module;
}
public void setModule(String module) {
this.module = module;
}
public String getCapacity() {
return capacity;
}
public void setCapacity(String capacity) {
this.capacity = capacity;
}
public String getStandardDescribeOne() {
return standardDescribeOne;
}
public void setStandardDescribeOne(String standardDescribeOne) {
this.standardDescribeOne = standardDescribeOne;
}
public String getStandardDescribeTwo() {
return standardDescribeTwo;
}
public void setStandardDescribeTwo(String standardDescribeTwo) {
this.standardDescribeTwo = standardDescribeTwo;
}
public String getStudyContent() {
return studyContent;
}
public void setStudyContent(String studyContent) {
this.studyContent = studyContent;
}
public String getStudyLevel() {
return studyLevel;
}
public void setStudyLevel(String studyLevel) {
this.studyLevel = studyLevel;
}
public String getSpecificRequireOneNumber() {
return specificRequireOneNumber;
}
public void setSpecificRequireOneNumber(String specificRequireOneNumber) {
this.specificRequireOneNumber = specificRequireOneNumber;
}
public String getSpecificRequireOne() {
return specificRequireOne;
}
public void setSpecificRequireOne(String specificRequireOne) {
this.specificRequireOne = specificRequireOne;
}
public String getSpecificRequireTwoNumber() {
return specificRequireTwoNumber;
}
public void setSpecificRequireTwoNumber(String specificRequireTwoNumber) {
this.specificRequireTwoNumber = specificRequireTwoNumber;
}
public String getSpecificRequireTwo() {
return specificRequireTwo;
}
public void setSpecificRequireTwo(String specificRequireTwo) {
this.specificRequireTwo = specificRequireTwo;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCurType() {
return curType;
}
public void setCurType(String curType) {
this.curType = curType;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
/**
* @return is_deleted
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
public Boolean getUpperShelf() {
return upperShelf;
}
public void setUpperShelf(Boolean upperShelf) {
this.upperShelf = upperShelf;
}
public String getStandardDescribeThree() {
return standardDescribeThree;
}
public void setStandardDescribeThree(String standardDescribeThree) {
this.standardDescribeThree = standardDescribeThree;
}
}
package com.chineseall.teachgoal.model.VO;
import java.util.Date;
public class CourseStandardListVO {
private Long id;
private String studyStage;
private String subject;
private String curType;
private Date gmtCreate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getStudyStage() {
return studyStage;
}
public void setStudyStage(String studyStage) {
this.studyStage = studyStage;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCurType() {
return curType;
}
public void setCurType(String curType) {
this.curType = curType;
}
public Date getGmtCreate() {
return gmtCreate;
}
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
}
package com.chineseall.teachgoal.model.VO;
import java.util.List;
public class DictVO {
private String label;
private String value;
private String type;
private List<String> stageList;
private List<String> subjectList;
private List<String> curTypeList;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public List<String> getStageList() {
return stageList;
}
public void setStageList(List<String> stageList) {
this.stageList = stageList;
}
public List<String> getSubjectList() {
return subjectList;
}
public void setSubjectList(List<String> subjectList) {
this.subjectList = subjectList;
}
public List<String> getCurTypeList() {
return curTypeList;
}
public void setCurTypeList(List<String> curTypeList) {
this.curTypeList = curTypeList;
}
}
package com.chineseall.teachgoal.model.VO;
import java.util.List;
public class ExcelTreeVO {
private String label;
private List<ExcelTreeVO> list;
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public List<ExcelTreeVO> getList() {
return list;
}
public void setList(List<ExcelTreeVO> list) {
this.list = list;
}
}
package com.chineseall.teachgoal.model.VO;
import javax.persistence.*;
import java.util.Date;
@Table(name = "sys_dict")
public class SysDictVO {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "dict_value")
private String dictValue;
@Column(name = "dict_text")
private String dictText;
@Column(name = "dict_type")
private String dictType;
@Column(name = "order_index")
private Byte orderIndex;
@Column(name = "gmt_create")
private Date gmtCreate;
@Column(name = "gmt_modifie")
private Date gmtModifie;
@Column(name = "is_deleted")
private Boolean isDeleted;
@Column(name = "dict_type_name")
private String dictTypeName;
@Column(name = "dict_desc")
private String dictDesc;
@Column(name = "dict_default_value")
private String dictDefaultValue;
private String code;
/**
* @return id
*/
public Long getId() {
return id;
}
/**
* @param id
*/
public void setId(Long id) {
this.id = id;
}
/**
* @return dict_value
*/
public String getDictValue() {
return dictValue;
}
/**
* @param dictValue
*/
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
/**
* @return dict_text
*/
public String getDictText() {
return dictText;
}
/**
* @param dictText
*/
public void setDictText(String dictText) {
this.dictText = dictText;
}
/**
* @return dict_type
*/
public String getDictType() {
return dictType;
}
/**
* @param dictType
*/
public void setDictType(String dictType) {
this.dictType = dictType;
}
/**
* @return order_index
*/
public Byte getOrderIndex() {
return orderIndex;
}
/**
* @param orderIndex
*/
public void setOrderIndex(Byte orderIndex) {
this.orderIndex = orderIndex;
}
/**
* @return gmt_create
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
* @return gmt_modifie
*/
public Date getGmtModifie() {
return gmtModifie;
}
/**
* @param gmtModifie
*/
public void setGmtModifie(Date gmtModifie) {
this.gmtModifie = gmtModifie;
}
/**
* @return is_deleted
*/
public Boolean getIsDeleted() {
return isDeleted;
}
/**
* @param isDeleted
*/
public void setIsDeleted(Boolean isDeleted) {
this.isDeleted = isDeleted;
}
/**
* @return dict_type_name
*/
public String getDictTypeName() {
return dictTypeName;
}
/**
* @param dictTypeName
*/
public void setDictTypeName(String dictTypeName) {
this.dictTypeName = dictTypeName;
}
/**
* @return dict_desc
*/
public String getDictDesc() {
return dictDesc;
}
/**
* @param dictDesc
*/
public void setDictDesc(String dictDesc) {
this.dictDesc = dictDesc;
}
/**
* @return dict_default_value
*/
public String getDictDefaultValue() {
return dictDefaultValue;
}
/**
* @param dictDefaultValue
*/
public void setDictDefaultValue(String dictDefaultValue) {
this.dictDefaultValue = dictDefaultValue;
}
/**
* @return code
*/
public String getCode() {
return code;
}
/**
* @param code
*/
public void setCode(String code) {
this.code = code;
}
}
\ No newline at end of file
package com.chineseall.teachgoal.model.VO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TreeVO {
private String label;
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
private Integer id;
private String eductional;
private String eductionalName;
private String subjectName;
private String subject;
private String knowledgeType;
private String knowledgeTypeName;
public String getEductional() {
return eductional;
}
public void setEductional(String eductional) {
this.eductional = eductional;
}
public String getEductionalName() {
return eductionalName;
}
public void setEductionalName(String eductionalName) {
this.eductionalName = eductionalName;
}
public String getSubjectName() {
return subjectName;
}
public void setSubjectName(String subjectName) {
this.subjectName = subjectName;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getKnowledgeType() {
return knowledgeType;
}
public void setKnowledgeType(String knowledgeType) {
this.knowledgeType = knowledgeType;
}
public String getKnowledgeTypeName() {
return knowledgeTypeName;
}
public void setKnowledgeTypeName(String knowledgeTypeName) {
this.knowledgeTypeName = knowledgeTypeName;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
private List<TreeVO> children;
public TreeVO(String label) {
this.label = label;
}
}
package com.chineseall.teachgoal.model.VO;
import java.util.List;
public class TreeWithIdVO {
private Long id;
public List<TreeVO> getTree() {
return tree;
}
public void setTree(List<TreeVO> tree) {
this.tree = tree;
}
private List<TreeVO> tree;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.AliBucket;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/08.
*/
public interface AliBucketService extends Service<AliBucket> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.dao.AliBucketMapperE;
import com.chineseall.teachgoal.model.AliBucket;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/08.
*/
@Service
public class AliBucketServiceE {
@Resource
private AliBucketMapperE aliBucketMapperE;
public AliBucket selectByCode(String code){
return aliBucketMapperE.selectByCode(code);
}
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.Service;
import com.chineseall.teachgoal.model.BasicData;
/**
* Created by guojw on 2019/04/08.
*/
public interface BasicDataService extends Service<BasicData> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/08.
*/
public interface ClientService extends Service<Client> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.Service;
import com.chineseall.teachgoal.model.CourseStandardList;
/**
* Created by guojw on 2019/04/08.
*/
public interface CourseStandardListService extends Service<CourseStandardList> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.PageOut;
import com.chineseall.teachgoal.core.ServiceException;
import com.chineseall.teachgoal.core.UuidGenerator;
import com.chineseall.teachgoal.dao.CourseStandardListMapperE;
import com.chineseall.teachgoal.model.CourseStandardList;
import com.chineseall.teachgoal.model.VO.CourseStandardListVO;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class CourseStandardListServiceE {
@Resource
private CourseStandardListMapperE courseStandardListMapperE;
// @Resource
// private ImportPhysicsServiceE physicsServiceE;
// @Resource
// private ImportChineseServiceE chineseServiceE;
// @Resource
// private ImportMathServiceE mathServiceE;
// @Resource
// private ImportChemistryServiceE chemistryServiceE;
// @Resource
// private ImportEnglishServiceE englishServiceE;
// @Resource
// private ImportGeographyServiceE geographyServiceE;
// @Resource
// private ImportBiologyServiceE biologyServiceE;
// @Resource
// private ImportTechnologyServiceE technologyServiceE;
public Long countByCondition(String studyStage, String curType, String subject) {
return courseStandardListMapperE.findByCondition(studyStage,curType,subject);
}
public List<CourseStandardList> queryTeachGoalByCondition(Integer status,String studyStage, String curType, String subject) {
return courseStandardListMapperE.queryTeachGoalByCondition(status,studyStage,curType,subject);
}
/**
* 插入excel列表并返回id
* @param curType 课标类型
* @param subject 学科
* @param studyStage 学段
* @return 该课标的id
*/
public Long saveAndBackId(String curType, String subject, String studyStage) {
CourseStandardList list = new CourseStandardList();
list.setCode(UuidGenerator.getUUID32());
list.setCurType(curType);
list.setSubject(subject);
list.setStudyStage(studyStage);
courseStandardListMapperE.saveAndBackId(list);
return list.getId();
}
/**
* 获取已上架的课标
*
* @param page 当前页码
* @param size 每一页显示内容条数
* @return 已上架的课标信息
*/
public PageOut<CourseStandardListVO> queryAll(Integer page, Integer size) {
Page<CourseStandardListVO> courseStandardListPage = PageHelper.startPage(page, size).doSelectPage(() -> courseStandardListMapperE.queryAll());
PageOut<CourseStandardListVO> voPageOut = new PageOut<>();
voPageOut.setPageSize(courseStandardListPage.getPageSize());
voPageOut.setPageNumber(courseStandardListPage.getPageNum());
voPageOut.setTotalSize(courseStandardListPage.getTotal());
voPageOut.setData(courseStandardListPage.getResult());
return voPageOut;
}
/**
* 获取草稿箱数据
* @param page 当前页码
* @param size 每一页显示内容条数
* @return 草稿箱的课标信息
*/
public PageOut<CourseStandardListVO> queryDrafts(Integer page, Integer size) {
Page<CourseStandardListVO> courseStandardListPage = PageHelper.startPage(page, size).doSelectPage(() -> courseStandardListMapperE.queryDrafts());
PageOut<CourseStandardListVO> voPageOut = new PageOut<>();
voPageOut.setPageSize(courseStandardListPage.getPageSize());
voPageOut.setPageNumber(courseStandardListPage.getPageNum());
voPageOut.setTotalSize(courseStandardListPage.getTotal());
voPageOut.setData(courseStandardListPage.getResult());
return voPageOut;
}
/**
* 删除课标 已上架的教学目标不能删除
* @param id 课标id
*/
public void deleteCourseStandard(Long id) {
CourseStandardList courseStandardList = courseStandardListMapperE.findById(id);
if (courseStandardList == null){
throw new ServiceException("该教学目标不存在");
}
if (courseStandardList.getStatus() != null && !courseStandardList.getStatus()){
throw new ServiceException("上架课标不可以删除");
}
courseStandardListMapperE.deleteCourseStandard(id);
}
/**
* 加入草稿箱
* @param id 课标id
*/
public void addDrafts(Long id) {
CourseStandardList courseStandardList = courseStandardListMapperE.findById(id);
if (courseStandardList == null){
throw new ServiceException("该课表不存在");
}
courseStandardListMapperE.addDrafts(id);
}
/**
* 上架入库
* @param id 课标id
*/
public void upperShelf(Long id) {
CourseStandardList courseStandardList = courseStandardListMapperE.findById(id);
if (courseStandardList == null){
throw new ServiceException("该课表不存在");
}
courseStandardListMapperE.upperShelf(id);
}
//查询最近插入的课标
public CourseStandardList findLastOne() {
return courseStandardListMapperE.findLastOne();
}
// /**
// * 获取课标的结构图
// * @param id 课标id
// * @return 该课标excel中的所有内容(层级展示)
// */
// public List<TreeVo> getTree(Long id) {
//
// CourseStandardList course = courseStandardListMapperE.findById(id);
// if (course == null){
// throw new ServiceException("该课表不存在");
// }
//
// String subject = course.getSubject();
// String curType = course.getCurType();
// String studyStage = course.getStudyStage();
//
// //String excelName = studyStage + subject + curType;
//
// if (studyStage.equals("高中")){
//
// if (subject.equals("物理")){
// if (curType.contains("01")){
// return physicsServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return physicsServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return physicsServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return physicsServiceE.getHighNationFourTree(id);
// }
// if (curType.contains("05")){
// return physicsServiceE.getHighNationFiveTree(id);
// }
// if (curType.contains("06")){
// return physicsServiceE.getHighNationSixTree(id);
// }
// if (curType.contains("07")){
// return physicsServiceE.getHighNationSevenTree(id);
// }
// }
// if (subject.equals("数学")){
// if (curType.contains("01")){
// return mathServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return mathServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return mathServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return mathServiceE.getHighNationFourTree(id);
// }
// }
// if (subject.equals("语文")){
// if (curType.contains("01")){
// return chineseServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return chineseServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return chineseServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return chineseServiceE.getHighNationFourTree(id);
// }
// }
// if (subject.equals("英语")){
// if (curType.contains("01")){
// return englishServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return englishServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return englishServiceE.getHighNationThreeTree(id);
// }
// }
// if (subject.equals("地理")){
// if (curType.contains("01")){
// return geographyServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return geographyServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return geographyServiceE.getHighNationThreeTree(id);
// }
// }
// if (subject.equals("化学")){
// if (curType.contains("01")){
// return chemistryServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return chemistryServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return chemistryServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return chemistryServiceE.getHighNationFourTree(id);
// }
// }
// if (subject.equals("化学")){
// if (curType.contains("01")){
// return chemistryServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return chemistryServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return chemistryServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return chemistryServiceE.getHighNationFourTree(id);
// }
// }
// if (subject.equals("生物")){
// if (curType.contains("01")){
// return biologyServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return biologyServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return biologyServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return biologyServiceE.getHighNationFourTree(id);
// }
// }
// if (subject.equals("通用技术")){
// if (curType.contains("01")){
// return technologyServiceE.getHighNationOneTree(id);
// }
// if (curType.contains("02")){
// return technologyServiceE.getHighNationTwoTree(id);
// }
// if (curType.contains("03")){
// return technologyServiceE.getHighNationThreeTree(id);
// }
// if (curType.contains("04")){
// return technologyServiceE.getHighNationFourTree(id);
// }
// }
// }
//
// if (studyStage.equals("初中")){
//
// if (subject.equals("英语")){
//
// if (curType.equals("国家课标01-分级目标")){
// return englishServiceE.getMiddleNationOneTree(id);
// }
//
// if (curType.equals("国家课标02-分级标准")){
// return englishServiceE.getMiddleNationTwoTree(id);
// }
//
// if (curType.equals("上海教学基本要求01")){
// return englishServiceE.getMiddleRegionOneTree(id);
// }
//
// if (curType.equals("上海教学基本要求02-功能话题")){
// return englishServiceE.getMiddleRegionTwoTree(id);
// }
//
// if (curType.equals("上海教学基本要求03-核心能力")){
// return englishServiceE.getMiddleRegionThreeTree(id);
// }
// }
// if (subject.equals("化学")){
// if (curType.equals("国家课标01-课程目标")){
// return chemistryServiceE.getMiddleNationOneTree(id);
// }
// if (curType.equals("国家课标02-课程内容")){
// return chemistryServiceE.getMiddleNationTwoTree(id);
// }
// if (curType.equals("上海教学基本要求")){
// return chemistryServiceE.getMiddleRegionTree(id);
// }
// }
// if (subject.equals("物理")){
// if (curType.equals("国家课标01-课程目标")){
// return physicsServiceE.getMiddleNationOneTree(id);
// }
// if (curType.equals("国家课标02-课程内容")){
// return physicsServiceE.getMiddleNationTwoTree(id);
// }
// if (curType.equals("上海教学基本要求")){
// return physicsServiceE.getMiddleRegionTree(id);
// }
// }
//
// if (subject.equals("数学")){
//
// if (curType.equals("国家课标01-课程目标")){
// return mathServiceE.getMiddleNationOneTree(id);
// }
//
// if (curType.equals("国家课标02-课程内容")){
// return mathServiceE.getMiddleNationTwoTree(id);
// }
//
// if (curType.equals("上海教学基本要求")){
// return mathServiceE.getMiddleRegionTree(id);
// }
// }
//
// if (subject.equals("语文")){
// return chineseServiceE.getMiddleNationTree(id);
// }
// }
// if (studyStage.equals("小学")){
// if (subject.equals("英语")){
// if (curType.equals("国家课标01-分级目标")){
// return englishServiceE.getPrimaryNationOneTree(id);
// }
// if (curType.equals("国家课标02-分级标准")){
// return englishServiceE.getPrimaryNationTwoTree(id);
// }
// if (curType.equals("上海教学基本要求01")){
// return englishServiceE.getPrimaryRegionOneTree(id);
// }
// if (curType.equals("上海教学基本要求02-功能话题")){
// return englishServiceE.getPrimaryRegionTwoTree(id);
// }
// if (curType.equals("上海教学基本要求03-核心能力")){
// return englishServiceE.getPrimaryRegionThreeTree(id);
// }
// }
// if (subject.equals("数学")){
//
// if (curType.equals("国家课标01-课程目标")){
// return mathServiceE.getPrimaryNationOneTree(id);
// }
//
// if (curType.equals("国家课标02-课程内容")){
// return mathServiceE.getPrimaryNationTwoTree(id);
// }
//
// if (curType.equals("上海教学基本要求")){
// return mathServiceE.getPrimaryRegionTree(id);
// }
// }
// if (subject.equals("语文")){
// return chineseServiceE.getPrimaryNationTree(id);
// }
// }
// return null;
// }
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.dao.ExcelNameMapperE;
import com.chineseall.teachgoal.model.VO.ExcelTreeVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
@Service
public class ExcelNameServiceE {
@Resource
private ExcelNameMapperE excelNameMapperE;
public List<ExcelTreeVO> queryGradeSubjectType() {
List<ExcelTreeVO> treeVoList = new ArrayList<>();
List<String> gradeList = excelNameMapperE.listGrade();
for (String grade : gradeList) {
ExcelTreeVO treeVo = new ExcelTreeVO();
treeVo.setLabel(grade);
treeVo.setList(getSubject(grade));
treeVoList.add(treeVo);
}
return treeVoList;
}
private List<ExcelTreeVO> getSubject(String grade){
List<ExcelTreeVO> treeVoList = new ArrayList<>();
List<String> subjectList = excelNameMapperE.listSubject(grade);
for (String subject : subjectList) {
ExcelTreeVO treeVo = new ExcelTreeVO();
treeVo.setLabel(subject);
treeVo.setList(getType(grade,subject));
treeVoList.add(treeVo);
}
return treeVoList;
}
private List<ExcelTreeVO> getType(String grade,String subject){
List<ExcelTreeVO> treeVoList = new ArrayList<>();
List<String> typeList = excelNameMapperE.listType(grade, subject);
for (String type : typeList) {
ExcelTreeVO treeVo = new ExcelTreeVO();
treeVo.setLabel(type);
treeVoList.add(treeVo);
}
return treeVoList;
}
public List<String> listStage(){
return excelNameMapperE.listGrade();
}
public List<String> listSubject(){
return excelNameMapperE.listSubject(null);
}
public List<String> listType(){
return excelNameMapperE.listType(null, null);
}
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.AutoMapperUtil;
import com.chineseall.teachgoal.core.UuidGenerator;
import com.chineseall.teachgoal.dao.ImportMathMapperE;
import com.chineseall.teachgoal.model.*;
import org.modelmapper.TypeToken;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
public class ImportMathServiceE {
@Resource
private ImportMathMapperE mathMapperE;
/**
* 导入 【分年级教学目标】 到数据库中
*
* @param allExcelFields 前端传来的excel内容
* @param id 课标列表id
*/
public List<MathPrimaryTeachTarget> saveTeachTarget(List<AllExcelField> allExcelFields, Long id) {
//将excel数据入库
List<MathPrimaryTeachTarget> list = AutoMapperUtil.mapperToBean(allExcelFields, new TypeToken<List<MathPrimaryTeachTarget>>() {
});
for (MathPrimaryTeachTarget math : list) {
math.setCode(UuidGenerator.getUUID32());
math.setPid(id);
math.setIsDelete(false);
math.setGmtCreate(new Date());
}
return list;
}
/**
* 导入 【小学数学课程总目标】 到数据库中
*
* @param allExcelFields 前端传来的excel内容
* @param id 课标列表id
*/
public List<MathPrimaryCourseTarget> saveCourseTarget(List<AllExcelField> allExcelFields, Long id) {
//将excel数据入库
List<MathPrimaryCourseTarget> list = AutoMapperUtil.mapperToBean(allExcelFields, new TypeToken<List<MathPrimaryCourseTarget>>() {
});
for (MathPrimaryCourseTarget math : list) {
math.setCode(UuidGenerator.getUUID32());
math.setPid(id);
math.setIsDelete(false);
math.setGmtCreate(new Date());
}
return list;
}
/**
* 导入 【小学数学课程目标】 到数据库中
*
* @param allExcelFields 前端传来的excel内容
* @param id 课标列表id
*/
public List<MathPrimaryStageTarget> saveStageTarget(List<AllExcelField> allExcelFields, Long id) {
//将excel数据入库
List<MathPrimaryStageTarget> list = AutoMapperUtil.mapperToBean(allExcelFields, new TypeToken<List<MathPrimaryStageTarget>>() {
});
for (MathPrimaryStageTarget math : list) {
math.setCode(UuidGenerator.getUUID32());
math.setPid(id);
math.setIsDelete(false);
math.setGmtCreate(new Date());
}
return list;
}
/**
* 导入 【小学数学课程内容】 到数据库中
*
* @param allExcelFields 前端传来的excel内容
* @param id 课标列表id
*/
public List<MathPrimaryCourseContent> saveCourseContent(List<AllExcelField> allExcelFields, Long id) {
//将excel数据入库
List<MathPrimaryCourseContent> list = AutoMapperUtil.mapperToBean(allExcelFields, new TypeToken<List<MathPrimaryCourseContent>>() {
});
for (MathPrimaryCourseContent math : list) {
math.setCode(UuidGenerator.getUUID32());
math.setPid(id);
math.setIsDelete(false);
math.setGmtCreate(new Date());
}
return list;
}
// /**
// * 导入 【高中数学-国家课标01】 到数据库中
// *
// * @param allExcelFields 前端传来的excel内容
// * @param id 课标列表id
// */
// public void saveHighNationOne(List<AllExcelField> allExcelFields, Long id) {
//
// //将excel数据入库
// List<MathHighNationOne> list = AutoMapperUtil.mapperToBean(allExcelFields, new TypeToken<List<MathHighNationOne>>() {
// });
// for (MathHighNationOne math : list) {
// math.setCode(UuidGenerator.getUUID32());
// }
// mathMapperE.saveHighNationOne(list, id);
// }
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/09.
*/
public interface MathPrimaryCourseContentService extends Service<MathPrimaryCourseContent> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/09.
*/
public interface MathPrimaryCourseTargetService extends Service<MathPrimaryCourseTarget> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.MathPrimaryStageTarget;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/09.
*/
public interface MathPrimaryStageTargetService extends Service<MathPrimaryStageTarget> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.model.MathPrimaryTeachTarget;
import com.chineseall.teachgoal.core.Service;
/**
* Created by guojw on 2020/04/09.
*/
public interface MathPrimaryTeachTargetService extends Service<MathPrimaryTeachTarget> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.Service;
import com.chineseall.teachgoal.model.SysDict;
/**
* Created by guojw on 2020/04/08.
*/
public interface SysDictService extends Service<SysDict> {
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.convert.Convert;
import com.chineseall.teachgoal.core.AutoMapperUtil;
import com.chineseall.teachgoal.core.CollectionUtils;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultGenerator;
import com.chineseall.teachgoal.dao.BasicDataMapperE;
import com.chineseall.teachgoal.model.VO.BasicDataExportVO;
import com.chineseall.teachgoal.model.VO.BasicDataVO;
import com.chineseall.teachgoal.model.VO.DictVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by guojw on 2020/04/08.
*/
@Service
@Transactional
public class SysDictServiceImplE {
@Resource
private BasicDataMapperE basicDataMapperE;
public Result getDictByType(List dictTypeList) {
if(CollectionUtils.isEmpty(dictTypeList)) {
return ResultGenerator.genSuccessResult();
}
List<DictVO> dictVOList = new ArrayList<>();
List<BasicDataVO> list = new ArrayList<>();
list = basicDataMapperE.getDictByType(dictTypeList);
for (BasicDataVO basicDataVO:list
) {
DictVO dictVO = new DictVO();
dictVO.setValue(basicDataVO.getCode());
dictVO.setLabel(basicDataVO.getTitle());
dictVO.setType(basicDataVO.getType());
dictVOList.add(dictVO);
}
return ResultGenerator.genSuccessResult(dictVOList);
}
public List<BasicDataExportVO> listDict(Date gmtModified) {
Convert convert = new Convert();
List<BasicDataExportVO> basicDataExportVOList = new ArrayList<>();
List<BasicDataVO> basicDataVOList = basicDataMapperE.listDict(gmtModified);
if (CollectionUtils.isNotEmpty(basicDataVOList)) {
for (BasicDataVO basicDataVO : basicDataVOList
) {
BasicDataExportVO basicDataExportVO = AutoMapperUtil.mapperToModel(basicDataVO,BasicDataExportVO.class);
basicDataExportVOList.add(basicDataExportVO);
}
}
return basicDataExportVOList;
}
}
package com.chineseall.teachgoal.service;
import com.chineseall.teachgoal.core.Service;
import com.chineseall.teachgoal.model.User;
/**
* Created by guojw on 2020/04/08.
*/
public interface UserService extends Service<User> {
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.AliBucketMapper;
import com.chineseall.teachgoal.model.AliBucket;
import com.chineseall.teachgoal.service.AliBucketService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2019/08/08.
*/
@Service
@Transactional
public class AliBucketServiceImpl extends AbstractService<AliBucket> implements AliBucketService {
@Resource
private AliBucketMapper aliBucketMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.core.AbstractService;
import com.chineseall.teachgoal.dao.BasicDataMapper;
import com.chineseall.teachgoal.model.BasicData;
import com.chineseall.teachgoal.service.BasicDataService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by CodeGenerator on 2019/05/08.
*/
@Service
@Transactional
public class BasicDataServiceImpl extends AbstractService<BasicData> implements BasicDataService {
@Resource
private BasicDataMapper basicDataMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.ClientMapper;
import com.chineseall.teachgoal.model.Client;
import com.chineseall.teachgoal.service.ClientService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/09.
*/
@Service
@Transactional
public class ClientServiceImpl extends AbstractService<Client> implements ClientService {
@Resource
private ClientMapper clientMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.core.AbstractService;
import com.chineseall.teachgoal.dao.CourseStandardListMapper;
import com.chineseall.teachgoal.model.CourseStandardList;
import com.chineseall.teachgoal.service.CourseStandardListService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/08.
*/
@Service
@Transactional
public class CourseStandardListServiceImpl extends AbstractService<CourseStandardList> implements CourseStandardListService {
@Resource
private CourseStandardListMapper courseStandardListMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.MathPrimaryCourseContentMapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
import com.chineseall.teachgoal.service.MathPrimaryCourseContentService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/09.
*/
@Service
@Transactional
public class MathPrimaryCourseContentServiceImpl extends AbstractService<MathPrimaryCourseContent> implements MathPrimaryCourseContentService {
@Resource
private MathPrimaryCourseContentMapper mathPrimaryCourseContentMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.MathPrimaryCourseTargetMapper;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
import com.chineseall.teachgoal.service.MathPrimaryCourseTargetService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/09.
*/
@Service
@Transactional
public class MathPrimaryCourseTargetServiceImpl extends AbstractService<MathPrimaryCourseTarget> implements MathPrimaryCourseTargetService {
@Resource
private MathPrimaryCourseTargetMapper mathPrimaryCourseTargetMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.MathPrimaryStageTargetMapper;
import com.chineseall.teachgoal.model.MathPrimaryStageTarget;
import com.chineseall.teachgoal.service.MathPrimaryStageTargetService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/09.
*/
@Service
@Transactional
public class MathPrimaryStageTargetServiceImpl extends AbstractService<MathPrimaryStageTarget> implements MathPrimaryStageTargetService {
@Resource
private MathPrimaryStageTargetMapper mathPrimaryStageTargetMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.dao.MathPrimaryTeachTargetMapper;
import com.chineseall.teachgoal.model.MathPrimaryTeachTarget;
import com.chineseall.teachgoal.service.MathPrimaryTeachTargetService;
import com.chineseall.teachgoal.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by guojw on 2020/04/09.
*/
@Service
@Transactional
public class MathPrimaryTeachTargetServiceImpl extends AbstractService<MathPrimaryTeachTarget> implements MathPrimaryTeachTargetService {
@Resource
private MathPrimaryTeachTargetMapper mathPrimaryTeachTargetMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.core.AbstractService;
import com.chineseall.teachgoal.dao.SysDictMapper;
import com.chineseall.teachgoal.model.SysDict;
import com.chineseall.teachgoal.service.SysDictService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by CodeGenerator on 2019/05/06.
*/
@Service
@Transactional
public class SysDictServiceImpl extends AbstractService<SysDict> implements SysDictService {
@Resource
private SysDictMapper sysDictMapper;
}
package com.chineseall.teachgoal.service.impl;
import com.chineseall.teachgoal.core.AbstractService;
import com.chineseall.teachgoal.dao.UserMapper;
import com.chineseall.teachgoal.model.User;
import com.chineseall.teachgoal.service.UserService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by zhaoding on 2019/05/15.
*/
@Service
@Transactional
public class UserServiceImpl extends AbstractService<User> implements UserService {
@Resource
private UserMapper userMapper;
}
package com.chineseall.teachgoal.service.impl.client;
import com.chineseall.teachgoal.dao.client.ClientEMapper;
import com.chineseall.teachgoal.model.Client;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by guojw on 2019/01/28.
*/
@Service
public class ClientEService {
@Autowired
private ClientEMapper clientEMapper;
public List<Client> selectByClientId(String clientId){
return clientEMapper.selectByClientId(clientId);
}
public Client getByCode(String code){
return clientEMapper.getByCode(code);
}
public Client getByClientId(String clientId){
return clientEMapper.getByClientId(clientId);
}
}
//package com.chineseall.teachgoal.web;
//import com.chineseall.teachgoal.core.BaseNoLoginController;
//import com.chineseall.teachgoal.core.Result;
//import com.chineseall.teachgoal.core.ResultGenerator;
//import com.chineseall.teachgoal.core.UuidGenerator;
//import com.chineseall.teachgoal.model.Client;
//import com.chineseall.teachgoal.service.ClientService;
//import com.github.pagehelper.PageHelper;
//import com.github.pagehelper.PageInfo;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.util.Date;
//import java.util.List;
//
///**
//* Created by guojw on 2020/04/08.
//*/
//@RestController
//@RequestMapping("/client")
//@Api(description ="客户端信息API")
//@CrossOrigin
//public class ClientController extends BaseNoLoginController {
// @Resource
// private ClientService clientService;
//
// @ApiOperation(value = "新增客户端", notes = "新增客户端")
// @RequestMapping(value = "/add", method = RequestMethod.POST)
// @CrossOrigin
// public Result add(@RequestParam(required =false) String t_clientId,
// @RequestParam(required =false) String timeStamp,
// @RequestParam(required =false) String sign,
// @RequestParam(required =false) String versionNo,
// @RequestBody Client client) {
// String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
// if(!"SUCCESS".equals(validResult))
// {
// if("NOCLIENT".equals(validResult)) {
// return ResultGenerator.genNoClientIdResult("ClientId不正确");
// }
// if("SIGNFAIL".equals(validResult)) {
// return ResultGenerator.genSignFailResult("Sign不正确");
// }
// }
// client.setCode(UuidGenerator.getUUID32());
// client.setGmtCreate(new Date());
// client.setGmtModified(new Date());
// clientService.save(client);
// return ResultGenerator.genSuccessResult(client);
// }
//
// @ApiOperation(value = "查询客户端", notes = "查询客户端")
// @RequestMapping(value = "/list", method = RequestMethod.GET)
// @CrossOrigin
// public Result list(@RequestParam(required =false) String t_clientId,
// @RequestParam(required =false) String timeStamp,
// @RequestParam(required =false) String sign,
// @RequestParam(required =false) String versionNo,
// @RequestParam(defaultValue = "1") Integer page,
// @RequestParam(defaultValue = "10") Integer size) {
// String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
// if(!"SUCCESS".equals(validResult))
// {
// if("NOCLIENT".equals(validResult)) {
// return ResultGenerator.genNoClientIdResult("ClientId不正确");
// }
// if("SIGNFAIL".equals(validResult)) {
// return ResultGenerator.genSignFailResult("Sign不正确");
// }
// }
// PageHelper.startPage(page, size);
// List<Client> list = clientService.findAll();
// PageInfo pageInfo = new PageInfo(list);
// return ResultGenerator.genSuccessResult(pageInfo);
// }
//}
package com.chineseall.teachgoal.web;
import com.chineseall.teachgoal.core.BaseNoLoginController;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultGenerator;
import com.chineseall.teachgoal.model.CourseStandardList;
import com.chineseall.teachgoal.model.Query.TeachGoalQuery;
import com.chineseall.teachgoal.model.VO.DictVO;
import com.chineseall.teachgoal.model.VO.ExcelTreeVO;
import com.chineseall.teachgoal.model.VO.TreeVO;
import com.chineseall.teachgoal.model.VO.TreeWithIdVO;
import com.chineseall.teachgoal.service.CourseStandardListService;
import com.chineseall.teachgoal.service.CourseStandardListServiceE;
import com.chineseall.teachgoal.service.ExcelNameServiceE;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by guojw on 2020/04/08.
*/
@RestController
@RequestMapping("/course/standard/list")
@Api(description = "课标列表Api")
@CrossOrigin
public class CourseStandardListController extends BaseNoLoginController {
@Resource
private CourseStandardListService courseStandardListService;
@Resource
private CourseStandardListServiceE courseStandardListServiceE;
@Resource
private ExcelNameServiceE excelNameServiceE;
@ApiOperation(value = "获取学段/科目/课标类型级联菜单接口")
@RequestMapping(value = "/queryGradeSubjectTypeTree", method = RequestMethod.GET)
@CrossOrigin
public Result queryGradeSubjectTypeTree(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo) {
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
//该接口获取学段/学科/课标类型 前端三级联动展示
List<ExcelTreeVO> list = excelNameServiceE.queryGradeSubjectType();
return ResultGenerator.genSuccessResult(list);
}
@ApiOperation(value = "获取学段/科目/课标类型列表接口")
@RequestMapping(value = "/queryGradeSubjectTypeList", method = RequestMethod.GET)
@CrossOrigin
public Result queryGradeSubjectTypeList(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo) {
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
//该接口获取学段/学科/课标类型 前端三级联动展示
List<String> stageList = excelNameServiceE.listStage();
List<String> subjectList = excelNameServiceE.listSubject();
List<String> curTypeList = excelNameServiceE.listType();
DictVO dictVO = new DictVO();
dictVO.setStageList(stageList);
dictVO.setSubjectList(subjectList);
dictVO.setCurTypeList(curTypeList);
return ResultGenerator.genSuccessResult(dictVO);
}
@ApiOperation(value = "根据条件查询教学目标")
@RequestMapping(value = "/queryTeachGoalByCondition", method = RequestMethod.POST)
@CrossOrigin
public Result queryTeachGoalByCondition(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody TeachGoalQuery query){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
courseStandardListServiceE.queryTeachGoalByCondition(query.getStatus(),query.getStudyStage(),query.getSubject(),query.getCurType());
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "发布教学目标")
@RequestMapping(value = "/publishTeachGoal", method = RequestMethod.POST)
@CrossOrigin
public Result publishTeachGoal(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam Long id){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
CourseStandardList courseStandardList = new CourseStandardList();
courseStandardList.setId(id);
courseStandardList.setStatus(true);
courseStandardListService.update(courseStandardList);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "删除教学目标")
@RequestMapping(value = "/deleteTeachGoal", method = RequestMethod.POST)
@CrossOrigin
public Result deleteTeachGoal(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam Long id){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
CourseStandardList courseStandardList = new CourseStandardList();
courseStandardList.setId(id);
courseStandardList.setIsDelete(true);
courseStandardListService.update(courseStandardList);
// courseStandardListServiceE.deleteCourseStandard(id);
return ResultGenerator.genSuccessResult();
}
@ApiOperation(value = "获取 最新插入课标的课标树结构 接口")
@RequestMapping(value = "/getTree", method = RequestMethod.GET)
@CrossOrigin
public Result getTree(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
CourseStandardList courseStandardList = courseStandardListServiceE.findLastOne();
Long id = courseStandardList.getId();
List<TreeVO> tree = null;
//courseStandardListServiceE.getTree(id);
TreeWithIdVO voId = new TreeWithIdVO();
voId.setId(id);
voId.setTree(tree);
return ResultGenerator.genSuccessResult(voId);
}
@ApiOperation(value = "通过id获取课标树结构接口")
@RequestMapping(value = "/getTreeById", method = RequestMethod.GET)
@CrossOrigin
public Result getTreeById(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam Long id){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
List<TreeVO> treeVo = null;
//courseStandardListServiceE.getTree(id);
TreeWithIdVO voId = new TreeWithIdVO();
voId.setId(id);
voId.setTree(treeVo);
return ResultGenerator.genSuccessResult(voId);
}
}
package com.chineseall.teachgoal.web;
import com.chineseall.teachgoal.core.BaseNoLoginController;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultGenerator;
import com.chineseall.teachgoal.model.DTO.UploadDTO;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
import com.chineseall.teachgoal.model.MathPrimaryStageTarget;
import com.chineseall.teachgoal.model.MathPrimaryTeachTarget;
import com.chineseall.teachgoal.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**   
 *  
 * 导入数学excel 包括高中、初中、小学 共9个接口
 * @Description:  导入数学excel   
 * @Author:       guojw   
 * @CreateDate:   2020-04-08      
 *    
 */
@RestController
@RequestMapping("/math/primary")
@Api(description = "数学excel导入接口")
@CrossOrigin
public class ImportMathController extends BaseNoLoginController {
@Resource
private ImportMathServiceE mathServiceE;
@Resource
private CourseStandardListServiceE courseStandardListServiceE;
@Resource
private MathPrimaryTeachTargetService mathPrimaryTeachTargetService;
@Resource
private MathPrimaryCourseTargetService mathPrimaryCourseTargetService;
@Resource
private MathPrimaryStageTargetService mathPrimaryStageTargetService;
@Resource
private MathPrimaryCourseContentService mathPrimaryCourseContentService;
@ApiOperation(value = "上传 小学数学分年级教学目标")
@RequestMapping(value = "/teach/target/upload", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result TeachTargetUpload(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryTeachTarget> list = mathServiceE.saveTeachTarget(dto.getList(), id);
mathPrimaryTeachTargetService.save(list);
return ResultGenerator.genSuccessResult(id);
}
@ApiOperation(value = "上传 小学数学课程总目标")
@RequestMapping(value = "/course/target/upload", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result courseTargetUpload(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryCourseTarget> list = mathServiceE.saveCourseTarget(dto.getList(), id);
mathPrimaryCourseTargetService.save(list);
return ResultGenerator.genSuccessResult(id);
}
@ApiOperation(value = "上传 小学数学课程目标(学段目标)")
@RequestMapping(value = "/stage/target/upload", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result stageTargetUpload(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryStageTarget> list = mathServiceE.saveStageTarget(dto.getList(), id);
mathPrimaryStageTargetService.save(list);
return ResultGenerator.genSuccessResult(id);
}
@ApiOperation(value = "上传 小学数学课程内容")
@RequestMapping(value = "/course/content/upload", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result courseContentUpload(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryCourseContent> list = mathServiceE.saveCourseContent(dto.getList(), id);
mathPrimaryCourseContentService.save(list);
return ResultGenerator.genSuccessResult(id);
}
@ApiOperation(value = "根据国标编码查询课程总目标")
@RequestMapping(value = "/getCourseTargetByCode", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result getCourseTargetByCode(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryCourseContent> list = mathServiceE.saveCourseContent(dto.getList(), id);
mathPrimaryCourseContentService.save(list);
return ResultGenerator.genSuccessResult(id);
}
}
//package com.chineseall.teachgoal.web;
//import com.chineseall.teachgoal.core.BaseNoLoginController;
//import com.chineseall.teachgoal.core.Result;
//import com.chineseall.teachgoal.core.ResultGenerator;
//import com.chineseall.teachgoal.model.DictTypeList;
//import com.chineseall.teachgoal.service.SysDictService;
//import com.chineseall.teachgoal.service.SysDictServiceImplE;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//
///**
//* Created by guojw on 2020/04/08.
//*/
//@Api(description = "数据字典接口")
//@RestController
//@RequestMapping("/sys/dict")
//@CrossOrigin
//public class SysDictController extends BaseNoLoginController {
// @Resource
// private SysDictService sysDictService;
//
// @Autowired
// private SysDictServiceImplE sysDictServiceImplE;
//
// @CrossOrigin
// @ApiOperation("根据type获取字典信息")
// @PostMapping("/sysDictByTypeList")
// public Result sysDictByTypeList(@RequestParam(required =false) String t_clientId,
// @RequestParam(required =false) String timeStamp,
// @RequestParam(required =false) String sign,
// @RequestParam(required =false) String versionNo,
// @RequestBody DictTypeList dictTypeList) {
// String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
// if(!"SUCCESS".equals(validResult))
// {
// if("NOCLIENT".equals(validResult)) {
// return ResultGenerator.genNoClientIdResult("ClientId不正确");
// }
// if("SIGNFAIL".equals(validResult)) {
// return ResultGenerator.genSignFailResult("Sign不正确");
// }
// }
// return sysDictServiceImplE.getDictByType(dictTypeList.getDictTypeList());
// }
//}
# 开发环境配置
# 数据源配置,请修改为你项目的实际配置
spring.datasource.url=jdbc:mysql://localhost:3306/teach_goal?useSSL=false
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#端口号
server.port=9090
#最大连接数
http.maxTotal = 100
#并发数
http.defaultMaxPerRoute = 20
#创建连接的最长时间
http.connectTimeout=1000
#从连接池中获取到连接的最长时间
http.connectionRequestTimeout=500
#数据传输的最长时间
http.socketTimeout=10000
#提交请求前测试连接是否可用
http.staleConnectionCheckEnabled=true
#存储桶调用地址
http.OssBaseUrl=https://col-sh-test-file-bucket.oss-cn-shanghai.aliyuncs.com/
#支撑平台调用地址
http.PlatCallUrl=http://test.colsh.cn:5680/support
\ No newline at end of file
# 生产环境配置
# 数据源配置,请修改为你项目的实际配置
spring.datasource.url=jdbc:mysql://rm-uf6jnq4r6316q782s.mysql.rds.aliyuncs.com:3306/iss
spring.datasource.username=appuser
spring.datasource.password=%OZngC790GSh54SZ
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#生产存储桶调用地址
http.OssBaseUrl=https://supportedu-file.oss-cn-shanghai.aliyuncs.com/
#支撑平台调用地址
http.PlatCallUrl=https://support.etextbook.cn
# 测试环境配置
spring.datasource.url=jdbc:mysql://rm-uf682ooa1xuq7vre3.mysql.rds.aliyuncs.com:3306/iss
spring.datasource.username=dbuser
spring.datasource.password=ChineseAll#0514
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#测试存储桶调用地址
http.OssBaseUrl=https://col-sh-test-file-bucket.oss-cn-shanghai.aliyuncs.com/
#支撑平台调用地址
http.PlatCallUrl=http://test.colsh.cn:5680/support
# RC测试环境配置
#spring.datasource.url=jdbc:mysql://rm-uf6kphk801x0pc2v4.mysql.rds.aliyuncs.com:3306/iss
#spring.datasource.username=dbuser_rc
#spring.datasource.password=chineseall#123
vspring.datasource.driver-class-name=com.mysql.jdbc.Driver
#RC存储桶调用地址
#http.OssBaseUrl=https://col-sh-test-file-bucket.oss-cn-shanghai.aliyuncs.com/diandu-genius-rc/
\ No newline at end of file
spring.profiles.active=dev
# 所有环境通用的配置,放在这里
# 404 交给异常处理器处理
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false
#是否启用安全性
security.switch=F
配置文件传输
spring.servlet.multipart.enabled =true
spring.servlet.multipart.file-size-threshold =0
#单个数据的大小
spring.servlet.multipart.max-file-size = 100Mb
#总数据的大小
spring.servlet.multipart.max-request-size=100Mb
server.tomcat.max-http-post-size=-1
server.tomcat.max-http-header-size=1024000
////////////////////////////////////////////////////////////////////
// _ooOoo_ //
// o8888888o //
// 88" . "88 //
// (| ^_^ |) //
// O\ = /O //
// ____/`---'\____ //
// .' \\| |// `. //
// / \\||| : |||// \ //
// / _||||| -:- |||||- \ //
// | | \\\ - /// | | //
// | \_| ''\---/'' | | //
// \ .-\__ `-` ___/-. / //
// ___`. .' /--.--\ `. . ___ //
// ."" '< `.___\_<|>_/___.' >'"". //
// | | : `- \`.;`\ _ /`;.`/ - ` : | | //
// \ \ `-. \_ __\ /__ _/ .-` / / //
// ========`-.____`-.___\_____/___.-`____.-'======== //
// `=---=' //
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //
// 佛祖保佑 永不宕机 永无BUG //
////////////////////////////////////////////////////////////////////
\ No newline at end of file
<?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.chineseall.teachgoal.dao.AliBucketMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.AliBucket">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="region" jdbcType="VARCHAR" property="region" />
<result column="access_key_id" jdbcType="VARCHAR" property="accessKeyId" />
<result column="access_key_secret" jdbcType="VARCHAR" property="accessKeySecret" />
<result column="bucket" jdbcType="VARCHAR" property="bucket" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="role_arn" jdbcType="VARCHAR" property="roleArn" />
<result column="endpoint" jdbcType="VARCHAR" property="endpoint" />
<result column="catalogue" jdbcType="VARCHAR" property="catalogue" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.AliBucketMapperE">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.AliBucket">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="region" jdbcType="VARCHAR" property="region" />
<result column="access_key_id" jdbcType="VARCHAR" property="accessKeyId" />
<result column="access_key_secret" jdbcType="VARCHAR" property="accessKeySecret" />
<result column="bucket" jdbcType="VARCHAR" property="bucket" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="role_arn" jdbcType="VARCHAR" property="roleArn" />
<result column="endpoint" jdbcType="VARCHAR" property="endpoint" />
<result column="catalogue" jdbcType="VARCHAR" property="catalogue" />
</resultMap>
<select id="selectByCode" resultMap="BaseResultMap">
SELECT
id,region,access_key_id,access_key_secret,
bucket,gmt_create,gmt_modified,creator,
code,role_arn,endpoint,catalogue
FROM ali_bucket
WHERE code = #{code}
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.BasicDataMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.BasicData">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="shortTitle" jdbcType="VARCHAR" property="shorttitle" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="orderIndex" jdbcType="INTEGER" property="orderindex" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="sheetName" jdbcType="VARCHAR" property="sheetname" />
<result column="excelPath" jdbcType="VARCHAR" property="excelpath" />
<result column="excelName" jdbcType="VARCHAR" property="excelname" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.BasicDataMapperE">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.VO.BasicDataVO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="shortTitle" jdbcType="VARCHAR" property="shorttitle" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="orderIndex" jdbcType="INTEGER" property="orderindex" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="createTime" jdbcType="TIMESTAMP" property="createtime" />
<result column="updateTime" jdbcType="TIMESTAMP" property="updatetime" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="sheetName" jdbcType="VARCHAR" property="sheetname" />
<result column="excelPath" jdbcType="VARCHAR" property="excelpath" />
<result column="excelName" jdbcType="VARCHAR" property="excelname" />
</resultMap>
<select id="getDictByType" resultMap="BaseResultMap">
SELECT
title,code,type
FROM
basic_data
WHERE
1 = 1 and
type IN
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<select id="listDict" resultMap="BaseResultMap">
select * from basic_data where status = 0 and updateTime >= #{updateTime}
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.client.ClientEMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.Client">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="client_name" jdbcType="VARCHAR" property="clientName" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="client_id" jdbcType="VARCHAR" property="clientId" />
<result column="client_key" jdbcType="VARCHAR" property="clientKey" />
</resultMap>
<select id="selectByClientId" resultMap="BaseResultMap">
select
id,
client_name,
client_id
from client
where client_id=#{clientId, jdbcType=VARCHAR}
and is_deleted=false
</select>
<select id="getByCode" resultMap="BaseResultMap">
select
id,
code,
client_name,
client_id
from client
where code=#{code}
and is_deleted=false
</select>
<select id="getByClientId" resultMap="BaseResultMap">
select
id,
code,
client_name,
client_id,
client_key
from client
where client_id=#{clientId}
and is_deleted=false
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.ClientMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.Client">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="client_name" jdbcType="VARCHAR" property="clientName" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="creator" jdbcType="BIGINT" property="creator" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="client_id" jdbcType="VARCHAR" property="clientId" />
<result column="expired" jdbcType="TIMESTAMP" property="expired" />
<result column="client_key" jdbcType="VARCHAR" property="clientKey" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.CourseStandardApiMapperE">
<resultMap id="CourseStandardMap" type="com.chineseall.teachgoal.model.VO.CourseStandardApiVO">
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="standard_code" jdbcType="VARCHAR" property="standardCode" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="subject" jdbcType="VARCHAR" property="subject" />
<result column="cur_type" jdbcType="VARCHAR" property="curType" />
<result column="status" jdbcType="BIT" property="status" />
<result column="upper_shelf" jdbcType="BIT" property="upperShelf" />
<result column="is_delete" jdbcType="BIT" property="isDeleted" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="standard_dimension" jdbcType="VARCHAR" property="standardDimension" />
<result column="ranks" jdbcType="VARCHAR" property="ranks" />
<result column="course_target_number" jdbcType="VARCHAR" property="courseTargetNumber" />
<result column="course_target" jdbcType="VARCHAR" property="courseTarget" />
<result column="theme_one" jdbcType="VARCHAR" property="themeOne" />
<result column="theme_two" jdbcType="VARCHAR" property="themeTwo" />
<result column="element" jdbcType="VARCHAR" property="element" />
<result column="target_number" jdbcType="VARCHAR" property="targetNumber" />
<result column="target" jdbcType="VARCHAR" property="target" />
<result column="standard_number" jdbcType="VARCHAR" property="standardNumber" />
<result column="standard" jdbcType="VARCHAR" property="standard" />
<result column="unit" jdbcType="VARCHAR" property="unit" />
<result column="course_content" jdbcType="VARCHAR" property="courseContent" />
<result column="science_content_one" jdbcType="VARCHAR" property="scienceContentOne" />
<result column="science_content_two" jdbcType="VARCHAR" property="scienceContentTwo" />
<result column="science_element" jdbcType="VARCHAR" property="scienceElement" />
<result column="study_content_one" jdbcType="VARCHAR" property="studyContentOne" />
<result column="study_content_two" jdbcType="VARCHAR" property="studyContentTwo" />
<result column="study_content_three" jdbcType="VARCHAR" property="studyContentThree" />
<result column="study_content_four" jdbcType="VARCHAR" property="studyContentFour" />
<result column="course_content_one" jdbcType="VARCHAR" property="courseContentOne" />
<result column="course_content_two" jdbcType="VARCHAR" property="courseContentTwo" />
<result column="course_content_three_number" jdbcType="VARCHAR" property="courseContentThreeNumber" />
<result column="course_content_three" jdbcType="VARCHAR" property="courseContentThree" />
<result column="course_content_four_number" jdbcType="VARCHAR" property="courseContentFourNumber" />
<result column="course_content_four" jdbcType="VARCHAR" property="courseContentFour" />
<result column="study_content_module" jdbcType="VARCHAR" property="studyContentModule" />
<result column="target_describe" jdbcType="VARCHAR" property="targetDescribe" />
<result column="classify" jdbcType="VARCHAR" property="classify" />
<result column="module" jdbcType="VARCHAR" property="module" />
<result column="capacity" jdbcType="VARCHAR" property="capacity" />
<result column="standard_describe_one" jdbcType="VARCHAR" property="standardDescribeOne" />
<result column="standard_describe_two" jdbcType="VARCHAR" property="standardDescribeTwo" />
<result column="standard_describe_three" jdbcType="VARCHAR" property="standardDescribeThree" />
<result column="study_content" jdbcType="VARCHAR" property="studyContent" />
<result column="study_level" jdbcType="VARCHAR" property="studyLevel" />
<result column="specific_require_one_number" jdbcType="VARCHAR" property="specificRequireOneNumber" />
<result column="specific_require_one" jdbcType="VARCHAR" property="specificRequireOne" />
<result column="specific_require_two_number" jdbcType="VARCHAR" property="specificRequireTwoNumber" />
<result column="specific_require_two" jdbcType="VARCHAR" property="specificRequireTwo" />
</resultMap>
<select id="getCourseStandardList" resultMap="CourseStandardMap">
select * from all_subject_view
where is_delete = false
AND upper_shelf = true
AND status = false
<if test="standardCodeList != null">
AND standard_code in
<foreach collection="standardCodeList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by gmt_modified desc
</select>
<select id="getCourseStandardListByLastUpdateTime" resultMap="CourseStandardMap">
select * from all_subject_view
where is_delete = false
AND upper_shelf = true
AND status = false
<if test="lastUpdateTime != null">
AND gmt_modified >= #{lastUpdateTime}
</if>
order by gmt_modified desc
</select>
<select id="listCourseStandards" resultMap="CourseStandardMap">
select * from all_subject_view
where is_delete = false
AND upper_shelf = true
AND status = false
AND gmt_modified >= #{gmtModified}
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.CourseStandardListMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.CourseStandardList">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="subject" jdbcType="VARCHAR" property="subject" />
<result column="cur_type" jdbcType="VARCHAR" property="curType" />
<result column="upper_shelf" jdbcType="BIT" property="upperShelf" />
<result column="status" jdbcType="BIT" property="status" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.CourseStandardListMapperE">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.CourseStandardList">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="subject" jdbcType="VARCHAR" property="subject" />
<result column="cur_type" jdbcType="VARCHAR" property="curType" />
<result column="status" jdbcType="BIT" property="status" />
<result column="upper_shelf" jdbcType="BIT" property="upperShelf" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
<insert id="saveAndBackId" useGeneratedKeys="true" parameterType="com.chineseall.teachgoal.model.CourseStandardList" keyProperty="item.id" >
insert into course_standard_list (code,study_stage,subject,cur_type)
values (#{item.code},#{item.studyStage},#{item.subject},#{item.curType})
</insert>
<update id="addDrafts">
update course_standard_list set status = 1,upper_shelf = 0 where id = #{id}
</update>
<update id="upperShelf">
update course_standard_list set status = 0,upper_shelf = 1 where id = #{id}
</update>
<delete id="deleteCourseStandard">
update course_standard_list set is_delete = 1 where id = #{id}
</delete>
<select id="queryDrafts" resultMap="BaseResultMap">
select id,study_stage,subject,cur_type,gmt_create
from course_standard_list
where status = 1 and is_delete = 0 order by gmt_create desc
</select>
<select id="queryAll" resultMap="BaseResultMap">
select id,study_stage,subject,cur_type,gmt_create
from course_standard_list
where status = 0 and upper_shelf = 1 and is_delete = 0 order by gmt_create desc
</select>
<select id="findById" resultMap="BaseResultMap">
select * from course_standard_list where id = #{id}
</select>
<select id="findLastOne" resultType="com.chineseall.teachgoal.model.CourseStandardList">
select * from course_standard_list order by gmt_create desc limit 1
</select>
<select id="findByCondition" resultType="java.lang.Long">
select
id from course_standard_list
where
is_delete = 0
and study_stage = #{studyStage} and cur_type = #{curType} and subject = #{subject} limit 1
</select>
<select id="queryTeachGoalByCondition" resultMap="BaseResultMap">
select id,study_stage,subject,cur_type,gmt_create
from course_standard_list
where is_delete = 0
<if test="status != null">
AND status = #{status}
</if>
<if test="studyStage != null">
AND study_stage = #{studyStage,jdbcType=VARCHAR}
</if>
<if test="subject != null">
AND subject = #{subject,jdbcType=VARCHAR}
</if>
<if test="curType != null">
AND cur_type = #{curType,jdbcType=VARCHAR}
</if>
order by gmt_create desc
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.ExcelNameMapperE">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.ExcelName">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="subject" jdbcType="VARCHAR" property="subject" />
<result column="cur_type" jdbcType="VARCHAR" property="curType" />
</resultMap>
<select id="listGrade" resultType="java.lang.String">
select distinct study_stage from excel_name
</select>
<select id="listSubject" resultType="java.lang.String">
select distinct subject from excel_name
where 1=1
<if test="grade != null">
AND study_stage = #{grade}
</if>
</select>
<select id="listType" resultType="java.lang.String">
select distinct cur_type from excel_name
where 1=1
<if test="grade !=null">
AND study_stage = #{grade}
</if>
<if test="subject !=null">
AND subject = #{subject}
</if>
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.ImportMathMapperE">
<resultMap id="HighNationOneMap" type="com.chineseall.teachgoal.model.MathHighNationOne">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="subject_core_shitsuke_number" jdbcType="VARCHAR" property="subjectCoreShitsukeNumber" />
<result column="subject_core_shitsuke" jdbcType="VARCHAR" property="subjectCoreShitsuke" />
<result column="specific_content_number" jdbcType="VARCHAR" property="specificContentNumber" />
<result column="specific_content" jdbcType="VARCHAR" property="specificContent" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
<insert id="saveHighNationOne">
insert into math_high_nation_one
(code,
nation_code,
study_stage,
subject_core_shitsuke_number,
subject_core_shitsuke,
specific_content_number,
specific_content,
pid)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.code},
#{item.nationCode},
#{item.studyStage},
#{item.subjectCoreShitsukeNumber},
#{item.subjectCoreShitsuke},
#{item.specificContentNumber},
#{item.specificContent},
#{id}
)
</foreach>
</insert>
<select id="listHighNationOneColumn" resultMap="HighNationOneMap">
select
<if test="level == 1">distinct study_stage</if>
<if test="level == 2">distinct study_stage, subject_core_shitsuke_number, subject_core_shitsuke</if>
<if test="level == 3">specific_content_number, specific_content, nation_code</if>
from math_high_nation_one
where pid = #{pid}
<if test="level == 2 "> and study_stage = #{parent.studyStage}</if>
<if test="level == 3 "> and study_stage = #{parent.studyStage} and subject_core_shitsuke_number = #{parent.subjectCoreShitsukeNumber} and subject_core_shitsuke =#{parent.subjectCoreShitsuke}</if>
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.MathPrimaryCourseContentMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.MathPrimaryCourseContent">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="course_content_one" jdbcType="VARCHAR" property="courseContentOne" />
<result column="course_content_two" jdbcType="VARCHAR" property="courseContentTwo" />
<result column="course_content_three_number" jdbcType="VARCHAR" property="courseContentThreeNumber" />
<result column="course_content_three" jdbcType="VARCHAR" property="courseContentThree" />
<result column="study_level" jdbcType="VARCHAR" property="studyLevel" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.MathPrimaryCourseTargetMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.MathPrimaryCourseTarget">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="standard_dimension" jdbcType="VARCHAR" property="standardDimension" />
<result column="course_target_number" jdbcType="VARCHAR" property="courseTargetNumber" />
<result column="course_target" jdbcType="VARCHAR" property="courseTarget" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.MathPrimaryStageTargetMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.MathPrimaryStageTarget">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="standard_dimension" jdbcType="VARCHAR" property="standardDimension" />
<result column="stage_target_number" jdbcType="VARCHAR" property="stageTargetNumber" />
<result column="stage_target" jdbcType="VARCHAR" property="stageTarget" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.MathPrimaryTeachTargetMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.MathPrimaryTeachTarget">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="course_target_code" jdbcType="VARCHAR" property="courseTargetCode" />
<result column="stage_target_code" jdbcType="VARCHAR" property="stageTargetCode" />
<result column="course_content_code" jdbcType="VARCHAR" property="courseContentCode" />
<result column="grade" jdbcType="VARCHAR" property="grade" />
<result column="element" jdbcType="VARCHAR" property="element" />
<result column="theme" jdbcType="VARCHAR" property="theme" />
<result column="level" jdbcType="VARCHAR" property="level" />
<result column="teach_target_number" jdbcType="VARCHAR" property="teachTargetNumber" />
<result column="teach_target" jdbcType="VARCHAR" property="teachTarget" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.SysDictMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.SysDict">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="dict_value" jdbcType="VARCHAR" property="dictValue" />
<result column="dict_text" jdbcType="VARCHAR" property="dictText" />
<result column="dict_type" jdbcType="VARCHAR" property="dictType" />
<result column="order_index" jdbcType="TINYINT" property="orderIndex" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modifie" jdbcType="TIMESTAMP" property="gmtModifie" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="dict_type_name" jdbcType="VARCHAR" property="dictTypeName" />
<result column="dict_desc" jdbcType="VARCHAR" property="dictDesc" />
<result column="dict_default_value" jdbcType="VARCHAR" property="dictDefaultValue" />
<result column="code" jdbcType="VARCHAR" property="code" />
</resultMap>
</mapper>
\ No newline at end of file
<?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.chineseall.teachgoal.dao.SysDictMapperE">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.VO.SysDictVO">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="BIGINT" property="id" />
<result column="dict_value" jdbcType="VARCHAR" property="dictValue" />
<result column="dict_text" jdbcType="VARCHAR" property="dictText" />
<result column="dict_type" jdbcType="VARCHAR" property="dictType" />
<result column="order_index" jdbcType="TINYINT" property="orderIndex" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modifie" jdbcType="TIMESTAMP" property="gmtModifie" />
<result column="is_deleted" jdbcType="BIT" property="isDeleted" />
<result column="dict_type_name" jdbcType="VARCHAR" property="dictTypeName" />
<result column="dict_desc" jdbcType="VARCHAR" property="dictDesc" />
<result column="dict_default_value" jdbcType="VARCHAR" property="dictDefaultValue" />
<result column="code" jdbcType="VARCHAR" property="code" />
</resultMap>
<select id="getDictByType" resultMap="BaseResultMap">
SELECT
dict_value,dict_text,dict_type
FROM
sys_dict
WHERE dict_type IN
<foreach collection="list" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
<?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.chineseall.standardlibraryapi.dao.UserMapper">
<resultMap id="BaseResultMap" type="com.chineseall.teachgoal.model.User">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="login_name" jdbcType="VARCHAR" property="loginName" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
</mapper>
\ No newline at end of file
import com.google.common.base.CaseFormat;
import freemarker.template.TemplateExceptionHandler;
import org.apache.commons.lang3.StringUtils;
import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.*;
import org.mybatis.generator.internal.DefaultShellCallback;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import static com.chineseall.teachgoal.core.ProjectConstant.*;
/**
* 代码生成器,根据数据表名称生成对应的Model、Mapper、Service、Controller简化开发。
*/
public class CodeGenerator {
//JDBC配置,请修改为你项目的实际配置
private static final String JDBC_URL = "jdbc:mysql://localhost:3306/teach_goal?useSSL=false";
private static final String JDBC_USERNAME = "root";
private static final String JDBC_PASSWORD = "root";
private static final String JDBC_DIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
private static final String PROJECT_PATH = System.getProperty("user.dir");//项目在硬盘上的基础路径
private static final String TEMPLATE_FILE_PATH = PROJECT_PATH + "/src/test/resources/generator/template";//模板位置
private static final String JAVA_PATH = "/src/main/java"; //java文件路径
private static final String RESOURCES_PATH = "/src/main/resources";//资源文件路径
private static final String PACKAGE_PATH_SERVICE = packageConvertPath(SERVICE_PACKAGE);//生成的Service存放路径
private static final String PACKAGE_PATH_SERVICE_IMPL = packageConvertPath(SERVICE_IMPL_PACKAGE);//生成的Service实现存放路径
private static final String PACKAGE_PATH_CONTROLLER = packageConvertPath(CONTROLLER_PACKAGE);//生成的Controller存放路径
private static final String AUTHOR = "guojw";//@author
private static final String DATE = new SimpleDateFormat("yyyy/MM/dd").format(new Date());//@date
public static void main(String[] args) {
genCode("math_primary_course_content");
//genCodeByCustomModelName("输入表名","输入自定义Model名称");
}
/**
* 通过数据表名称生成代码,Model 名称通过解析数据表名称获得,下划线转大驼峰的形式。
* 如输入表名称 "t_user_detail" 将生成 TUserDetail、TUserDetailMapper、TUserDetailService ...
* @param tableNames 数据表名称...
*/
public static void genCode(String... tableNames) {
for (String tableName : tableNames) {
genCodeByCustomModelName(tableName, null);
}
}
/**
* 通过数据表名称,和自定义的 Model 名称生成代码
* 如输入表名称 "t_user_detail" 和自定义的 Model 名称 "User" 将生成 User、UserMapper、UserService ...
* @param tableName 数据表名称
* @param modelName 自定义的 Model 名称
*/
public static void genCodeByCustomModelName(String tableName, String modelName) {
genModelAndMapper(tableName, modelName);
genService(tableName, modelName);
// genController(tableName, modelName);
}
public static void genModelAndMapper(String tableName, String modelName) {
Context context = new Context(ModelType.FLAT);
context.setId("Potato");
context.setTargetRuntime("MyBatis3Simple");
context.addProperty(PropertyRegistry.CONTEXT_BEGINNING_DELIMITER, "`");
context.addProperty(PropertyRegistry.CONTEXT_ENDING_DELIMITER, "`");
JDBCConnectionConfiguration jdbcConnectionConfiguration = new JDBCConnectionConfiguration();
jdbcConnectionConfiguration.setConnectionURL(JDBC_URL);
jdbcConnectionConfiguration.setUserId(JDBC_USERNAME);
jdbcConnectionConfiguration.setPassword(JDBC_PASSWORD);
jdbcConnectionConfiguration.setDriverClass(JDBC_DIVER_CLASS_NAME);
context.setJdbcConnectionConfiguration(jdbcConnectionConfiguration);
PluginConfiguration pluginConfiguration = new PluginConfiguration();
pluginConfiguration.setConfigurationType("tk.mybatis.mapper.generator.MapperPlugin");
pluginConfiguration.addProperty("mappers", MAPPER_INTERFACE_REFERENCE);
context.addPluginConfiguration(pluginConfiguration);
JavaModelGeneratorConfiguration javaModelGeneratorConfiguration = new JavaModelGeneratorConfiguration();
javaModelGeneratorConfiguration.setTargetProject(PROJECT_PATH + JAVA_PATH);
javaModelGeneratorConfiguration.setTargetPackage(MODEL_PACKAGE);
context.setJavaModelGeneratorConfiguration(javaModelGeneratorConfiguration);
SqlMapGeneratorConfiguration sqlMapGeneratorConfiguration = new SqlMapGeneratorConfiguration();
sqlMapGeneratorConfiguration.setTargetProject(PROJECT_PATH + RESOURCES_PATH);
sqlMapGeneratorConfiguration.setTargetPackage("mapper");
context.setSqlMapGeneratorConfiguration(sqlMapGeneratorConfiguration);
JavaClientGeneratorConfiguration javaClientGeneratorConfiguration = new JavaClientGeneratorConfiguration();
javaClientGeneratorConfiguration.setTargetProject(PROJECT_PATH + JAVA_PATH);
javaClientGeneratorConfiguration.setTargetPackage(MAPPER_PACKAGE);
javaClientGeneratorConfiguration.setConfigurationType("XMLMAPPER");
context.setJavaClientGeneratorConfiguration(javaClientGeneratorConfiguration);
TableConfiguration tableConfiguration = new TableConfiguration(context);
tableConfiguration.setTableName(tableName);
if (StringUtils.isNotEmpty(modelName))tableConfiguration.setDomainObjectName(modelName);
tableConfiguration.setGeneratedKey(new GeneratedKey("id", "Mysql", true, null));
context.addTableConfiguration(tableConfiguration);
List<String> warnings;
MyBatisGenerator generator;
try {
Configuration config = new Configuration();
config.addContext(context);
config.validate();
boolean overwrite = true;
DefaultShellCallback callback = new DefaultShellCallback(overwrite);
warnings = new ArrayList<String>();
generator = new MyBatisGenerator(config, callback, warnings);
generator.generate(null);
} catch (Exception e) {
throw new RuntimeException("生成Model和Mapper失败", e);
}
if (generator.getGeneratedJavaFiles().isEmpty() || generator.getGeneratedXmlFiles().isEmpty()) {
throw new RuntimeException("生成Model和Mapper失败:" + warnings);
}
if (StringUtils.isEmpty(modelName)) modelName = tableNameConvertUpperCamel(tableName);
System.out.println(modelName + ".java 生成成功");
System.out.println(modelName + "Mapper.java 生成成功");
System.out.println(modelName + "Mapper.xml 生成成功");
}
public static void genService(String tableName, String modelName) {
try {
freemarker.template.Configuration cfg = getConfiguration();
Map<String, Object> data = new HashMap<>();
data.put("date", DATE);
data.put("author", AUTHOR);
String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName;
data.put("modelNameUpperCamel", modelNameUpperCamel);
data.put("modelNameLowerCamel", tableNameConvertLowerCamel(tableName));
data.put("basePackage", BASE_PACKAGE);
File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_SERVICE + modelNameUpperCamel + "Service.java");
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
cfg.getTemplate("service.ftl").process(data,
new FileWriter(file));
System.out.println(modelNameUpperCamel + "Service.java 生成成功");
File file1 = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_SERVICE_IMPL + modelNameUpperCamel + "ServiceImpl.java");
if (!file1.getParentFile().exists()) {
file1.getParentFile().mkdirs();
}
cfg.getTemplate("service-impl.ftl").process(data,
new FileWriter(file1));
System.out.println(modelNameUpperCamel + "ServiceImpl.java 生成成功");
} catch (Exception e) {
throw new RuntimeException("生成Service失败", e);
}
}
public static void genController(String tableName, String modelName) {
try {
freemarker.template.Configuration cfg = getConfiguration();
Map<String, Object> data = new HashMap<>();
data.put("date", DATE);
data.put("author", AUTHOR);
String modelNameUpperCamel = StringUtils.isEmpty(modelName) ? tableNameConvertUpperCamel(tableName) : modelName;
data.put("baseRequestMapping", modelNameConvertMappingPath(modelNameUpperCamel));
data.put("modelNameUpperCamel", modelNameUpperCamel);
data.put("modelNameLowerCamel", CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, modelNameUpperCamel));
data.put("basePackage", BASE_PACKAGE);
File file = new File(PROJECT_PATH + JAVA_PATH + PACKAGE_PATH_CONTROLLER + modelNameUpperCamel + "Controller.java");
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
//cfg.getTemplate("controller-restful.ftl").process(data, new FileWriter(file));
cfg.getTemplate("controller.ftl").process(data, new FileWriter(file));
System.out.println(modelNameUpperCamel + "Controller.java 生成成功");
} catch (Exception e) {
throw new RuntimeException("生成Controller失败", e);
}
}
private static freemarker.template.Configuration getConfiguration() throws IOException {
freemarker.template.Configuration cfg = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_23);
cfg.setDirectoryForTemplateLoading(new File(TEMPLATE_FILE_PATH));
cfg.setDefaultEncoding("UTF-8");
cfg.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
return cfg;
}
private static String tableNameConvertLowerCamel(String tableName) {
return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, tableName.toLowerCase());
}
private static String tableNameConvertUpperCamel(String tableName) {
return CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableName.toLowerCase());
}
private static String tableNameConvertMappingPath(String tableName) {
tableName = tableName.toLowerCase();//兼容使用大写的表名
return "/" + (tableName.contains("_") ? tableName.replaceAll("_", "/") : tableName);
}
private static String modelNameConvertMappingPath(String modelName) {
String tableName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, modelName);
return tableNameConvertMappingPath(tableName);
}
private static String packageConvertPath(String packageName) {
return String.format("/%s/", packageName.contains(".") ? packageName.replaceAll("\\.", "/") : packageName);
}
}
package com.conpany.project;
import com.chineseall.teachgoal.Application;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
/**
* 单元测试继承该类即可
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)
@Transactional
@Rollback
public abstract class Tester {}
/*
Navicat MySQL Data Transfer
Source Server : Localhost
Source Server Version : 50713
Source Host : localhost:3306
Source Database : test
Target Server Type : MYSQL
Target Server Version : 50713
File Encoding : 65001
Date: 2017-06-23 14:25:27
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL,
`nick_name` varchar(255) DEFAULT NULL,
`sex` int(1) DEFAULT NULL,
`register_date` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', '89921218@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('2', '2@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-2', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('3', '3@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-3', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('4', '4@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-4', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('5', '5@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-5', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('6', '6@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-6', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('7', '7@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-7', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('8', '8@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-8', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('9', '9@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-9', '1', '2017-06-23 14:24:23');
INSERT INTO `user` VALUES ('10', '10@qq.com', '1ee04e0b1cb5af7367c80c22e42efd8b', '土豆-10', '1', '2017-06-23 14:24:23');
SET FOREIGN_KEY_CHECKS=1;
package ${basePackage}.web;
import ${basePackage}.core.Result;
import ${basePackage}.core.ResultGenerator;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.service.${modelNameUpperCamel}Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by ${author} on ${date}.
*/
@RestController
@RequestMapping("${baseRequestMapping}")
public class ${modelNameUpperCamel}Controller {
@Resource
private ${modelNameUpperCamel}Service ${modelNameLowerCamel}Service;
@PostMapping
public Result add(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel}) {
${modelNameLowerCamel}Service.save(${modelNameLowerCamel});
return ResultGenerator.genSuccessResult();
}
@DeleteMapping("/{id}")
public Result delete(@PathVariable Integer id) {
${modelNameLowerCamel}Service.deleteById(id);
return ResultGenerator.genSuccessResult();
}
@PutMapping
public Result update(@RequestBody ${modelNameUpperCamel} ${modelNameLowerCamel}) {
${modelNameLowerCamel}Service.update(${modelNameLowerCamel});
return ResultGenerator.genSuccessResult();
}
@GetMapping("/{id}")
public Result detail(@PathVariable Integer id) {
${modelNameUpperCamel} ${modelNameLowerCamel} = ${modelNameLowerCamel}Service.findById(id);
return ResultGenerator.genSuccessResult(${modelNameLowerCamel});
}
@GetMapping
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
PageHelper.startPage(page, size);
List<${modelNameUpperCamel}> list = ${modelNameLowerCamel}Service.findAll();
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
}
package ${basePackage}.web;
import ${basePackage}.core.Result;
import ${basePackage}.core.ResultGenerator;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.service.${modelNameUpperCamel}Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by ${author} on ${date}.
*/
@RestController
@RequestMapping("${baseRequestMapping}")
public class ${modelNameUpperCamel}Controller {
@Resource
private ${modelNameUpperCamel}Service ${modelNameLowerCamel}Service;
@PostMapping("/add")
public Result add(${modelNameUpperCamel} ${modelNameLowerCamel}) {
${modelNameLowerCamel}Service.save(${modelNameLowerCamel});
return ResultGenerator.genSuccessResult();
}
@PostMapping("/delete")
public Result delete(@RequestParam Integer id) {
${modelNameLowerCamel}Service.deleteById(id);
return ResultGenerator.genSuccessResult();
}
@PostMapping("/update")
public Result update(${modelNameUpperCamel} ${modelNameLowerCamel}) {
${modelNameLowerCamel}Service.update(${modelNameLowerCamel});
return ResultGenerator.genSuccessResult();
}
@PostMapping("/detail")
public Result detail(@RequestParam Integer id) {
${modelNameUpperCamel} ${modelNameLowerCamel} = ${modelNameLowerCamel}Service.findById(id);
return ResultGenerator.genSuccessResult(${modelNameLowerCamel});
}
@PostMapping("/list")
public Result list(@RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "0") Integer size) {
PageHelper.startPage(page, size);
List<${modelNameUpperCamel}> list = ${modelNameLowerCamel}Service.findAll();
PageInfo pageInfo = new PageInfo(list);
return ResultGenerator.genSuccessResult(pageInfo);
}
}
package ${basePackage}.service.impl;
import ${basePackage}.dao.${modelNameUpperCamel}Mapper;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.service.${modelNameUpperCamel}Service;
import ${basePackage}.core.AbstractService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
* Created by ${author} on ${date}.
*/
@Service
@Transactional
public class ${modelNameUpperCamel}ServiceImpl extends AbstractService<${modelNameUpperCamel}> implements ${modelNameUpperCamel}Service {
@Resource
private ${modelNameUpperCamel}Mapper ${modelNameLowerCamel}Mapper;
}
package ${basePackage}.service;
import ${basePackage}.model.${modelNameUpperCamel};
import ${basePackage}.core.Service;
/**
* Created by ${author} on ${date}.
*/
public interface ${modelNameUpperCamel}Service extends Service<${modelNameUpperCamel}> {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment