P2P项目中遇到的问题总结

Exception cause

Mybatis细节

java.lang.NoSuchMethodException
xxx(java.lang.xxx) or values (xxxx)
  <resultMap id="baseResultMap" type="com.xxx.p2p.base.domain.LoginInfo" >
    <id column="id" jdbcType="BIGINT" property="id" javaType="java.lang.Long" />
    <result column="username" property="username" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="password" property="password" jdbcType="VARCHAR" javaType="java.lang.String" />
    <result column="state" property="state" jdbcType="INTEGER" javaType="java.lang.Integer" />
  </resultMap>

<!--

	column:对应的是数据库中的列名
	property:对应的是java对象中的属性名
	

	通过mysql查询出来的数据:(不配置property)
		username:会被映射成userName 需要对返回的结果进行配置 <result column="usernanme" property="username">
		或者java对象中的属性名定义为 userName

-->

Key Technologies

spring中获取request

  <!--管理请求相关内容的的监听器 只用配置了这个监听器才能使用RequestContextHolder(里面包装了request)-->
 <listener>
   <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
 </listener>

状态码的表示

1.给当前用户添加一个状态: 当前用户状态码||套添加的状态码
2.判断当前用户是否具有某一个状态: 当前状态码&要判断的状态码 如果>0 有 <0 没有
3.给当前状态码移除一个状态: 当前状态码^要移除的状态码
4.& 运算
	0000 0011 
	0000 1010 &
	___________
	0000 0010
5. |运算
	0000 0011
	0000 1010 |
	___________
	0000 1011
6. ^运算
	0000 0011	
	0000 1010 ^
	___________
	0000 1001

关于Mybatis配置文件的错误

*Mapper.xml 配置文件出错

 <!--jdbcType配置的是数据库里面的属性-->
    <result column="bitState" property="bitState" jdbcType="BIGINT" />
    <result column="realName" property="realName" jdbcType="VARCHAR" />
    <result column="idNumber" property="idNumber" jdbcType="VARCHAR" />
    <result column="phoneNumber" property="phoneNumber" jdbcType="VARCHAR" />
    <!--javaType配置的是java文件中权限定类名或者别名-->
    <association property="incomeGrade" javaType="com.xxx.p2p.base.domain.SystemDictionaryItem" column="incomeGrade_id" select="com.xxx.p2p.base.mapper.SystemDictionaryItemMapper.selectByPrimaryKey"/>
    <association property="marriage" javaType="com.xxx.p2p.base.domain.SystemDictionaryItem" column="marriage_id" select="com.xxx.p2p.base.mapper.SystemDictionaryItemMapper.selectByPrimaryKey"/>
    <association property="kidCount" javaType="com.xxx.p2p.base.domain.SystemDictionaryItem" column="kidCount_id" select="com.xxx.p2p.base.mapper.SystemDictionaryItemMapper.selectByPrimaryKey"/>
    <association property="educationBackground" javaType="com.xxx.p2p.base.domain.SystemDictionaryItem" column="educationBackground_id" select="com.xxx.p2p.base.mapper.SystemDictionaryItemMapper.selectByPrimaryKey"/>
    <association property="houseCondition" javaType="com.xxx.p2p.base.domain.SystemDictionaryItem" column="houseCondition_id" select="com.xxx.p2p.base.mapper.SystemDictionaryItemMapper.selectByPrimaryKey"/>

关于乐观锁的问题

乐观锁的sql语句必须要在where后面加

where id = *** and version = #{version}  //用来控制乐观锁

FreeMarker:

  • FreeMarker中的模型:hash(如map或者自定义对象),scalars(存储的简单值),sequence(数组或者可以遍历的对象)
  • FreeMarker模板中的分类
    • 插值${}
      • 直接输出scalars:${someValue}
      • 处理不存在的scalars:${somevalue!“this is new someValue”}
      • 处理hash中的属性:${somebean.someValue}
      • 处理hash中的方法:${somebean.someMethod()}
      • 处理不存在的hash调用:${(xxx.xxx.something)!“ssss”}
    • ftl指令<#>:常见的ftl指令
      • <#if>…<#elseif>…<#else>…</#if>
      • <#list sequence(数组或者对象) as item(数组或者对象的某一个)>…</#list>
  • 注释<#-- -->
  • 标准文本 除了以上三种 其他都是静态文本 原样输出

关于后台初始化超级管理员的方案

在这里插入图片描述

手机验证码的逻辑步骤

在这里插入图片描述

发送短信验证码的细节操作

 <script type="text/javascript">
        $(function(){
            if ($("#showBindPhoneModal").size() > 0) {
               $("#showBindPhoneModal").click(function(){
                   $("#bindPhoneModal").modal("show");
               })

                //验证码逻辑
                $("#sendVerifyCode").click(function(){
                    //代表当前的发送验证码按钮
                    var _this = $(this);
                    //点击按钮立刻禁用按钮
                    _this.attr("disabled",true);
                    //发送ajax请求验证验证码
                    $.ajax({
                        url:"sendVerifyCode.do",
                        dataType:"json",
                        type:"post",
                        data:{phoneNumber:$("#phoneNumber").val()},
                        success:function(data){
                            if (data.success) {
                                //设置倒计时时间
                                var countDown = 5;
                                //创建定时器
                                var timer = window.setInterval(function(){
                                    debugger;
                                    if (countDown > 0) {
                                        _this.text(countDown+"秒重新发送!");
                                        countDown--;
                                    }else {
                                        window.clearInterval(timer);
                                        _this.attr("disabled",false);
                                        _this.text("重新发送验证码!");
                                    }
                                },1000);
                            }else {
                                _this.attr("disabled",false);
                                $.messager.popup("验证码错误!");
                            }
                        }
                    })
                })
            }
        })
    </script>

验证邮箱的思路

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/CSDN7771/article/details/89193374
P2P