parent
64ec7b586f
commit
103c7af9b7
@ -0,0 +1,96 @@ |
|||||||
|
package com.hfkj.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.MemberValidateUtil; |
||||||
|
import com.hfkj.common.utils.RedisUtil; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.service.user.BsUserService; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.HashMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: ClientController |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/client") |
||||||
|
@Api(value="客户端业务") |
||||||
|
public class ClientController { |
||||||
|
@Resource |
||||||
|
private BsUserService userService; |
||||||
|
@Resource |
||||||
|
private RedisUtil redisUtil; |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@RequestMapping(value = "/smsLogin", method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "登录并注册 { 'phone': '手机号', 'smsCode': '短信验证码'}") |
||||||
|
public ResponseData smsLogin(@RequestBody JSONObject body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| StringUtils.isBlank(body.getString("phone")) |
||||||
|
|| StringUtils.isBlank(body.getString("smsCode")) |
||||||
|
) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
String phone = body.getString("phone"); |
||||||
|
// 校验手机号格式
|
||||||
|
if (!MemberValidateUtil.validatePhone(phone)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); |
||||||
|
} |
||||||
|
if (StringUtils.isBlank(body.getString("smsCode"))) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); |
||||||
|
} |
||||||
|
// 手机号的验证码
|
||||||
|
Object phoneCodeObject = redisUtil.get("SMS_LOGIN_CODE:" + phone); |
||||||
|
if (phoneCodeObject == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
redisUtil.del("SMS_LOGIN_CODE:" + phone); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(userService.login(phone, UserLoginType.SMS, new HashMap<>())); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value="/loginOut",method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "退出登录") |
||||||
|
public ResponseData loginOut(HttpServletRequest request) { |
||||||
|
try { |
||||||
|
SecUserSessionObject session = userCenter.getSessionModel(SecUserSessionObject.class); |
||||||
|
if (session != null) { |
||||||
|
userCenter.remove(request); |
||||||
|
} |
||||||
|
return ResponseMsgUtil.success("退出成功"); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
package com.hfkj.controller;
import com.alibaba.fastjson.JSONObject;
import com.hfkj.common.exception.ErrorCode;
import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode;
import com.hfkj.common.utils.MemberValidateUtil;
import com.hfkj.common.utils.RedisUtil;
import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.model.ResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Random;
@Controller
@RequestMapping(value = "/sms")
@Api(value = "短信服务")
public class SmsController {
private static Logger log = LoggerFactory.getLogger(SmsController.class);
@Resource
private RedisUtil redisUtil;
@RequestMapping(value = "/sendLoginCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "获取登录验证码 {'phone': '手机号'}")
public ResponseData sendLoginCode(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("phone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
String phone = body.getString("phone");
// 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
}
// 生成随机6位验证码
String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
// 验证码缓存5分钟
redisUtil.set("SMS_LOGIN_CODE:"+phone, 123456, 60*5);
return ResponseMsgUtil.success("短信发送成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/sendBindPhoneCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "发送绑定手机号验证码 {'phone': '手机号'}")
public ResponseData sendBindPhoneCode(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("phone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
String phone = body.getString("phone");
// 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
}
// 生成随机6位验证码
String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
// 验证码缓存5分钟
redisUtil.set("SMS_BIND_PHONE_CODE:"+phone, 123456, 60*5);
return ResponseMsgUtil.success("短信发送成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/sendUpdatePhoneCode", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "发送修改手机号验证码 {'phone': '手机号'}")
public ResponseData sendUpdatePhoneCode(@RequestBody JSONObject body) {
try {
if (body == null || StringUtils.isBlank(body.getString("phone"))) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
String phone = body.getString("phone");
// 校验手机号格式
if (!MemberValidateUtil.validatePhone(phone)) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号");
}
// 生成随机6位验证码
String smsCode = String.valueOf(new Random().nextInt(899999) + 100000);
// 验证码缓存5分钟
redisUtil.set("SMS_UPDATE_PHONE_CODE:"+phone, 123456, 60*5);
return ResponseMsgUtil.success("短信发送成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}
|
@ -0,0 +1,150 @@ |
|||||||
|
package com.hfkj.controller; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.MemberValidateUtil; |
||||||
|
import com.hfkj.common.utils.RedisUtil; |
||||||
|
import com.hfkj.common.utils.ResponseMsgUtil; |
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.model.ResponseData; |
||||||
|
import com.hfkj.model.SecUserSessionObject; |
||||||
|
import com.hfkj.model.UserSessionObject; |
||||||
|
import com.hfkj.service.user.BsUserService; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Controller; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: ClientController |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
@Controller |
||||||
|
@RequestMapping(value="/user") |
||||||
|
@Api(value="客户端业务") |
||||||
|
public class UserController { |
||||||
|
@Resource |
||||||
|
private BsUserService userService; |
||||||
|
@Resource |
||||||
|
private RedisUtil redisUtil; |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
|
||||||
|
@RequestMapping(value = "/getUser", method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "查询用户信息") |
||||||
|
public ResponseData getUser() { |
||||||
|
try { |
||||||
|
Map<String,Object> param = new HashMap<>(); |
||||||
|
// 用户信息
|
||||||
|
param.put("user", userCenter.getSessionModel(UserSessionObject.class)); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(param); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/bindPhone", method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "绑定手机号") |
||||||
|
public ResponseData bindPhone(@RequestBody JSONObject body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| StringUtils.isBlank(body.getString("phone")) |
||||||
|
|| StringUtils.isBlank(body.getString("smsCode"))) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
||||||
|
if (StringUtils.isNotBlank(userSession.getUser().getPhone())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "手机号已绑定"); |
||||||
|
} |
||||||
|
String phone = body.getString("phone"); |
||||||
|
// 校验手机号格式
|
||||||
|
if (!MemberValidateUtil.validatePhone(phone)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); |
||||||
|
} |
||||||
|
if (StringUtils.isBlank(body.getString("smsCode"))) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); |
||||||
|
} |
||||||
|
// 手机号的验证码
|
||||||
|
Object phoneCodeObject = redisUtil.get("SMS_BIND_PHONE_CODE:" + phone); |
||||||
|
if (phoneCodeObject == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
redisUtil.del("SMS_BIND_PHONE_CODE:" + phone); |
||||||
|
|
||||||
|
// 更新手机号
|
||||||
|
userService.updatePhone(userSession.getUser().getId(), body.getString("phone")); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@RequestMapping(value = "/updatePhone", method = RequestMethod.POST) |
||||||
|
@ResponseBody |
||||||
|
@ApiOperation(value = "修改手机号") |
||||||
|
public ResponseData updatePhone(@RequestBody JSONObject body) { |
||||||
|
try { |
||||||
|
if (body == null |
||||||
|
|| StringUtils.isBlank(body.getString("newPhone")) |
||||||
|
|| StringUtils.isBlank(body.getString("smsCode"))) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
||||||
|
} |
||||||
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
||||||
|
if (StringUtils.isBlank(userSession.getUser().getPhone())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户未绑定手机号"); |
||||||
|
} |
||||||
|
String phone = body.getString("newPhone"); |
||||||
|
if (userSession.getUser().getPhone().equals(phone)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "新手机号与现绑定手机号相同"); |
||||||
|
} |
||||||
|
// 校验手机号格式
|
||||||
|
if (!MemberValidateUtil.validatePhone(phone)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入正确的手机号"); |
||||||
|
} |
||||||
|
if (StringUtils.isBlank(body.getString("smsCode"))) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "请输入短信验证码"); |
||||||
|
} |
||||||
|
// 手机号的验证码
|
||||||
|
Object phoneCodeObject = redisUtil.get("SMS_UPDATE_PHONE_CODE:" + phone); |
||||||
|
if (phoneCodeObject == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
if (!body.getString("smsCode").equals(phoneCodeObject.toString())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "短信验证码错误"); |
||||||
|
} |
||||||
|
redisUtil.del("SMS_UPDATE_PHONE_CODE:" + phone); |
||||||
|
|
||||||
|
// 更新手机号
|
||||||
|
userService.updatePhone(userSession.getUser().getId(), body.getString("phone")); |
||||||
|
|
||||||
|
return ResponseMsgUtil.success(userCenter.getSessionModel(UserSessionObject.class)); |
||||||
|
|
||||||
|
} catch (Exception e) { |
||||||
|
return ResponseMsgUtil.exception(e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,148 @@ |
|||||||
|
package com.hfkj.common.security; |
||||||
|
|
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.utils.RedisUtil; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||||
|
import org.springframework.web.context.request.ServletRequestAttributes; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
|
||||||
|
@Component |
||||||
|
public class SecUserCenter { |
||||||
|
|
||||||
|
private static Logger log = LoggerFactory.getLogger(SecUserCenter.class); |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private RedisUtil redisUtil; |
||||||
|
private final int EXPIRE = 3600 * 24 * 90; // 登录过期时间为90天
|
||||||
|
|
||||||
|
private final static String LOGIN_CACHE_KEY = "SEC_USER_LOGIN:"; |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存登录信息 |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public void save(SessionObject seObj) { |
||||||
|
redisUtil.set(LOGIN_CACHE_KEY+seObj.getToken(), seObj, EXPIRE); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 刷新登录缓存时间 |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public void refresh(HttpServletRequest request) { |
||||||
|
String token = request.getHeader("Authorization"); |
||||||
|
if(StringUtils.isNotBlank(token)) { |
||||||
|
redisUtil.expire(LOGIN_CACHE_KEY+token, EXPIRE); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否登录 |
||||||
|
* @param request |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean isLogin(HttpServletRequest request){ |
||||||
|
String token = request.getHeader("Authorization"); |
||||||
|
if(StringUtils.isBlank(token)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return redisUtil.hasKey(LOGIN_CACHE_KEY+token); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否登录 |
||||||
|
* @param token 账户token |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public boolean isLogin(String token){ |
||||||
|
if(StringUtils.isBlank(token)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return redisUtil.hasKey(LOGIN_CACHE_KEY+token); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 退出登录 |
||||||
|
* @param request |
||||||
|
*/ |
||||||
|
public void remove(HttpServletRequest request) { |
||||||
|
String token = request.getHeader("Authorization"); |
||||||
|
if (StringUtils.isNotBlank(token)) { |
||||||
|
//通过token方式登录
|
||||||
|
redisUtil.del(LOGIN_CACHE_KEY+token); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 退出登录 |
||||||
|
* @param token |
||||||
|
*/ |
||||||
|
public void remove(String token) { |
||||||
|
if (StringUtils.isNotBlank(token)) { |
||||||
|
//通过token方式登录
|
||||||
|
redisUtil.del(LOGIN_CACHE_KEY+token); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取session信息 |
||||||
|
* @param clazz |
||||||
|
* @return |
||||||
|
* @param <E> |
||||||
|
*/ |
||||||
|
public <E> E getSessionModel(Class<E> clazz){ |
||||||
|
if (RequestContextHolder.getRequestAttributes()!=null) { |
||||||
|
HttpServletRequest req = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); |
||||||
|
SessionObject sessionObject = getSessionObject(req); |
||||||
|
if (sessionObject == null){ |
||||||
|
return null; |
||||||
|
} |
||||||
|
if (clazz.equals(sessionObject.getObject().getClass())) { |
||||||
|
return (E)sessionObject.getObject(); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取session信息 |
||||||
|
* @param request |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public SessionObject getSessionObject(HttpServletRequest request) { |
||||||
|
String token = request.getHeader("Authorization"); |
||||||
|
if (StringUtils.isBlank(token)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
Object obj = redisUtil.get(LOGIN_CACHE_KEY+token); |
||||||
|
if (obj == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
return (SessionObject) obj; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 获取session信息 |
||||||
|
* @param token |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public SessionObject getSessionObject(String token) { |
||||||
|
if (StringUtils.isBlank(token)) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
Object obj = redisUtil.get(LOGIN_CACHE_KEY+token); |
||||||
|
if (obj == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
||||||
|
} |
||||||
|
return (SessionObject) obj; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,148 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUserLoginLog; |
||||||
|
import com.hfkj.entity.BsUserLoginLogExample; |
||||||
|
import java.util.List; |
||||||
|
import org.apache.ibatis.annotations.Delete; |
||||||
|
import org.apache.ibatis.annotations.DeleteProvider; |
||||||
|
import org.apache.ibatis.annotations.Insert; |
||||||
|
import org.apache.ibatis.annotations.InsertProvider; |
||||||
|
import org.apache.ibatis.annotations.Options; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Result; |
||||||
|
import org.apache.ibatis.annotations.Results; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
import org.apache.ibatis.annotations.SelectProvider; |
||||||
|
import org.apache.ibatis.annotations.Update; |
||||||
|
import org.apache.ibatis.annotations.UpdateProvider; |
||||||
|
import org.apache.ibatis.type.JdbcType; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成,请勿修改!!! |
||||||
|
* 如果需要扩展请在其父类进行扩展 |
||||||
|
* |
||||||
|
**/ |
||||||
|
@Repository |
||||||
|
public interface BsUserLoginLogMapper extends BsUserLoginLogMapperExt { |
||||||
|
@SelectProvider(type=BsUserLoginLogSqlProvider.class, method="countByExample") |
||||||
|
long countByExample(BsUserLoginLogExample example); |
||||||
|
|
||||||
|
@DeleteProvider(type=BsUserLoginLogSqlProvider.class, method="deleteByExample") |
||||||
|
int deleteByExample(BsUserLoginLogExample example); |
||||||
|
|
||||||
|
@Delete({ |
||||||
|
"delete from bs_user_login_log", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int deleteByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@Insert({ |
||||||
|
"insert into bs_user_login_log (user_id, user_phone, ", |
||||||
|
"login_type_code, login_type_name, ", |
||||||
|
"ip, country, region_id, ", |
||||||
|
"region_name, city_id, ", |
||||||
|
"city_name, isp, `status`, ", |
||||||
|
"remark, create_time, ", |
||||||
|
"ext_1, ext_2, ext_3)", |
||||||
|
"values (#{userId,jdbcType=BIGINT}, #{userPhone,jdbcType=VARCHAR}, ", |
||||||
|
"#{loginTypeCode,jdbcType=VARCHAR}, #{loginTypeName,jdbcType=VARCHAR}, ", |
||||||
|
"#{ip,jdbcType=VARCHAR}, #{country,jdbcType=VARCHAR}, #{regionId,jdbcType=VARCHAR}, ", |
||||||
|
"#{regionName,jdbcType=VARCHAR}, #{cityId,jdbcType=VARCHAR}, ", |
||||||
|
"#{cityName,jdbcType=VARCHAR}, #{isp,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ", |
||||||
|
"#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ", |
||||||
|
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||||
|
}) |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insert(BsUserLoginLog record); |
||||||
|
|
||||||
|
@InsertProvider(type=BsUserLoginLogSqlProvider.class, method="insertSelective") |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insertSelective(BsUserLoginLog record); |
||||||
|
|
||||||
|
@SelectProvider(type=BsUserLoginLogSqlProvider.class, method="selectByExample") |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="login_type_code", property="loginTypeCode", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="login_type_name", property="loginTypeName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="country", property="country", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_id", property="cityId", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="isp", property="isp", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
List<BsUserLoginLog> selectByExample(BsUserLoginLogExample example); |
||||||
|
|
||||||
|
@Select({ |
||||||
|
"select", |
||||||
|
"id, user_id, user_phone, login_type_code, login_type_name, ip, country, region_id, ", |
||||||
|
"region_name, city_id, city_name, isp, `status`, remark, create_time, ext_1, ", |
||||||
|
"ext_2, ext_3", |
||||||
|
"from bs_user_login_log", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="login_type_code", property="loginTypeCode", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="login_type_name", property="loginTypeName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ip", property="ip", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="country", property="country", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="region_id", property="regionId", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_id", property="cityId", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="isp", property="isp", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
BsUserLoginLog selectByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByExampleSelective") |
||||||
|
int updateByExampleSelective(@Param("record") BsUserLoginLog record, @Param("example") BsUserLoginLogExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByExample") |
||||||
|
int updateByExample(@Param("record") BsUserLoginLog record, @Param("example") BsUserLoginLogExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserLoginLogSqlProvider.class, method="updateByPrimaryKeySelective") |
||||||
|
int updateByPrimaryKeySelective(BsUserLoginLog record); |
||||||
|
|
||||||
|
@Update({ |
||||||
|
"update bs_user_login_log", |
||||||
|
"set user_id = #{userId,jdbcType=BIGINT},", |
||||||
|
"user_phone = #{userPhone,jdbcType=VARCHAR},", |
||||||
|
"login_type_code = #{loginTypeCode,jdbcType=VARCHAR},", |
||||||
|
"login_type_name = #{loginTypeName,jdbcType=VARCHAR},", |
||||||
|
"ip = #{ip,jdbcType=VARCHAR},", |
||||||
|
"country = #{country,jdbcType=VARCHAR},", |
||||||
|
"region_id = #{regionId,jdbcType=VARCHAR},", |
||||||
|
"region_name = #{regionName,jdbcType=VARCHAR},", |
||||||
|
"city_id = #{cityId,jdbcType=VARCHAR},", |
||||||
|
"city_name = #{cityName,jdbcType=VARCHAR},", |
||||||
|
"isp = #{isp,jdbcType=VARCHAR},", |
||||||
|
"`status` = #{status,jdbcType=INTEGER},", |
||||||
|
"remark = #{remark,jdbcType=VARCHAR},", |
||||||
|
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||||
|
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||||
|
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||||
|
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int updateByPrimaryKey(BsUserLoginLog record); |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
/** |
||||||
|
* mapper扩展类 |
||||||
|
*/ |
||||||
|
public interface BsUserLoginLogMapperExt { |
||||||
|
} |
@ -0,0 +1,416 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUserLoginLog; |
||||||
|
import com.hfkj.entity.BsUserLoginLogExample.Criteria; |
||||||
|
import com.hfkj.entity.BsUserLoginLogExample.Criterion; |
||||||
|
import com.hfkj.entity.BsUserLoginLogExample; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import org.apache.ibatis.jdbc.SQL; |
||||||
|
|
||||||
|
public class BsUserLoginLogSqlProvider { |
||||||
|
|
||||||
|
public String countByExample(BsUserLoginLogExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.SELECT("count(*)").FROM("bs_user_login_log"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String deleteByExample(BsUserLoginLogExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.DELETE_FROM("bs_user_login_log"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String insertSelective(BsUserLoginLog record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.INSERT_INTO("bs_user_login_log"); |
||||||
|
|
||||||
|
if (record.getUserId() != null) { |
||||||
|
sql.VALUES("user_id", "#{userId,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUserPhone() != null) { |
||||||
|
sql.VALUES("user_phone", "#{userPhone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeCode() != null) { |
||||||
|
sql.VALUES("login_type_code", "#{loginTypeCode,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeName() != null) { |
||||||
|
sql.VALUES("login_type_name", "#{loginTypeName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIp() != null) { |
||||||
|
sql.VALUES("ip", "#{ip,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCountry() != null) { |
||||||
|
sql.VALUES("country", "#{country,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionId() != null) { |
||||||
|
sql.VALUES("region_id", "#{regionId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionName() != null) { |
||||||
|
sql.VALUES("region_name", "#{regionName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityId() != null) { |
||||||
|
sql.VALUES("city_id", "#{cityId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.VALUES("city_name", "#{cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIsp() != null) { |
||||||
|
sql.VALUES("isp", "#{isp,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRemark() != null) { |
||||||
|
sql.VALUES("remark", "#{remark,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String selectByExample(BsUserLoginLogExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
if (example != null && example.isDistinct()) { |
||||||
|
sql.SELECT_DISTINCT("id"); |
||||||
|
} else { |
||||||
|
sql.SELECT("id"); |
||||||
|
} |
||||||
|
sql.SELECT("user_id"); |
||||||
|
sql.SELECT("user_phone"); |
||||||
|
sql.SELECT("login_type_code"); |
||||||
|
sql.SELECT("login_type_name"); |
||||||
|
sql.SELECT("ip"); |
||||||
|
sql.SELECT("country"); |
||||||
|
sql.SELECT("region_id"); |
||||||
|
sql.SELECT("region_name"); |
||||||
|
sql.SELECT("city_id"); |
||||||
|
sql.SELECT("city_name"); |
||||||
|
sql.SELECT("isp"); |
||||||
|
sql.SELECT("`status`"); |
||||||
|
sql.SELECT("remark"); |
||||||
|
sql.SELECT("create_time"); |
||||||
|
sql.SELECT("ext_1"); |
||||||
|
sql.SELECT("ext_2"); |
||||||
|
sql.SELECT("ext_3"); |
||||||
|
sql.FROM("bs_user_login_log"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
|
||||||
|
if (example != null && example.getOrderByClause() != null) { |
||||||
|
sql.ORDER_BY(example.getOrderByClause()); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||||
|
BsUserLoginLog record = (BsUserLoginLog) parameter.get("record"); |
||||||
|
BsUserLoginLogExample example = (BsUserLoginLogExample) parameter.get("example"); |
||||||
|
|
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user_login_log"); |
||||||
|
|
||||||
|
if (record.getId() != null) { |
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUserId() != null) { |
||||||
|
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUserPhone() != null) { |
||||||
|
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeCode() != null) { |
||||||
|
sql.SET("login_type_code = #{record.loginTypeCode,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeName() != null) { |
||||||
|
sql.SET("login_type_name = #{record.loginTypeName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIp() != null) { |
||||||
|
sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCountry() != null) { |
||||||
|
sql.SET("country = #{record.country,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionId() != null) { |
||||||
|
sql.SET("region_id = #{record.regionId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionName() != null) { |
||||||
|
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityId() != null) { |
||||||
|
sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIsp() != null) { |
||||||
|
sql.SET("isp = #{record.isp,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRemark() != null) { |
||||||
|
sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExample(Map<String, Object> parameter) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user_login_log"); |
||||||
|
|
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
sql.SET("user_id = #{record.userId,jdbcType=BIGINT}"); |
||||||
|
sql.SET("user_phone = #{record.userPhone,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("login_type_code = #{record.loginTypeCode,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("login_type_name = #{record.loginTypeName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ip = #{record.ip,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("country = #{record.country,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("region_id = #{record.regionId,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("region_name = #{record.regionName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("city_id = #{record.cityId,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("isp = #{record.isp,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||||
|
sql.SET("remark = #{record.remark,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
|
||||||
|
BsUserLoginLogExample example = (BsUserLoginLogExample) parameter.get("example"); |
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByPrimaryKeySelective(BsUserLoginLog record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user_login_log"); |
||||||
|
|
||||||
|
if (record.getUserId() != null) { |
||||||
|
sql.SET("user_id = #{userId,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUserPhone() != null) { |
||||||
|
sql.SET("user_phone = #{userPhone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeCode() != null) { |
||||||
|
sql.SET("login_type_code = #{loginTypeCode,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getLoginTypeName() != null) { |
||||||
|
sql.SET("login_type_name = #{loginTypeName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIp() != null) { |
||||||
|
sql.SET("ip = #{ip,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCountry() != null) { |
||||||
|
sql.SET("country = #{country,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionId() != null) { |
||||||
|
sql.SET("region_id = #{regionId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRegionName() != null) { |
||||||
|
sql.SET("region_name = #{regionName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityId() != null) { |
||||||
|
sql.SET("city_id = #{cityId,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.SET("city_name = #{cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getIsp() != null) { |
||||||
|
sql.SET("isp = #{isp,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getRemark() != null) { |
||||||
|
sql.SET("remark = #{remark,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void applyWhere(SQL sql, BsUserLoginLogExample example, boolean includeExamplePhrase) { |
||||||
|
if (example == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
String parmPhrase1; |
||||||
|
String parmPhrase1_th; |
||||||
|
String parmPhrase2; |
||||||
|
String parmPhrase2_th; |
||||||
|
String parmPhrase3; |
||||||
|
String parmPhrase3_th; |
||||||
|
if (includeExamplePhrase) { |
||||||
|
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} else { |
||||||
|
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} |
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||||
|
boolean firstCriteria = true; |
||||||
|
for (int i = 0; i < oredCriteria.size(); i++) { |
||||||
|
Criteria criteria = oredCriteria.get(i); |
||||||
|
if (criteria.isValid()) { |
||||||
|
if (firstCriteria) { |
||||||
|
firstCriteria = false; |
||||||
|
} else { |
||||||
|
sb.append(" or "); |
||||||
|
} |
||||||
|
|
||||||
|
sb.append('('); |
||||||
|
List<Criterion> criterions = criteria.getAllCriteria(); |
||||||
|
boolean firstCriterion = true; |
||||||
|
for (int j = 0; j < criterions.size(); j++) { |
||||||
|
Criterion criterion = criterions.get(j); |
||||||
|
if (firstCriterion) { |
||||||
|
firstCriterion = false; |
||||||
|
} else { |
||||||
|
sb.append(" and "); |
||||||
|
} |
||||||
|
|
||||||
|
if (criterion.isNoValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
} else if (criterion.isSingleValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isBetweenValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isListValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
sb.append(" ("); |
||||||
|
List<?> listItems = (List<?>) criterion.getValue(); |
||||||
|
boolean comma = false; |
||||||
|
for (int k = 0; k < listItems.size(); k++) { |
||||||
|
if (comma) { |
||||||
|
sb.append(", "); |
||||||
|
} else { |
||||||
|
comma = true; |
||||||
|
} |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase3, i, j, k)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (sb.length() > 0) { |
||||||
|
sql.WHERE(sb.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,120 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserExample; |
||||||
|
import java.util.List; |
||||||
|
import org.apache.ibatis.annotations.Delete; |
||||||
|
import org.apache.ibatis.annotations.DeleteProvider; |
||||||
|
import org.apache.ibatis.annotations.Insert; |
||||||
|
import org.apache.ibatis.annotations.InsertProvider; |
||||||
|
import org.apache.ibatis.annotations.Options; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Result; |
||||||
|
import org.apache.ibatis.annotations.Results; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
import org.apache.ibatis.annotations.SelectProvider; |
||||||
|
import org.apache.ibatis.annotations.Update; |
||||||
|
import org.apache.ibatis.annotations.UpdateProvider; |
||||||
|
import org.apache.ibatis.type.JdbcType; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成,请勿修改!!! |
||||||
|
* 如果需要扩展请在其父类进行扩展 |
||||||
|
* |
||||||
|
**/ |
||||||
|
@Repository |
||||||
|
public interface BsUserMapper extends BsUserMapperExt { |
||||||
|
@SelectProvider(type=BsUserSqlProvider.class, method="countByExample") |
||||||
|
long countByExample(BsUserExample example); |
||||||
|
|
||||||
|
@DeleteProvider(type=BsUserSqlProvider.class, method="deleteByExample") |
||||||
|
int deleteByExample(BsUserExample example); |
||||||
|
|
||||||
|
@Delete({ |
||||||
|
"delete from bs_user", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int deleteByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@Insert({ |
||||||
|
"insert into bs_user (head_img, `name`, ", |
||||||
|
"phone, grade, `status`, ", |
||||||
|
"create_time, update_time, ", |
||||||
|
"ext_1, ext_2, ext_3)", |
||||||
|
"values (#{headImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", |
||||||
|
"#{phone,jdbcType=VARCHAR}, #{grade,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, ", |
||||||
|
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||||
|
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||||
|
}) |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insert(BsUser record); |
||||||
|
|
||||||
|
@InsertProvider(type=BsUserSqlProvider.class, method="insertSelective") |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insertSelective(BsUser record); |
||||||
|
|
||||||
|
@SelectProvider(type=BsUserSqlProvider.class, method="selectByExample") |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="head_img", property="headImg", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
List<BsUser> selectByExample(BsUserExample example); |
||||||
|
|
||||||
|
@Select({ |
||||||
|
"select", |
||||||
|
"id, head_img, `name`, phone, grade, `status`, create_time, update_time, ext_1, ", |
||||||
|
"ext_2, ext_3", |
||||||
|
"from bs_user", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="head_img", property="headImg", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="phone", property="phone", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="grade", property="grade", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), |
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
BsUser selectByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserSqlProvider.class, method="updateByExampleSelective") |
||||||
|
int updateByExampleSelective(@Param("record") BsUser record, @Param("example") BsUserExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserSqlProvider.class, method="updateByExample") |
||||||
|
int updateByExample(@Param("record") BsUser record, @Param("example") BsUserExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=BsUserSqlProvider.class, method="updateByPrimaryKeySelective") |
||||||
|
int updateByPrimaryKeySelective(BsUser record); |
||||||
|
|
||||||
|
@Update({ |
||||||
|
"update bs_user", |
||||||
|
"set head_img = #{headImg,jdbcType=VARCHAR},", |
||||||
|
"`name` = #{name,jdbcType=VARCHAR},", |
||||||
|
"phone = #{phone,jdbcType=VARCHAR},", |
||||||
|
"grade = #{grade,jdbcType=INTEGER},", |
||||||
|
"`status` = #{status,jdbcType=INTEGER},", |
||||||
|
"create_time = #{createTime,jdbcType=TIMESTAMP},", |
||||||
|
"update_time = #{updateTime,jdbcType=TIMESTAMP},", |
||||||
|
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||||
|
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||||
|
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int updateByPrimaryKey(BsUser record); |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
/** |
||||||
|
* mapper扩展类 |
||||||
|
*/ |
||||||
|
public interface BsUserMapperExt { |
||||||
|
} |
@ -0,0 +1,318 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserExample.Criteria; |
||||||
|
import com.hfkj.entity.BsUserExample.Criterion; |
||||||
|
import com.hfkj.entity.BsUserExample; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import org.apache.ibatis.jdbc.SQL; |
||||||
|
|
||||||
|
public class BsUserSqlProvider { |
||||||
|
|
||||||
|
public String countByExample(BsUserExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.SELECT("count(*)").FROM("bs_user"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String deleteByExample(BsUserExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.DELETE_FROM("bs_user"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String insertSelective(BsUser record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.INSERT_INTO("bs_user"); |
||||||
|
|
||||||
|
if (record.getHeadImg() != null) { |
||||||
|
sql.VALUES("head_img", "#{headImg,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getName() != null) { |
||||||
|
sql.VALUES("`name`", "#{name,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getPhone() != null) { |
||||||
|
sql.VALUES("phone", "#{phone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getGrade() != null) { |
||||||
|
sql.VALUES("grade", "#{grade,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.VALUES("`status`", "#{status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUpdateTime() != null) { |
||||||
|
sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String selectByExample(BsUserExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
if (example != null && example.isDistinct()) { |
||||||
|
sql.SELECT_DISTINCT("id"); |
||||||
|
} else { |
||||||
|
sql.SELECT("id"); |
||||||
|
} |
||||||
|
sql.SELECT("head_img"); |
||||||
|
sql.SELECT("`name`"); |
||||||
|
sql.SELECT("phone"); |
||||||
|
sql.SELECT("grade"); |
||||||
|
sql.SELECT("`status`"); |
||||||
|
sql.SELECT("create_time"); |
||||||
|
sql.SELECT("update_time"); |
||||||
|
sql.SELECT("ext_1"); |
||||||
|
sql.SELECT("ext_2"); |
||||||
|
sql.SELECT("ext_3"); |
||||||
|
sql.FROM("bs_user"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
|
||||||
|
if (example != null && example.getOrderByClause() != null) { |
||||||
|
sql.ORDER_BY(example.getOrderByClause()); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||||
|
BsUser record = (BsUser) parameter.get("record"); |
||||||
|
BsUserExample example = (BsUserExample) parameter.get("example"); |
||||||
|
|
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user"); |
||||||
|
|
||||||
|
if (record.getId() != null) { |
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getHeadImg() != null) { |
||||||
|
sql.SET("head_img = #{record.headImg,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getName() != null) { |
||||||
|
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getPhone() != null) { |
||||||
|
sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getGrade() != null) { |
||||||
|
sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUpdateTime() != null) { |
||||||
|
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExample(Map<String, Object> parameter) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user"); |
||||||
|
|
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
sql.SET("head_img = #{record.headImg,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("`name` = #{record.name,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("phone = #{record.phone,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("grade = #{record.grade,jdbcType=INTEGER}"); |
||||||
|
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); |
||||||
|
sql.SET("create_time = #{record.createTime,jdbcType=TIMESTAMP}"); |
||||||
|
sql.SET("update_time = #{record.updateTime,jdbcType=TIMESTAMP}"); |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
|
||||||
|
BsUserExample example = (BsUserExample) parameter.get("example"); |
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByPrimaryKeySelective(BsUser record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("bs_user"); |
||||||
|
|
||||||
|
if (record.getHeadImg() != null) { |
||||||
|
sql.SET("head_img = #{headImg,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getName() != null) { |
||||||
|
sql.SET("`name` = #{name,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getPhone() != null) { |
||||||
|
sql.SET("phone = #{phone,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getGrade() != null) { |
||||||
|
sql.SET("grade = #{grade,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getStatus() != null) { |
||||||
|
sql.SET("`status` = #{status,jdbcType=INTEGER}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCreateTime() != null) { |
||||||
|
sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getUpdateTime() != null) { |
||||||
|
sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void applyWhere(SQL sql, BsUserExample example, boolean includeExamplePhrase) { |
||||||
|
if (example == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
String parmPhrase1; |
||||||
|
String parmPhrase1_th; |
||||||
|
String parmPhrase2; |
||||||
|
String parmPhrase2_th; |
||||||
|
String parmPhrase3; |
||||||
|
String parmPhrase3_th; |
||||||
|
if (includeExamplePhrase) { |
||||||
|
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} else { |
||||||
|
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} |
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||||
|
boolean firstCriteria = true; |
||||||
|
for (int i = 0; i < oredCriteria.size(); i++) { |
||||||
|
Criteria criteria = oredCriteria.get(i); |
||||||
|
if (criteria.isValid()) { |
||||||
|
if (firstCriteria) { |
||||||
|
firstCriteria = false; |
||||||
|
} else { |
||||||
|
sb.append(" or "); |
||||||
|
} |
||||||
|
|
||||||
|
sb.append('('); |
||||||
|
List<Criterion> criterions = criteria.getAllCriteria(); |
||||||
|
boolean firstCriterion = true; |
||||||
|
for (int j = 0; j < criterions.size(); j++) { |
||||||
|
Criterion criterion = criterions.get(j); |
||||||
|
if (firstCriterion) { |
||||||
|
firstCriterion = false; |
||||||
|
} else { |
||||||
|
sb.append(" and "); |
||||||
|
} |
||||||
|
|
||||||
|
if (criterion.isNoValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
} else if (criterion.isSingleValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isBetweenValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isListValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
sb.append(" ("); |
||||||
|
List<?> listItems = (List<?>) criterion.getValue(); |
||||||
|
boolean comma = false; |
||||||
|
for (int k = 0; k < listItems.size(); k++) { |
||||||
|
if (comma) { |
||||||
|
sb.append(", "); |
||||||
|
} else { |
||||||
|
comma = true; |
||||||
|
} |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase3, i, j, k)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (sb.length() > 0) { |
||||||
|
sql.WHERE(sb.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,216 @@ |
|||||||
|
package com.hfkj.entity; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* bs_user |
||||||
|
* @author |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成 |
||||||
|
* |
||||||
|
**/ |
||||||
|
public class BsUser implements Serializable { |
||||||
|
/** |
||||||
|
* 主键 |
||||||
|
*/ |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 头像 |
||||||
|
*/ |
||||||
|
private String headImg; |
||||||
|
|
||||||
|
/** |
||||||
|
* 名称 |
||||||
|
*/ |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* 手机号 |
||||||
|
*/ |
||||||
|
private String phone; |
||||||
|
|
||||||
|
/** |
||||||
|
* 等级 1:见习会员 2:正式会员 3:团长 4:渠道 |
||||||
|
*/ |
||||||
|
private Integer grade; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 0:删除 1:正常 2:禁用 |
||||||
|
*/ |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改时间 |
||||||
|
*/ |
||||||
|
private Date updateTime; |
||||||
|
|
||||||
|
private String ext1; |
||||||
|
|
||||||
|
private String ext2; |
||||||
|
|
||||||
|
private String ext3; |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
public Long getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(Long id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public String getHeadImg() { |
||||||
|
return headImg; |
||||||
|
} |
||||||
|
|
||||||
|
public void setHeadImg(String headImg) { |
||||||
|
this.headImg = headImg; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public String getPhone() { |
||||||
|
return phone; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPhone(String phone) { |
||||||
|
this.phone = phone; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getGrade() { |
||||||
|
return grade; |
||||||
|
} |
||||||
|
|
||||||
|
public void setGrade(Integer grade) { |
||||||
|
this.grade = grade; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getStatus() { |
||||||
|
return status; |
||||||
|
} |
||||||
|
|
||||||
|
public void setStatus(Integer status) { |
||||||
|
this.status = status; |
||||||
|
} |
||||||
|
|
||||||
|
public Date getCreateTime() { |
||||||
|
return createTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) { |
||||||
|
this.createTime = createTime; |
||||||
|
} |
||||||
|
|
||||||
|
public Date getUpdateTime() { |
||||||
|
return updateTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) { |
||||||
|
this.updateTime = updateTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt1() { |
||||||
|
return ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt1(String ext1) { |
||||||
|
this.ext1 = ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt2() { |
||||||
|
return ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt2(String ext2) { |
||||||
|
this.ext2 = ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt3() { |
||||||
|
return ext3; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt3(String ext3) { |
||||||
|
this.ext3 = ext3; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object that) { |
||||||
|
if (this == that) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
if (that == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (getClass() != that.getClass()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
BsUser other = (BsUser) that; |
||||||
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||||
|
&& (this.getHeadImg() == null ? other.getHeadImg() == null : this.getHeadImg().equals(other.getHeadImg())) |
||||||
|
&& (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName())) |
||||||
|
&& (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone())) |
||||||
|
&& (this.getGrade() == null ? other.getGrade() == null : this.getGrade().equals(other.getGrade())) |
||||||
|
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||||
|
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||||
|
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime())) |
||||||
|
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||||
|
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||||
|
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int hashCode() { |
||||||
|
final int prime = 31; |
||||||
|
int result = 1; |
||||||
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||||
|
result = prime * result + ((getHeadImg() == null) ? 0 : getHeadImg().hashCode()); |
||||||
|
result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); |
||||||
|
result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode()); |
||||||
|
result = prime * result + ((getGrade() == null) ? 0 : getGrade().hashCode()); |
||||||
|
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||||
|
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||||
|
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode()); |
||||||
|
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||||
|
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||||
|
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
sb.append(getClass().getSimpleName()); |
||||||
|
sb.append(" ["); |
||||||
|
sb.append("Hash = ").append(hashCode()); |
||||||
|
sb.append(", id=").append(id); |
||||||
|
sb.append(", headImg=").append(headImg); |
||||||
|
sb.append(", name=").append(name); |
||||||
|
sb.append(", phone=").append(phone); |
||||||
|
sb.append(", grade=").append(grade); |
||||||
|
sb.append(", status=").append(status); |
||||||
|
sb.append(", createTime=").append(createTime); |
||||||
|
sb.append(", updateTime=").append(updateTime); |
||||||
|
sb.append(", ext1=").append(ext1); |
||||||
|
sb.append(", ext2=").append(ext2); |
||||||
|
sb.append(", ext3=").append(ext3); |
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||||
|
sb.append("]"); |
||||||
|
return sb.toString(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,943 @@ |
|||||||
|
package com.hfkj.entity; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class BsUserExample { |
||||||
|
protected String orderByClause; |
||||||
|
|
||||||
|
protected boolean distinct; |
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria; |
||||||
|
|
||||||
|
private Integer limit; |
||||||
|
|
||||||
|
private Long offset; |
||||||
|
|
||||||
|
public BsUserExample() { |
||||||
|
oredCriteria = new ArrayList<Criteria>(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setOrderByClause(String orderByClause) { |
||||||
|
this.orderByClause = orderByClause; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOrderByClause() { |
||||||
|
return orderByClause; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDistinct(boolean distinct) { |
||||||
|
this.distinct = distinct; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isDistinct() { |
||||||
|
return distinct; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criteria> getOredCriteria() { |
||||||
|
return oredCriteria; |
||||||
|
} |
||||||
|
|
||||||
|
public void or(Criteria criteria) { |
||||||
|
oredCriteria.add(criteria); |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria or() { |
||||||
|
Criteria criteria = createCriteriaInternal(); |
||||||
|
oredCriteria.add(criteria); |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria createCriteria() { |
||||||
|
Criteria criteria = createCriteriaInternal(); |
||||||
|
if (oredCriteria.size() == 0) { |
||||||
|
oredCriteria.add(criteria); |
||||||
|
} |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criteria createCriteriaInternal() { |
||||||
|
Criteria criteria = new Criteria(); |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public void clear() { |
||||||
|
oredCriteria.clear(); |
||||||
|
orderByClause = null; |
||||||
|
distinct = false; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLimit(Integer limit) { |
||||||
|
this.limit = limit; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getLimit() { |
||||||
|
return limit; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOffset(Long offset) { |
||||||
|
this.offset = offset; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getOffset() { |
||||||
|
return offset; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract static class GeneratedCriteria { |
||||||
|
protected List<Criterion> criteria; |
||||||
|
|
||||||
|
protected GeneratedCriteria() { |
||||||
|
super(); |
||||||
|
criteria = new ArrayList<Criterion>(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isValid() { |
||||||
|
return criteria.size() > 0; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criterion> getAllCriteria() { |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criterion> getCriteria() { |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition) { |
||||||
|
if (condition == null) { |
||||||
|
throw new RuntimeException("Value for condition cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition)); |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value, String property) { |
||||||
|
if (value == null) { |
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition, value)); |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) { |
||||||
|
if (value1 == null || value2 == null) { |
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition, value1, value2)); |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIsNull() { |
||||||
|
addCriterion("id is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIsNotNull() { |
||||||
|
addCriterion("id is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdEqualTo(Long value) { |
||||||
|
addCriterion("id =", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotEqualTo(Long value) { |
||||||
|
addCriterion("id <>", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdGreaterThan(Long value) { |
||||||
|
addCriterion("id >", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
||||||
|
addCriterion("id >=", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdLessThan(Long value) { |
||||||
|
addCriterion("id <", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdLessThanOrEqualTo(Long value) { |
||||||
|
addCriterion("id <=", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIn(List<Long> values) { |
||||||
|
addCriterion("id in", values, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotIn(List<Long> values) { |
||||||
|
addCriterion("id not in", values, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdBetween(Long value1, Long value2) { |
||||||
|
addCriterion("id between", value1, value2, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotBetween(Long value1, Long value2) { |
||||||
|
addCriterion("id not between", value1, value2, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgIsNull() { |
||||||
|
addCriterion("head_img is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgIsNotNull() { |
||||||
|
addCriterion("head_img is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgEqualTo(String value) { |
||||||
|
addCriterion("head_img =", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgNotEqualTo(String value) { |
||||||
|
addCriterion("head_img <>", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgGreaterThan(String value) { |
||||||
|
addCriterion("head_img >", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("head_img >=", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgLessThan(String value) { |
||||||
|
addCriterion("head_img <", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("head_img <=", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgLike(String value) { |
||||||
|
addCriterion("head_img like", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgNotLike(String value) { |
||||||
|
addCriterion("head_img not like", value, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgIn(List<String> values) { |
||||||
|
addCriterion("head_img in", values, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgNotIn(List<String> values) { |
||||||
|
addCriterion("head_img not in", values, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgBetween(String value1, String value2) { |
||||||
|
addCriterion("head_img between", value1, value2, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andHeadImgNotBetween(String value1, String value2) { |
||||||
|
addCriterion("head_img not between", value1, value2, "headImg"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameIsNull() { |
||||||
|
addCriterion("`name` is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameIsNotNull() { |
||||||
|
addCriterion("`name` is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameEqualTo(String value) { |
||||||
|
addCriterion("`name` =", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameNotEqualTo(String value) { |
||||||
|
addCriterion("`name` <>", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameGreaterThan(String value) { |
||||||
|
addCriterion("`name` >", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("`name` >=", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameLessThan(String value) { |
||||||
|
addCriterion("`name` <", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("`name` <=", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameLike(String value) { |
||||||
|
addCriterion("`name` like", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameNotLike(String value) { |
||||||
|
addCriterion("`name` not like", value, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameIn(List<String> values) { |
||||||
|
addCriterion("`name` in", values, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameNotIn(List<String> values) { |
||||||
|
addCriterion("`name` not in", values, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameBetween(String value1, String value2) { |
||||||
|
addCriterion("`name` between", value1, value2, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andNameNotBetween(String value1, String value2) { |
||||||
|
addCriterion("`name` not between", value1, value2, "name"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneIsNull() { |
||||||
|
addCriterion("phone is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneIsNotNull() { |
||||||
|
addCriterion("phone is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneEqualTo(String value) { |
||||||
|
addCriterion("phone =", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneNotEqualTo(String value) { |
||||||
|
addCriterion("phone <>", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneGreaterThan(String value) { |
||||||
|
addCriterion("phone >", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("phone >=", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneLessThan(String value) { |
||||||
|
addCriterion("phone <", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("phone <=", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneLike(String value) { |
||||||
|
addCriterion("phone like", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneNotLike(String value) { |
||||||
|
addCriterion("phone not like", value, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneIn(List<String> values) { |
||||||
|
addCriterion("phone in", values, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneNotIn(List<String> values) { |
||||||
|
addCriterion("phone not in", values, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneBetween(String value1, String value2) { |
||||||
|
addCriterion("phone between", value1, value2, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andPhoneNotBetween(String value1, String value2) { |
||||||
|
addCriterion("phone not between", value1, value2, "phone"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeIsNull() { |
||||||
|
addCriterion("grade is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeIsNotNull() { |
||||||
|
addCriterion("grade is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeEqualTo(Integer value) { |
||||||
|
addCriterion("grade =", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeNotEqualTo(Integer value) { |
||||||
|
addCriterion("grade <>", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeGreaterThan(Integer value) { |
||||||
|
addCriterion("grade >", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeGreaterThanOrEqualTo(Integer value) { |
||||||
|
addCriterion("grade >=", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeLessThan(Integer value) { |
||||||
|
addCriterion("grade <", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeLessThanOrEqualTo(Integer value) { |
||||||
|
addCriterion("grade <=", value, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeIn(List<Integer> values) { |
||||||
|
addCriterion("grade in", values, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeNotIn(List<Integer> values) { |
||||||
|
addCriterion("grade not in", values, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeBetween(Integer value1, Integer value2) { |
||||||
|
addCriterion("grade between", value1, value2, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andGradeNotBetween(Integer value1, Integer value2) { |
||||||
|
addCriterion("grade not between", value1, value2, "grade"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusIsNull() { |
||||||
|
addCriterion("`status` is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusIsNotNull() { |
||||||
|
addCriterion("`status` is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusEqualTo(Integer value) { |
||||||
|
addCriterion("`status` =", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusNotEqualTo(Integer value) { |
||||||
|
addCriterion("`status` <>", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusGreaterThan(Integer value) { |
||||||
|
addCriterion("`status` >", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusGreaterThanOrEqualTo(Integer value) { |
||||||
|
addCriterion("`status` >=", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusLessThan(Integer value) { |
||||||
|
addCriterion("`status` <", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusLessThanOrEqualTo(Integer value) { |
||||||
|
addCriterion("`status` <=", value, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusIn(List<Integer> values) { |
||||||
|
addCriterion("`status` in", values, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusNotIn(List<Integer> values) { |
||||||
|
addCriterion("`status` not in", values, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusBetween(Integer value1, Integer value2) { |
||||||
|
addCriterion("`status` between", value1, value2, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andStatusNotBetween(Integer value1, Integer value2) { |
||||||
|
addCriterion("`status` not between", value1, value2, "status"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNull() { |
||||||
|
addCriterion("create_time is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeIsNotNull() { |
||||||
|
addCriterion("create_time is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeEqualTo(Date value) { |
||||||
|
addCriterion("create_time =", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeNotEqualTo(Date value) { |
||||||
|
addCriterion("create_time <>", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThan(Date value) { |
||||||
|
addCriterion("create_time >", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { |
||||||
|
addCriterion("create_time >=", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThan(Date value) { |
||||||
|
addCriterion("create_time <", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeLessThanOrEqualTo(Date value) { |
||||||
|
addCriterion("create_time <=", value, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeIn(List<Date> values) { |
||||||
|
addCriterion("create_time in", values, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeNotIn(List<Date> values) { |
||||||
|
addCriterion("create_time not in", values, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeBetween(Date value1, Date value2) { |
||||||
|
addCriterion("create_time between", value1, value2, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCreateTimeNotBetween(Date value1, Date value2) { |
||||||
|
addCriterion("create_time not between", value1, value2, "createTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeIsNull() { |
||||||
|
addCriterion("update_time is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeIsNotNull() { |
||||||
|
addCriterion("update_time is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeEqualTo(Date value) { |
||||||
|
addCriterion("update_time =", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotEqualTo(Date value) { |
||||||
|
addCriterion("update_time <>", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeGreaterThan(Date value) { |
||||||
|
addCriterion("update_time >", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { |
||||||
|
addCriterion("update_time >=", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeLessThan(Date value) { |
||||||
|
addCriterion("update_time <", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { |
||||||
|
addCriterion("update_time <=", value, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeIn(List<Date> values) { |
||||||
|
addCriterion("update_time in", values, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotIn(List<Date> values) { |
||||||
|
addCriterion("update_time not in", values, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeBetween(Date value1, Date value2) { |
||||||
|
addCriterion("update_time between", value1, value2, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { |
||||||
|
addCriterion("update_time not between", value1, value2, "updateTime"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1IsNull() { |
||||||
|
addCriterion("ext_1 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1IsNotNull() { |
||||||
|
addCriterion("ext_1 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1EqualTo(String value) { |
||||||
|
addCriterion("ext_1 =", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotEqualTo(String value) { |
||||||
|
addCriterion("ext_1 <>", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1GreaterThan(String value) { |
||||||
|
addCriterion("ext_1 >", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_1 >=", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1LessThan(String value) { |
||||||
|
addCriterion("ext_1 <", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_1 <=", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1Like(String value) { |
||||||
|
addCriterion("ext_1 like", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotLike(String value) { |
||||||
|
addCriterion("ext_1 not like", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1In(List<String> values) { |
||||||
|
addCriterion("ext_1 in", values, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotIn(List<String> values) { |
||||||
|
addCriterion("ext_1 not in", values, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1Between(String value1, String value2) { |
||||||
|
addCriterion("ext_1 between", value1, value2, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_1 not between", value1, value2, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2IsNull() { |
||||||
|
addCriterion("ext_2 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2IsNotNull() { |
||||||
|
addCriterion("ext_2 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2EqualTo(String value) { |
||||||
|
addCriterion("ext_2 =", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotEqualTo(String value) { |
||||||
|
addCriterion("ext_2 <>", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2GreaterThan(String value) { |
||||||
|
addCriterion("ext_2 >", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_2 >=", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2LessThan(String value) { |
||||||
|
addCriterion("ext_2 <", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_2 <=", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2Like(String value) { |
||||||
|
addCriterion("ext_2 like", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotLike(String value) { |
||||||
|
addCriterion("ext_2 not like", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2In(List<String> values) { |
||||||
|
addCriterion("ext_2 in", values, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotIn(List<String> values) { |
||||||
|
addCriterion("ext_2 not in", values, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2Between(String value1, String value2) { |
||||||
|
addCriterion("ext_2 between", value1, value2, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_2 not between", value1, value2, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3IsNull() { |
||||||
|
addCriterion("ext_3 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3IsNotNull() { |
||||||
|
addCriterion("ext_3 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3EqualTo(String value) { |
||||||
|
addCriterion("ext_3 =", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotEqualTo(String value) { |
||||||
|
addCriterion("ext_3 <>", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3GreaterThan(String value) { |
||||||
|
addCriterion("ext_3 >", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_3 >=", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3LessThan(String value) { |
||||||
|
addCriterion("ext_3 <", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_3 <=", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3Like(String value) { |
||||||
|
addCriterion("ext_3 like", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotLike(String value) { |
||||||
|
addCriterion("ext_3 not like", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3In(List<String> values) { |
||||||
|
addCriterion("ext_3 in", values, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotIn(List<String> values) { |
||||||
|
addCriterion("ext_3 not in", values, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3Between(String value1, String value2) { |
||||||
|
addCriterion("ext_3 between", value1, value2, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_3 not between", value1, value2, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*/ |
||||||
|
public static class Criteria extends GeneratedCriteria { |
||||||
|
|
||||||
|
protected Criteria() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static class Criterion { |
||||||
|
private String condition; |
||||||
|
|
||||||
|
private Object value; |
||||||
|
|
||||||
|
private Object secondValue; |
||||||
|
|
||||||
|
private boolean noValue; |
||||||
|
|
||||||
|
private boolean singleValue; |
||||||
|
|
||||||
|
private boolean betweenValue; |
||||||
|
|
||||||
|
private boolean listValue; |
||||||
|
|
||||||
|
private String typeHandler; |
||||||
|
|
||||||
|
public String getCondition() { |
||||||
|
return condition; |
||||||
|
} |
||||||
|
|
||||||
|
public Object getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public Object getSecondValue() { |
||||||
|
return secondValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isNoValue() { |
||||||
|
return noValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSingleValue() { |
||||||
|
return singleValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isBetweenValue() { |
||||||
|
return betweenValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isListValue() { |
||||||
|
return listValue; |
||||||
|
} |
||||||
|
|
||||||
|
public String getTypeHandler() { |
||||||
|
return typeHandler; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.typeHandler = null; |
||||||
|
this.noValue = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, String typeHandler) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.value = value; |
||||||
|
this.typeHandler = typeHandler; |
||||||
|
if (value instanceof List<?>) { |
||||||
|
this.listValue = true; |
||||||
|
} else { |
||||||
|
this.singleValue = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value) { |
||||||
|
this(condition, value, null); |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.value = value; |
||||||
|
this.secondValue = secondValue; |
||||||
|
this.typeHandler = typeHandler; |
||||||
|
this.betweenValue = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue) { |
||||||
|
this(condition, value, secondValue, null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,328 @@ |
|||||||
|
package com.hfkj.entity; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* bs_user_login_log |
||||||
|
* @author |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成 |
||||||
|
* |
||||||
|
**/ |
||||||
|
public class BsUserLoginLog implements Serializable { |
||||||
|
/** |
||||||
|
* 主键 |
||||||
|
*/ |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录账户id |
||||||
|
*/ |
||||||
|
private Long userId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录账户手机号 |
||||||
|
*/ |
||||||
|
private String userPhone; |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录方式code |
||||||
|
*/ |
||||||
|
private String loginTypeCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录方式名称 |
||||||
|
*/ |
||||||
|
private String loginTypeName; |
||||||
|
|
||||||
|
/** |
||||||
|
* ip |
||||||
|
*/ |
||||||
|
private String ip; |
||||||
|
|
||||||
|
/** |
||||||
|
* 国家 |
||||||
|
*/ |
||||||
|
private String country; |
||||||
|
|
||||||
|
/** |
||||||
|
* 省份编号 |
||||||
|
*/ |
||||||
|
private String regionId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 省份名称 |
||||||
|
*/ |
||||||
|
private String regionName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 城市编号 |
||||||
|
*/ |
||||||
|
private String cityId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 城市名称 |
||||||
|
*/ |
||||||
|
private String cityName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 运营商 |
||||||
|
*/ |
||||||
|
private String isp; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 1:正常 2:风险 |
||||||
|
*/ |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 备注 |
||||||
|
*/ |
||||||
|
private String remark; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
private String ext1; |
||||||
|
|
||||||
|
private String ext2; |
||||||
|
|
||||||
|
private String ext3; |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
public Long getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(Long id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getUserId() { |
||||||
|
return userId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUserId(Long userId) { |
||||||
|
this.userId = userId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getUserPhone() { |
||||||
|
return userPhone; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUserPhone(String userPhone) { |
||||||
|
this.userPhone = userPhone; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLoginTypeCode() { |
||||||
|
return loginTypeCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLoginTypeCode(String loginTypeCode) { |
||||||
|
this.loginTypeCode = loginTypeCode; |
||||||
|
} |
||||||
|
|
||||||
|
public String getLoginTypeName() { |
||||||
|
return loginTypeName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLoginTypeName(String loginTypeName) { |
||||||
|
this.loginTypeName = loginTypeName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getIp() { |
||||||
|
return ip; |
||||||
|
} |
||||||
|
|
||||||
|
public void setIp(String ip) { |
||||||
|
this.ip = ip; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCountry() { |
||||||
|
return country; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCountry(String country) { |
||||||
|
this.country = country; |
||||||
|
} |
||||||
|
|
||||||
|
public String getRegionId() { |
||||||
|
return regionId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setRegionId(String regionId) { |
||||||
|
this.regionId = regionId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getRegionName() { |
||||||
|
return regionName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setRegionName(String regionName) { |
||||||
|
this.regionName = regionName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCityId() { |
||||||
|
return cityId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCityId(String cityId) { |
||||||
|
this.cityId = cityId; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCityName() { |
||||||
|
return cityName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCityName(String cityName) { |
||||||
|
this.cityName = cityName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getIsp() { |
||||||
|
return isp; |
||||||
|
} |
||||||
|
|
||||||
|
public void setIsp(String isp) { |
||||||
|
this.isp = isp; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getStatus() { |
||||||
|
return status; |
||||||
|
} |
||||||
|
|
||||||
|
public void setStatus(Integer status) { |
||||||
|
this.status = status; |
||||||
|
} |
||||||
|
|
||||||
|
public String getRemark() { |
||||||
|
return remark; |
||||||
|
} |
||||||
|
|
||||||
|
public void setRemark(String remark) { |
||||||
|
this.remark = remark; |
||||||
|
} |
||||||
|
|
||||||
|
public Date getCreateTime() { |
||||||
|
return createTime; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) { |
||||||
|
this.createTime = createTime; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt1() { |
||||||
|
return ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt1(String ext1) { |
||||||
|
this.ext1 = ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt2() { |
||||||
|
return ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt2(String ext2) { |
||||||
|
this.ext2 = ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt3() { |
||||||
|
return ext3; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt3(String ext3) { |
||||||
|
this.ext3 = ext3; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object that) { |
||||||
|
if (this == that) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
if (that == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (getClass() != that.getClass()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
BsUserLoginLog other = (BsUserLoginLog) that; |
||||||
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||||
|
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId())) |
||||||
|
&& (this.getUserPhone() == null ? other.getUserPhone() == null : this.getUserPhone().equals(other.getUserPhone())) |
||||||
|
&& (this.getLoginTypeCode() == null ? other.getLoginTypeCode() == null : this.getLoginTypeCode().equals(other.getLoginTypeCode())) |
||||||
|
&& (this.getLoginTypeName() == null ? other.getLoginTypeName() == null : this.getLoginTypeName().equals(other.getLoginTypeName())) |
||||||
|
&& (this.getIp() == null ? other.getIp() == null : this.getIp().equals(other.getIp())) |
||||||
|
&& (this.getCountry() == null ? other.getCountry() == null : this.getCountry().equals(other.getCountry())) |
||||||
|
&& (this.getRegionId() == null ? other.getRegionId() == null : this.getRegionId().equals(other.getRegionId())) |
||||||
|
&& (this.getRegionName() == null ? other.getRegionName() == null : this.getRegionName().equals(other.getRegionName())) |
||||||
|
&& (this.getCityId() == null ? other.getCityId() == null : this.getCityId().equals(other.getCityId())) |
||||||
|
&& (this.getCityName() == null ? other.getCityName() == null : this.getCityName().equals(other.getCityName())) |
||||||
|
&& (this.getIsp() == null ? other.getIsp() == null : this.getIsp().equals(other.getIsp())) |
||||||
|
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) |
||||||
|
&& (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark())) |
||||||
|
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime())) |
||||||
|
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||||
|
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||||
|
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int hashCode() { |
||||||
|
final int prime = 31; |
||||||
|
int result = 1; |
||||||
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||||
|
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode()); |
||||||
|
result = prime * result + ((getUserPhone() == null) ? 0 : getUserPhone().hashCode()); |
||||||
|
result = prime * result + ((getLoginTypeCode() == null) ? 0 : getLoginTypeCode().hashCode()); |
||||||
|
result = prime * result + ((getLoginTypeName() == null) ? 0 : getLoginTypeName().hashCode()); |
||||||
|
result = prime * result + ((getIp() == null) ? 0 : getIp().hashCode()); |
||||||
|
result = prime * result + ((getCountry() == null) ? 0 : getCountry().hashCode()); |
||||||
|
result = prime * result + ((getRegionId() == null) ? 0 : getRegionId().hashCode()); |
||||||
|
result = prime * result + ((getRegionName() == null) ? 0 : getRegionName().hashCode()); |
||||||
|
result = prime * result + ((getCityId() == null) ? 0 : getCityId().hashCode()); |
||||||
|
result = prime * result + ((getCityName() == null) ? 0 : getCityName().hashCode()); |
||||||
|
result = prime * result + ((getIsp() == null) ? 0 : getIsp().hashCode()); |
||||||
|
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); |
||||||
|
result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode()); |
||||||
|
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode()); |
||||||
|
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||||
|
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||||
|
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
sb.append(getClass().getSimpleName()); |
||||||
|
sb.append(" ["); |
||||||
|
sb.append("Hash = ").append(hashCode()); |
||||||
|
sb.append(", id=").append(id); |
||||||
|
sb.append(", userId=").append(userId); |
||||||
|
sb.append(", userPhone=").append(userPhone); |
||||||
|
sb.append(", loginTypeCode=").append(loginTypeCode); |
||||||
|
sb.append(", loginTypeName=").append(loginTypeName); |
||||||
|
sb.append(", ip=").append(ip); |
||||||
|
sb.append(", country=").append(country); |
||||||
|
sb.append(", regionId=").append(regionId); |
||||||
|
sb.append(", regionName=").append(regionName); |
||||||
|
sb.append(", cityId=").append(cityId); |
||||||
|
sb.append(", cityName=").append(cityName); |
||||||
|
sb.append(", isp=").append(isp); |
||||||
|
sb.append(", status=").append(status); |
||||||
|
sb.append(", remark=").append(remark); |
||||||
|
sb.append(", createTime=").append(createTime); |
||||||
|
sb.append(", ext1=").append(ext1); |
||||||
|
sb.append(", ext2=").append(ext2); |
||||||
|
sb.append(", ext3=").append(ext3); |
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||||
|
sb.append("]"); |
||||||
|
return sb.toString(); |
||||||
|
} |
||||||
|
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,16 @@ |
|||||||
|
package com.hfkj.model; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户登录session对象 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class UserSessionObject { |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录账户 |
||||||
|
*/ |
||||||
|
private BsUser user; |
||||||
|
} |
@ -0,0 +1,36 @@ |
|||||||
|
package com.hfkj.service.user; |
||||||
|
|
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserLoginLog; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: BsUserLoginLogService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/5/6 |
||||||
|
**/ |
||||||
|
public interface BsUserLoginLogService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建 |
||||||
|
* @param userLoginLog |
||||||
|
*/ |
||||||
|
void create(BsUserLoginLog userLoginLog); |
||||||
|
|
||||||
|
/** |
||||||
|
* 异步创建登录日志 |
||||||
|
* @param user |
||||||
|
*/ |
||||||
|
void asyncCreateLog(UserLoginType loginType, BsUser user, HttpServletRequest request); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询日志列表 |
||||||
|
* @param param |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
List<BsUserLoginLog> getLogList(Map<String, Object> param); |
||||||
|
} |
@ -0,0 +1,61 @@ |
|||||||
|
package com.hfkj.service.user; |
||||||
|
|
||||||
|
import com.hfkj.common.security.SessionObject; |
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
|
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: BsUserService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
public interface BsUserService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 编辑数据 |
||||||
|
* @param data |
||||||
|
*/ |
||||||
|
void editData(BsUser data); |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新手机号 |
||||||
|
* @param userId |
||||||
|
* @param newPhone |
||||||
|
*/ |
||||||
|
void updatePhone(Long userId, String newPhone) throws Exception; |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询详情 |
||||||
|
* @param userId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
BsUser getUser(Long userId); |
||||||
|
|
||||||
|
/** |
||||||
|
* 查询详情SmsController |
||||||
|
* @param userPhone |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
BsUser getUser(String userPhone); |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户注册 |
||||||
|
* @param phone 手机号 |
||||||
|
* @param other 其他参数 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
BsUser register(String phone, Map<String, Object> other); |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户登录 |
||||||
|
* @param phone 用户手机号 |
||||||
|
* @param other 其他参数 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
SessionObject login(String phone, UserLoginType loginType, Map<String, Object> other) throws Exception; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
package com.hfkj.service.user.impl; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.common.alipay.AliyunService; |
||||||
|
import com.hfkj.common.utils.RequestUtils; |
||||||
|
import com.hfkj.dao.BsUserLoginLogMapper; |
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserLoginLog; |
||||||
|
import com.hfkj.entity.BsUserLoginLogExample; |
||||||
|
import com.hfkj.service.user.BsUserLoginLogService; |
||||||
|
import com.hfkj.sysenum.sec.SecUserLoginLogStatusEnum; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.concurrent.ExecutorService; |
||||||
|
import java.util.concurrent.Executors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: BsUserLoginLogServiceImpl |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/5/6 |
||||||
|
**/ |
||||||
|
@Service("userLoginLogService") |
||||||
|
public class BsUserLoginLogServiceImpl implements BsUserLoginLogService { |
||||||
|
@Resource |
||||||
|
private BsUserLoginLogMapper userLoginLogMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void create(BsUserLoginLog userLoginLog) { |
||||||
|
userLoginLog.setCreateTime(new Date()); |
||||||
|
userLoginLogMapper.insert(userLoginLog); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void asyncCreateLog(UserLoginType loginType, BsUser user, HttpServletRequest request) { |
||||||
|
// 创建一个单线程的线程池
|
||||||
|
ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(); |
||||||
|
// 异步记录登录信息
|
||||||
|
singleThreadExecutor.submit(new Runnable() { |
||||||
|
@Override |
||||||
|
public void run() { |
||||||
|
BsUserLoginLog loginLog = new BsUserLoginLog(); |
||||||
|
loginLog.setUserId(user.getId()); |
||||||
|
loginLog.setUserPhone(user.getPhone()); |
||||||
|
loginLog.setLoginTypeCode(loginType.getCode()); |
||||||
|
loginLog.setLoginTypeName(loginType.getName()); |
||||||
|
loginLog.setIp(RequestUtils.getIpAddress(request)); |
||||||
|
// 查询ip归属地
|
||||||
|
JSONObject ipAddress = AliyunService.queryAddress(loginLog.getIp()); |
||||||
|
if (ipAddress != null) { |
||||||
|
loginLog.setCountry(StringUtils.isNotBlank(ipAddress.getString("country"))?ipAddress.getString("country"):"未知"); |
||||||
|
loginLog.setRegionId(StringUtils.isNotBlank(ipAddress.getString("region_id"))?ipAddress.getString("region_id"):null); |
||||||
|
loginLog.setRegionName(StringUtils.isNotBlank(ipAddress.getString("region"))?ipAddress.getString("region"):"未知"); |
||||||
|
loginLog.setCityId(StringUtils.isNotBlank(ipAddress.getString("city_id"))?ipAddress.getString("city_id"):null); |
||||||
|
loginLog.setCityName(StringUtils.isNotBlank(ipAddress.getString("city"))?ipAddress.getString("city"):"未知"); |
||||||
|
loginLog.setIsp(StringUtils.isNotBlank(ipAddress.getString("isp"))?ipAddress.getString("isp"):"未知"); |
||||||
|
loginLog.setStatus(SecUserLoginLogStatusEnum.status1.getCode()); |
||||||
|
} else { |
||||||
|
loginLog.setCountry("未知"); |
||||||
|
loginLog.setRegionName("未知"); |
||||||
|
loginLog.setCityName("未知"); |
||||||
|
loginLog.setIsp("未知"); |
||||||
|
loginLog.setStatus(SecUserLoginLogStatusEnum.status2.getCode()); |
||||||
|
} |
||||||
|
create(loginLog); |
||||||
|
} |
||||||
|
}); |
||||||
|
singleThreadExecutor.shutdown(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<BsUserLoginLog> getLogList(Map<String, Object> param) { |
||||||
|
BsUserLoginLogExample example = new BsUserLoginLogExample(); |
||||||
|
BsUserLoginLogExample.Criteria criteria = example.createCriteria(); |
||||||
|
|
||||||
|
if (MapUtils.getLong(param, "userId") != null) { |
||||||
|
criteria.andUserIdEqualTo(MapUtils.getLong(param, "userId")); |
||||||
|
} |
||||||
|
|
||||||
|
if (MapUtils.getInteger(param, "status") != null) { |
||||||
|
criteria.andStatusEqualTo(MapUtils.getInteger(param, "status")); |
||||||
|
} |
||||||
|
|
||||||
|
example.setOrderByClause("create_time desc"); |
||||||
|
return userLoginLogMapper.selectByExample(example); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,156 @@ |
|||||||
|
package com.hfkj.service.user.impl; |
||||||
|
|
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.common.security.AESEncodeUtil; |
||||||
|
import com.hfkj.common.security.SessionObject; |
||||||
|
import com.hfkj.common.security.UserCenter; |
||||||
|
import com.hfkj.common.utils.RedisUtil; |
||||||
|
import com.hfkj.dao.BsUserMapper; |
||||||
|
import com.hfkj.entity.BsUser; |
||||||
|
import com.hfkj.entity.BsUserExample; |
||||||
|
import com.hfkj.model.UserSessionObject; |
||||||
|
import com.hfkj.service.user.BsUserLoginLogService; |
||||||
|
import com.hfkj.service.user.BsUserService; |
||||||
|
import com.hfkj.sysenum.user.UserGradeEnum; |
||||||
|
import com.hfkj.sysenum.user.UserLoginType; |
||||||
|
import com.hfkj.sysenum.user.UserStatusEnum; |
||||||
|
import org.apache.commons.collections4.MapUtils; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.web.context.request.RequestAttributes; |
||||||
|
import org.springframework.web.context.request.RequestContextHolder; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: BsUserServiceImpl |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
@Service("userService") |
||||||
|
public class BsUserServiceImpl implements BsUserService { |
||||||
|
@Resource |
||||||
|
private BsUserMapper userMapper; |
||||||
|
@Resource |
||||||
|
private RedisUtil redisUtil; |
||||||
|
@Resource |
||||||
|
private UserCenter userCenter; |
||||||
|
@Resource |
||||||
|
private BsUserLoginLogService userLoginLogService; |
||||||
|
private final static String CACHE_KEY = "USER"; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户token |
||||||
|
* @param userId |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String userToken(Long userId) throws Exception { |
||||||
|
return AESEncodeUtil.aesEncrypt(userId.toString()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void editData(BsUser data) { |
||||||
|
data.setUpdateTime(new Date()); |
||||||
|
if (data.getId() == null) { |
||||||
|
data.setCreateTime(new Date()); |
||||||
|
userMapper.insert(data); |
||||||
|
} else { |
||||||
|
userMapper.updateByPrimaryKey(data); |
||||||
|
} |
||||||
|
if (StringUtils.isNotBlank(data.getPhone())) { |
||||||
|
// 加入缓存
|
||||||
|
redisUtil.hset(CACHE_KEY, data.getPhone(), data); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updatePhone(Long userId, String newPhone) throws Exception { |
||||||
|
// 查询用户
|
||||||
|
BsUser user = getUser(userId); |
||||||
|
if (user == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); |
||||||
|
} |
||||||
|
user.setPhone(newPhone); |
||||||
|
editData(user); |
||||||
|
|
||||||
|
// 更新session
|
||||||
|
UserSessionObject session = new UserSessionObject(); |
||||||
|
session.setUser(user); |
||||||
|
SessionObject sessionObject = new SessionObject(userToken(user.getId()), session); |
||||||
|
userCenter.save(sessionObject); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BsUser getUser(Long userId) { |
||||||
|
|
||||||
|
BsUser user = userMapper.selectByPrimaryKey(userId); |
||||||
|
// 加入缓存
|
||||||
|
redisUtil.hset(CACHE_KEY, user.getId().toString(), user); |
||||||
|
return user; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BsUser getUser(String userPhone) { |
||||||
|
// 查询缓存
|
||||||
|
Object cacheObj = redisUtil.hget(CACHE_KEY, userPhone); |
||||||
|
if (cacheObj != null) { |
||||||
|
return (BsUser) cacheObj; |
||||||
|
} |
||||||
|
BsUserExample example = new BsUserExample(); |
||||||
|
example.createCriteria().andPhoneEqualTo(userPhone).andStatusNotEqualTo(UserStatusEnum.status0.getCode()); |
||||||
|
List<BsUser> list = userMapper.selectByExample(example); |
||||||
|
if (!list.isEmpty()) { |
||||||
|
BsUser user = list.get(0); |
||||||
|
// 加入缓存
|
||||||
|
redisUtil.hset(CACHE_KEY, user.getPhone(), user); |
||||||
|
return user; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BsUser register(String phone, Map<String, Object> other) { |
||||||
|
// 查询手机号
|
||||||
|
if (getUser(phone) != null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户手机号已存在,请更换"); |
||||||
|
} |
||||||
|
BsUser user = new BsUser(); |
||||||
|
user.setHeadImg(MapUtils.getString(other,"headImg")); |
||||||
|
user.setName( |
||||||
|
StringUtils.isNotBlank(MapUtils.getString(other,"name")) |
||||||
|
? MapUtils.getString(other,"name") |
||||||
|
: "元气优淘" |
||||||
|
); |
||||||
|
user.setPhone(phone); |
||||||
|
user.setGrade(UserGradeEnum.grade1.getCode()); |
||||||
|
user.setStatus(UserStatusEnum.status1.getCode()); |
||||||
|
editData(user); |
||||||
|
return user; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public SessionObject login(String phone, UserLoginType loginType, Map<String, Object> other) throws Exception { |
||||||
|
// 查询用户
|
||||||
|
BsUser user = getUser(phone); |
||||||
|
if (user == null) { |
||||||
|
user = register(phone, other); |
||||||
|
} |
||||||
|
// 缓存
|
||||||
|
UserSessionObject session = new UserSessionObject(); |
||||||
|
session.setUser(user); |
||||||
|
|
||||||
|
SessionObject sessionObject = new SessionObject(userToken(user.getId()), session); |
||||||
|
userCenter.save(sessionObject); |
||||||
|
|
||||||
|
// 异步记录登录信息
|
||||||
|
userLoginLogService.asyncCreateLog(loginType, user, (HttpServletRequest) RequestContextHolder.getRequestAttributes().resolveReference(RequestAttributes.REFERENCE_REQUEST)); |
||||||
|
return sessionObject; |
||||||
|
} |
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.hfkj.sysenum; |
package com.hfkj.sysenum.sec; |
||||||
|
|
||||||
/** |
/** |
||||||
* 菜单类型 |
* 菜单类型 |
@ -1,4 +1,4 @@ |
|||||||
package com.hfkj.sysenum; |
package com.hfkj.sysenum.sec; |
||||||
|
|
||||||
/** |
/** |
||||||
* 登录日志状态 |
* 登录日志状态 |
@ -1,4 +1,4 @@ |
|||||||
package com.hfkj.sysenum; |
package com.hfkj.sysenum.sec; |
||||||
|
|
||||||
/** |
/** |
||||||
* 账户类型 |
* 账户类型 |
@ -1,4 +1,4 @@ |
|||||||
package com.hfkj.sysenum; |
package com.hfkj.sysenum.sec; |
||||||
|
|
||||||
/** |
/** |
||||||
* 系统用户状态 |
* 系统用户状态 |
@ -0,0 +1,42 @@ |
|||||||
|
package com.hfkj.sysenum.user; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用户等级 |
||||||
|
* @className: UserStatusEnum |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/9/6 |
||||||
|
**/ |
||||||
|
@Getter |
||||||
|
public enum UserGradeEnum { |
||||||
|
/** |
||||||
|
* 见习会员 |
||||||
|
*/ |
||||||
|
grade1(1, "见习会员"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 正式会员 |
||||||
|
*/ |
||||||
|
grade2(2, "正式会员"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 团长 |
||||||
|
*/ |
||||||
|
grade3(3, "团长"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 渠道 |
||||||
|
*/ |
||||||
|
grade4(4, "渠道"), |
||||||
|
; |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
private String name; |
||||||
|
|
||||||
|
UserGradeEnum(int code, String name) { |
||||||
|
this.code = code; |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.hfkj.sysenum.user; |
||||||
|
|
||||||
|
import lombok.Getter; |
||||||
|
|
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
|
/** |
||||||
|
* 登录方式 |
||||||
|
* @className: LoginType |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2022/10/20 |
||||||
|
**/ |
||||||
|
@Getter |
||||||
|
public enum UserLoginType { |
||||||
|
/** |
||||||
|
* 短信登录 |
||||||
|
*/ |
||||||
|
SMS("SMS", "短信登录"), |
||||||
|
/** |
||||||
|
* 微信授权 |
||||||
|
*/ |
||||||
|
WECHAT_EMPOWER("WECHAT_EMPOWER", "微信授权"), |
||||||
|
; |
||||||
|
|
||||||
|
private String code; |
||||||
|
|
||||||
|
private String name; |
||||||
|
|
||||||
|
UserLoginType(String code, String name) { |
||||||
|
this.code = code; |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据类型查询数据 |
||||||
|
* @param code |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static UserLoginType getDataByType(String code) { |
||||||
|
for (UserLoginType ele : values()) { |
||||||
|
if (Objects.equals(code,ele.getCode())) return ele; |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
package com.hfkj.sysenum.user; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: UserStatusEnum |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/5/6 |
||||||
|
**/ |
||||||
|
public enum UserStatusEnum { |
||||||
|
/** |
||||||
|
* 删除 |
||||||
|
*/ |
||||||
|
status0(0, "删除"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 正常 |
||||||
|
*/ |
||||||
|
status1(1, "正常"), |
||||||
|
|
||||||
|
/** |
||||||
|
* 禁用 |
||||||
|
*/ |
||||||
|
status2(2, "禁用"), |
||||||
|
; |
||||||
|
|
||||||
|
private int code; |
||||||
|
|
||||||
|
private String name; |
||||||
|
|
||||||
|
|
||||||
|
UserStatusEnum(int code, String name) { |
||||||
|
this.code = code; |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCode(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public String getName() { |
||||||
|
return name; |
||||||
|
} |
||||||
|
|
||||||
|
public void setName(String name) { |
||||||
|
this.name = name; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue