zoukankan      html  css  js  c++  java
  • ssm实战(7)------收货地址管理

    收货地址管理

    功能:

    添加地址;删除地址;更新地址;地址的list;地址的分页;地址的详情

    接口:

    注:

    学习目标:

    1 SpringMVC数据绑定中的对象绑定

    2 Mybatis自动生主键、配置和使用 : useGeneratedKeys="true" keyProperty="id"  加上这个配置,当用shipping对象插入数据后,会将自动生成的主键保存到 插入数据用的shipping对象

    <insert id="insert" parameterType="com.eshop.pojo.Shipping" useGeneratedKeys="true" keyProperty="id">
        insert into eshop_shipping (id, user_id, receiver_name, 
          receiver_phone, receiver_mobile, receiver_province, 
          receiver_city, receiver_district, receiver_address, 
          receiver_zip, create_time, update_time
          )
        values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{receiverName,jdbcType=VARCHAR}, 
          #{receiverPhone,jdbcType=VARCHAR}, #{receiverMobile,jdbcType=VARCHAR}, #{receiverProvince,jdbcType=VARCHAR}, 
          #{receiverCity,jdbcType=VARCHAR}, #{receiverDistrict,jdbcType=VARCHAR}, #{receiverAddress,jdbcType=VARCHAR}, 
          #{receiverZip,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
          )
      </insert>
    

    3 如何避免横向越权的漏洞的巩固:

    删除的横向越权:

    //要防止横向越权,让该用户删除了 不属于自己的 购物车地址。自己写一个新的SQL
    int resultCount=shippingMapper.deleteByUserIdShippingId(userId,shippingId);
      <delete id="deleteByUserIdShippingId" parameterType="map">
        delete from eshop_shipping
        where id=#{shippingId}
        and user_id=#{userId}
      </delete>
    

     更新的横向越权

     
  • 相关阅读:
    异步与同步,阻塞与非阻塞的正确认识
    Go 环境配置
    使用node.js 脚手架搭建Vue项目
    使用HBuilder+MUI+Flask后端服务器框架+Mongodb数据库开发手机APP
    基于百度API+Flask实现网页版和图灵机器聊天
    人工智能-调百度AI接口+图灵机器人
    日期显示格式的修改
    salt软件远程控制服务器
    Django
    孙鑫MFC学习笔记14:网络编程
  • 原文地址:https://www.cnblogs.com/Lemonades/p/11502933.html
Copyright © 2011-2022 走看看