├── README.md ├── pom.xml └── src ├── doc └── user.sql ├── main ├── java │ └── com │ │ └── ly │ │ └── milestone │ │ ├── Interceptor │ │ └── AccessInterceptor.java │ │ ├── MileStoneApplication.java │ │ ├── controller │ │ ├── BaseController.java │ │ ├── HomeController.java │ │ ├── OauthController.java │ │ └── RestfulController.java │ │ ├── dao │ │ └── IUserDao.java │ │ ├── filter │ │ └── AccessFilter.java │ │ ├── listener │ │ └── UserEventListener.java │ │ ├── model │ │ ├── ResponseResult.java │ │ ├── User.java │ │ └── UserInfo.java │ │ ├── service │ │ ├── IOauthService.java │ │ ├── IUserService.java │ │ └── impl │ │ │ ├── OauthServiceImpl.java │ │ │ └── UserServiceImpl.java │ │ └── utils │ │ ├── Constants.java │ │ ├── DateUtils.java │ │ ├── PageHelper.java │ │ ├── RedisHelper.java │ │ └── WebUtils.java ├── resources │ ├── application-dev.properties │ ├── application-prod.properties │ ├── application-qa.properties │ ├── application-qas.properties │ ├── application-stage.properties │ ├── application.properties │ ├── log4j2.xml │ ├── mapper │ │ └── UserMapper.xml │ ├── static │ │ ├── css │ │ │ └── common.css │ │ ├── img │ │ │ └── login-picture.png │ │ └── resources │ │ │ ├── css │ │ │ ├── app.4a7c7a3aa0b8c970d29ea645f096f7b9.css │ │ │ ├── app.4a7c7a3aa0b8c970d29ea645f096f7b9.css.map │ │ │ ├── app.93be55c68d682d48f84b3fac7a7359bd.css │ │ │ └── app.93be55c68d682d48f84b3fac7a7359bd.css.map │ │ │ ├── fonts │ │ │ ├── fontawesome-webfont.674f50d.eot │ │ │ ├── fontawesome-webfont.af7ae50.woff2 │ │ │ ├── fontawesome-webfont.b06871f.ttf │ │ │ ├── fontawesome-webfont.fee66e7.woff │ │ │ ├── icomoon.0a74426.eot │ │ │ ├── icomoon.7d4ac7d.woff │ │ │ └── icomoon.9f5fd7b.ttf │ │ │ ├── img │ │ │ ├── fontawesome-webfont.912ec66.svg │ │ │ ├── icomoon.f558046.svg │ │ │ ├── loading.fa62483.gif │ │ │ └── login-picture.9ef0edd.png │ │ │ └── js │ │ │ ├── 0.189655bfb41f9a7e055c.js │ │ │ ├── 0.189655bfb41f9a7e055c.js.map │ │ │ ├── 0.ff91e9aeb7c13069990d.js │ │ │ ├── 0.ff91e9aeb7c13069990d.js.map │ │ │ ├── app.a0e73f296f7a9e2b22db.js │ │ │ ├── app.a0e73f296f7a9e2b22db.js.map │ │ │ ├── app.b29f1611522b14ca8296.js │ │ │ ├── app.b29f1611522b14ca8296.js.map │ │ │ ├── manifest.641b86d275879d17bd40.js │ │ │ ├── manifest.641b86d275879d17bd40.js.map │ │ │ ├── manifest.c33206a2a4e949504f7e.js │ │ │ ├── manifest.c33206a2a4e949504f7e.js.map │ │ │ ├── vendor.22fc2031e69fdfb70909.js │ │ │ ├── vendor.22fc2031e69fdfb70909.js.map │ │ │ ├── vendor.adfb67b43adfea8bade3.js │ │ │ └── vendor.adfb67b43adfea8bade3.js.map │ ├── tcbase.properties │ └── templates │ │ ├── home.html │ │ └── index.html └── webapp │ └── hello.html └── test └── java └── com └── ly └── milestone ├── DemoApplicationTests.java └── controller └── RestControllerTest.java /README.md: -------------------------------------------------------------------------------- 1 | # vue.js-springboot-demo 2 | vue.js+springboot前后端分离demo 3 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.ly 7 | MileStone 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | MileStone 12 | MileStone project for Spring Boot 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.5.1.RELEASE 18 | 19 | 20 | 21 | 22 | UTF-8 23 | UTF-8 24 | 1.8 25 | 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-logging 35 | 36 | 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-test 42 | test 43 | 44 | 45 | 46 | org.springframework.boot 47 | spring-boot-starter-web 48 | 49 | 50 | 51 | org.springframework.boot 52 | spring-boot-devtools 53 | true 54 | 55 | 56 | 57 | org.springframework.boot 58 | spring-boot-starter-thymeleaf 59 | 60 | 61 | org.apache.tomcat 62 | tomcat-jdbc 63 | 7.0.47 64 | 65 | 66 | org.springframework 67 | spring-tx 68 | 4.1.8.RELEASE 69 | 70 | 71 | org.springframework 72 | spring-jdbc 73 | 4.1.6.RELEASE 74 | 75 | 76 | mysql 77 | mysql-connector-java 78 | 79 | 80 | 81 | org.mybatis.spring.boot 82 | mybatis-spring-boot-starter 83 | 1.1.1 84 | 85 | 86 | 87 | com.alibaba 88 | druid 89 | 1.0.19 90 | 91 | 92 | 93 | net.sf.json-lib 94 | json-lib 95 | 2.4 96 | jdk15 97 | 98 | 99 | commons-logging 100 | commons-logging 101 | 102 | 103 | 104 | 105 | 106 | commons-httpclient 107 | commons-httpclient 108 | 3.0.1 109 | 110 | 111 | 112 | 113 | org.apache.logging.log4j 114 | log4j-slf4j-impl 115 | 2.4.1 116 | 117 | 118 | org.apache.logging.log4j 119 | log4j-api 120 | 2.4.1 121 | 122 | 123 | org.apache.logging.log4j 124 | log4j-core 125 | 2.4.1 126 | 127 | 128 | org.slf4j 129 | jcl-over-slf4j 130 | 1.7.12 131 | 132 | 133 | 134 | 135 | 136 | 137 | milestone 138 | 139 | 140 | 141 | src/main/resources 142 | 143 | application-dev.properties 144 | application-prod.properties 145 | application-qa.properties 146 | application-qas.properties 147 | application-stage.properties 148 | application.properties 149 | 150 | true 151 | 152 | 153 | true 154 | src/main/resources 155 | 156 | application-${environment}.properties 157 | application.properties 158 | 159 | 160 | 161 | 162 | 163 | 164 | org.springframework.boot 165 | spring-boot-maven-plugin 166 | 167 | true 168 | 169 | 170 | 171 | 172 | org.apache.maven.plugins 173 | maven-resources-plugin 174 | 2.4.3 175 | 176 | UTF-8 177 | 178 | ttf 179 | woff 180 | woff2 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | dev 190 | 191 | dev 192 | test 193 | 194 | 195 | true 196 | 197 | 198 | 199 | prod 200 | 201 | prod 202 | product 203 | 204 | 205 | 206 | qa 207 | 208 | qa 209 | test 210 | 211 | 212 | 213 | qas 214 | 215 | qas 216 | test 217 | 218 | 219 | 220 | stage 221 | 222 | stage 223 | stage 224 | 225 | 226 | 227 | 228 | 229 | 230 | -------------------------------------------------------------------------------- /src/doc/user.sql: -------------------------------------------------------------------------------- 1 | 2 | DROP TABLE IF EXISTS `user`; 3 | 4 | CREATE TABLE `user` ( 5 | `rec_id` bigint(10) NOT NULL AUTO_INCREMENT, 6 | `user_id` int(10) NOT NULL DEFAULT '0', 7 | `user_name` varchar(255) NOT NULL DEFAULT '', 8 | `sex` varchar(10) NOT NULL DEFAULT '', 9 | `address` varchar(255) NOT NULL DEFAULT '', 10 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, 11 | `is_valid` int(11) NOT NULL DEFAULT '1', 12 | PRIMARY KEY (`rec_id`) 13 | ) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8; 14 | 15 | 16 | insert into `user`(`rec_id`,`user_id`,`user_name`,`sex`,`address`,`create_time`,`is_valid`) values (1,1,'丽丽3','female','address1','2017-04-01 09:43:57',1),(2,2,'Lucy','female','address2','2017-04-02 09:43:57',1),(3,3,'Ted','male','address3','2017-04-03 09:43:57',1),(4,4,'Henry','male','address4','2017-04-04 09:43:57',1),(5,5,'John','male','address55','2017-04-05 09:43:57',1),(6,6,'6','male','address6','2017-04-06 09:43:57',1),(7,7,'7','male','address7','2017-04-06 09:43:57',1),(8,8,'8','male','address8','2017-04-06 09:43:57',1); 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/Interceptor/AccessInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.Interceptor; 2 | 3 | import org.springframework.stereotype.Component; 4 | import org.springframework.web.servlet.HandlerInterceptor; 5 | import org.springframework.web.servlet.ModelAndView; 6 | 7 | import javax.servlet.http.HttpServletRequest; 8 | import javax.servlet.http.HttpServletResponse; 9 | 10 | /** 11 | * Created by lyc28724 on 2017/4/5. 12 | */ 13 | @Component 14 | public class AccessInterceptor implements HandlerInterceptor { 15 | 16 | @Override 17 | public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception { 18 | httpServletResponse.setHeader("Access-Control-Allow-Headers", "Content-Type"); 19 | httpServletResponse.setHeader("Access-Control-Allow-Origin", "*"); 20 | return true; 21 | } 22 | 23 | @Override 24 | public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception { 25 | 26 | } 27 | 28 | @Override 29 | public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception { 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/MileStoneApplication.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone; 2 | 3 | import com.ly.milestone.Interceptor.AccessInterceptor; 4 | import com.ly.milestone.filter.AccessFilter; 5 | import org.apache.ibatis.session.SqlSessionFactory; 6 | import org.mybatis.spring.SqlSessionFactoryBean; 7 | import org.mybatis.spring.annotation.MapperScan; 8 | import org.mybatis.spring.boot.autoconfigure.SpringBootVFS; 9 | import org.springframework.boot.SpringApplication; 10 | import org.springframework.boot.autoconfigure.SpringBootApplication; 11 | import org.springframework.boot.context.properties.ConfigurationProperties; 12 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 13 | import org.springframework.context.annotation.Bean; 14 | import org.springframework.context.annotation.Configuration; 15 | import org.springframework.core.io.support.PathMatchingResourcePatternResolver; 16 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; 17 | import org.springframework.transaction.PlatformTransactionManager; 18 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 19 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; 20 | 21 | import javax.sql.DataSource; 22 | 23 | @SpringBootApplication 24 | @MapperScan("com.ly.milestone.dao") 25 | @Configuration 26 | public class MileStoneApplication { 27 | 28 | // DataSource配置 29 | @Bean 30 | @ConfigurationProperties(prefix="spring.datasource") 31 | public DataSource dataSource() { 32 | return new org.apache.tomcat.jdbc.pool.DataSource(); 33 | } 34 | 35 | // 提供SqlSeesion 36 | @Bean 37 | public SqlSessionFactory sqlSessionFactoryBean() throws Exception { 38 | SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean(); 39 | sqlSessionFactoryBean.setDataSource(dataSource()); 40 | PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); 41 | sqlSessionFactoryBean.setVfs(SpringBootVFS.class); 42 | sqlSessionFactoryBean.setTypeAliasesPackage("com.ly.milestone.model"); 43 | sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/*.xml")); 44 | return sqlSessionFactoryBean.getObject(); 45 | } 46 | 47 | // 事务配置 48 | @Bean 49 | public PlatformTransactionManager transactionManager() { 50 | return new DataSourceTransactionManager(dataSource()); 51 | } 52 | 53 | // 主启动函数 54 | public static void main(String[] args) { 55 | SpringApplication.run(MileStoneApplication.class, args); 56 | } 57 | 58 | // 过滤器配置 59 | @Bean 60 | public FilterRegistrationBean someFilterRegistration() { 61 | FilterRegistrationBean registration = new FilterRegistrationBean(); 62 | AccessFilter accessFilter = new AccessFilter(); 63 | registration.setFilter(accessFilter); 64 | registration.addUrlPatterns("/admin/*"); 65 | registration.setName("accessFilter"); 66 | return registration; 67 | } 68 | 69 | @Configuration 70 | static class AddInterceptor extends WebMvcConfigurerAdapter { 71 | public void addInterceptors(InterceptorRegistry registry) { 72 | registry.addInterceptor(new AccessInterceptor()).addPathPatterns("/admin/*"); 73 | } 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/controller/BaseController.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.controller; 2 | 3 | import com.ly.milestone.model.UserInfo; 4 | import com.ly.milestone.service.IOauthService; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | 11 | import javax.servlet.http.HttpServletRequest; 12 | 13 | /** 14 | * Created by lyc28724 on 2017/3/30. 15 | */ 16 | @Controller 17 | public class BaseController { 18 | 19 | private static final Logger LOG = LoggerFactory.getLogger(HomeController.class); 20 | 21 | @Autowired 22 | private IOauthService oauthService; 23 | 24 | protected UserInfo userInfo; 25 | 26 | public UserInfo getUserInfo(HttpServletRequest request) { 27 | try { 28 | return oauthService.getUserInfoByToken(request); 29 | } catch (Exception e) { 30 | LOG.error("getUserInfo is failed:", e); 31 | } 32 | return null; 33 | } 34 | 35 | @RequestMapping("/") 36 | public String forward() { 37 | return "redirect:admin/index/"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.controller; 2 | 3 | import com.ly.milestone.model.User; 4 | import com.ly.milestone.model.UserInfo; 5 | import com.ly.milestone.service.IUserService; 6 | import org.slf4j.Logger; 7 | import org.slf4j.LoggerFactory; 8 | import org.springframework.beans.factory.annotation.Autowired; 9 | import org.springframework.context.ApplicationEventPublisher; 10 | import org.springframework.stereotype.Controller; 11 | import org.springframework.ui.Model; 12 | import org.springframework.web.bind.annotation.RequestMapping; 13 | 14 | import javax.servlet.http.HttpServletRequest; 15 | import java.util.List; 16 | 17 | /** 18 | * Created by lyc28724 on 2017/2/28. 19 | */ 20 | @Controller 21 | @RequestMapping("admin") 22 | public class HomeController extends BaseController{ 23 | 24 | private static final Logger LOG = LoggerFactory.getLogger(HomeController.class); 25 | 26 | @Autowired 27 | private IUserService userService; 28 | 29 | @Autowired 30 | ApplicationEventPublisher publisher; 31 | 32 | 33 | @RequestMapping("home") 34 | public String home(HttpServletRequest request, Model model){ 35 | try { 36 | UserInfo userInfo = getUserInfo(request); 37 | String sex = "male"; 38 | List userList = userService.queryUserBySex(sex); 39 | int userId = 2; 40 | User user = userService.queryUserByUserId(userId); 41 | model.addAttribute("userList", userList); 42 | model.addAttribute("user", user); 43 | model.addAttribute("userInfo", userInfo); 44 | } catch (Exception e) { 45 | LOG.error("access home is failed:", e); 46 | } 47 | return "home"; 48 | } 49 | 50 | @RequestMapping("index") 51 | public String Index() { 52 | return "index"; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/controller/OauthController.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.controller; 2 | 3 | import com.ly.milestone.service.IOauthService; 4 | import com.ly.milestone.utils.RedisHelper; 5 | import net.sf.json.JSONObject; 6 | import org.apache.commons.lang3.StringUtils; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.beans.factory.annotation.Value; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.ui.Model; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | 15 | import javax.servlet.http.Cookie; 16 | import javax.servlet.http.HttpServletRequest; 17 | import javax.servlet.http.HttpServletResponse; 18 | 19 | import static com.ly.milestone.utils.WebUtils.postByJsonParameters; 20 | import static com.ly.milestone.utils.Constants.*; 21 | 22 | /** 23 | * Created by lyc28724 on 2017/3/30. 24 | */ 25 | @Controller 26 | @RequestMapping("oauth") 27 | public class OauthController { 28 | 29 | private static final Logger LOG = LoggerFactory.getLogger(OauthController.class); 30 | 31 | @Value("${applyTokenRedirectUri}") 32 | private String applyTokenRedirectUri; 33 | 34 | @Value("${codeApplyForTokenUri}") 35 | private String codeApplyForTokenUri; 36 | 37 | @Value("${ssoLogoutUri}") 38 | private String ssoLogoutUri; 39 | 40 | @Value("${cookieExpireTime}") 41 | private int cookieExpireTime; 42 | 43 | @Value("${responseType}") 44 | private String responseType; 45 | 46 | @Value("${clientId}") 47 | private String clientId; 48 | 49 | @Value("${scope}") 50 | private String scope; 51 | 52 | @Value("${grantType}") 53 | private String grantType; 54 | 55 | @Value("${clientSecret}") 56 | private String clientSecret; 57 | 58 | @Autowired 59 | private IOauthService oauthService; 60 | 61 | 62 | /** 63 | * 向SSO站点申请访问令牌 64 | * 65 | * @param response 66 | * @return 67 | */ 68 | @RequestMapping("applyfortoken") 69 | public String applyForToken(HttpServletRequest request, HttpServletResponse response) throws Exception { 70 | try { 71 | String applyForTokenUri = oauthService.applyForTokenFromSSO(request, response); 72 | return "redirect:" + applyForTokenUri; 73 | } catch (Exception e) { 74 | LOG.error("applyfortoken is failed:", e); 75 | return null; 76 | } 77 | } 78 | 79 | 80 | /** 81 | * 回调接口 82 | * 83 | * @param request 84 | * @param response 85 | * @param state 86 | * @param code 87 | * @param model 88 | * @return 89 | * @throws Exception 90 | */ 91 | @RequestMapping("authorization_code_callback") 92 | public String authorizationCodeCallback(HttpServletRequest request, HttpServletResponse response, String state, String code, String returnUri, Model model) throws Exception { 93 | try { 94 | Boolean stateIsValid = oauthService.checkState(request, response, state); 95 | if (stateIsValid) { 96 | JSONObject jsonParams = new JSONObject(); 97 | jsonParams.put("client_id", clientId); 98 | jsonParams.put("client_secret", clientSecret); 99 | jsonParams.put("redirect_uri", applyTokenRedirectUri); 100 | jsonParams.put("code", code); 101 | jsonParams.put("grant_type", grantType); 102 | // 通过接收到的授权码到SSO站点申请令牌 103 | String returnParams = postByJsonParameters(codeApplyForTokenUri, jsonParams); 104 | JSONObject jsonResponse = JSONObject.fromObject(returnParams); 105 | String accessToken = jsonResponse.getString(ACCESS_TOKEN); 106 | if (null != accessToken) { 107 | Cookie cookie = new Cookie(ACCESS_TOKEN, accessToken); 108 | cookie.setMaxAge(cookieExpireTime); 109 | cookie.setPath(WEBROOT_URI_PATH); 110 | response.addCookie(cookie); 111 | if (StringUtils.isNotEmpty(returnUri)) { 112 | return "redirect:" + returnUri; 113 | } 114 | return "redirect:/admin/home"; 115 | } 116 | model.addAttribute("error", "Invalid code"); 117 | return "oauth/oauth_error"; 118 | } else { 119 | model.addAttribute("error", "Invalid state"); 120 | return "oauth/oauth_error"; 121 | } 122 | } catch (Exception e) { 123 | LOG.error("authorization_code_callback is failed:", e); 124 | return null; 125 | } 126 | } 127 | 128 | /** 129 | * 退出登录 130 | * 131 | * @param request 132 | * @param response 133 | * @return 134 | * @throws Exception 135 | */ 136 | @RequestMapping("logout") 137 | public String logout(HttpServletRequest request, HttpServletResponse response) throws Exception { 138 | try { 139 | StringBuffer fullLogoutUri = new StringBuffer().append(ssoLogoutUri); 140 | if (null != request.getCookies()) { 141 | for (Cookie cookie : request.getCookies()) { 142 | if (ACCESS_TOKEN.equals(cookie.getName())) { 143 | fullLogoutUri.append("?").append(ACCESS_TOKEN).append("=").append(cookie.getValue()); 144 | cookie.setMaxAge(0); 145 | cookie.setPath(WEBROOT_URI_PATH); 146 | response.addCookie(cookie); 147 | RedisHelper.del(cookie.getValue()); 148 | break; 149 | } 150 | } 151 | } 152 | return "redirect:" + fullLogoutUri.toString(); 153 | } catch (Exception e) { 154 | LOG.error("logout is failed:", e); 155 | return null; 156 | } 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/controller/RestfulController.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.controller; 2 | 3 | import com.ly.milestone.model.ResponseResult; 4 | import com.ly.milestone.model.User; 5 | import com.ly.milestone.model.UserInfo; 6 | import com.ly.milestone.service.IOauthService; 7 | import com.ly.milestone.service.IUserService; 8 | import com.ly.milestone.utils.PageHelper; 9 | import net.sf.json.JSONObject; 10 | import org.slf4j.Logger; 11 | import org.slf4j.LoggerFactory; 12 | import org.springframework.beans.factory.annotation.Autowired; 13 | import org.springframework.web.bind.annotation.RequestBody; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | import org.springframework.web.bind.annotation.RequestMethod; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | import java.util.HashMap; 20 | import java.util.List; 21 | import java.util.Map; 22 | 23 | import static com.ly.milestone.utils.Constants.ERR_CODE; 24 | import static com.ly.milestone.utils.Constants.SUCC_CODE; 25 | 26 | 27 | /** 28 | * Created by lyc28724 on 2017/2/28. 29 | */ 30 | 31 | @RestController 32 | @RequestMapping("admin") 33 | public class RestfulController { 34 | 35 | private static final Logger LOG = LoggerFactory.getLogger(RestfulController.class); 36 | 37 | @Autowired 38 | private IUserService userService; 39 | 40 | @Autowired 41 | private IOauthService oauthService; 42 | 43 | 44 | @RequestMapping(value = "loadList", method = RequestMethod.POST) 45 | public PageHelper loadList(@RequestBody PageHelper page) { 46 | try { 47 | page.setTotalCount(userService.findTotalCountUsers(page)); 48 | page.setContent(userService.searchUserByPage(page)); 49 | return page; 50 | } catch (Exception e) { 51 | LOG.error("invoking loadList is failed:", e); 52 | } 53 | return null; 54 | } 55 | 56 | @RequestMapping(value = "list", method = RequestMethod.POST) 57 | public List list(@RequestBody PageHelper page) { 58 | try { 59 | List userList = userService.searchUserByPage(page); 60 | return userList; 61 | } catch (Exception e) { 62 | LOG.error("invoking list is failed:", e); 63 | } 64 | return null; 65 | } 66 | 67 | @RequestMapping(value = "addUser", method = RequestMethod.POST) 68 | public ResponseResult addUser(@RequestBody User user) { 69 | ResponseResult responseResult = new ResponseResult(); 70 | try { 71 | userService.insertUser(user); 72 | responseResult.setCode(SUCC_CODE); 73 | } catch (Exception e) { 74 | responseResult.setCode(ERR_CODE); 75 | LOG.error("addUser is failed:", e); 76 | } 77 | return responseResult; 78 | 79 | } 80 | 81 | @RequestMapping(value = "userDetail", method = RequestMethod.POST) 82 | public ResponseResult userDetail(Long recId) { 83 | ResponseResult responseResult = new ResponseResult(); 84 | try { 85 | User user = userService.queryUserByRecId(recId); 86 | responseResult.setData(user); 87 | responseResult.setCode(SUCC_CODE); 88 | } catch (Exception e) { 89 | responseResult.setCode(ERR_CODE); 90 | LOG.error("userDetail is failed:", e); 91 | } 92 | return responseResult; 93 | } 94 | 95 | @RequestMapping(value = "editUser", method = RequestMethod.POST) 96 | public ResponseResult editUser(@RequestBody User user) { 97 | ResponseResult responseResult = new ResponseResult(); 98 | try { 99 | userService.editUserByRecId(user); 100 | responseResult.setCode(SUCC_CODE); 101 | } catch (Exception e) { 102 | responseResult.setCode(ERR_CODE); 103 | LOG.error("editUser is failed:", e); 104 | } 105 | return responseResult; 106 | } 107 | 108 | @RequestMapping(value = "delUser", method = RequestMethod.POST) 109 | public ResponseResult delUser(Long recId) { 110 | ResponseResult responseResult = new ResponseResult(); 111 | try { 112 | userService.delUserByRecId(recId); 113 | responseResult.setCode(SUCC_CODE); 114 | } catch (Exception e) { 115 | responseResult.setCode(ERR_CODE); 116 | LOG.error("delUser is failed:", e); 117 | } 118 | return responseResult; 119 | 120 | } 121 | 122 | @RequestMapping("map") 123 | public Map map() { 124 | Map map = new HashMap<>(); 125 | try { 126 | map.put("name", "lili"); 127 | map.put("age", "20"); 128 | } catch (Exception e) { 129 | LOG.error("invoking map is failed:", e); 130 | } 131 | return map; 132 | } 133 | 134 | @RequestMapping("object") 135 | public User object() { 136 | try { 137 | int userId = 1; 138 | User user = userService.queryUserByUserId(userId); 139 | return user; 140 | } catch (Exception e) { 141 | LOG.error("invoking object is failed:", e); 142 | } 143 | return null; 144 | } 145 | 146 | @RequestMapping("userInfo") 147 | public String userInfo(HttpServletRequest request) { 148 | try { 149 | UserInfo userInfo = oauthService.getUserInfoByToken(request); 150 | return "callback(" + JSONObject.fromObject(userInfo).toString() +")"; 151 | } catch (Exception e) { 152 | LOG.error("invoking userInfo is failed:", e); 153 | } 154 | return null; 155 | } 156 | 157 | } 158 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/dao/IUserDao.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.dao; 2 | 3 | import com.ly.milestone.model.User; 4 | import com.ly.milestone.utils.PageHelper; 5 | import org.omg.PortableInterceptor.INACTIVE; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import java.util.List; 9 | 10 | 11 | /** 12 | * Created by lyc28724 on 2017/3/1. 13 | */ 14 | @Repository 15 | public interface IUserDao { 16 | 17 | List queryUserBySex(String sex); 18 | 19 | User queryUserByUserId(Integer userId); 20 | 21 | List searchUserByPage(PageHelper page); 22 | 23 | Long findTotalCountUsers(PageHelper page); 24 | 25 | Integer insertUser(User user); 26 | 27 | Integer delUser(Long recId); 28 | 29 | User queryUserByRecId(Long recId); 30 | 31 | Integer editUserByRecId(User user); 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/filter/AccessFilter.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.filter; 2 | 3 | /** 4 | * Created by lyc28724 on 2017/3/30. 5 | */ 6 | 7 | import com.ly.milestone.utils.WebUtils; 8 | import org.apache.commons.lang3.StringUtils; 9 | 10 | import javax.servlet.*; 11 | import javax.servlet.http.HttpServletRequest; 12 | import javax.servlet.http.HttpServletResponse; 13 | import java.io.IOException; 14 | 15 | import static com.ly.milestone.utils.Constants.ACCESS_TOKEN; 16 | 17 | public class AccessFilter implements Filter{ 18 | 19 | @Override 20 | public void init(FilterConfig filterConfig) throws ServletException { 21 | 22 | } 23 | 24 | @Override 25 | public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException { 26 | HttpServletRequest request = (HttpServletRequest) req; 27 | HttpServletResponse response = (HttpServletResponse) resp; 28 | 29 | // 访问系统页面,检查cookie中是否有token信息 30 | String accessToken = WebUtils.getCookieValueByName(request, ACCESS_TOKEN); 31 | if (StringUtils.isNotEmpty(accessToken)) { 32 | // request.setAttribute(ACCESS_TOKEN, accessToken); 33 | chain.doFilter(req, resp); 34 | } else { 35 | String returnUri = request.getRequestURL().toString(); 36 | request.setAttribute("returnUri", returnUri); 37 | request.getRequestDispatcher("/oauth/applyfortoken").forward(req,resp); 38 | } 39 | } 40 | 41 | @Override 42 | public void destroy() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/listener/UserEventListener.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.listener; 2 | 3 | import com.ly.milestone.model.User; 4 | import org.springframework.context.event.EventListener; 5 | import org.springframework.scheduling.annotation.Async; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * Created by lyc28724 on 2017/4/14. 10 | */ 11 | @Component 12 | public class UserEventListener { 13 | 14 | @Async 15 | @EventListener 16 | public void userHandler(User user){ 17 | // do sth. 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/model/ResponseResult.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by lyc28724 on 2017/3/29. 7 | */ 8 | public class ResponseResult implements Serializable { 9 | 10 | private Integer code; 11 | private String msg; 12 | private T data; 13 | 14 | public Integer getCode() { 15 | return code; 16 | } 17 | 18 | public void setCode(Integer code) { 19 | this.code = code; 20 | } 21 | 22 | public T getData() { 23 | return data; 24 | } 25 | 26 | public void setData(T data) { 27 | this.data = data; 28 | } 29 | 30 | public String getMsg() { 31 | return msg; 32 | } 33 | 34 | public void setMsg(String msg) { 35 | this.msg = msg; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/model/User.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | /** 7 | * Created by lyc28724 on 2017/3/1. 8 | */ 9 | public class User implements Serializable { 10 | 11 | private Long recId; 12 | private Integer userId; 13 | private String userName; 14 | private String sex; 15 | private String address; 16 | private Date createTime; 17 | private String startTime; 18 | private String endTime; 19 | 20 | public Long getRecId() { 21 | return recId; 22 | } 23 | 24 | public void setRecId(Long recId) { 25 | this.recId = recId; 26 | } 27 | 28 | public String getSex() { 29 | return sex; 30 | } 31 | 32 | public void setSex(String sex) { 33 | this.sex = sex; 34 | } 35 | 36 | public String getAddress() { 37 | return address; 38 | } 39 | 40 | public void setAddress(String address) { 41 | this.address = address; 42 | } 43 | 44 | public Integer getUserId() { 45 | return userId; 46 | } 47 | 48 | public void setUserId(Integer userId) { 49 | this.userId = userId; 50 | } 51 | 52 | public String getUserName() { 53 | return userName; 54 | } 55 | 56 | public void setUserName(String userName) { 57 | this.userName = userName; 58 | } 59 | 60 | public Date getCreateTime() { 61 | return createTime; 62 | } 63 | 64 | public void setCreateTime(Date createTime) { 65 | this.createTime = createTime; 66 | } 67 | 68 | public String getStartTime() { 69 | return startTime; 70 | } 71 | 72 | public void setStartTime(String startTime) { 73 | this.startTime = startTime; 74 | } 75 | 76 | public String getEndTime() { 77 | return endTime; 78 | } 79 | 80 | public void setEndTime(String endTime) { 81 | this.endTime = endTime; 82 | } 83 | } 84 | 85 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/model/UserInfo.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.model; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * Created by lyc28724 on 2017/3/30. 7 | */ 8 | public class UserInfo implements Serializable { 9 | 10 | private String username; 11 | private String department; 12 | private String departmentId; 13 | private String userId; 14 | private String workId; 15 | private String gender; 16 | private String email; 17 | private String deptLevelId; 18 | private String deptLevelName; 19 | private String phoneNumber; 20 | 21 | public String getWorkId() { 22 | return workId; 23 | } 24 | 25 | public void setWorkId(String workId) { 26 | this.workId = workId; 27 | } 28 | 29 | public String getUsername() { 30 | return username; 31 | } 32 | 33 | public void setUsername(String username) { 34 | this.username = username; 35 | } 36 | 37 | public String getDepartment() { 38 | return department; 39 | } 40 | 41 | public void setDepartment(String department) { 42 | this.department = department; 43 | } 44 | 45 | public String getUserId() { 46 | return userId; 47 | } 48 | 49 | public void setUserId(String userId) { 50 | this.userId = userId; 51 | } 52 | 53 | public String getGender() { 54 | return gender; 55 | } 56 | 57 | public void setGender(String gender) { 58 | this.gender = gender; 59 | } 60 | 61 | public String getEmail() { 62 | return email; 63 | } 64 | 65 | public void setEmail(String email) { 66 | this.email = email; 67 | } 68 | 69 | public String getDeptLevelId() { 70 | return deptLevelId; 71 | } 72 | 73 | public void setDeptLevelId(String deptLevelId) { 74 | this.deptLevelId = deptLevelId; 75 | } 76 | 77 | public String getDeptLevelName() { 78 | return deptLevelName; 79 | } 80 | 81 | public void setDeptLevelName(String deptLevelName) { 82 | this.deptLevelName = deptLevelName; 83 | } 84 | 85 | public String getPhoneNumber() { 86 | return phoneNumber; 87 | } 88 | 89 | public void setPhoneNumber(String phoneNumber) { 90 | this.phoneNumber = phoneNumber; 91 | } 92 | 93 | public String getDepartmentId() { 94 | return departmentId; 95 | } 96 | 97 | public void setDepartmentId(String departmentId) { 98 | this.departmentId = departmentId; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/service/IOauthService.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.service; 2 | 3 | import com.ly.milestone.model.UserInfo; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | /** 9 | * Created by lyc28724 on 2017/3/30. 10 | */ 11 | public interface IOauthService { 12 | 13 | /** 14 | * 向SSO站点申请访问令牌 15 | * 16 | * @param response 17 | * @return 18 | */ 19 | String applyForTokenFromSSO(HttpServletRequest request, HttpServletResponse response) throws Exception; 20 | 21 | /** 22 | * 检查认证服务器回传过来的state是否与客户端传过去的一致,防止CSRF攻击 23 | * 24 | * @param request 25 | * @param response 26 | * @param state 27 | * @return 28 | */ 29 | Boolean checkState(HttpServletRequest request, HttpServletResponse response, String state); 30 | 31 | /** 32 | * 根据token获取用户信息 33 | * 34 | * @param request 35 | * @return 36 | */ 37 | UserInfo getUserInfoByToken(HttpServletRequest request); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/service/IUserService.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.service; 2 | 3 | import com.ly.milestone.model.User; 4 | import com.ly.milestone.utils.PageHelper; 5 | import org.omg.PortableInterceptor.INACTIVE; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by lyc28724 on 2017/3/1. 11 | */ 12 | public interface IUserService { 13 | 14 | List queryUserBySex(String sex); 15 | 16 | User queryUserByUserId(Integer userId); 17 | 18 | List searchUserByPage(PageHelper page); 19 | 20 | Long findTotalCountUsers(PageHelper page); 21 | 22 | Integer insertUser(User user); 23 | 24 | Integer delUserByRecId(Long recId); 25 | 26 | User queryUserByRecId(Long recId); 27 | 28 | Integer editUserByRecId(User user); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/service/impl/OauthServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.service.impl; 2 | 3 | import com.ly.milestone.model.UserInfo; 4 | import com.ly.milestone.service.IOauthService; 5 | import com.ly.milestone.utils.RedisHelper; 6 | import com.ly.milestone.utils.WebUtils; 7 | import net.sf.json.JSONObject; 8 | import org.springframework.beans.factory.annotation.Value; 9 | import org.springframework.stereotype.Service; 10 | 11 | import javax.servlet.http.Cookie; 12 | import javax.servlet.http.HttpServletRequest; 13 | import javax.servlet.http.HttpServletResponse; 14 | import java.net.URLEncoder; 15 | import java.util.UUID; 16 | 17 | import static com.ly.milestone.utils.WebUtils.postByJsonParameters; 18 | import static com.ly.milestone.utils.Constants.*; 19 | 20 | /** 21 | * Created by lyc28724 on 2017/3/30. 22 | */ 23 | @Service 24 | public class OauthServiceImpl implements IOauthService { 25 | 26 | @Value("${applyTokenRedirectUri}") 27 | private String applyTokenRedirectUri; 28 | 29 | @Value("${stateApplyForCodeUri}") 30 | private String stateApplyForCodeUri; 31 | 32 | @Value("${responseType}") 33 | private String responseType; 34 | 35 | @Value("${scope}") 36 | private String scope; 37 | 38 | @Value("${clientId}") 39 | private String clientId; 40 | 41 | @Value("${getUserInfoByTokenUri}") 42 | private String getUserInfoByTokenUri; 43 | 44 | @Override 45 | public String applyForTokenFromSSO(HttpServletRequest request, HttpServletResponse response) throws Exception { 46 | // 如果cookie中没有token信息,通过state向SSO站点申请授权码 47 | String state = UUID.randomUUID().toString().replaceAll("-", ""); 48 | // 用于防止跨站请求伪造(CSRF)攻击 49 | Cookie cookie = new Cookie("state", state); 50 | cookie.setPath(WEBROOT_URI_PATH); 51 | response.addCookie(cookie); 52 | StringBuffer fullUri = new StringBuffer(); 53 | String redirectUri = URLEncoder.encode(applyTokenRedirectUri, CHARSET_UTF8); 54 | String returnUri = ""; 55 | if (null != request.getAttribute("returnUri")) { 56 | returnUri = URLEncoder.encode(request.getAttribute("returnUri").toString(), CHARSET_UTF8); 57 | } 58 | fullUri.append(stateApplyForCodeUri) 59 | .append("?response_type=").append(responseType) 60 | .append("&scope=").append(scope) 61 | .append("&client_id=").append(clientId) 62 | .append("&redirect_uri=").append(redirectUri) 63 | .append("&state=").append(state) 64 | .append("&return_uri=").append(returnUri); 65 | return fullUri.toString(); 66 | } 67 | 68 | @Override 69 | public Boolean checkState(HttpServletRequest request, HttpServletResponse response, String state) { 70 | if (null != request.getCookies()) { 71 | for (Cookie cookie : request.getCookies()) { 72 | if ("state".equals(cookie.getName())) { 73 | if (state.equals(cookie.getValue())) { 74 | cookie.setMaxAge(0); 75 | cookie.setPath(WEBROOT_URI_PATH); 76 | response.addCookie(cookie); 77 | return true; 78 | } 79 | } 80 | } 81 | } 82 | return false; 83 | } 84 | 85 | @Override 86 | public UserInfo getUserInfoByToken(HttpServletRequest request) { 87 | // String accessToken = request.getAttribute(ACCESS_TOKEN).toString(); 88 | String accessToken = WebUtils.getCookieValueByName(request, ACCESS_TOKEN); 89 | UserInfo userInfo = RedisHelper.getObject(accessToken, UserInfo.class); 90 | if (null == userInfo) { 91 | JSONObject jsonParams = new JSONObject(); 92 | jsonParams.put(ACCESS_TOKEN, accessToken); 93 | String returnParams = postByJsonParameters(getUserInfoByTokenUri, jsonParams); 94 | JSONObject json = JSONObject.fromObject(returnParams); 95 | if (json.containsKey("username")) { 96 | // userInfo.setWorkId(json.getString("workId")); 97 | userInfo = (UserInfo) JSONObject.toBean(json, UserInfo.class); 98 | RedisHelper.setObject(accessToken, 43200, userInfo); 99 | } 100 | } 101 | return userInfo; 102 | } 103 | 104 | } 105 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.service.impl; 2 | 3 | import com.ly.milestone.dao.IUserDao; 4 | import com.ly.milestone.model.User; 5 | import com.ly.milestone.service.IUserService; 6 | import com.ly.milestone.utils.PageHelper; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * Created by lyc28724 on 2017/3/1. 14 | */ 15 | @Service 16 | public class UserServiceImpl implements IUserService { 17 | 18 | @Autowired 19 | private IUserDao userDao; 20 | 21 | @Override 22 | public List queryUserBySex(String sex) { 23 | return userDao.queryUserBySex(sex); 24 | } 25 | 26 | @Override 27 | public User queryUserByUserId(Integer userId) { 28 | return userDao.queryUserByUserId(userId); 29 | } 30 | 31 | @Override 32 | public List searchUserByPage(PageHelper page) { 33 | return userDao.searchUserByPage(page); 34 | } 35 | 36 | @Override 37 | public Long findTotalCountUsers(PageHelper page) { 38 | return userDao.findTotalCountUsers(page); 39 | } 40 | 41 | @Override 42 | public Integer insertUser(User user) { 43 | return userDao.insertUser(user); 44 | } 45 | 46 | @Override 47 | public Integer delUserByRecId(Long recId) { 48 | return userDao.delUser(recId); 49 | } 50 | 51 | @Override 52 | public User queryUserByRecId(Long recId) { 53 | return userDao.queryUserByRecId(recId); 54 | } 55 | 56 | @Override 57 | public Integer editUserByRecId(User user) { 58 | return userDao.editUserByRecId(user); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.utils; 2 | 3 | /** 4 | * Created by lyc28724 on 2017/3/29. 5 | */ 6 | public abstract class Constants { 7 | public static final int SUCC_CODE = 0; 8 | public static final int ERR_CODE = -1; 9 | public static final String CHARSET_UTF8 = "UTF-8"; 10 | public static final String ACCESS_TOKEN = "access_token"; 11 | public static final String WEBROOT_URI_PATH = "/milestone"; 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/utils/DateUtils.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.utils; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.text.ParseException; 6 | import java.text.SimpleDateFormat; 7 | import java.util.Calendar; 8 | import java.util.Date; 9 | 10 | /** 11 | * Created by lyc28724 on 2017/4/7. 12 | */ 13 | public abstract class DateUtils { 14 | 15 | private DateUtils() { 16 | 17 | } 18 | 19 | /** 20 | * Default time format : yyyy-MM-dd HH:mm:ss 21 | */ 22 | public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss"; 23 | 24 | /** 25 | * Time format : yyyy-MM-dd HH:mm 26 | */ 27 | public static final String DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm"; 28 | public static final String DATE_TIME_CN_FORMAT = "yyyy年MM月dd日 HH:mm"; 29 | public static final String TIME_FORMAT = "HH:mm"; 30 | 31 | /** 32 | * Default date format 33 | */ 34 | public static final String DATE_FORMAT = "yyyy-MM-dd"; 35 | /** 36 | * Default month format 37 | */ 38 | public static final String MONTH_FORMAT = "yyyy-MM"; 39 | /** 40 | * Default day format 41 | */ 42 | public static final String DAY_FORMAT = "dd"; 43 | 44 | 45 | //Date pattern, demo: 2013-09-11 46 | public static final String DATE_PATTERN = "^[0-9]{4}\\-[0-9]{2}\\-[0-9]{2}$"; 47 | 48 | public static boolean isDate(String dateAsText) { 49 | return StringUtils.isNotEmpty(dateAsText) && dateAsText.matches(DATE_PATTERN); 50 | } 51 | 52 | public static Date now() { 53 | return new Date(); 54 | } 55 | 56 | public static String toDateText(Date date) { 57 | return toDateText(date, DATE_FORMAT); 58 | } 59 | 60 | public static String toDateText(Date date, String pattern) { 61 | if (date == null || pattern == null) { 62 | return null; 63 | } 64 | SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); 65 | return dateFormat.format(date); 66 | } 67 | 68 | public static Date getDate(String dateText) { 69 | return getDate(dateText, DATE_FORMAT); 70 | } 71 | 72 | 73 | public static Date getDate(String dateText, String pattern) { 74 | SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); 75 | try { 76 | return dateFormat.parse(dateText); 77 | } catch (ParseException e) { 78 | throw new IllegalStateException("Parse date from [" + dateText + "," + pattern + "] failed", e); 79 | } 80 | } 81 | 82 | public static String toDateTime(Date date) { 83 | return toDateText(date, DEFAULT_DATE_TIME_FORMAT); 84 | } 85 | 86 | public static String toCNDateTime(Date date) { 87 | return toDateText(date, DATE_TIME_CN_FORMAT); 88 | } 89 | 90 | 91 | /** 92 | * Return current year. 93 | * 94 | * @return Current year 95 | */ 96 | public static int currentYear() { 97 | return calendar().get(Calendar.YEAR); 98 | } 99 | 100 | public static Calendar calendar() { 101 | return Calendar.getInstance(); 102 | } 103 | 104 | public static long getRemainingTimeOfToday() { 105 | Calendar todayEnd = Calendar.getInstance(); 106 | todayEnd.set(Calendar.HOUR_OF_DAY, 23); 107 | todayEnd.set(Calendar.MINUTE, 59); 108 | todayEnd.set(Calendar.SECOND, 59); 109 | todayEnd.set(Calendar.MILLISECOND, 999); 110 | Calendar todayCurrent = Calendar.getInstance(); 111 | return (todayEnd.getTimeInMillis() - todayCurrent.getTimeInMillis()) / 1000; 112 | } 113 | 114 | 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/utils/PageHelper.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.utils; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by lyc28724 on 2017/4/5. 7 | */ 8 | public class PageHelper { 9 | 10 | private List content; 11 | private long pageSize; 12 | private long pageIndex; 13 | private long totalCount; 14 | private long totalPage; 15 | private long from; 16 | private T condition; 17 | 18 | public PageHelper() { 19 | 20 | } 21 | 22 | public PageHelper(long pageSize) { 23 | this.pageSize = pageSize; 24 | } 25 | 26 | public List getContent() { 27 | return content; 28 | } 29 | 30 | public void setContent(List content) { 31 | this.content = content; 32 | } 33 | 34 | public long getPageSize() { 35 | return pageSize; 36 | } 37 | 38 | public void setPageSize(long pageSize) { 39 | pageSize = pageSize == 0 ? 10 : pageSize; 40 | from = pageSize * (pageIndex - 1); 41 | this.pageSize = pageSize; 42 | } 43 | 44 | public long getPageIndex() { 45 | return pageIndex; 46 | } 47 | 48 | public void setPageIndex(long pageIndex) { 49 | pageSize = pageSize == 0 ? 10 : pageSize; 50 | from = pageSize * (pageIndex - 1); 51 | this.pageIndex = pageIndex; 52 | } 53 | 54 | public long getTotalCount() { 55 | return totalCount; 56 | } 57 | 58 | public void setTotalCount(long totalCount) { 59 | this.totalCount = totalCount; 60 | double totalPage = (double) totalCount / (double) getPageSize(); 61 | this.totalPage = (long) Math.ceil(totalPage); 62 | } 63 | 64 | public long getTotalPage() { 65 | double totalPage = (double) totalCount / (double) getPageSize(); 66 | return (long) Math.ceil(totalPage); 67 | } 68 | 69 | public void setTotalPage(long totalPage) { 70 | this.totalPage = totalPage; 71 | } 72 | 73 | public T getCondition() { 74 | return condition; 75 | } 76 | 77 | public void setCondition(T condition) { 78 | this.condition = condition; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/utils/RedisHelper.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.utils; 2 | 3 | /** 4 | * Created by lyc28724 on 2017/5/4. 5 | */ 6 | public class RedisHelper { 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/ly/milestone/utils/WebUtils.java: -------------------------------------------------------------------------------- 1 | package com.ly.milestone.utils; 2 | 3 | import net.sf.json.JSONObject; 4 | import org.apache.commons.httpclient.HttpClient; 5 | import org.apache.commons.httpclient.HttpException; 6 | import org.apache.commons.httpclient.HttpStatus; 7 | import org.apache.commons.httpclient.NameValuePair; 8 | import org.apache.commons.httpclient.methods.GetMethod; 9 | import org.apache.commons.httpclient.methods.PostMethod; 10 | import org.apache.commons.httpclient.methods.StringRequestEntity; 11 | 12 | import javax.servlet.http.Cookie; 13 | import javax.servlet.http.HttpServletRequest; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.IOException; 16 | import java.math.BigInteger; 17 | import java.security.MessageDigest; 18 | import java.security.NoSuchAlgorithmException; 19 | import java.util.Map; 20 | import java.util.Set; 21 | 22 | /** 23 | * Created by lyc28724 on 2017/3/30. 24 | */ 25 | public abstract class WebUtils { 26 | 27 | /** 28 | * 模拟post请求方法,请求参数为map 29 | * 30 | * @param url 31 | * @param params 32 | */ 33 | public static String postByMapParameters(String url, Map params) { 34 | HttpClient httpClient = new HttpClient(); 35 | PostMethod postMethod = new PostMethod(url); 36 | Set keySet = params.keySet(); 37 | try { 38 | NameValuePair[] postData = new NameValuePair[keySet.size()]; 39 | int postDataIndex = 0; 40 | for (String key : keySet) { 41 | postData[postDataIndex++] = new NameValuePair(key, params.get(key)); 42 | } 43 | postMethod.getParams().setContentCharset(Constants.CHARSET_UTF8); 44 | postMethod.addParameters(postData); 45 | httpClient.executeMethod(postMethod); 46 | if (postMethod.getStatusCode() == HttpStatus.SC_OK) { 47 | String clientUri = new String(postMethod.getResponseBodyAsString()); 48 | return clientUri; 49 | } else { 50 | return null; 51 | } 52 | } catch (HttpException e) { 53 | e.printStackTrace(); 54 | } catch (IOException e) { 55 | e.printStackTrace(); 56 | } finally { 57 | postMethod.releaseConnection(); 58 | } 59 | return null; 60 | } 61 | 62 | /** 63 | * 模拟get请求方法 64 | * 65 | * @param url 66 | * @return 67 | */ 68 | public static String httpClientGet(String url) { 69 | HttpClient httpClient = new HttpClient(); 70 | GetMethod getMethod = new GetMethod(url); 71 | try { 72 | httpClient.executeMethod(getMethod); 73 | if (getMethod.getStatusCode() == HttpStatus.SC_OK) { 74 | String response = new String(getMethod.getResponseBodyAsString()); 75 | return response; 76 | } else { 77 | return null; 78 | } 79 | } catch (IOException e) { 80 | e.printStackTrace(); 81 | } finally { 82 | getMethod.releaseConnection(); 83 | } 84 | return null; 85 | } 86 | 87 | /** 88 | * 模拟post请求方法,请求参数为json 89 | * 90 | * @param url 91 | * @param params 92 | * @return 93 | */ 94 | public static String postByJsonParameters(String url, JSONObject params) { 95 | HttpClient httpClient = new HttpClient(); 96 | PostMethod postMethod = new PostMethod(url); 97 | Set keySet = params.keySet(); 98 | try { 99 | NameValuePair[] postData = new NameValuePair[keySet.size()]; 100 | int postDataIndex = 0; 101 | for (String key : keySet) { 102 | postData[postDataIndex++] = new NameValuePair(key, params.getString(key)); 103 | } 104 | postMethod.getParams().setContentCharset(Constants.CHARSET_UTF8); 105 | postMethod.addParameters(postData); 106 | httpClient.executeMethod(postMethod); 107 | if (postMethod.getStatusCode() == HttpStatus.SC_OK) { 108 | String response = new String(postMethod.getResponseBodyAsString()); 109 | return response; 110 | } else { 111 | return null; 112 | } 113 | } catch (HttpException e) { 114 | e.printStackTrace(); 115 | } catch (IOException e) { 116 | e.printStackTrace(); 117 | } finally { 118 | postMethod.releaseConnection(); 119 | } 120 | return null; 121 | } 122 | 123 | public static String postByJsonString(String url, String jsonParams) { 124 | HttpClient httpClient = new HttpClient(); 125 | PostMethod postMethod = new PostMethod(url); 126 | try { 127 | StringRequestEntity entity = new StringRequestEntity(jsonParams, "application/json", Constants.CHARSET_UTF8); 128 | postMethod.setRequestEntity(entity); 129 | httpClient.executeMethod(postMethod); 130 | if (postMethod.getStatusCode() == HttpStatus.SC_OK) { 131 | String response = new String(postMethod.getResponseBodyAsString()); 132 | return response; 133 | } else { 134 | return null; 135 | } 136 | } catch (HttpException e) { 137 | e.printStackTrace(); 138 | } catch (IOException e) { 139 | e.printStackTrace(); 140 | } finally { 141 | postMethod.releaseConnection(); 142 | } 143 | return null; 144 | } 145 | 146 | /** 147 | * 加密 148 | * 149 | * @param str 150 | * @param method 151 | * @return 152 | */ 153 | public static String encode(String str, String method) { 154 | MessageDigest md; 155 | String encodeStr = null; 156 | try { 157 | md = MessageDigest.getInstance(method); 158 | md.update(str.getBytes()); 159 | encodeStr = new BigInteger(1, md.digest()).toString(16); 160 | } catch (NoSuchAlgorithmException e) { 161 | e.printStackTrace(); 162 | } 163 | return encodeStr; 164 | } 165 | 166 | /** 167 | * 新增cookie 168 | * 169 | * @param response 170 | * @param name 171 | * @param value 172 | * @param path 173 | * @param maxAge 174 | */ 175 | public static void addCookie(HttpServletResponse response, String name, String value, String path, int maxAge) { 176 | Cookie cookie = new Cookie(name, value); 177 | cookie.setPath(path); 178 | cookie.setMaxAge(maxAge); 179 | response.addCookie(cookie); 180 | } 181 | 182 | /** 183 | * 根据cookie的名称获取cookie的值 184 | * 185 | * @param request 186 | * @param name 187 | * @return 188 | */ 189 | public static String getCookieValueByName(HttpServletRequest request, String name) { 190 | if (null != request.getCookies()) { 191 | for (Cookie cookie : request.getCookies()) { 192 | if (cookie.getName().equals(name)) { 193 | return cookie.getValue(); 194 | } 195 | } 196 | } 197 | return null; 198 | } 199 | 200 | /** 201 | * 根据cookie的名称获取cookie 202 | * 203 | * @param request 204 | * @param name 205 | * @return 206 | */ 207 | public static Cookie getCookieByName(HttpServletRequest request, String name) { 208 | if (null != request.getCookies()) { 209 | for (Cookie cookie : request.getCookies()) { 210 | if (cookie.getName().equals(name)) { 211 | return cookie; 212 | } 213 | } 214 | } 215 | return null; 216 | } 217 | 218 | /** 219 | * 根据名称清除cookie 220 | * 221 | * @param request 222 | * @param response 223 | * @param name 224 | * @param path 225 | */ 226 | public static void clearCookieByName(HttpServletRequest request, HttpServletResponse response, String name, String path) { 227 | if (null != request.getCookies()) { 228 | for (Cookie cookie : request.getCookies()) { 229 | if (cookie.getName().equals(name)) { 230 | cookie.setMaxAge(0); 231 | cookie.setPath(path); 232 | response.addCookie(cookie); 233 | return; 234 | } 235 | } 236 | } 237 | } 238 | 239 | /** 240 | * 清除cookie 241 | * 242 | * @param response 243 | * @param cookie 244 | * @param path 245 | */ 246 | public static void clearCookie(HttpServletResponse response, Cookie cookie, String path) { 247 | cookie.setMaxAge(0); 248 | cookie.setPath(path); 249 | response.addCookie(cookie); 250 | } 251 | } 252 | -------------------------------------------------------------------------------- /src/main/resources/application-dev.properties: -------------------------------------------------------------------------------- 1 | 2 | #通过state申请code地址 3 | stateApplyForCodeUri=/oauth/authorize 4 | 5 | #通过code申请token地址 6 | codeApplyForTokenUri=/oauth/token 7 | 8 | #获取用户信息地址 9 | getUserInfoByTokenUri=/oauth/rs/getuserinfo 10 | 11 | #SSO退出登录地址 12 | ssoLogoutUri=/oauth/logout 13 | 14 | #单点登录回调本系统地址 15 | applyTokenRedirectUri=http://localhost:8011/milestone/oauth/authorization_code_callback 16 | 17 | #客户端属性 18 | clientId=tcbase.milestone.local 19 | clientSecret=c0b3748cade747701c52d3809cc28196 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/main/resources/application-prod.properties: -------------------------------------------------------------------------------- 1 | 2 | #通过state申请code地址 3 | stateApplyForCodeUri=/oauth/authorize 4 | 5 | #通过code申请token地址 6 | codeApplyForTokenUri=/oauth/token 7 | 8 | #获取用户信息地址 9 | getUserInfoByTokenUri=/oauth/rs/getuserinfo 10 | 11 | #SSO退出登录地址 12 | ssoLogoutUri=/oauth/logout 13 | 14 | #单点登录回调本系统地址 15 | applyTokenRedirectUri=http://localhost:8011/milestone/oauth/authorization_code_callback 16 | 17 | #客户端属性 18 | clientId=tcbase.milestone 19 | clientSecret=46554dce9291023ad15dbcbd9ff496ac 20 | 21 | -------------------------------------------------------------------------------- /src/main/resources/application-qa.properties: -------------------------------------------------------------------------------- 1 | 2 | #通过state申请code地址 3 | stateApplyForCodeUri=/oauth/authorize 4 | 5 | #通过code申请token地址 6 | codeApplyForTokenUri=/oauth/token 7 | 8 | #获取用户信息地址 9 | getUserInfoByTokenUri=/oauth/rs/getuserinfo 10 | 11 | #SSO退出登录地址 12 | ssoLogoutUri=/oauth/logout 13 | 14 | #单点登录回调本系统地址 15 | applyTokenRedirectUri=http://localhost:8011/milestone/oauth/authorization_code_callback 16 | 17 | #客户端属性 18 | clientId=tcbase.milestone.local.qa 19 | clientSecret=16ab626c1df7a0f216011ba8df51ab78 20 | -------------------------------------------------------------------------------- /src/main/resources/application-qas.properties: -------------------------------------------------------------------------------- 1 | 2 | #通过state申请code地址 3 | stateApplyForCodeUri=m/oauth/authorize 4 | 5 | #通过code申请token地址 6 | codeApplyForTokenUri=/oauth/token 7 | 8 | #获取用户信息地址 9 | getUserInfoByTokenUri=/oauth/rs/getuserinfo 10 | 11 | #SSO退出登录地址 12 | ssoLogoutUri=/oauth/logout 13 | 14 | #单点登录回调本系统地址 15 | applyTokenRedirectUri=http://localhost:8011/milestone/oauth/authorization_code_callback 16 | 17 | #客户端属性 18 | clientId=tcbase.milestone.qas 19 | clientSecret=9a29fdfb357137a31972eb52b838460e 20 | -------------------------------------------------------------------------------- /src/main/resources/application-stage.properties: -------------------------------------------------------------------------------- 1 | 2 | #通过state申请code地址 3 | stateApplyForCodeUri=/oauth/authorize 4 | 5 | #通过code申请token地址 6 | codeApplyForTokenUri=/oauth/token 7 | 8 | #获取用户信息地址 9 | getUserInfoByTokenUri=/oauth/rs/getuserinfo 10 | 11 | #SSO退出登录地址 12 | ssoLogoutUri=/oauth/logout 13 | 14 | #单点登录回调本系统地址 15 | applyTokenRedirectUri=http://localhost:8011/milestone/oauth/authorization_code_callback 16 | 17 | #客户端属性 18 | clientId=tcbase.milestone.t 19 | clientSecret=8a1f055a9d61736811e33db92769bd90 20 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.thymeleaf.cache=false 2 | server.port=8011 3 | server.context-path=/milestone 4 | 5 | spring.datasource.url=jdbc:mysql://localhost:3306/tc_test?characterEncoding=utf8&useSSL=false 6 | spring.datasource.username=root 7 | spring.datasource.password=123456lyc 8 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 9 | 10 | #客户端属性 11 | grantType=authorization_code 12 | responseType=code 13 | scope=read 14 | 15 | cookieExpireTime=43200 16 | 17 | spring.profiles.active=@environment@ 18 | -------------------------------------------------------------------------------- /src/main/resources/log4j2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | rec_id, user_id, user_name, sex, address, create_time 18 | 19 | 20 | 21 | 22 | 23 | user_id like concat('%', #{condition.userId}, '%') 24 | 25 | 26 | and user_name like concat('%', #{condition.userName}, '%') 27 | 28 | 29 | and sex = #{condition.sex} 30 | 31 | 32 | and address like concat('%', #{condition.address}, '%') 33 | 34 | 35 | and create_time between #{condition.startTime} and #{condition.endTime} 36 | 37 | 38 | and is_valid = 1 39 | 40 | 41 | 42 | 47 | 48 | 53 | 54 | 60 | 61 | 66 | 67 | 68 | insert into user 69 | (user_id, user_name, sex, address) 70 | values(#{userId}, #{userName}, #{sex}, #{address}) 71 | 72 | 73 | 74 | update user 75 | set is_valid = 0 76 | where rec_id = #{recId} 77 | 78 | 79 | 84 | 85 | 86 | update user 87 | set user_id = #{userId}, user_name = #{userName}, sex = #{sex}, address = #{address} 88 | where rec_id = #{recId} 89 | 90 | -------------------------------------------------------------------------------- /src/main/resources/static/css/common.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: "Microsoft YaHei"; 3 | background-color: #f3f3f3; 4 | } 5 | h2 { 6 | margin: 50px auto; 7 | } 8 | h3 { 9 | margin: 20px auto; 10 | } 11 | a { 12 | text-decoration: none; 13 | color: #333; 14 | } -------------------------------------------------------------------------------- /src/main/resources/static/img/login-picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/img/login-picture.png -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/fontawesome-webfont.674f50d.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/fontawesome-webfont.674f50d.eot -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/fontawesome-webfont.af7ae50.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/fontawesome-webfont.af7ae50.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/fontawesome-webfont.b06871f.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/fontawesome-webfont.b06871f.ttf -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/fontawesome-webfont.fee66e7.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/fontawesome-webfont.fee66e7.woff -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/icomoon.0a74426.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/icomoon.0a74426.eot -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/icomoon.7d4ac7d.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/icomoon.7d4ac7d.woff -------------------------------------------------------------------------------- /src/main/resources/static/resources/fonts/icomoon.9f5fd7b.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/fonts/icomoon.9f5fd7b.ttf -------------------------------------------------------------------------------- /src/main/resources/static/resources/img/icomoon.f558046.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Generated by IcoMoon 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /src/main/resources/static/resources/img/loading.fa62483.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/img/loading.fa62483.gif -------------------------------------------------------------------------------- /src/main/resources/static/resources/img/login-picture.9ef0edd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dali-lyc/vue.js-springboot-demo/a8e3ee5600307b3f735f39fc1d6779467a29df7e/src/main/resources/static/resources/img/login-picture.9ef0edd.png -------------------------------------------------------------------------------- /src/main/resources/static/resources/js/0.189655bfb41f9a7e055c.js: -------------------------------------------------------------------------------- 1 | webpackJsonp([0],{931:function(e,t,n){n(935);var s=n(2)(n(933),n(936),null,null);e.exports=s.exports},933:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={name:"Lazy"}},934:function(e,t,n){t=e.exports=n(930)(),t.push([e.i,"","",{version:3,sources:[],names:[],mappings:"",file:"Lazy.vue",sourceRoot:""}])},935:function(e,t,n){var s=n(934);"string"==typeof s&&(s=[[e.i,s,""]]),s.locals&&(e.exports=s.locals);n(932)("357221c1",s,!0)},936:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement;e._self._c;return e._m(0)},staticRenderFns:[function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",[n("ul",{staticClass:"sf-crumbs"},[n("li",[e._v("懒加载的页面")])])])}]}}}); 2 | //# sourceMappingURL=0.189655bfb41f9a7e055c.js.map -------------------------------------------------------------------------------- /src/main/resources/static/resources/js/0.189655bfb41f9a7e055c.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"sources":["webpack:///resources/js/0.189655bfb41f9a7e055c.js","webpack:///./src/pages/Lazy.vue","webpack:///Lazy.vue","webpack:///./src/pages/Lazy.vue?bad2","webpack:///./src/pages/Lazy.vue?3849","webpack:///./src/pages/Lazy.vue?e022"],"names":["webpackJsonp","931","module","exports","__webpack_require__","Component","933","__webpack_exports__","Object","defineProperty","value","name","934","push","i","version","sources","names","mappings","file","sourceRoot","935","content","locals","936","render","_vm","this","_h","$createElement","_self","_c","_m","staticRenderFns","staticClass","_v"],"mappings":"AAAAA,cAAc,IAERC,IACA,SAAUC,EAAQC,EAASC,GCDjCA,EAAA,IAEA,IAAAC,GAAAD,EAAA,GAEAA,EAAA,KAEAA,EAAA,KAEA,KAEA,KAGAF,GAAAC,QAAAE,EAAAF,SDUMG,IACA,SAAUJ,EAAQK,EAAqBH,GAE7C,YACAI,QAAOC,eAAeF,EAAqB,cAAgBG,OAAO,IEpBlEH,EAAA,SFwBII,KEtBJ,SF2BMC,IACA,SAAUV,EAAQC,EAASC,GGvCjCD,EAAAD,EAAAC,QAAAC,EAAA,OAKAD,EAAAU,MAAAX,EAAAY,EAAA,OAAkCC,QAAA,EAAAC,WAAAC,SAAAC,SAAA,GAAAC,KAAA,WAAAC,WAAA,OHgD5BC,IACA,SAAUnB,EAAQC,EAASC,GInDjC,GAAAkB,GAAAlB,EAAA,IACA,iBAAAkB,SAAApB,EAAAY,EAAAQ,EAAA,MACAA,EAAAC,SAAArB,EAAAC,QAAAmB,EAAAC,OAEAnB,GAAA,gBAAAkB,GAAA,IJ4DME,IACA,SAAUtB,EAAQC,GKpExBD,EAAAC,SAAgBsB,OAAA,WAAmB,GAAAC,GAAAC,KAAaC,EAAAF,EAAAG,cAA0BH,GAAAI,MAAAC,EAC1E,OAAAL,GAAAM,GAAA,IACCC,iBAAA,WAA+B,GAAAP,GAAAC,KAAaC,EAAAF,EAAAG,eAA0BE,EAAAL,EAAAI,MAAAC,IAAAH,CACvE,OAAAG,GAAA,OAAAA,EAAA,MACAG,YAAA,cACGH,EAAA,MAAAL,EAAAS,GAAA","file":"resources/js/0.189655bfb41f9a7e055c.js","sourcesContent":["webpackJsonp([0],{\n\n/***/ 931:\n/***/ (function(module, exports, __webpack_require__) {\n\n\n/* styles */\n__webpack_require__(935)\n\nvar Component = __webpack_require__(2)(\n /* script */\n __webpack_require__(933),\n /* template */\n __webpack_require__(936),\n /* scopeId */\n null,\n /* cssModules */\n null\n)\n\nmodule.exports = Component.exports\n\n\n/***/ }),\n\n/***/ 933:\n/***/ (function(module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\nObject.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'Lazy'\n});\n\n/***/ }),\n\n/***/ 934:\n/***/ (function(module, exports, __webpack_require__) {\n\nexports = module.exports = __webpack_require__(930)();\n// imports\n\n\n// module\nexports.push([module.i, \"\", \"\", {\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\",\"file\":\"Lazy.vue\",\"sourceRoot\":\"\"}]);\n\n// exports\n\n\n/***/ }),\n\n/***/ 935:\n/***/ (function(module, exports, __webpack_require__) {\n\n// style-loader: Adds some css to the DOM by adding a \n\n\n\n// WEBPACK FOOTER //\n// Lazy.vue?4daba716","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \"\", \"\", {\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\",\"file\":\"Lazy.vue\",\"sourceRoot\":\"\"}]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/css-loader?{\"minimize\":true,\"sourceMap\":true}!./~/vue-loader/lib/style-compiler?{\"id\":\"data-v-675f5e00\",\"scoped\":false,\"hasInlineConfig\":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/pages/Lazy.vue\n// module id = 934\n// module chunks = 0","// style-loader: Adds some css to the DOM by adding a \n\n\n\n// WEBPACK FOOTER //\n// Lazy.vue?4daba716","exports = module.exports = require(\"../../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \"\", \"\", {\"version\":3,\"sources\":[],\"names\":[],\"mappings\":\"\",\"file\":\"Lazy.vue\",\"sourceRoot\":\"\"}]);\n\n// exports\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./~/css-loader?{\"minimize\":true,\"sourceMap\":true}!./~/vue-loader/lib/style-compiler?{\"id\":\"data-v-675f5e00\",\"scoped\":false,\"hasInlineConfig\":false}!./~/vue-loader/lib/selector.js?type=styles&index=0!./src/pages/Lazy.vue\n// module id = 936\n// module chunks = 0","// style-loader: Adds some css to the DOM by adding a