Compare commits

..

No commits in common. 'main' and 'branch_JH' have entirely different histories.

@ -1,16 +1,31 @@
// test
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.annotation;
package com.hyc.wechat.controller.annotation; // 定义注解所在的包名
import java.lang.annotation.*;
import java.lang.annotation.*; // 导入Java标准注解库
// 定义一个名为ControllerConfig的注解
@Retention(value = RetentionPolicy.RUNTIME) // 指定注解的生命周期RUNTIME表示注解将被保留到运行时可以通过反射读取
@Target(value = ElementType.TYPE) // 指定注解可以应用的目标类型TYPE表示注解可以用于类、接口或枚举声明
public @interface ControllerConfig { // 使用@interface关键字定义注解
// 定义一个名为path的属性方法默认值为空字符串
// 该属性用于配置控制器类的路径
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description ActionProviderurl
* @date 2019-05-02 11:28
*/
@Documented
@Retention(value = RetentionPolicy.RUNTIME)
@Target(value = ElementType.TYPE)
public @interface ControllerConfig {
String path() default "";
}

@ -1,11 +1,31 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.constant;
// 定义一个名为ControllerMessage的枚举类用于存储控制器相关的消息常量
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @date 2019-05-03 13:11
*/
public enum ControllerMessage {
/**
*
*/
//枚举常量,表示用户当前处于游客身份
YOU_ARE_VISITOR("您现在处于游客身份,该服务并未对游客开放,如需使用请先注册一个账号"),
/*
@ -16,24 +36,21 @@ public enum ControllerMessage {
/**
*
*/
// 枚举常量,用于分隔不同类型的消息常量,系统错误码部分
SYSTEM_EXECEPTION("服务器发生了严重异常,无法提供服务"),
/**
*
*/
//// 枚举常量,表示请求参数错误
REQUEST_INVALID("您的请求参数不足或错误,系统无法处理您的请求");
// 枚举成员变量,用于存储消息文本
public String message;
// 枚举的构造方法,用于在创建枚举实例时初始化成员变量
ControllerMessage(String message) {
this.message = message;
}
// 公共方法,用于获取枚举实例中存储的消息文本
public String getMessage() {
return message;
}
// 私有方法,用于设置枚举实例中的消息文本
private void setMessage(String message) {
this.message = message;
}

@ -1,5 +1,30 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.constant;
/**
* requestmethod
*
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program XHotel
* @description
* @date 2019-04-18 12:45
*/
public enum RequestMethod {
/**

@ -1,8 +1,32 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.constant;
// 定义一个名为WebPage的枚举类用于表示不同的网页路径
/**
*
*
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program XHotel
* @description
* @date 2019-04-18 12:48
*/
public enum WebPage {
/**
*
*/
@ -45,8 +69,6 @@ public enum WebPage {
PICTRUES_JSP;
@Override
// 重写toString方法以提供枚举常量的字符串表示形式
// 将枚举名称转换为小写,并用点号替换下划线,以符合网页文件的命名习惯
public String toString() {
return "/"+super.toString().toLowerCase().replaceAll("_", ".");
}

@ -1,73 +1,87 @@
package com.hyc.wechat.controller.impl.filter; // 定义过滤器所在的包名
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.hyc.wechat.controller.constant.ControllerMessage; // 导入控制器消息常量类
import com.hyc.wechat.controller.constant.WebPage; // 导入网页常量类
import org.apache.log4j.Logger; // 导入log4j日志记录器
package com.hyc.wechat.controller.impl.filter;
import javax.servlet.*; // 导入Servlet API
import javax.servlet.annotation.WebFilter; // 导入WebFilter注解
import javax.servlet.annotation.WebInitParam; // 导入WebInitParam注解
import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest类
import javax.servlet.http.HttpServletResponse; // 导入HttpServletResponse类
import java.io.IOException; // 导入IOException类
import com.hyc.wechat.controller.constant.ControllerMessage;
import com.hyc.wechat.controller.constant.WebPage;
import org.apache.log4j.Logger;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-02 22:56
*/
// 使用@WebFilter注解定义一个名为"EncodingFilter"的过滤器
// 过滤器将作用于所有的URL模式"/*"
// 并且具有一个初始化参数"ENCODING",其值为"UTF-8"
@WebFilter(
filterName = "EncodingFilter",
urlPatterns = {"/*"},
urlPatterns = {"/*"}, servletNames = {"/*"},
initParams = {
@WebInitParam(name = "ENCODING", value = "UTF-8")
}
)
public class EncodingFilter implements Filter { // 实现Filter接口
public class EncodingFilter implements Filter {
private String ENCODING = null; // 用于存储字符编码的成员变量
private String ENCODING = null;
@Override
public void init(FilterConfig config) { // 过滤器初始化方法
// 从FilterConfig获取初始化参数"ENCODING"
public void init(FilterConfig config) {
this.ENCODING = config.getInitParameter("ENCODING");
}
@Override
public void destroy() { // 过滤器销毁方法
// 在此可以释放资源,但本例中无需实现
public void destroy() {
}
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) {
// 类型转换以便使用HttpServletRequest和HttpServletResponse的方法
HttpServletRequest req = (HttpServletRequest) servletRequest;
HttpServletResponse resp = (HttpServletResponse) servletResponse;
try {
// 设置请求和响应的字符编码
req.setCharacterEncoding(ENCODING);
resp.setContentType("text/html;charset=utf-8");
resp.setCharacterEncoding(ENCODING);
// 设置CORS相关响应头允许跨域请求
resp.addHeader("Access-Control-Allow-Origin", "*");
resp.addHeader("Access-Control-Allow-Headers",
"origin, content-type, accept, x-requested-with, sid, mycustom, smuser");
resp.addHeader("Access-Control-Allow-Methods", "*");
resp.addHeader("Access-Control-Max-Age", "100");
resp.addHeader("Access-Control-Allow-Credentials", "false");
// 继续执行过滤链中的下一个过滤器或Servlet
filterChain.doFilter(servletRequest, servletResponse);
} catch (IOException | ServletException e) {
e.printStackTrace(); // 打印异常堆栈信息
e.printStackTrace();
try {
// 设置请求属性,传递系统异常信息
req.setAttribute("message", ControllerMessage.SYSTEM_EXECEPTION.message);
// 转发请求到错误页面
req.getRequestDispatcher(WebPage.ERROR_JSP.toString()).forward(req, resp);
} catch (ServletException | IOException ex) {
ex.printStackTrace(); // 打印转发过程中可能出现的异常堆栈信息
ex.printStackTrace();
}
}
// 获取日志记录器并记录请求信息
Logger logger = Logger.getLogger(EncodingFilter.class);
logger.info("[请求url] : " + req.getRequestURI() + " [请求参数] " + req.getQueryString());
}
}

@ -1,80 +1,100 @@
// 导入必要的库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.impl.filter;
import com.hyc.wechat.controller.constant.ControllerMessage; // 导入控制器消息常量类
import com.hyc.wechat.controller.constant.RequestMethod; // 导入请求方法常量类
import com.hyc.wechat.controller.constant.WebPage; // 导入网页常量类
import com.hyc.wechat.model.dto.ServiceResult; // 导入服务结果数据传输对象
import com.hyc.wechat.model.po.User; // 导入用户持久化对象
import com.hyc.wechat.provider.UserProvider; // 导入用户提供者类
import com.hyc.wechat.service.constants.Status; // 导入状态常量类
import com.hyc.wechat.service.impl.UserServiceImpl; // 导入用户服务实现类
import com.hyc.wechat.controller.constant.ControllerMessage;
import com.hyc.wechat.controller.constant.RequestMethod;
import com.hyc.wechat.controller.constant.WebPage;
import com.hyc.wechat.model.dto.ServiceResult;
import com.hyc.wechat.model.po.User;
import com.hyc.wechat.provider.UserProvider;
import com.hyc.wechat.service.constants.Status;
import com.hyc.wechat.service.impl.UserServiceImpl;
import javax.servlet.*; // 导入Servlet API
import javax.servlet.annotation.WebFilter; // 导入WebFilter注解
import javax.servlet.annotation.WebInitParam; // 导入WebInitParam注解
import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest类
import javax.servlet.http.HttpServletResponse; // 导入HttpServletResponse类
import javax.servlet.http.HttpSession; // 导入HttpSession类
import java.io.IOException; // 导入IOException类
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.annotation.WebInitParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import static com.hyc.wechat.util.ControllerUtils.returnJsonObject; // 导入返回JSON对象的工具方法
import static com.hyc.wechat.util.ControllerUtils.returnJsonObject;
// 使用@WebFilter注解定义一个名为"LoginFilter"的过滤器
// 过滤器将作用于所有的URL模式"/*"
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-09 15:41
*/
@WebFilter(
filterName = "LoginFilter",
urlPatterns = {"/*"},
urlPatterns = {"/*"}, servletNames = {"/*"},
initParams = {
@WebInitParam(name = "ENCODING", value = "UTF-8")
})
public class LoginFilter implements Filter { // 实现Filter接口
public class LoginFilter implements Filter {
private final UserProvider userProvider = new UserProvider(); // 创建用户提供者实例
private final UserProvider userProvider = new UserProvider();
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest req = (HttpServletRequest) servletRequest; // 类型转换
HttpServletResponse resp = (HttpServletResponse) servletResponse; // 类型转换
String method = req.getParameter("method"); // 获取请求方法参数
String uri = req.getRequestURI(); // 获取请求URI
String contextPath = req.getContextPath(); // 获取上下文路径
String path = uri.substring(contextPath.length()); // 获取请求路径
HttpSession sess = req.getSession(false); // 获取当前会话如果不存在则返回null
HttpServletRequest req = (HttpServletRequest) servletRequest;
HttpServletResponse resp = (HttpServletResponse) servletResponse;
String method = req.getParameter("method");
String uri = req.getRequestURI();
String contextPath = req.getContextPath();
String path = uri.substring(contextPath.length());
HttpSession sess = req.getSession(false);
// 尝试自动登录
//尝试自动登陆
userProvider.autoLogin(req);
sess = req.getSession(); // 获取或创建会话
// 放行登录和注册相关请求
sess=req.getSession();
//放行登陆注册
if (sess == null || sess.getAttribute("login") == null) {
if (WebPage.LOGIN_JSP.toString().equalsIgnoreCase(path) || // 登录页面
WebPage.REGISTER_JSP.toString().equalsIgnoreCase(path) || // 注册页面
RequestMethod.LOGIN_DO.toString().equalsIgnoreCase(method) || // 登录操作
RequestMethod.REGISTER_DO.toString().equalsIgnoreCase(method) || // 注册操作
path.endsWith("logo.png") || path.endsWith(".js") || path.endsWith("agreement.html")) { // 资源文件
filterChain.doFilter(req, resp); // 继续执行过滤链
if (WebPage.LOGIN_JSP.toString().equalsIgnoreCase(path) ||
(WebPage.REGISTER_JSP.toString()).equalsIgnoreCase(path) ||
(RequestMethod.LOGIN_DO.toString()).equalsIgnoreCase(method) ||
(RequestMethod.REGISTER_DO.toString()).equalsIgnoreCase(method) ||
path.endsWith("logo.png") || path.endsWith(".js") || path.endsWith("agreement.html")) {
filterChain.doFilter(req, resp);
return;
} else {
// 检查会话是否有'login'属性,没有则重定向到登录界面
//检查session是否有'login'属性,没有则重定向到登陆界面
if (sess == null || sess.getAttribute("login") == null) {
req.getRequestDispatcher(WebPage.LOGIN_JSP.toString()).forward(req, resp); // 转发到登录页面
req.getRequestDispatcher(WebPage.LOGIN_JSP.toString()).forward(req, resp);
return;
}
}
} else {
// 已登录用户检查登录身份
}else {
//已登陆用户检查登陆身份
if (path.startsWith("/wechat/moment") || path.startsWith("/wechat/friend")) {
// 检查登录身份
User user = (User) sess.getAttribute("login"); // 获取登录用户信息
//检查登陆身份
User user = (User) sess.getAttribute("login");
if (user != null && UserServiceImpl.VISITOR_EMAIL.equals(user.getEmail())) {
// 游客不可使用
returnJsonObject(resp, new ServiceResult(Status.ERROR, ControllerMessage.YOU_ARE_VISITOR.message, null)); // 返回错误信息
//游客不可使用
returnJsonObject(resp, new ServiceResult(Status.ERROR, ControllerMessage.YOU_ARE_VISITOR.message, null));
return;
}
}
}
filterChain.doFilter(req, resp); // 继续执行过滤链
filterChain.doFilter(req, resp);
}
}

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.impl.listener;
@ -10,20 +25,18 @@ import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* ServletWebWeb
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description servlet
* @date 2019-05-01 0844
*/
@WebListener
public class ServletContextListener implements javax.servlet.ServletContextListener {
/**
* 使ConcurrentHashMap线
*/
private static final ConcurrentHashMap<String, Provider> providerMap = new ConcurrentHashMap<>();
/**
* Servlet
* @param sce Servlet
*/
@Override
public void contextInitialized(ServletContextEvent sce) {

@ -1,65 +1,90 @@
// 导入必要的库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.controller.impl.servlet;
import com.hyc.wechat.controller.annotation.ControllerConfig; // 导入自定义的ControllerConfig注解
import com.hyc.wechat.controller.constant.ControllerMessage; // 导入控制器消息常量类
import com.hyc.wechat.provider.Provider; // 导入Provider接口
import com.hyc.wechat.util.ControllerUtils; // 导入控制器工具类
import org.apache.log4j.Logger; // 导入log4j日志记录器
import com.hyc.wechat.controller.annotation.ControllerConfig;
import com.hyc.wechat.controller.constant.ControllerMessage;
import com.hyc.wechat.provider.Provider;
import com.hyc.wechat.util.ControllerUtils;
import org.apache.log4j.Logger;
import javax.servlet.annotation.MultipartConfig; // 导入MultipartConfig注解
import javax.servlet.annotation.WebServlet; // 导入WebServlet注解
import javax.servlet.http.HttpServlet; // 导入HttpServlet类
import javax.servlet.http.HttpServletRequest; // 导入HttpServletRequest类
import javax.servlet.http.HttpServletResponse; // 导入HttpServletResponse类
import java.io.IOException; // 导入IOException类
import java.util.Map; // 导入Map接口
import java.util.Set; // 导入Set接口
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import static com.hyc.wechat.provider.Provider.toErrorPage; // 导入Provider类的静态方法toErrorPage
import static com.hyc.wechat.provider.Provider.toErrorPage;
// 使用@MultipartConfig注解配置文件上传的临时存储位置
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description controller
* @date 2019-05-02 03:28
*/
@MultipartConfig(location = "/home/pan/tomcat/webapps/wechat/upload")
//@MultipartConfig(location = "C:\\Users\\Misterchaos\\Documents\\Java Develop Workplaces\\IDEA workspace\\wechat\\out\\artifacts\\wechat_war_exploded\\upload")
@WebServlet("/wechat/*") // 使用@WebServlet注解映射@WebServlet到/wechat/*路径
@WebServlet("/wechat/*")
public class MyServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
this.doPost(req, resp); // 将GET请求转发到doPost方法处理
this.doPost(req, resp);
}
/**
* urlProvider
*
* @param req
* @param resp
* @param req
* @param resp
* @name doPost
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
Map<String, Provider> providerMap = (Map<String, Provider>) getServletContext().getAttribute("providerMap"); // 从ServletContext获取Provider映射
String url = req.getRequestURI(); // 获取请求的URI
Set<String> keys = providerMap.keySet(); // 获取Provider映射的键集合
Logger logger = Logger.getLogger(MyServlet.class); // 获取日志记录器
logger.info("[请求url:] " + url + " [匹配provider]: " + url.substring(14)); // 记录请求的URL和尝试匹配的Provider
boolean isMatch = false; // 标记是否找到匹配的Provider
for (String key : keys) { // 遍历Provider映射的键集合
// 解析注解中的path信息匹配ActionProvider
String path = providerMap.get(key).getPath(); // 获取Provider的路径
if (url.substring(14).equalsIgnoreCase(path)) { // 检查请求的路径是否与Provider的路径匹配
providerMap.get(key).doAction(req, resp); // 执行匹配的Provider的doAction方法
logger.info("provider 分发完毕"); // 记录Provider分发完成
isMatch = true; // 设置匹配标志为true
Map<String, Provider>providerMap = (Map<String, Provider>) getServletContext().getAttribute("providerMap");
String url = req.getRequestURI();
Set<String> keys = providerMap.keySet();
Logger logger = Logger.getLogger(MyServlet.class);
logger.info("[请求url:]"+url+"[匹配provider]:"+url.substring(14));
boolean isMatch=false;
for (String key : keys) {
//解析注解中的path信息匹配ActionProvider
String path =providerMap.get(key).getPath();
if (url.substring(14).equalsIgnoreCase(path)) {
providerMap.get(key).doAction(req, resp);
logger.info("provider 分发完毕");
isMatch=true;
}
}
if (!isMatch) { // 如果没有找到匹配的Provider
toErrorPage(ControllerMessage.REQUEST_INVALID.message, req, resp); // 转发到错误页面
logger.info("该请求没有匹配provider: " + url.substring(14)); // 记录没有匹配的Provider
return; // 结束方法执行
if(!isMatch){
toErrorPage(ControllerMessage.REQUEST_INVALID.message,req,resp);
logger.info("该请求没有匹配provider :"+url.substring(14));
return;
}
// logger.info("响应结果 "+resp.getOutputStream()); // 这行代码被注释掉了,可能是为了调试目的
// logger.info("响应结果 "+resp.getOutputStream());
}
}

@ -1,11 +1,28 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
import com.hyc.wechat.dao.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Dao
* @date 2019-05-01 17:11
*/
public interface BaseDao {
@ -24,6 +41,8 @@ public interface BaseDao {
* @param obj
* @name insert
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Insert()
int insert(Object obj);
@ -37,6 +56,8 @@ public interface BaseDao {
* @name update
* @notice null<br>
* null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Update()
int update(Object obj);
@ -47,6 +68,8 @@ public interface BaseDao {
* @param obj
* @name delete
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Delete()
int delete(Object obj);

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -9,7 +24,9 @@ import com.hyc.wechat.model.po.Chat;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description CRUD
* @date 2019-05-03 02:18
*/
public interface ChatDao extends BaseDao {
@ -23,6 +40,8 @@ public interface ChatDao extends BaseDao {
* @return
* @name getChatById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = Chat.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")
@ -35,6 +54,8 @@ public interface ChatDao extends BaseDao {
* @return
* @name listByUserId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/3
*/
@Result(entity = Chat.class, returns = ResultType.LIST)
@Query(value = "select c.id,c.number,c.owner_id,c.name,c.type,c.member,c.photo,c.status,c.gmt_create,c.gmt_modified " +
@ -51,6 +72,8 @@ public interface ChatDao extends BaseDao {
* @return
* @name toFriendChat
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/5
*/
@Result(entity = Chat.class, returns = ResultType.OBJECT)
@Query(value = "select c.id,c.number,c.owner_id,u.name as name,c.member,u.photo as photo,c.type,c.status,c.gmt_create,c.gmt_modified " +
@ -65,6 +88,8 @@ public interface ChatDao extends BaseDao {
* @return
* @name getByChatNumber
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/6
*/
@Result(entity = Chat.class,returns = ResultType.OBJECT)
@Query(value = "select "+ALL_FIELD+" from "+TABLE+" where number = ? ")

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -6,8 +21,10 @@ import com.hyc.wechat.exception.DaoException;
import java.sql.Connection;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Dao
* @date 2019-05-01 16:33
*/
public interface DataSource {
/**
@ -17,6 +34,8 @@ public interface DataSource {
* @throws DaoException
* @name getConnection
* @notice
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
Connection getConnection() throws DaoException;
@ -26,6 +45,8 @@ public interface DataSource {
*
* @param conn
* @name freeConnection
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
void freeConnection(Connection conn);
@ -35,6 +56,8 @@ public interface DataSource {
* @param conn
* @return java.sql.Connection
* @name createConnection
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
void destroyConnection(Connection conn);
@ -44,6 +67,8 @@ public interface DataSource {
*
* @return int
* @name getCurrentCount
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
int getCurrentCount();
@ -52,6 +77,8 @@ public interface DataSource {
*
* @return int
* @name getfreeCount
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
int getfreeCount();
}

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -11,8 +26,10 @@ import java.math.BigInteger;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description CRUD
* @date 2019-05-02 01:59
*/
public interface FriendDao extends BaseDao {
@ -27,6 +44,8 @@ public interface FriendDao extends BaseDao {
* @return
* @name getFriendByUIDAndFriendId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/6
*/
@Result(entity = Friend.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where user_id = ? and friend_id = ? ")
@ -40,6 +59,8 @@ public interface FriendDao extends BaseDao {
* @return
* @name listByUserId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/6
*/
@Result(entity = Friend.class, returns = ResultType.LIST)
@Query(value = "select f.id,f.user_id,f.friend_id,f.chat_id,f.group_id,f.alias,f.description,u.photo as photo,f.status,f.gmt_create,f.gmt_modified " +
@ -53,6 +74,8 @@ public interface FriendDao extends BaseDao {
* @param id id
* @name getFriendById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Friend.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -10,7 +25,9 @@ import java.math.BigInteger;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description user_chatCRUD
* @date 2019-05-03 13:05
*/
public interface MemberDao extends BaseDao {
String TABLE = "member";
@ -23,6 +40,8 @@ public interface MemberDao extends BaseDao {
* @return
* @name getMemberById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = Member.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")
@ -36,6 +55,8 @@ public interface MemberDao extends BaseDao {
* @return
* @name getMemberByUIdAndChatId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = Member.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where user_id = ? and chat_id = ? ")
@ -48,6 +69,8 @@ public interface MemberDao extends BaseDao {
* @param chatId id
* @return
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/5
*/
@Result(entity = Member.class, returns = ResultType.LIST)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where chat_id = ? ")

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -10,7 +25,9 @@ import java.math.BigInteger;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description messageCRUD
* @date 2019-05-03 13:06
*/
public interface MessageDao extends BaseDao {
@ -26,6 +43,8 @@ public interface MessageDao extends BaseDao {
* @param chatId id
* @return
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = Message.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where sender_id = ? and chat_id = ? and time = ? ")
@ -41,6 +60,8 @@ public interface MessageDao extends BaseDao {
* @param offset
* @name listMessageByUserIdAndChatId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Message.class, returns = ResultType.LIST)
@Query(value = "select m.id, m.sender_id, m.chat_id, m.content , m.type , m.time ,m.status , " +
@ -58,6 +79,8 @@ public interface MessageDao extends BaseDao {
* @param offset
* @name listMessageByUserIdAndChatId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Message.class, returns = ResultType.LIST)
@Query(value = "select m.id, m.sender_id, m.chat_id, m.content , m.type , m.time ,m.status , " +
@ -73,6 +96,8 @@ public interface MessageDao extends BaseDao {
* @param chatId id
* @param fileName
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Message.class, returns = ResultType.LIST)
@Query(value = "select m.id, m.sender_id, m.chat_id, m.content , m.type , m.time ,m.status , " +
@ -89,6 +114,8 @@ public interface MessageDao extends BaseDao {
* @param limit
* @param offset
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Message.class, returns = ResultType.LIST)
@Query(value = "select m.id, m.sender_id, m.chat_id, m.content , m.type , m.time ,m.status , " +
@ -104,6 +131,8 @@ public interface MessageDao extends BaseDao {
* @param limit
* @param offset
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Message.class, returns = ResultType.LIST)
@Query(value = "select m.id, m.sender_id, m.chat_id, m.content , m.type , m.time ,m.status , " +

@ -25,7 +25,9 @@ import com.hyc.wechat.model.po.Moment;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description CRUD
* @date 2019-05-07 11:55
*/
public interface MomentDao extends BaseDao {
String TABLE = "moment";
@ -37,6 +39,8 @@ public interface MomentDao extends BaseDao {
* @param id id
* @name geMomentById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = Moment.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")
@ -48,6 +52,8 @@ public interface MomentDao extends BaseDao {
* @param ownerId id
* @param stauts
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/8
*/
@Result(entity = Moment.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where owner_id = ? and status = ? ")
@ -62,6 +68,8 @@ public interface MomentDao extends BaseDao {
* @param offset
* @name listMyMomentByOwnerIdDesc
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Moment.class, returns = ResultType.LIST)
@Query("select " + ALL_FIELD + " from " + TABLE + " where owner_id = ? order by time desc limit ? offset ? ")
@ -75,6 +83,8 @@ public interface MomentDao extends BaseDao {
* @param offset
* @name listMyMomentByOwnerId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = Moment.class, returns = ResultType.LIST)
@Query("select " + ALL_FIELD + " from " + TABLE + " where owner_id = ? order by time limit ? offset ? ")
@ -89,6 +99,8 @@ public interface MomentDao extends BaseDao {
* @param offset
* @name loadPhoto
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/10
*/
@Result(entity = Moment.class, returns = ResultType.LIST)
@Query("select photo from " + TABLE + " where owner_id = ? order by time desc limit ? offset ? ")

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -9,7 +24,9 @@ import com.hyc.wechat.model.po.News;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description CRUD
* @date 2019-05-07 18:47
*/
public interface NewsDao extends BaseDao {
String TABLE = "news";
@ -23,6 +40,8 @@ public interface NewsDao extends BaseDao {
* @param offset
* @name listNewsByUserId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = News.class, returns = ResultType.LIST)
@Query("select " + ALL_FIELD + " from " + TABLE + " where user_id = ? order by gmt_create desc limit ? offset ? ")
@ -36,6 +55,8 @@ public interface NewsDao extends BaseDao {
* @param userId id
* @name getNewsByMomentId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Result(entity = News.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where moment_id = ? and user_id = ? ")

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -5,7 +20,9 @@ import com.hyc.wechat.dao.annotation.Delete;
import com.hyc.wechat.dao.annotation.Update;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description CRUD
* @date 2019-05-06 21:41
*/
public interface RecordDao extends BaseDao {
String TABLE = "record";
@ -20,6 +37,8 @@ public interface RecordDao extends BaseDao {
* @param chatId id
* @name updateStatusInChat
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Update("update " + TABLE + " as r inner join message as m set r.status = ? where r.user_id = ? and r.message_id = m.id and m.chat_id = ?")
void updateStatusInChat(Object status, Object userId ,Object chatId);
@ -32,6 +51,8 @@ public interface RecordDao extends BaseDao {
* @param chatId id
* @name deleteAllRecordInChat
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/10
*/
@Update("delete r from " + TABLE + " r inner join message m on r.message_id = m.id where r.user_id = ? and m.chat_id = ? " )
void deleteAllRecordInChat(Object userId , Object chatId);

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -10,7 +25,9 @@ import com.hyc.wechat.model.po.Remark;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @date 2019-05-14 01:12
*/
public interface RemarkDao extends BaseDao{
String TABLE = "remark";
@ -24,6 +41,8 @@ public interface RemarkDao extends BaseDao{
* @param offset
* @name listRemarkDesc
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/14
*/
@Result(entity = Remark.class, returns = ResultType.LIST)
@Query("select " + ALL_FIELD + " from " + TABLE + " where moment_id = ? order by time limit ? offset ? ")
@ -35,6 +54,8 @@ public interface RemarkDao extends BaseDao{
* @param id id
* @name geRemarkById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/14
*/
@Result(entity = Remark.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")

@ -1,8 +1,25 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @date 2019-05-14 01:12
*/
public interface ReplyDao extends BaseDao {
}

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
@ -5,8 +20,10 @@ package com.hyc.wechat.dao;
import java.sql.ResultSet;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program XHotel
* @description
* @date 2019-04-09 15:06
*/
public interface ResultMapper {
/**
@ -15,6 +32,8 @@ public interface ResultMapper {
* @param rs
* @return java.lang.Object
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
Object doMap(ResultSet rs);
}

@ -1,9 +1,26 @@
//t
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program XHotel
* @description sql
* @date 2019-04-11 17:55
*/
public interface SQLMapper {
@ -15,6 +32,8 @@ public interface SQLMapper {
* @return sql
* @name doMap
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/12
*/
String doMap(Object... params);

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
import com.hyc.wechat.dao.annotation.Insert;
@ -6,8 +21,10 @@ import com.hyc.wechat.dao.annotation.Insert;
import java.util.LinkedList;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description SQL
* @date 2019-05-01 17:34
*/
public interface SQLRunner {
@ -31,6 +48,8 @@ public interface SQLRunner {
* @return java.lang.Object
* @name executeUpdate
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
int executeUpdate(String sql, Object[] params);
@ -44,6 +63,8 @@ public interface SQLRunner {
* @return int sql
* @name executeUpdate
* @notice SqlMapper
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
* @see SQLMapper
*/
int executeUpdate(Object obj, SQLMapper sqlMapper);
@ -55,6 +76,8 @@ public interface SQLRunner {
* @return int
* @name insert
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
@Insert()
int insert(Object obj, String table);
@ -67,6 +90,8 @@ public interface SQLRunner {
* @name update
* @notice null<br>
* null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
int update(Object obj, String table);
@ -77,6 +102,8 @@ public interface SQLRunner {
* @return int
* @name delete
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
int delete(Object id, String table);
@ -98,6 +125,8 @@ public interface SQLRunner {
* @return java.lang.Object
* @name executeQuery
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
Object executeQuery(String sql, Object[] params, ResultMapper mapper);
@ -116,6 +145,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryList
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
LinkedList queryList(String sql, Object[] params, Class clazz);
@ -129,6 +160,8 @@ public interface SQLRunner {
* @return Object
* @name queryList
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
Object queryObject(String sql, Object[] params, Class clazz);
@ -140,6 +173,8 @@ public interface SQLRunner {
* @return
* @name queryValue
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/11
*/
Object queryValue(String sql, Object[] params);
@ -166,6 +201,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryOrderBy
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryOrderBy(String[] selectFields, String orderBy, boolean isDesc, String tableName);
@ -197,6 +234,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryWhere
* @notice not
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryWhere(String[] selectFields, Object obj, String conj, String condition);
@ -212,6 +251,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryWhereAndEquals
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryWhereAndEquals(String[] selectFields, Object obj);
@ -228,6 +269,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryWhereLikeAnd
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryWhereLikeAnd(String[] selectFields, Object obj);
@ -243,6 +286,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryWhereLikeAnd
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryWhereLikeOr(String[] selectFields, Object obj);
@ -262,6 +307,8 @@ public interface SQLRunner {
* @return java.util.LinkedList
* @name queryPages
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
LinkedList queryPages(String[] selectFields, String tableName, String limit, String offset);
@ -279,6 +326,8 @@ public interface SQLRunner {
* @param fieldValues
* @name fieldMapper
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
void fieldMapper(Object obj, LinkedList fieldNames, LinkedList fieldValues);
@ -290,6 +339,8 @@ public interface SQLRunner {
* @return java.lang.String
* @name selectMapper
* @notice
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String selectMapper(String tableName, Object[] selectFields);
@ -301,6 +352,8 @@ public interface SQLRunner {
* @return java.lang.String where,where id = ? and user_name = ?
* @name whereMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String whereMapper(Object[] whereFields, String conj, String condition);
@ -312,6 +365,8 @@ public interface SQLRunner {
* @return java.lang.String where,where id like ? and user_name like ?
* @name likeMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String likeMapper(Object[] likeFields, String conj);
@ -323,6 +378,8 @@ public interface SQLRunner {
* @return java.lang.String
* @name orderByMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String orderByMapper(String orderBy, boolean isDesc);
@ -334,6 +391,8 @@ public interface SQLRunner {
* @return java.lang.String
* @name pageMapper
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String pageMapper(String limit, String offset);
@ -346,6 +405,8 @@ public interface SQLRunner {
* @return java.lang.String
* @name pageMapper
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
String pageOffsetMapper(String offset);

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao;
import com.hyc.wechat.dao.annotation.Query;
@ -9,8 +24,10 @@ import com.hyc.wechat.model.po.User;
import java.util.List;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description UserCRUD
* @date 2019-05-01 23:39
*/
public interface UserDao extends BaseDao {
String TABLE = "user";
@ -25,6 +42,8 @@ public interface UserDao extends BaseDao {
* @return
* @name getUserById
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = User.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where id = ? ")
@ -38,6 +57,8 @@ public interface UserDao extends BaseDao {
* @return
* @name getUserByEmail
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = User.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where email = ? ")
@ -51,6 +72,8 @@ public interface UserDao extends BaseDao {
* @return
* @name getUserByWechatId
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/2
*/
@Result(entity = User.class, returns = ResultType.OBJECT)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where wechat_id = ? ")
@ -61,6 +84,8 @@ public interface UserDao extends BaseDao {
* @return
* @name listByName
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/5
*/
@Result(entity = User.class, returns = ResultType.LIST)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where name = ?")
@ -74,6 +99,8 @@ public interface UserDao extends BaseDao {
* @return
* @name listLike
* @notice
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/6
*/
@Result(entity = User.class, returns = ResultType.LIST)
@Query(value = "select " + ALL_FIELD + " from " + TABLE + " where name like ? ")

@ -1,25 +1,32 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Delete {
/**
* value
* SQL
*
* @return SQL
*/
String value()default "";
}

@ -1,19 +1,32 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description SQL
* @program wechat
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Field {
/* name
*
* @return
*/
String name ();
}

@ -1,22 +1,32 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Insert {
/**
* value
* SQL
*
* @return SQL
*/
String value()default "";
}

@ -1,11 +1,28 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description SQL
* @program wechat
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

@ -1,11 +1,28 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
@ -6,8 +21,10 @@ import com.hyc.wechat.model.po.abs.BaseEntity;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description SQL
* @program wechat
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

@ -1,9 +1,26 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description SQL
* @date 2019-05-01 21:21
*/
public enum ResultType{
/**

@ -1,12 +1,29 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @date 2019-05-01 00:19
*/
@Documented
@Retention(value = RetentionPolicy.RUNTIME)

@ -1,11 +1,28 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.annotation;
import java.lang.annotation.*;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @program wechat
* @date 2019-05-01 13:32
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)

@ -1,3 +1,19 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.impl;
import com.hyc.wechat.dao.DataSource;
@ -14,8 +30,10 @@ import java.util.Queue;
import java.util.concurrent.LinkedBlockingQueue;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Dao
* @date 2019-05-01 16:40
*/
public class DataSourceImpl implements DataSource {
/*
@ -133,6 +151,8 @@ public class DataSourceImpl implements DataSource {
* @throws DaoException
* @name getConnection
* @notice
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Override
public Connection getConnection() throws DaoException {
@ -169,6 +189,8 @@ public class DataSourceImpl implements DataSource {
*
* @param conn
* @name freeConnection
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Override
public void freeConnection(Connection conn) {
@ -180,6 +202,8 @@ public class DataSourceImpl implements DataSource {
*
* @return java.sql.Connection
* @name createConnection
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Override
public void destroyConnection(Connection conn) {
@ -197,6 +221,8 @@ public class DataSourceImpl implements DataSource {
*
* @return int
* @name getCurrentCount
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Override
public int getCurrentCount() {
@ -208,6 +234,8 @@ public class DataSourceImpl implements DataSource {
*
* @return int
* @name getfreeCount
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
@Override
public int getfreeCount() {
@ -226,6 +254,8 @@ public class DataSourceImpl implements DataSource {
*
* @return java.sql.Connection
* @name createConnection
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/1
*/
private Connection createConnection() throws DaoException {
currentCount++;

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.dao.impl;
@ -19,8 +34,10 @@ import static com.hyc.wechat.util.ReflectUtils.getMethods;
import static com.hyc.wechat.util.StringUtils.field2SqlField;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description sql
* @date 2019-05-01 17:34
*/
public class SQLRunnerImpl implements SQLRunner {
@ -39,6 +56,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.Object
* @name executeUpdate
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
@Override
public int executeUpdate(String sql, Object[] params) {
@ -73,6 +92,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return int sql
* @name executeUpdate
* @notice SqlMapper
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
* @see SQLMapper
*/
@Override
@ -128,6 +149,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return int
* @name insert
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
@Override
public int insert(Object obj, String table) {
@ -162,6 +185,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @name update
* @notice null<br>
* null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
@Override
public int update(Object obj, String table) {
@ -205,6 +230,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return int
* @name delete
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public int delete(Object obj, String table) {
@ -238,6 +265,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.Object
* @name executeQuery
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
@Override
public Object executeQuery(String sql, Object[] params, ResultMapper mapper) {
@ -291,7 +320,9 @@ public class SQLRunnerImpl implements SQLRunner {
* @param clazz
* @return java.util.LinkedList
* @name queryList
* @notice non
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
@Override
public LinkedList queryList(String sql, Object[] params, Class clazz) {
@ -302,8 +333,10 @@ public class SQLRunnerImpl implements SQLRunner {
* ResultMapperList<br>
* 使
*
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @name ListMapper
* @notice
* @date 2019/4/10
* @see com.hyc.www.dao.inter.ResultMapper
*/
LinkedList list = new LinkedList<>();
@ -366,6 +399,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return Object
* @name queryList
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/10
*/
@Override
public Object queryObject(String sql, Object[] params, Class clazz) {
@ -381,6 +416,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return
* @name queryValue
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/11
*/
@Override
public Object queryValue(String sql, Object[] params) {
@ -424,6 +461,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryOrderBy
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryOrderBy(String[] selectFields, String orderBy, boolean isDesc, String tableName) {
@ -465,6 +504,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryWhere
* @notice not
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryWhere(String[] selectFields, Object obj, String conj, String condition) {
@ -507,6 +548,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryWhereAndEquals
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryWhereAndEquals(String[] selectFields, Object obj) {
@ -526,6 +569,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryWhereLikeAnd
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryWhereLikeAnd(String[] selectFields, Object obj) {
@ -544,6 +589,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryWhereLikeAnd
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryWhereLikeOr(String[] selectFields, Object obj) {
@ -566,6 +613,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.util.LinkedList
* @name queryPages
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public LinkedList queryPages(String[] selectFields, String tableName, String limit, String offset) {
@ -588,6 +637,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @param fieldValues
* @name fieldMapper
* @notice null
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/9
*/
@Override
public void fieldMapper(Object obj, LinkedList fieldNames, LinkedList fieldValues) {
@ -637,6 +688,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String
* @name selectMapper
* @notice
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String selectMapper(String tableName, Object[] selectFields) {
@ -657,6 +710,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String where,where id = ? and user_name = ?
* @name whereMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String whereMapper(Object[] whereFields, String conj, String condition) {
@ -682,6 +737,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String where,where id like ? and user_name like ?
* @name likeMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String likeMapper(Object[] likeFields, String conj) {
@ -706,6 +763,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String
* @name orderByMapper
* @notice where
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String orderByMapper(String orderBy, boolean isDesc) {
@ -733,6 +792,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String
* @name pageMapper
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String pageMapper(String limit, String offset) {
@ -748,6 +809,8 @@ public class SQLRunnerImpl implements SQLRunner {
* @return java.lang.String
* @name pageMapper
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/4/13
*/
@Override
public String pageOffsetMapper(String offset) {

@ -1,51 +1,44 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.exception;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Dao
* @date 2019-05-01 16:36
*/
public class DaoException extends RuntimeException{
/**
*
* DaoException
*/
public DaoException() {
super();
}
/**
*
* DaoException
* @param message
*/
public DaoException(String message) {
super(message);
}
/**
*
* DaoException
* @param message
* @param cause
*/
public DaoException(String message, Throwable cause) {
super(message, cause);
}
/**
*
* DaoException
* @param cause
*/
public DaoException(Throwable cause) {
super(cause);
}
/**
*
* DaoException
* @param message
* @param cause
* @param enableSuppression
* @param writableStackTrace
*/
protected DaoException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

@ -1,52 +1,44 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.exception;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description service
* @date 2019-05-01 17:41
*/
public class ServiceException extends RuntimeException{
/**
*
* ServiceException
*/
public ServiceException() {
super();
}
/**
*
* ServiceException
* @param message
*/
public ServiceException(String message) {
super(message);
}
/**
*
* ServiceException
* @param message
* @param cause
*/
public ServiceException(String message, Throwable cause) {
super(message, cause);
}
/**
*
* ServiceException
* @param cause
*/
public ServiceException(Throwable cause) {
super(cause);
}
/**
*
* ServiceException
*
* @param message
* @param cause
* @param enableSuppression
* @param writableStackTrace
*/
protected ServiceException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.factory;
@ -10,18 +25,16 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Daosql
* @date 2019-05-01 11:01
*/
public class DaoProxyFactory implements InvocationHandler {
private static SQLRunner executor = new SQLRunnerImpl();
private static DaoProxyFactory instance= new DaoProxyFactory();
/**
* 使Java Proxy API
* @param interfaces DAOClass
* @return
*/
public Object getProxyInstance(Class interfaces) {
return Proxy.newProxyInstance(interfaces.getClassLoader(), new Class[]{interfaces}, this);
}
@ -29,21 +42,11 @@ public class DaoProxyFactory implements InvocationHandler {
private DaoProxyFactory() {
}
/**
* DaoProxyFactory
* @return DaoProxyFactory
*/
public static DaoProxyFactory getInstance(){
return instance;
}
/**
* InvocationHandlerinvoke
* @param proxy
* @param method
* @param args
* @return
* @throws Throwable
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getAnnotation(Insert.class) != null) {
@ -74,22 +77,17 @@ public class DaoProxyFactory implements InvocationHandler {
}
}
if (method.getAnnotation(Query.class) != null) {
// 获取@Result注解指定的返回类型
ResultType type = method.getAnnotation(Result.class).returns();
switch (type) {
case OBJECT:
// 执行查询并返回单个对象
return executor.queryObject(method.getAnnotation(Query.class).value(), args, method.getAnnotation(Result.class).entity());
case LIST:
// 执行查询并返回对象列表
return executor.queryList(method.getAnnotation(Query.class).value(), args, method.getAnnotation(Result.class).entity());
case VALUE:
// 执行查询并返回单个值
return executor.queryValue(method.getAnnotation(Query.class).value(), args);
default:
}
}
// 如果方法没有注解,则直接调用原始方法
return method.invoke(proxy, args);
}

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.factory;
import java.lang.reflect.InvocationHandler;
@ -6,47 +21,31 @@ import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description Daosql
* @date 2019-05-01 11:01
*/
public class ServiceProxyFactory implements InvocationHandler {
private Object target;
/**
* 使Java Proxy API
* @param target
* @return
*/
public Object getProxyInstance(Object target) {
this.target =target;
// 创建代理对象,该代理对象实现了目标对象的所有接口
return Proxy.newProxyInstance(target.getClass().getClassLoader(), target.getClass().getInterfaces(), this);
}
/**
* InvocationHandlerinvoke
* @param proxy
* @param method
* @param args
* @return
* @throws Throwable
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return method.invoke(target, args);
}
/**
*
* @return
*/
public Object getTarget() {
return target;
}
/**
*
* @param target
*/
public void setTarget(Object target) {
this.target = target;
}

@ -1,3 +1,19 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.factory.proxy;
import com.hyc.wechat.dao.DataSource;
@ -10,92 +26,51 @@ import java.lang.reflect.Proxy;
import java.sql.Connection;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
*
* @description
* @date 2019-05-01 17:52
*/
public class ConnectionProxy implements InvocationHandler {
// 被代理的Connection对象
private Connection target;
// 数据源对象,用于管理数据库连接
private DataSource dataSource;
/**
*
* @param dataSource
*/
public ConnectionProxy(DataSource dataSource) {
this.dataSource = dataSource;
public Connection getProxyInstance(Connection target){
this.target= target;
return (Connection) Proxy.newProxyInstance(Connection.class.getClassLoader(),new Class[]{Connection.class},this);
}
/**
*
* @param target Connection
* @return Connection
*/
public Connection getProxyInstance(Connection target) {
this.target = target; // 设置被代理的目标对象
// 使用Proxy类创建一个Connection代理实例并将当前对象作为调用处理器
return (Connection) Proxy.newProxyInstance(
Connection.class.getClassLoader(), // 类加载器
new Class[]{Connection.class}, // 代理实现的接口数组
this); // 调用处理器
public ConnectionProxy(DataSource dataSource) {
this.dataSource = dataSource;
}
/**
* InvocationHandlerinvoke
* @param proxy
* @param method
* @param args
* @return
*/
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
// 如果调用的是close方法则将连接放回数据源而不是真正关闭连接
if ("close".equals(method.getName())) {
dataSource.freeConnection(target); // 将连接放回数据源
return null; // close方法没有返回值
//调用代理对象的close方法时将目标对象放回数据库连接池
dataSource.freeConnection(target);
return null;
}
try {
// 对于其他方法调用,直接转发给被代理的目标对象
return method.invoke(target, args);
} catch (IllegalAccessException | InvocationTargetException e) {
// 如果方法调用过程中发生异常则抛出DaoException
throw new DaoException("无法调用目标对象的方法", e);
}
}
// 以下是getter和setter方法用于访问和修改target和dataSource属性
/**
* Connection
* @return Connection
*/
public Connection getTarget() {
return target;
}
/**
* Connection
* @param target Connection
*/
public void setTarget(Connection target) {
this.target = target;
}
/**
*
* @return
*/
public DataSource getDataSource() {
return dataSource;
}
/**
*
* @param dataSource
*/
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
}

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.builder;
import com.hyc.wechat.model.vo.MessageVO;
@ -7,91 +22,49 @@ import java.math.BigInteger;
import java.sql.Timestamp;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description MessageVO
* @date 2019-05-07 14:58
*/
public class MessageVOBuilder {
private MessageVO messageVo;
/**
* MessageVO
*/
public MessageVOBuilder() {
this.messageVo = new MessageVO();
}
/**
* MessageVO
* @return MessageVO
*/
public MessageVO build(){
return this.messageVo;
}
/**
*
* @param senderName
* @return MessageVOBuilder便
*/
public MessageVOBuilder setSenderName(String senderName) {
this.messageVo.setSenderName(senderName);
return this;
}
/**
* ID
* @param senderId ID
* @return MessageVOBuilder便
*/
public MessageVOBuilder setSenderId(BigInteger senderId){
this.messageVo.setSenderId(senderId);
return this;
}
/**
* URL
* @param senderPhoto URL
* @return MessageVOBuilder便
*/
public MessageVOBuilder setSenderPhoto(String senderPhoto){
this.messageVo.setSenderPhoto(senderPhoto);
return this;
}
/**
* ID
* @param chatId ID
* @return MessageVOBuilder便
*/
public MessageVOBuilder setChatId(BigInteger chatId){
this.messageVo.setChatId(chatId);
return this;
}
/**
*
* @param content
* @return MessageVOBuilder便
*/
public MessageVOBuilder setContent(String content){
this.messageVo.setContent(content);
return this;
}
/**
*
* @param time
* @return MessageVOBuilder便
*/
public MessageVOBuilder setTime(Timestamp time){
this.messageVo.setTime(time);
return this;
}
/**
*
* @param type
* @return MessageVOBuilder便
*/
public MessageVOBuilder setType(String type){
this.messageVo.setType(type);
return this;
}
/**
* ID
* @param id ID
* @return MessageVOBuilder便
*/
public MessageVOBuilder setId(BigInteger id){
this.messageVo.setId(id);
return this;

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.builder;
@ -7,186 +22,100 @@ import java.math.BigInteger;
import java.sql.Timestamp;
/**
* @description MomentVO
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @date 2019-05-07 20:32
*/
public class MomentVOBuilder {
// MomentVO对象用于存储构建过程中的数据
private MomentVO momentVO;
/**
* MomentVO
*/
public MomentVOBuilder() {
this.momentVO = new MomentVO();
}
/**
* MomentVO
* @return MomentVO
*/
public MomentVO build() {
return this.momentVO;
}
// 以下方法用于设置MomentVO对象的属性并返回当前Builder对象以便链式调用
/**
*
* @param time
* @return Builder
*/
public MomentVOBuilder setTime(Timestamp time){
this.momentVO.setTime(time);
return this;
}
/**
* URL
* @param userPhoto URL
* @return Builder
*/
public MomentVOBuilder setUserPhoto(String userPhoto){
this.momentVO.setUserPhoto(userPhoto);
return this;
}
/**
* URL
* @param photo URL
* @return Builder
*/
public MomentVOBuilder setPhoto(String photo){
this.momentVO.setPhoto(photo);
return this;
}
/**
*
* @param userName
* @return Builder
*/
public MomentVOBuilder setUserName(String userName){
this.momentVO.setUserName(userName);
return this;
}
/**
* ID
* @param id ID
* @return Builder
*/
public MomentVOBuilder setId(BigInteger id) {
this.momentVO.setId(id);
return this;
}
/**
* ID
* @param userId ID
* @return Builder
*/
public MomentVOBuilder setUserId(BigInteger userId) {
this.momentVO.setOwnerId(userId);
return this;
}
/**
*
* @param content
* @return Builder
*/
public MomentVOBuilder setContent(String content) {
this.momentVO.setContent(content);
return this;
}
/**
*
* @param share
* @return Builder
*/
public MomentVOBuilder setShare(Long share) {
this.momentVO.setShare(share);
return this;
}
/**
*
* @param love
* @return Builder
*/
public MomentVOBuilder setLove(Long love) {
this.momentVO.setLove(love);
return this;
}
/**
*
* @param remark
* @return Builder
*/
public MomentVOBuilder setRemark(Long remark) {
this.momentVO.setRemark(remark);
return this;
}
/**
*
* @param view
* @return Builder
*/
public MomentVOBuilder setView(Long view) {
this.momentVO.setView(view);
return this;
}
/**
*
* @param collect
* @return Builder
*/
public MomentVOBuilder setCollect(Long collect) {
this.momentVO.setCollect(collect);
return this;
}
/**
*
* @param loved
* @return Builder
*/
public MomentVOBuilder setLoved(Boolean loved) {
this.momentVO.setLoved(loved);
return this;
}
/**
*
* @param shared
* @return Builder
*/
public MomentVOBuilder setShared(Boolean shared) {
this.momentVO.setShared(shared);
return this;
}
/**
*
* @param viewed
* @return Builder
*/
public MomentVOBuilder setViewed(Boolean viewed) {
this.momentVO.setViewed(viewed);
return this;
}
public MomentVOBuilder setViewed(Boolean viewed) {
this.momentVO.setViewed(viewed);
return this;
/**
*
* @param collected
* @return Builder
*/
}
public MomentVOBuilder setCollected(Boolean collected) {
this.momentVO.setCollected(collected);
return this;
}
}

@ -1,99 +1,73 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.dto;
import com.hyc.wechat.service.constants.Status;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description serviceDTO
* @description service
* @date 2019-05-02 03:01
*/
public class ServiceResult {
/**
*
*
*/
private Status status;
/**
*
*
*/
private String message;
/**
*
*
*/
private Object data;
/**
* ServiceResult
*/
public ServiceResult() {
}
/**
* ServiceResult
*
* @param status
* @param message
* @param data
*/
public ServiceResult(Status status, String message, Object data) {
this.status = status;
this.message = message;
this.data = data;
}
/**
*
*
* @return
*/
public Status getStatus() {
return status;
}
/**
*
*
* @param status
*/
public void setStatus(Status status) {
this.status = status;
}
/**
*
*
* @return
*/
public String getMessage() {
return message;
}
/**
*
*
* @param message
*/
public void setMessage(String message) {
this.message = message;
}
/**
*
*
* @return
*/
public Object getData() {
return data;
}
/**
*
*
* @param data
*/
public void setData(Object data) {
this.data = data;
}
}

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.po;
import com.alibaba.fastjson.annotation.JSONField;
@ -8,135 +23,65 @@ import com.hyc.wechat.model.po.abs.BaseEntity;
import java.math.BigInteger;
/**
* @description chat
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description chat
* @date 2019-05-03 01:38
*/
@Table(name = "chat") // 指定该实体类对应的数据库表名为chat
@Table(name = "chat")
public class Chat extends BaseEntity {
// 聊天室的编号
private String number;
// 聊天室所有者的ID
@JSONField(name = "owner_id") // 指定在JSON序列化时的字段名为owner_id
@JSONField(name = "owner_id")
private BigInteger ownerId;
// 聊天室的类型(如群聊、私聊等)
private String type;
// 聊天室的名称
private String name;
// 聊天室的成员数量
private Integer member;
// 聊天室的封面照片URL
private String photo;
/**
*
*
* @return
*/
public String getType() {
return type;
}
/**
*
*
* @param type
*/
public void setType(String type) {
this.type = type;
}
/**
*
*
* @return
*/
public String getNumber() {
return number;
}
/**
*
*
* @param number
*/
public void setNumber(String number) {
this.number = number;
}
/**
* URL
*
* @return URL
*/
public String getPhoto() {
return photo;
}
/**
* URL
*
* @param photo URL
*/
public void setPhoto(String photo) {
this.photo = photo;
}
/**
* ID
*
* @return ID
*/
public BigInteger getOwnerId() {
return ownerId;
}
/**
* ID
*
* @param ownerId ID
*/
public void setOwnerId(BigInteger ownerId) {
this.ownerId = ownerId;
}
/**
*
*
* @return
*/
public String getName() {
return name;
}
/**
*
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
/**
*
*
* @return
*/
public Integer getMember() {
return member;
}
/**
*
*
* @param member
*/
public void setMember(Integer member) {
this.member = member;
}
}

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.po;
import com.alibaba.fastjson.annotation.JSONField;
@ -8,158 +23,77 @@ import com.hyc.wechat.model.po.abs.BaseEntity;
import java.math.BigInteger;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description friend
* @description
* @date 2019-05-02 01:56
*/
@Table(name = "friend") // 指定该实体类对应的数据库表名为friend
@Table(name = "friend")
public class Friend extends BaseEntity {
// 用户ID表示朋友的用户标识
@JSONField(name = "user_id") // 指定在JSON序列化时的字段名为user_id
@JSONField(name = "user_id")
private BigInteger userId;
// 朋友ID表示朋友的用户标识
@JSONField(name = "friend_id") // 指定在JSON序列化时的字段名为friend_id
@JSONField(name = "friend_id")
private BigInteger friendId;
// 聊天室ID表示与朋友关联的聊天室标识
@JSONField(name = "chat_id") // 指定在JSON序列化时的字段名为chat_id
@JSONField(name = "chat_id")
private BigInteger chatId;
// 朋友的头像照片URL
private String photo;
// 分组ID表示朋友所属的分组标识
@JSONField(name = "group_id") // 指定在JSON序列化时的字段名为group_id
@JSONField(name = "group_id")
private BigInteger groupId;
// 朋友的别名,用于在好友列表中显示的名称
private String alias;
// 朋友的描述信息
private String description;
/**
* ID
*
* @return ID
*/
public BigInteger getChatId() {
return chatId;
}
/**
* ID
*
* @param chatId ID
*/
public void setChatId(BigInteger chatId) {
this.chatId = chatId;
}
/**
* URL
*
* @return URL
*/
public String getPhoto() {
return photo;
}
/**
* URL
*
* @param photo URL
*/
public void setPhoto(String photo) {
this.photo = photo;
}
/**
* ID
*
* @return ID
*/
public BigInteger getUserId() {
return userId;
}
/**
* ID
*
* @param userId ID
*/
public void setUserId(BigInteger userId) {
this.userId = userId;
}
/**
* ID
*
* @return ID
*/
public BigInteger getFriendId() {
return friendId;
}
/**
* ID
*
* @param friendId ID
*/
public void setFriendId(BigInteger friendId) {
this.friendId = friendId;
}
/**
* ID
*
* @return ID
*/
public BigInteger getGroupId() {
return groupId;
}
/**
* ID
*
* @param groupId ID
*/
public void setGroupId(BigInteger groupId) {
this.groupId = groupId;
}
/**
*
*
* @return
*/
public String getAlias() {
return alias;
}
/**
*
*
* @param alias
*/
public void setAlias(String alias) {
this.alias = alias;
}
/**
*
*
* @return
*/
public String getDescription() {
return description;
}
/**
*
*
* @param description
*/
public void setDescription(String description) {
this.description = description;
}

@ -1,4 +1,19 @@
//导入必要库
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.po;
import com.alibaba.fastjson.annotation.JSONField;
@ -8,135 +23,66 @@ import com.hyc.wechat.model.po.abs.BaseEntity;
import java.math.BigInteger;
/**
* @description member
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @description
* @date 2019-05-03 12:58
*/
@Table(name = "member") // 指定该实体类对应的数据库表名为member
@Table(name = "member")
public class Member extends BaseEntity {
// 用户ID表示成员的用户标识
@JSONField(name = "user_id") // 指定在JSON序列化时的字段名为user_id
@JSONField(name = "user_id")
private BigInteger userId;
// 聊天室ID表示成员所属的群聊标识
@JSONField(name = "chat_id") // 指定在JSON序列化时的字段名为chat_id
@JSONField(name = "chat_id")
private BigInteger chatId;
// 群聊别名,表示成员在群聊中的别名
@JSONField(name = "group_alias") // 指定在JSON序列化时的字段名为group_alias
@JSONField(name = "group_alias")
private String groupAlias;
// 申请状态,表示成员的申请状态(如:待审批、已通过等)
private String apply;
// 背景图片,表示成员在群聊中的背景图片
private String background;
// 等级,表示成员在群聊中的等级或权限级别
private Integer level;
/**
*
*
* @return
*/
public String getApply() {
return apply;
}
/**
*
*
* @param apply
*/
public void setApply(String apply) {
this.apply = apply;
}
/**
*
*
* @return
*/
public Integer getLevel() {
return level;
}
/**
*
*
* @param level
*/
public void setLevel(Integer level) {
this.level = level;
}
/**
* ID
*
* @return ID
*/
public BigInteger getUserId() {
return userId;
}
/**
* ID
*
* @param userId ID
*/
public void setUserId(BigInteger userId) {
this.userId = userId;
}
/**
* ID
*
* @return ID
*/
public BigInteger getChatId() {
return chatId;
}
/**
* ID
*
* @param chatId ID
*/
public void setChatId(BigInteger chatId) {
this.chatId = chatId;
}
/**
*
*
* @return
*/
public String getGroupAlias() {
return groupAlias;
}
/**
*
*
* @param groupAlias
*/
public void setGroupAlias(String groupAlias) {
this.groupAlias = groupAlias;
}
/**
*
*
* @return
*/
public String getBackground() {
return background;
}
/**
*
*
* @param background
*/
public void setBackground(String background) {
this.background = background;
}

@ -1,4 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.po;

@ -1,3 +1,18 @@
/*
* Copyright (c) 2019.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hyc.wechat.model.po.abs;
@ -8,111 +23,62 @@ import java.math.BigInteger;
import java.util.Date;
/**
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @program wechat
* @description
* @description
* @date 2019-05-01 23:19
*/
public abstract class BaseEntity {
/**
*
*/
@Field(name = "id")
private BigInteger id;
/**
*
*/
@Field(name = "status")
private Integer status;
/**
*
*/
@Field(name = "gmt_create")
private Date gmtCreate;
/**
*
*/
@Field(name = "gmt_modified")
private Date gmtModified;
/**
*
*
* @return
*/
public BigInteger getId() {
return id;
}
/**
*
*
* @param id
*/
public void setId(BigInteger id) {
this.id = id;
}
/**
*
*
* @return
*/
public Integer getStatus() {
return status;
}
/**
*
*
* @param status
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
*
*
* @return
*/
public Date getGmtCreate() {
return gmtCreate;
}
/**
*
*
* @param gmtCreate
*/
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/**
*
*
* @return
*/
public Date getGmtModified() {
return gmtModified;
}
/**
*
*
* @param gmtModified
*/
public void setGmtModified(Date gmtModified) {
this.gmtModified = gmtModified;
}
/**
* toString使JSON
* potoString使json
*
* @return JSON
* @return
* @name toString
* @notice none
* @author <a href="mailto:kobe524348@gmail.com"></a>
* @date 2019/5/7
*/
@Override
public String toString() {

File diff suppressed because it is too large Load Diff

@ -21,220 +21,132 @@
Time: 3:51
To change this template use File | Settings | File Templates.
--%>
<%--
页面指令,设置页面的内容类型、字符集、脚本语言和页面编码。
contentType 指定了返回给客户端的内容类型为 HTML并使用 UTF-8 编码。
language 指定了页面中使用的脚本语言为 Java。
pageEncoding 明确指定了页面本身的编码为 UTF-8虽然通常与 contentType 中的 charset 相同,但在这里为了清晰起见还是单独设置了。
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%--
引入 JSTL 核心标签库,前缀为 c。
这允许我们在 JSP 页面中使用 JSTL 标签,如 <c:set>、<c:if> 等。
--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
使用 <c:set> 标签设置一个名为 host 的变量,其值为 "localhost:8080/wechat"。
这个变量稍后在页面中用于构建 URL。
--%>
<c:set var="host" value="localhost:8080/wechat"/>
<%--设置主机名--%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> <%-- 设置页面的字符集为 UTF-8 --%>
<title>wechat</title> <%-- 页面标题 --%>
<%-- 引入微信图标 --%>
<link rel="shortcut icon" type="image/x-icon" href="https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico">
<%-- 引入 Bootstrap CSS 框架 --%>
<meta charset="utf-8">
<title>wechat</title>
<link rel="shortcut icon" type=image/x-icon href=https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<%-- 引入 jQuery 库 --%>
<script src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.js"></script>
<%--
发送请求脚本的占位符,目前为空。
可以在这里添加 JavaScript 代码来处理发送请求的逻辑。
--%>
<!--BEGIN——发送请求脚本-->
<!--END——发送请求脚本-->
</head>
<body>
<%-- 页面背景容器 --%>
<div class="background">
<%-- 页面头部 --%>
<%-- 页面头部--%>
<div class="login-head" style="height: 100px">
<%-- 使用 Bootstrap 的 jumbotron 类来创建一个醒目的容器 --%>
<div class="jumbotron" style="padding-bottom: 20px;padding-top:20px;margin:0px">
<%-- 包含微信 logo 和标语的区域 --%>
<div class="logo">
<a href="${pageContext.request.contextPath}/index.jsp"
style="color: #999;font-size: 44px;text-decoration: none">
<img src="${pageContext.request.contextPath}/static/img/logo.png" alt="logo"
style="width: 100px;margin: 10px">
<%-- 注意:这里的 <h2> 标签被错误地关闭了,应该使用 </a> 来关闭 <a> 标签,而不是 </h2> --%>
微信,是一种生活方式</a> <%-- 这里应该使用正确的 HTML 结构,但原代码有误,已按原样注释 --%>
</a> <%-- 这是一个多余的闭合标签,应该删除 --%>
style="color: #999;font-size: 44px;text-decoration: none"><img
src="${pageContext.request.contextPath}/static/img/logo.png" alt="logo"
style="width: 100px;margin: 10px">微信,是一种生活方式</h2>
</a>
</div>
</div>
</div>
<%--
使用 <c:if> 标签检查 message 变量是否不为 null。
如果不为 null则使用 JavaScript 显示一个警告框。
--%>
<script>
<c:if test="${message!=null}">
alert("系统提示:${message}");
</c:if>
</script>
<%-- 输入框容器 --%>
<div class="input-box">
<%-- 输入字段的容器,带有自定义样式 --%>
<div class="color-input-field">
<%--
表单,提交到 http://${host}/wechat/user?method=login.do。
使用 POST 方法提交。
--%>
<form action="http://${host}/wechat/user?method=login.do" method="post">
<%--
一个隐藏的提交按钮,可能用于触发某些 JavaScript 事件,但在这里被设置为不显示。
--%>
<form action="http://${host}/wechat/user?method=login.do" method="post">
<input id="index" type="submit" style="display: none">
<%-- 输入框标题 --%>
<h2 class="input-box-title">邮箱登陆</h2>
<%-- 邮箱输入框,带有占位符和必填验证 --%>
<input type="text" required="required" class="form-control" id="email"
value="${param.email}" name="email" placeholder="请输入登陆邮箱">
<br/>
<%-- 密码输入框,带有占位符和必填验证 --%>
<input id="password" type="password" required="required" class="form-control" name="password"
placeholder="请输入密码">
<%-- 记住登陆选项 --%>
<div class="remember-me">
<input id="option" name="auto_login" type="checkbox" value="true">记住登陆
</div>
<%-- 提交按钮 --%>
<input type="submit" class="submit-button" value="登陆">
<br>
<%-- 切换按钮,包含注册链接和游客模式链接 --%>
<div class="switch-button">
<a href="${pageContext.request.contextPath}/register.jsp">立即注册</a>
<%--
游客模式链接,带有 onclick 事件处理器(尽管这里没有定义 visitor() 函数,可能需要在 JavaScript 中定义)。
注意:这里的 URL 拼接方式可能会导致安全问题,建议使用更安全的参数传递方式。
--%>
<a href="http://${host}/wechat/user?method=login.do&email=visitor" onclick="visitor()">| 游客模式</a>
</div>
<h2 class="input-box-title">邮箱登陆</h2>
<input type="text" required="required" class="form-control" id="email"
value="${param.email}" name="email" placeholder="请输入登陆邮箱" >
<br/>
<input id="password" type="password" required="required" class="form-control" name="password"
placeholder="请输入密码">
<div class="remember-me">
<input id="option" name="auto_login" type="checkbox" value="true">记住登陆
</div>
<input type="submit" class="submit-button" value="登陆">
<br>
<div class="switch-button">
<a href="${pageContext.request.contextPath}/register.jsp">立即注册</a>
<a href="http://${host}/wechat/user?method=login.do&email=visitor" onclick="visitor()">| 游客模式</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<!-- 网页的结束body标签通常表示HTML文档的主体内容结束 -->
</body>
<!-- 定义CSS样式 -->
<style type="text/css">
/* 设置背景样式 */
.background {
height: -webkit-fill-available; /* 高度填充可用空间针对webkit浏览器 */
min-height: 750px; /* 最小高度 */
text-align: center; /* 文本居中 */
font-size: 14px; /* 字体大小 */
background-color: #f1f1f1; /* 背景颜色 */
z-index: -1; /* 堆叠顺序,设置为-1表示在其他元素之下 */
height: -webkit-fill-available;
min-height: 750px;
text-align: center;
font-size: 14px;
background-color: #f1f1f1;
z-index: -1;
}
/* 设置logo样式 */
.logo {
position: absolute; /* 绝对定位 */
top: 56px; /* 距离顶部56px */
margin-left: 50px; /* 距离左侧50px */
position: absolute;
top: 56px;
margin-left: 50px;
}
/* 设置表单控件样式 */
.form-control {
padding: 10px; /* 内边距 */
min-height: 55px; /* 最小高度 */
max-height: 70px; /* 最大高度 */
font-size: 22px; /* 字体大小 */
padding: 10px;
min-height: 55px;
max-height: 70px;
font-size: 22px;
}
/* 设置输入框标题样式 */
.input-box-title {
text-align: center; /* 文本居中 */
margin: 0 auto 50px; /* 上下外边距自动底部外边距50px */
padding: 10px; /* 内边距 */
font-weight: 400; /* 字体粗细 */
color: #969696 /* 字体颜色 */
text-align: center;
margin: 0 auto 50px;
padding: 10px;
font-weight: 400;
color: #969696
}
/* 设置颜色输入框样式 */
.color-input-field {
padding: 50px; /* 内边距 */
font-size: 22px; /* 字体大小 */
height: 625px; /* 高度 */
width: 500px /* 宽度 */
padding: 50px;
font-size: 22px;
height: 625px;
width: 500px
}
/* 设置输入框容器样式 */
.input-box {
width: fit-content; /* 宽度适应内容 */
margin: 104px auto; /* 上下外边距104px左右外边距自动 */
background-color: #fff; /* 背景颜色 */
border-radius: 4px; /* 边框圆角 */
box-shadow: 0 0 8px rgba(0, 0, 0, .1); /* 盒子阴影 */
vertical-align: middle; /* 垂直对齐方式 */
width: fit-content;
margin: 104px auto;
background-color: #fff;
border-radius: 4px;
box-shadow: 0 0 8px rgba(0, 0, 0, .1);
vertical-align: middle;
}
/* 设置提交按钮样式 */
.submit-button {
margin-top: 20px; /* 上外边距 */
background-color: #1AAD19; /* 背景颜色 */
color: #FFFFFF; /* 字体颜色 */
padding: 9px 18px; /* 内边距 */
border-radius: 5px; /* 边框圆角 */
outline: none; /* 移除默认轮廓 */
border: none; /* 无边框 */
width: 100%; /* 宽度100% */
margin-top: 20px;
background-color: #1AAD19;
color: #FFFFFF;
padding: 9px 18px;
border-radius: 5px;
outline: none;
border: none;
width: 100%;
}
/* 设置记住我选项样式 */
.remember-me {
float: left; /* 左浮动 */
font-weight: 400; /* 字体粗细 */
color: #969696; /* 字体颜色 */
margin-top: 20px; /* 上外边距 */
float: left;
font-weight: 400;
color: #969696;
margin-top: 20px;
}
/* 设置切换按钮容器样式 */
.switch-button {
text-align: left; /* 文本左对齐 */
text-align: left;
}
</style>
<!-- 网页的结束html标签表示HTML文档结束 -->
</html>
</style>
</html>

@ -21,69 +21,55 @@
Time: 21:23
To change this template use File | Settings | File Templates.
--%>
<%-- 设置页面的内容类型为HTML并指定字符集和页面编码为UTF-8 --%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%-- 引入JSTL核心标签库并设置前缀为c --%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%-- 设置一个名为host的变量其值为localhost:8080/wechat --%>
<c:set var="host" value="localhost:8080/wechat"/>
<%-- 注释:设置主机名 --%>
<%--设置主机名--%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>wechat</title>
<%-- 设置网页的快捷图标favicon --%>
<link rel="shortcut icon" type="image/x-icon" href="https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico">
<%-- 引入Bootstrap的CSS样式 --%>
<link rel="shortcut icon" type=image/x-icon href=https://res.wx.qq.com/a/wx_fed/assets/res/NTI4MWU5.ico>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<%-- 引入jQuery库 --%>
<script src="${pageContext.request.contextPath}/static/js/jquery-3.4.1.js"></script>
<script>
// 定义注册函数
function register() {
// 获取邮箱和密码输入框的值
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
// 验证邮箱是否填写
if(email==null||email==''){
alert("请填写邮箱");
return;
}
// 验证密码是否填写
if(password==null||password===''){
alert("请填写密码");
return;
}
// 验证是否同意用户使用协议
if(!document.getElementById("agree").checked){
alert("请先同意用户使用协议");
return;
}
// 触发表单提交
document.getElementById("submit").click();
}
</script>
</head>
<body>
<%-- 如果message变量不为空则弹出系统提示 --%>
<script>
<c:if test="${message!=null}">
alert("系统提示:${message}");
</c:if>
</script>
<div class="background">
<%-- 页面头部 --%>
<%-- 页面头部--%>
<div class="login-head" style="height: 100px">
<div class="jumbotron" style="padding-bottom: 20px;padding-top:20px;margin:0px">
<div class="logo">
<%-- 链接到首页并显示微信logo和标语 --%>
<a href="${pageContext.request.contextPath}/index.jsp"
style="color: #999;font-size: 44px;text-decoration: none">
<img src="${pageContext.request.contextPath}/static/img/logo.png" alt="logo"
style="width: 100px;margin: 10px">
<h2>微信,是一种生活方式</h2>
style="color: #999;font-size: 44px;text-decoration: none"><img
src="${pageContext.request.contextPath}/static/img/logo.png" alt="logo"
style="width: 100px;margin: 10px">微信,是一种生活方式</h2>
</a>
</div>
</div>
@ -91,119 +77,101 @@
<div class="input-box">
<div class="color-input-field">
<h2 class="input-box-title">注册账号</h2>
<%-- 表单提交到注册处理URL使用POST方法 --%>
<form action="http://${host}/wechat/user?method=register.do" method="post">
<%-- 隐藏一个提交按钮用于在JavaScript中触发提交 --%>
<form action="http://${host}/wechat/user?method=register.do" method="post">
<input id="index" type="submit" style="display: none">
<%-- 邮箱输入框 --%>
<input id="email" type="text" required="required" class="form-control" name="email"
value="${data.email}" placeholder="请输入邮箱号">
<br/>
<%-- 密码输入框 --%>
<input id="password" type="password" required="required" class="form-control" name="password"
value="${data.password}" placeholder="请输入密码(6-20位英文字母数字或下划线)">
<div class="remember-me">
<%-- 同意协议复选框 --%>
<input id="agree" type="checkbox" name="agreement" value="true"
style="margin-bottom: 13px">
我已阅读并同意<a href="agreement.html">《微信服务协议》</a>
</div>
<%-- 隐藏的真实提交按钮 --%>
<input id="email" type="text" required="required" class="form-control" name="email"
value="${data.email}" placeholder="请输入邮箱号">
<br/>
<input id="password" type="password" required="required" class="form-control" name="password"
value="${data.password}" placeholder="请输入密码(6-20位英文字母数字或下划线)">
<div class="remember-me">
<input id="agree" type="checkbox" name="agreement" value="true"
style="margin-bottom: 13px">我已阅读并同意<a href="agreement.html">《微信服务协议》</a>
</div>
<input type="submit" id="submit" style="display: none">
<%-- 注册按钮点击后调用JavaScript的register函数 --%>
<input onclick="register()" type="button" class="submit-button" value="注册">
<br>
<div class="switch-button">
<%-- 提供登录和游客模式的链接 --%>
已有账号?<a href="${pageContext.request.contextPath}/login.jsp">请登陆</a>
<a href="http://${host}/wechat/user?method=login.do&email=visitor"> | 游客模式</a>
</div>
<input onclick="register()" type="button" class="submit-button" value="注册">
<br>
<div class="switch-button">
已有账号?<a href="${pageContext.request.contextPath}/login.jsp">请登陆</a>
<a href="http://${host}/wechat/user?method=login.do&email=visitor" >| 游客模式</a>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
<!-- 样式定义开始 -->
</body>
<style type="text/css">
/* 定义背景样式 */
.background {
height: -webkit-fill-available; /* 在webkit浏览器中高度自动填充可用空间 */
min-height: 750px; /* 最小高度为750px */
text-align: center; /* 文本居中 */
font-size: 14px; /* 字体大小为14px */
background-color: #f1f1f1; /* 背景颜色为浅灰色 */
z-index: -1; /* 元素的堆叠顺序为-1通常用于放在其他元素之后 */
height: -webkit-fill-available;
min-height: 750px;
text-align: center;
font-size: 14px;
background-color: #f1f1f1;
z-index: -1;
}
/* 定义logo样式 */
.logo {
position: absolute; /* 绝对定位 */
top: 56px; /* 距离顶部56px */
margin-left: 50px; /* 距离左侧50px */
position: absolute;
top: 56px;
margin-left: 50px;
}
/* 定义表单控件样式 */
.form-control {
padding: 10px; /* 内边距为10px */
min-height: 55px; /* 最小高度为55px */
max-height: 70px; /* 最大高度为70px */
font-size: 22px; /* 字体大小为22px */
padding: 10px;
min-height: 55px;
max-height: 70px;
font-size: 22px;
}
/* 定义输入框标题样式 */
.input-box-title {
text-align: center; /* 文本居中 */
margin: 0 auto 50px; /* 上边距为0左右自动居中下边距为50px */
padding: 10px; /* 内边距为10px */
font-weight: 400; /* 字体粗细为400 */
color: #969696; /* 字体颜色为深灰色 */
text-align: center;
margin: 0 auto 50px;
padding: 10px;
font-weight: 400;
color: #969696
}
/* 定义颜色输入框样式 */
.color-input-field {
padding: 50px; /* 内边距为50px */
font-size: 22px; /* 字体大小为22px */
height: 625px; /* 高度为625px */
width: 500px; /* 宽度为500px */
padding: 50px;
font-size: 22px;
height: 625px;
width: 500px
}
/* 定义输入框容器样式 */
.input-box {
width: fit-content; /* 宽度适应内容 */
margin: 104px auto; /* 上下边距为104px左右自动居中 */
background-color: #fff; /* 背景颜色为白色 */
border-radius: 4px; /* 边框圆角为4px */
box-shadow: 0 0 8px rgba(0, 0, 0, .1); /* 盒子阴影效果 */
vertical-align: middle; /* 垂直对齐方式为中间 */
width: fit-content;
margin: 104px auto;
background-color: #fff;
border-radius: 4px;
box-shadow: 0 0 8px rgba(0, 0, 0, .1);
vertical-align: middle;
}
/* 定义提交按钮样式 */
.submit-button {
margin-top: 20px; /* 上边距为20px */
background-color: #1AAD19; /* 背景颜色为绿色 */
color: #FFFFFF; /* 字体颜色为白色 */
padding: 9px 18px; /* 内边距为9px上下和18px左右 */
border-radius: 5px; /* 边框圆角为5px */
outline: none; /* 去除默认轮廓线 */
border: none; /* 无边框 */
width: 100%; /* 宽度为父容器的100% */
margin-top: 20px;
background-color: #1AAD19;
color: #FFFFFF;
padding: 9px 18px;
border-radius: 5px;
outline: none;
border: none;
width: 100%;
}
/* 定义记住我选项样式 */
.remember-me {
float: left; /* 左浮动 */
font-weight: 400; /* 字体粗细为400 */
color: #969696; /* 字体颜色为深灰色 */
margin-top: 20px; /* 上边距为20px */
float: left;
font-weight: 400;
color: #969696;
margin-top: 20px;
}
/* 定义切换按钮样式 */
.switch-button {
text-align: left; /* 文本左对齐 */
text-align: left;
}
</style>
<!-- 样式定义结束 -->
</html>

@ -1,23 +1,4 @@
/*
.page-body:
.menu:
.menu-head, .menu-head-photo, .menu-head-img, .menu-head-info, .menu-head-nickname:
.menu-search, .menu-search-icon, .menu-search-bar:
.menu-option, .menu-option-item, .menu-option-chat:
.chat-box, .chat-box-head, .chat-box-title, .chat-box-title-box, .chat-box-title-text:
.chat-input-box, .text-area:
.chat-output-box, .chat-output-head-photo-right, .chat-output-head-photo-left, .chat-output-content-right, .chat-output-content-left, .chat-output-meta-left, .chat-output-bubble-right, .chat-output-bubble-left, .chat-output-bubble-inner, .chat-output-bubble-pre-right, .chat-output-bubble-pre-left:
.user-photo, .my-photo, .user-list-block-href, .user-list-block, .user-info, .user-box, .my-name, .my-message:
*/
.page-body {
min-width: 800px;
height: 100%;

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save