Acwing第 4 场周赛【完结】

最新免费Redis连接工具RedisDesktopManager_2021.6.0

  返回  

mybatis resultMap使用

2021/8/21 17:58:17 浏览:
<!--获取商品列表-->
  <resultMap id="goodsVoMap" type="com.example.seckill.vo.GoodsVo">
    <id column="id" jdbcType="BIGINT" property="id"/>
    <result column="goods_name" jdbcType="VARCHAR" property="goodsName"/>
    <result column="goods_img" jdbcType="VARCHAR" property="goodsImg"/>
    <result column="goods_detail" jdbcType="VARCHAR" property="goodsDetail"/>
    <result column="goods_price" jdbcType="DECIMAL" property="goodsPrice"/>
    <result column="goods_stock" jdbcType="DECIMAL" property="goodsStock"/>
    <result column="seckill_price" jdbcType="DECIMAL" property="seckillPrice"/>
    <result column="stock_count" jdbcType="INTEGER" property="stockCount"/>
    <result column="start_date" jdbcType="INTEGER" property="startDate"/>
    <result column="end_date" jdbcType="INTEGER" property="endDate"/>
  </resultMap>
  <select id="findGoodsVo" resultMap="goodsVoMap">
    select
      g.id,g.goods_name,g.goods_img,g.goods_detail,g.goods_price,g.goods_stock,
      sg.seckill_price,sg.stock_count,sg.start_date,sg.end_date
    from
      t_goods g
        LEFT JOIN
      t_seckill_goods as sg on g.id=sg.goods_id
  </select>

注意事项
1.jdbcType必须大写
2.部分jdbctype类型和sql类型对应:

jdbc typesql
INTEGERint
VARCHARLongText

联系我们

如果您对我们的服务有兴趣,请及时和我们联系!

服务热线:18288888888
座机:18288888888
传真:
邮箱:888888@qq.com
地址:郑州市文化路红专路93号