提交 188a5aca 编写于 作者: rushui.chen's avatar rushui.chen

20190827 获取短信验证码接口和注册接口

上级 99fd1988
流水线 #13714 已失败 于阶段
in 0 second
......@@ -22,20 +22,19 @@ public class RegisterController extends AccountBaseController {
@Autowired
private RegisterService registerService;
@ApiOperation("注册接口")
@PostMapping(value = "")
public PicaResponse<String> register(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity);
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
AccountUtils.checkMobilePhone(request.getMobile());
AccountUtils.getAuthCodeKey(request.getSysCode(), EnumsType.SYSCODE_TYPE_REGISTER.getCode() + "");
AccountUtils.checkPassword(request.getPassword());
request.setFlag(EnumsType.SYSCODE_TYPE_REGISTER.getCode());
request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType());
PicaResponse picaResponse = registerService.register(request);
return picaResponse;
}
}
package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.account.account.server.util.CryptoUtil;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api("短信验证码资源")
@RestController
public class SysCodeController {
@RequestMapping(value = "/authCode")
public class SysCodeController extends AccountBaseController {
private final String AUTH_CODE_PREFIX = "authCode-";
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
@ApiOperation("获取短信验证码")
@PostMapping(value = "")
public PicaResponse getSysCode(@RequestBody EncryptEntity entity) throws Exception {
BaseRequest request = CryptoUtil.decrypt(entity);
request.setFlag(0);
AccountUtils.checkMobilePhone(request.getMobile());
processSysCode(request.getMobile(), request.getFlag());
return PicaResponse.toResponse();
}
/**
* 验证码发送逻辑
*
* @param mobilePhone
* @param flag
*/
private void processSysCode(String mobilePhone, Integer flag) {
//随机生成验证码
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
//判断账号是否已经存在
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobilePhone);
long senderId = accountInfoEntity == null ? 0L : accountInfoEntity.getId();
//验证码保存到redis,失效时间10分钟
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag + ""), authCode, 600);
//发送短信
super.sendMobileMessage(mobilePhone, message, senderId);
}
//获取验证码redis key
private String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + EncryptCreateUtil.encrypt(mobilePhone);
}
}
......@@ -13,6 +13,8 @@ public class Account {
private Long id;
private Integer acctId;
private Integer sex;
private String name;
......@@ -75,6 +77,14 @@ public class Account {
this.id = id;
}
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getSex() {
return sex;
}
......
......@@ -19,7 +19,7 @@ public class AccountInfoEntity {
private Date birthday;
private Byte sex;
private Integer sex;
private String idCard;
......@@ -99,11 +99,11 @@ public class AccountInfoEntity {
this.birthday = birthday;
}
public Byte getSex() {
public int getSex() {
return sex;
}
public void setSex(Byte sex) {
public void setSex(int sex) {
this.sex = sex;
}
......
......@@ -5,22 +5,22 @@ package com.pica.cloud.account.account.server.entity;
*/
public class EncryptEntity {
/**
* 加密后的密文
*/
private String key;
// /**
// * 加密后的密文
// */
// private String key;
/**
* 加密后的数据
*/
private String content;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
// public String getKey() {
// return key;
// }
//
// public void setKey(String key) {
// this.key = key;
// }
public String getContent() {
return content;
......@@ -30,11 +30,11 @@ public class EncryptEntity {
this.content = content;
}
@Override
public String toString() {
return "EncryptEntity{" +
"key='" + key + '\'' +
", content='" + content + '\'' +
'}';
}
// @Override
// public String toString() {
// return "EncryptEntity{" +
// "key='" + key + '\'' +
// ", content='" + content + '\'' +
// '}';
// }
}
......@@ -10,8 +10,27 @@ public interface AccountInfoDetailMapper {
int insertSelective(AccountInfoEntity record);
/**
* 通过电话号码查询账号信息
*
* @param mobile
* @return
*/
AccountInfoEntity selectByMobile(String mobile);
/**
* 插入注册人信息
*
* @param acctId
*/
void insertCreateInfo(int acctId);
AccountInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountInfoEntity record);
int updateByPrimaryKey(AccountInfoEntity record);
......
......@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
public class BaseRequest {
private String mobile;
private String password;
private String sysCode;
private int flag;
@ApiModelProperty("产品线类型")
......@@ -14,6 +15,7 @@ public class BaseRequest {
@ApiModelProperty("渠道来源")
private int sourceType;
public String getMobile() {
return mobile;
}
......@@ -22,6 +24,14 @@ public class BaseRequest {
this.mobile = mobile;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSysCode() {
return sysCode;
}
......
package com.pica.cloud.account.account.server.service;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.AccountUserInfoEntity;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
public class RegisterServiceImpl implements RegisterService {
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private AccountInfoDetailMapper accountInfoDetailMapper;
@Autowired
private UserInfoService userInfoService;
@Autowired
@Qualifier("cacheMigrateClient")
private ICacheClient cacheClient;
@Override
public PicaResponse register(BaseRequest baseRequest) {
return null;
String mobile = EncryptCreateUtil.encrypt(baseRequest.getMobile());
//校验用户是否已经注册
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobile);
if (accountInfoEntity != null) {
AccountInfoEntity accountInfo = new AccountInfoEntity();
accountInfo.setMobilePhone(baseRequest.getMobile());
accountInfo.setPassword(baseRequest.getPassword());
accountInfo.setCreatedTime(new Date());
accountInfo.setCreatedId(0);
accountInfo.setModifiedId(0);
accountInfo.setModifiedTime(new Date());
accountInfo.setRegTime(new Date());
accountInfo.setDeleteFlag(1);
accountInfo.setRegisterProduct(baseRequest.getProductType());
accountInfo.setRegisterSource(baseRequest.getSourceType());
accountInfoDetailMapper.insertSelective(accountInfo);
//账户id
Integer acctId = accountInfo.getId();
accountInfoDetailMapper.insertCreateInfo(acctId);
AccountUserInfoEntity accountUserInfoEntity = new AccountUserInfoEntity();
accountUserInfoEntity.setAcctId(acctId);
accountUserInfoEntity.setDeleteFlag(1);
accountUserInfoEntity.setCreateId(acctId);
accountUserInfoEntity.setModifyId(acctId);
accountUserInfoEntity.setCreateTime(new Date());
accountUserInfoEntity.setModifyTime(new Date());
userInfoService.insertUserInfo(accountUserInfoEntity);
Integer userId = accountUserInfoEntity.getId();
Account account = new Account();
account.setId(userId.longValue());
account.setAcctId(acctId);
account.setCreatTime(new Date());
account.setMobilePhone(mobile);
account.setRegisterSource(baseRequest.getSourceType());
String newToken = this.generateToken(account);
JSONObject jsonObject = new JSONObject();
jsonObject.put("token", newToken);
jsonObject.put("userId", userId);
return PicaResponse.toResponse(jsonObject.toJSONString());
//用户信息表记录
} else {
throw new PicaException(ExceptionType.PICA_ALREADY_REGISTER.getCode(), ExceptionType.PICA_ALREADY_REGISTER.getMessage());
}
}
/**
* 生成新的token
*
* @param account
* @return
*/
private String generateToken(Account account) {
String sourceType = AccountUtils.getSourceType(account.getRegisterSource());
String newToken = org.apache.commons.lang3.StringUtils.EMPTY;
try {
String value = "token-doctor-" + account.getId().toString();
//生成新token
int expiredSeconds = 30 * 24 * 60 * 60;//token有效期30天
newToken = UUID.randomUUID().toString().replace("-", "").toUpperCase();
String Key = "token-" + newToken;
//存储token:(token-FF9FCB0D93A642328A01C279701B7607:token-doctor-1)
cacheClient.set(Key, value, expiredSeconds);
//存储token:(token-doctor-12345678-app:token-FF9FCB0D93A642328A01C279701B7607)
cacheClient.set(value + sourceType, Key, expiredSeconds);
//用户数据放入缓存
String userData = cacheClient.hget(value, "id");
if (org.apache.commons.lang3.StringUtils.isEmpty(userData)) {
Map<String, String> data = new HashMap<>();
data.put("token", newToken);
data.put("id", account.getId() + "");
data.put("acctId", account.getAcctId() + "");
data.put("mobile", account.getMobilePhone());
data.put("name", account.getMobilePhone().replaceAll("(\\d{3})\\d{4}(\\w{4})", "$1****$2"));
data.put("created_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(account.getCreatTime()));
data.put("sysCode", sourceType);
Iterator<Map.Entry<String, String>> iterator = data.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, String> map = iterator.next();
String key = map.getKey();
String valueInfo = map.getValue();
//存储token:(token-doctor-1:用户数据)
cacheClient.hset(value, key, valueInfo);
}
}
} catch (Exception ex) {
logger.error("生成token异常:{}" + ex.getMessage(), ex);
}
return newToken;
}
}
package com.pica.cloud.account.account.server.service;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest;
public class Test {
public static void main(String[] args) {
// String json="{\"key\":\"密钥\",\"content\": {\"mobilePhone\" : \"1302412588\", \"flag\": \"1\"}}\n" +
// " }";
BaseRequest request = new BaseRequest();
request.setFlag(1);
request.setMobile("13024112588");
String string = JSONObject.toJSONString(request);
System.out.println(string);
EncryptEntity encryptEntity = new EncryptEntity();
encryptEntity.setContent(string);
System.out.println(JSONObject.toJSONString(encryptEntity));
}
}
package com.pica.cloud.account.account.server.service;
import com.pica.cloud.account.account.server.entity.AccountUserInfoEntity;
public interface UserInfoService {
AccountUserInfoEntity insertUserInfo(AccountUserInfoEntity accountUserInfoEntity);
}
package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.AccountUserInfoEntity;
import com.pica.cloud.account.account.server.service.UserInfoService;
import org.springframework.stereotype.Service;
@Service
public class UserInfoServerImpl implements UserInfoService {
@Override
public AccountUserInfoEntity insertUserInfo(AccountUserInfoEntity accountUserInfoEntity) {
return null;
}
}
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.enums.ExceptionType;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.ICacheClient;
......@@ -30,6 +31,13 @@ public class AccountUtils {
}
}
//手机格式校验
public static void checkPassword(String password) {
if (StringUtils.isBlank(password)) {
throw new PicaException(ExceptionType.PICA_NOT_EMPTY.getCode(), ExceptionType.PICA_NOT_EMPTY.getMessage());
}
}
//获取验证码redis key
public static String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + EncryptCreateUtil.encrypt(mobilePhone);
......
......@@ -27,7 +27,8 @@ public class CryptoUtil {
String finalKey = RSAUtil.encrypt(keyString);
EncryptEntity encryptEntity = new EncryptEntity();
encryptEntity.setContent(content);
encryptEntity.setKey(finalKey);
// TODO: 2019/8/27 :获取验证码接口
// encryptEntity.setKey(finalKey);
return encryptEntity;
}
......@@ -54,13 +55,14 @@ public class CryptoUtil {
* @return
* @throws Exception
*/
public static BaseRequest decrypt(EncryptEntity encryptEntity) throws Exception {
public static BaseRequest decrypt(EncryptEntity encryptEntity,Class zClass) throws Exception {
// TODO: 2019/8/27 : 暂时不处理这一块的逻辑
//获取解密密钥
String decryptKey = RSAUtil.decrypt(encryptEntity.getKey());
//String decryptKey = RSAUtil.decrypt(encryptEntity.getKey());
//解密数据
String content = AESUtil.decrypt(decryptKey, encryptEntity.getContent());
//String content = AESUtil.decrypt(decryptKey, encryptEntity.getContent());
//反序列化成对象
BaseRequest request = (BaseRequest) JSONObject.toJSON(content);
BaseRequest request = (BaseRequest) JSONObject.parseObject(encryptEntity.getContent(),zClass);
return request;
}
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper" >
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountInfoEntity" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR" />
<result column="password" property="password" jdbcType="VARCHAR" />
<result column="register_product" property="registerProduct" jdbcType="INTEGER" />
<result column="register_source" property="registerSource" jdbcType="INTEGER" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="age" property="age" jdbcType="TINYINT" />
<result column="birthday" property="birthday" jdbcType="DATE" />
<result column="sex" property="sex" jdbcType="TINYINT" />
<result column="id_card" property="idCard" jdbcType="VARCHAR" />
<result column="reg_time" property="regTime" jdbcType="TIMESTAMP" />
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" />
<result column="created_id" property="createdId" jdbcType="INTEGER" />
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" />
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" />
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
<mapper namespace="com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
<id column="id" property="id" jdbcType="INTEGER"/>
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR"/>
<result column="password" property="password" jdbcType="VARCHAR"/>
<result column="register_product" property="registerProduct" jdbcType="INTEGER"/>
<result column="register_source" property="registerSource" jdbcType="INTEGER"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="age" property="age" jdbcType="TINYINT"/>
<result column="birthday" property="birthday" jdbcType="DATE"/>
<result column="sex" property="sex" jdbcType="TINYINT"/>
<result column="id_card" property="idCard" jdbcType="VARCHAR"/>
<result column="reg_time" property="regTime" jdbcType="TIMESTAMP"/>
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER"/>
<result column="created_id" property="createdId" jdbcType="INTEGER"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modifiedId" jdbcType="INTEGER"/>
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, mobile_phone, password, register_product, register_source, name, age, birthday,
sex, id_card, reg_time, delete_flag, created_id, created_time, modified_id, modified_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from account_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from account_info
where id = #{id,jdbcType=INTEGER}
</select>
<!--通过电话号码查询账号信息-->
<select id="selectByMobile" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from account_info
where mobile_phone = #{mobile}
</select>
<!--插入注册人信息-->
<insert id="insertCreateInfo" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
insert into account_info (id, created_id,modified_id)
values (#{acctId},#{acctId},#{acctId})
</insert>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from account_info
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" >
<insert id="insert" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
insert into account_info (id, mobile_phone, password,
register_product, register_source, name,
age, birthday, sex, id_card,
......@@ -47,161 +63,162 @@
#{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" >
insert into account_info
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="mobilePhone != null" >
mobile_phone,
</if>
<if test="password != null" >
password,
</if>
<if test="registerProduct != null" >
register_product,
</if>
<if test="registerSource != null" >
register_source,
</if>
<if test="name != null" >
name,
</if>
<if test="age != null" >
age,
</if>
<if test="birthday != null" >
birthday,
</if>
<if test="sex != null" >
sex,
</if>
<if test="idCard != null" >
id_card,
</if>
<if test="regTime != null" >
reg_time,
</if>
<if test="deleteFlag != null" >
delete_flag,
</if>
<if test="createdId != null" >
created_id,
</if>
<if test="createdTime != null" >
created_time,
</if>
<if test="modifiedId != null" >
modified_id,
</if>
<if test="modifiedTime != null" >
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="mobilePhone != null" >
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null" >
#{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null" >
#{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null" >
#{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null" >
#{name,jdbcType=VARCHAR},
</if>
<if test="age != null" >
#{age,jdbcType=TINYINT},
</if>
<if test="birthday != null" >
#{birthday,jdbcType=DATE},
</if>
<if test="sex != null" >
#{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null" >
#{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null" >
#{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" >
update account_info
<set >
<if test="mobilePhone != null" >
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null" >
password = #{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null" >
register_product = #{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null" >
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null" >
name = #{name,jdbcType=VARCHAR},
</if>
<if test="age != null" >
age = #{age,jdbcType=TINYINT},
</if>
<if test="birthday != null" >
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="sex != null" >
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null" >
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null" >
reg_time = #{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null" >
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null" >
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null" >
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null" >
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null" >
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" >
<insert id="insertSelective" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
insert into account_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="mobilePhone != null">
mobile_phone,
</if>
<if test="password != null">
password,
</if>
<if test="registerProduct != null">
register_product,
</if>
<if test="registerSource != null">
register_source,
</if>
<if test="name != null">
name,
</if>
<if test="age != null">
age,
</if>
<if test="birthday != null">
birthday,
</if>
<if test="sex != null">
sex,
</if>
<if test="idCard != null">
id_card,
</if>
<if test="regTime != null">
reg_time,
</if>
<if test="deleteFlag != null">
delete_flag,
</if>
<if test="createdId != null">
created_id,
</if>
<if test="createdTime != null">
created_time,
</if>
<if test="modifiedId != null">
modified_id,
</if>
<if test="modifiedTime != null">
modified_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null">
#{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null">
#{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null">
#{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="age != null">
#{age,jdbcType=TINYINT},
</if>
<if test="birthday != null">
#{birthday,jdbcType=DATE},
</if>
<if test="sex != null">
#{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null">
#{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null">
#{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
#{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
#{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective"
parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info
<set>
<if test="mobilePhone != null">
mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
</if>
<if test="password != null">
password = #{password,jdbcType=VARCHAR},
</if>
<if test="registerProduct != null">
register_product = #{registerProduct,jdbcType=INTEGER},
</if>
<if test="registerSource != null">
register_source = #{registerSource,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="age != null">
age = #{age,jdbcType=TINYINT},
</if>
<if test="birthday != null">
birthday = #{birthday,jdbcType=DATE},
</if>
<if test="sex != null">
sex = #{sex,jdbcType=TINYINT},
</if>
<if test="idCard != null">
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="regTime != null">
reg_time = #{regTime,jdbcType=TIMESTAMP},
</if>
<if test="deleteFlag != null">
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if test="createdId != null">
created_id = #{createdId,jdbcType=INTEGER},
</if>
<if test="createdTime != null">
created_time = #{createdTime,jdbcType=TIMESTAMP},
</if>
<if test="modifiedId != null">
modified_id = #{modifiedId,jdbcType=INTEGER},
</if>
<if test="modifiedTime != null">
modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info
set mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册