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

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

上级 99fd1988
流水线 #13714 已失败 于阶段
in 0 second
...@@ -22,20 +22,19 @@ public class RegisterController extends AccountBaseController { ...@@ -22,20 +22,19 @@ public class RegisterController extends AccountBaseController {
@Autowired @Autowired
private RegisterService registerService; private RegisterService registerService;
@ApiOperation("注册接口") @ApiOperation("注册接口")
@PostMapping(value = "") @PostMapping(value = "")
public PicaResponse<String> register(@RequestBody EncryptEntity entity) throws Exception { 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.checkMobilePhone(request.getMobile());
AccountUtils.getAuthCodeKey(request.getSysCode(), EnumsType.SYSCODE_TYPE_REGISTER.getCode() + ""); AccountUtils.getAuthCodeKey(request.getSysCode(), EnumsType.SYSCODE_TYPE_REGISTER.getCode() + "");
AccountUtils.checkPassword(request.getPassword());
request.setFlag(EnumsType.SYSCODE_TYPE_REGISTER.getCode()); request.setFlag(EnumsType.SYSCODE_TYPE_REGISTER.getCode());
request.setProductType(super.getProductType()); request.setProductType(super.getProductType());
request.setSourceType(super.getSourceType()); request.setSourceType(super.getSourceType());
PicaResponse picaResponse = registerService.register(request); PicaResponse picaResponse = registerService.register(request);
return picaResponse; return picaResponse;
} }
} }
package com.pica.cloud.account.account.server.controller; 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.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; import org.springframework.web.bind.annotation.RestController;
@Api("短信验证码资源") @Api("短信验证码资源")
@RestController @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 { ...@@ -13,6 +13,8 @@ public class Account {
private Long id; private Long id;
private Integer acctId;
private Integer sex; private Integer sex;
private String name; private String name;
...@@ -75,6 +77,14 @@ public class Account { ...@@ -75,6 +77,14 @@ public class Account {
this.id = id; this.id = id;
} }
public Integer getAcctId() {
return acctId;
}
public void setAcctId(Integer acctId) {
this.acctId = acctId;
}
public Integer getSex() { public Integer getSex() {
return sex; return sex;
} }
......
...@@ -19,7 +19,7 @@ public class AccountInfoEntity { ...@@ -19,7 +19,7 @@ public class AccountInfoEntity {
private Date birthday; private Date birthday;
private Byte sex; private Integer sex;
private String idCard; private String idCard;
...@@ -99,11 +99,11 @@ public class AccountInfoEntity { ...@@ -99,11 +99,11 @@ public class AccountInfoEntity {
this.birthday = birthday; this.birthday = birthday;
} }
public Byte getSex() { public int getSex() {
return sex; return sex;
} }
public void setSex(Byte sex) { public void setSex(int sex) {
this.sex = sex; this.sex = sex;
} }
......
...@@ -5,22 +5,22 @@ package com.pica.cloud.account.account.server.entity; ...@@ -5,22 +5,22 @@ package com.pica.cloud.account.account.server.entity;
*/ */
public class EncryptEntity { public class EncryptEntity {
/** // /**
* 加密后的密文 // * 加密后的密文
*/ // */
private String key; // private String key;
/** /**
* 加密后的数据 * 加密后的数据
*/ */
private String content; private String content;
public String getKey() { // public String getKey() {
return key; // return key;
} // }
//
public void setKey(String key) { // public void setKey(String key) {
this.key = key; // this.key = key;
} // }
public String getContent() { public String getContent() {
return content; return content;
...@@ -30,11 +30,11 @@ public class EncryptEntity { ...@@ -30,11 +30,11 @@ public class EncryptEntity {
this.content = content; this.content = content;
} }
@Override // @Override
public String toString() { // public String toString() {
return "EncryptEntity{" + // return "EncryptEntity{" +
"key='" + key + '\'' + // "key='" + key + '\'' +
", content='" + content + '\'' + // ", content='" + content + '\'' +
'}'; // '}';
} // }
} }
...@@ -10,8 +10,27 @@ public interface AccountInfoDetailMapper { ...@@ -10,8 +10,27 @@ public interface AccountInfoDetailMapper {
int insertSelective(AccountInfoEntity record); int insertSelective(AccountInfoEntity record);
/**
* 通过电话号码查询账号信息
*
* @param mobile
* @return
*/
AccountInfoEntity selectByMobile(String mobile);
/**
* 插入注册人信息
*
* @param acctId
*/
void insertCreateInfo(int acctId);
AccountInfoEntity selectByPrimaryKey(Integer id); AccountInfoEntity selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(AccountInfoEntity record); int updateByPrimaryKeySelective(AccountInfoEntity record);
int updateByPrimaryKey(AccountInfoEntity record); int updateByPrimaryKey(AccountInfoEntity record);
......
...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
public class BaseRequest { public class BaseRequest {
private String mobile; private String mobile;
private String password;
private String sysCode; private String sysCode;
private int flag; private int flag;
@ApiModelProperty("产品线类型") @ApiModelProperty("产品线类型")
...@@ -14,6 +15,7 @@ public class BaseRequest { ...@@ -14,6 +15,7 @@ public class BaseRequest {
@ApiModelProperty("渠道来源") @ApiModelProperty("渠道来源")
private int sourceType; private int sourceType;
public String getMobile() { public String getMobile() {
return mobile; return mobile;
} }
...@@ -22,6 +24,14 @@ public class BaseRequest { ...@@ -22,6 +24,14 @@ public class BaseRequest {
this.mobile = mobile; this.mobile = mobile;
} }
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getSysCode() { public String getSysCode() {
return sysCode; return sysCode;
} }
......
package com.pica.cloud.account.account.server.service; 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.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.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 org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
@Service @Service
public class RegisterServiceImpl implements RegisterService { 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 @Override
public PicaResponse register(BaseRequest baseRequest) { 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; package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSONObject; 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.PicaException;
import com.pica.cloud.foundation.entity.PicaResultCode; import com.pica.cloud.foundation.entity.PicaResultCode;
import com.pica.cloud.foundation.redis.ICacheClient; import com.pica.cloud.foundation.redis.ICacheClient;
...@@ -30,6 +31,13 @@ public class AccountUtils { ...@@ -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 //获取验证码redis key
public static String getAuthCodeKey(String mobilePhone, String flag) { public static String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + EncryptCreateUtil.encrypt(mobilePhone); return AUTH_CODE_PREFIX + flag + "-" + EncryptCreateUtil.encrypt(mobilePhone);
......
...@@ -27,7 +27,8 @@ public class CryptoUtil { ...@@ -27,7 +27,8 @@ public class CryptoUtil {
String finalKey = RSAUtil.encrypt(keyString); String finalKey = RSAUtil.encrypt(keyString);
EncryptEntity encryptEntity = new EncryptEntity(); EncryptEntity encryptEntity = new EncryptEntity();
encryptEntity.setContent(content); encryptEntity.setContent(content);
encryptEntity.setKey(finalKey); // TODO: 2019/8/27 :获取验证码接口
// encryptEntity.setKey(finalKey);
return encryptEntity; return encryptEntity;
} }
...@@ -54,13 +55,14 @@ public class CryptoUtil { ...@@ -54,13 +55,14 @@ public class CryptoUtil {
* @return * @return
* @throws Exception * @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; return request;
} }
......
<?xml version="1.0" encoding="UTF-8" ?> <?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" > <!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" > <mapper namespace="com.pica.cloud.account.account.server.mapper.AccountInfoDetailMapper">
<resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountInfoEntity" > <resultMap id="BaseResultMap" type="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
<id column="id" property="id" jdbcType="INTEGER" /> <id column="id" property="id" jdbcType="INTEGER"/>
<result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR" /> <result column="mobile_phone" property="mobilePhone" jdbcType="VARCHAR"/>
<result column="password" property="password" jdbcType="VARCHAR" /> <result column="password" property="password" jdbcType="VARCHAR"/>
<result column="register_product" property="registerProduct" jdbcType="INTEGER" /> <result column="register_product" property="registerProduct" jdbcType="INTEGER"/>
<result column="register_source" property="registerSource" jdbcType="INTEGER" /> <result column="register_source" property="registerSource" jdbcType="INTEGER"/>
<result column="name" property="name" jdbcType="VARCHAR" /> <result column="name" property="name" jdbcType="VARCHAR"/>
<result column="age" property="age" jdbcType="TINYINT" /> <result column="age" property="age" jdbcType="TINYINT"/>
<result column="birthday" property="birthday" jdbcType="DATE" /> <result column="birthday" property="birthday" jdbcType="DATE"/>
<result column="sex" property="sex" jdbcType="TINYINT" /> <result column="sex" property="sex" jdbcType="TINYINT"/>
<result column="id_card" property="idCard" jdbcType="VARCHAR" /> <result column="id_card" property="idCard" jdbcType="VARCHAR"/>
<result column="reg_time" property="regTime" jdbcType="TIMESTAMP" /> <result column="reg_time" property="regTime" jdbcType="TIMESTAMP"/>
<result column="delete_flag" property="deleteFlag" jdbcType="INTEGER" /> <result column="delete_flag" property="deleteFlag" jdbcType="INTEGER"/>
<result column="created_id" property="createdId" jdbcType="INTEGER" /> <result column="created_id" property="createdId" jdbcType="INTEGER"/>
<result column="created_time" property="createdTime" jdbcType="TIMESTAMP" /> <result column="created_time" property="createdTime" jdbcType="TIMESTAMP"/>
<result column="modified_id" property="modifiedId" jdbcType="INTEGER" /> <result column="modified_id" property="modifiedId" jdbcType="INTEGER"/>
<result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP" /> <result column="modified_time" property="modifiedTime" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List">
id, mobile_phone, password, register_product, register_source, name, age, birthday, 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 sex, id_card, reg_time, delete_flag, created_id, created_time, modified_id, modified_time
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from account_info from account_info
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
<!--通过电话号码查询账号信息-->
<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 delete from account_info
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </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, insert into account_info (id, mobile_phone, password,
register_product, register_source, name, register_product, register_source, name,
age, birthday, sex, id_card, age, birthday, sex, id_card,
...@@ -47,161 +63,162 @@ ...@@ -47,161 +63,162 @@
#{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP} #{createdTime,jdbcType=TIMESTAMP}, #{modifiedId,jdbcType=INTEGER}, #{modifiedTime,jdbcType=TIMESTAMP}
) )
</insert> </insert>
<insert id="insertSelective" 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 insert into account_info
<trim prefix="(" suffix=")" suffixOverrides="," > <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null" > <if test="id != null">
id, id,
</if> </if>
<if test="mobilePhone != null" > <if test="mobilePhone != null">
mobile_phone, mobile_phone,
</if> </if>
<if test="password != null" > <if test="password != null">
password, password,
</if> </if>
<if test="registerProduct != null" > <if test="registerProduct != null">
register_product, register_product,
</if> </if>
<if test="registerSource != null" > <if test="registerSource != null">
register_source, register_source,
</if> </if>
<if test="name != null" > <if test="name != null">
name, name,
</if> </if>
<if test="age != null" > <if test="age != null">
age, age,
</if> </if>
<if test="birthday != null" > <if test="birthday != null">
birthday, birthday,
</if> </if>
<if test="sex != null" > <if test="sex != null">
sex, sex,
</if> </if>
<if test="idCard != null" > <if test="idCard != null">
id_card, id_card,
</if> </if>
<if test="regTime != null" > <if test="regTime != null">
reg_time, reg_time,
</if> </if>
<if test="deleteFlag != null" > <if test="deleteFlag != null">
delete_flag, delete_flag,
</if> </if>
<if test="createdId != null" > <if test="createdId != null">
created_id, created_id,
</if> </if>
<if test="createdTime != null" > <if test="createdTime != null">
created_time, created_time,
</if> </if>
<if test="modifiedId != null" > <if test="modifiedId != null">
modified_id, modified_id,
</if> </if>
<if test="modifiedTime != null" > <if test="modifiedTime != null">
modified_time, modified_time,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides="," > <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null" > <if test="id != null">
#{id,jdbcType=INTEGER}, #{id,jdbcType=INTEGER},
</if> </if>
<if test="mobilePhone != null" > <if test="mobilePhone != null">
#{mobilePhone,jdbcType=VARCHAR}, #{mobilePhone,jdbcType=VARCHAR},
</if> </if>
<if test="password != null" > <if test="password != null">
#{password,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
</if> </if>
<if test="registerProduct != null" > <if test="registerProduct != null">
#{registerProduct,jdbcType=INTEGER}, #{registerProduct,jdbcType=INTEGER},
</if> </if>
<if test="registerSource != null" > <if test="registerSource != null">
#{registerSource,jdbcType=INTEGER}, #{registerSource,jdbcType=INTEGER},
</if> </if>
<if test="name != null" > <if test="name != null">
#{name,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
</if> </if>
<if test="age != null" > <if test="age != null">
#{age,jdbcType=TINYINT}, #{age,jdbcType=TINYINT},
</if> </if>
<if test="birthday != null" > <if test="birthday != null">
#{birthday,jdbcType=DATE}, #{birthday,jdbcType=DATE},
</if> </if>
<if test="sex != null" > <if test="sex != null">
#{sex,jdbcType=TINYINT}, #{sex,jdbcType=TINYINT},
</if> </if>
<if test="idCard != null" > <if test="idCard != null">
#{idCard,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR},
</if> </if>
<if test="regTime != null" > <if test="regTime != null">
#{regTime,jdbcType=TIMESTAMP}, #{regTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="deleteFlag != null" > <if test="deleteFlag != null">
#{deleteFlag,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
</if> </if>
<if test="createdId != null" > <if test="createdId != null">
#{createdId,jdbcType=INTEGER}, #{createdId,jdbcType=INTEGER},
</if> </if>
<if test="createdTime != null" > <if test="createdTime != null">
#{createdTime,jdbcType=TIMESTAMP}, #{createdTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="modifiedId != null" > <if test="modifiedId != null">
#{modifiedId,jdbcType=INTEGER}, #{modifiedId,jdbcType=INTEGER},
</if> </if>
<if test="modifiedTime != null" > <if test="modifiedTime != null">
#{modifiedTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" > <update id="updateByPrimaryKeySelective"
update account_info parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
<set > update account_info
<if test="mobilePhone != null" > <set>
mobile_phone = #{mobilePhone,jdbcType=VARCHAR}, <if test="mobilePhone != null">
</if> mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
<if test="password != null" > </if>
password = #{password,jdbcType=VARCHAR}, <if test="password != null">
</if> password = #{password,jdbcType=VARCHAR},
<if test="registerProduct != null" > </if>
register_product = #{registerProduct,jdbcType=INTEGER}, <if test="registerProduct != null">
</if> register_product = #{registerProduct,jdbcType=INTEGER},
<if test="registerSource != null" > </if>
register_source = #{registerSource,jdbcType=INTEGER}, <if test="registerSource != null">
</if> register_source = #{registerSource,jdbcType=INTEGER},
<if test="name != null" > </if>
name = #{name,jdbcType=VARCHAR}, <if test="name != null">
</if> name = #{name,jdbcType=VARCHAR},
<if test="age != null" > </if>
age = #{age,jdbcType=TINYINT}, <if test="age != null">
</if> age = #{age,jdbcType=TINYINT},
<if test="birthday != null" > </if>
birthday = #{birthday,jdbcType=DATE}, <if test="birthday != null">
</if> birthday = #{birthday,jdbcType=DATE},
<if test="sex != null" > </if>
sex = #{sex,jdbcType=TINYINT}, <if test="sex != null">
</if> sex = #{sex,jdbcType=TINYINT},
<if test="idCard != null" > </if>
id_card = #{idCard,jdbcType=VARCHAR}, <if test="idCard != null">
</if> id_card = #{idCard,jdbcType=VARCHAR},
<if test="regTime != null" > </if>
reg_time = #{regTime,jdbcType=TIMESTAMP}, <if test="regTime != null">
</if> reg_time = #{regTime,jdbcType=TIMESTAMP},
<if test="deleteFlag != null" > </if>
delete_flag = #{deleteFlag,jdbcType=INTEGER}, <if test="deleteFlag != null">
</if> delete_flag = #{deleteFlag,jdbcType=INTEGER},
<if test="createdId != null" > </if>
created_id = #{createdId,jdbcType=INTEGER}, <if test="createdId != null">
</if> created_id = #{createdId,jdbcType=INTEGER},
<if test="createdTime != null" > </if>
created_time = #{createdTime,jdbcType=TIMESTAMP}, <if test="createdTime != null">
</if> created_time = #{createdTime,jdbcType=TIMESTAMP},
<if test="modifiedId != null" > </if>
modified_id = #{modifiedId,jdbcType=INTEGER}, <if test="modifiedId != null">
</if> modified_id = #{modifiedId,jdbcType=INTEGER},
<if test="modifiedTime != null" > </if>
modified_time = #{modifiedTime,jdbcType=TIMESTAMP}, <if test="modifiedTime != null">
</if> modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
</set> </if>
where id = #{id,jdbcType=INTEGER} </set>
</update> where id = #{id,jdbcType=INTEGER}
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity" > </update>
<update id="updateByPrimaryKey" parameterType="com.pica.cloud.account.account.server.entity.AccountInfoEntity">
update account_info update account_info
set mobile_phone = #{mobilePhone,jdbcType=VARCHAR}, set mobile_phone = #{mobilePhone,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR}, password = #{password,jdbcType=VARCHAR},
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册