82 lines
2.8 KiB
XML
82 lines
2.8 KiB
XML
<?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.fhy.mapper.GcarCommMapper" >
|
|
<resultMap id="BaseResultMap" type="com.fhy.pojo.GcarComm" >
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
<result column="comm_id" property="commId" jdbcType="INTEGER" />
|
|
<result column="g_id" property="gId" jdbcType="INTEGER" />
|
|
<result column="comm_num" property="commNum" jdbcType="VARCHAR" />
|
|
<result column="comm_price" property="commPrice" jdbcType="VARCHAR" />
|
|
<result column="comm_name" property="commName" jdbcType="VARCHAR" />
|
|
<result column="comm_img" property="commImg" jdbcType="VARCHAR" />
|
|
</resultMap>
|
|
<sql id="Base_Column_List" >
|
|
id, comm_id, g_id, comm_num, comm_price
|
|
</sql>
|
|
|
|
<!-- 添加购物车详情 -->
|
|
<insert id="insertSelective" parameterType="com.fhy.pojo.GcarComm" >
|
|
insert into gcar_comm
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >
|
|
id,
|
|
</if>
|
|
<if test="commId != null" >
|
|
comm_id,
|
|
</if>
|
|
<if test="gId != null" >
|
|
g_id,
|
|
</if>
|
|
<if test="commNum != null" >
|
|
comm_num,
|
|
</if>
|
|
<if test="commPrice != null" >
|
|
comm_price,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
<if test="id != null" >
|
|
#{id,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="commId != null" >
|
|
#{commId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="gId != null" >
|
|
#{gId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="commNum != null" >
|
|
#{commNum,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="commPrice != null" >
|
|
#{commPrice,jdbcType=VARCHAR},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- 查询自己的购物车 -->
|
|
<select id="selectByuserid" resultMap="BaseResultMap" parameterType="com.fhy.pojo.GcarComm">
|
|
select c.comm_name,gcc.comm_num,gcc.comm_price,c.comm_img,gc.gtime,gcc.comm_id,gcc.g_id
|
|
from gcar_comm as gcc,comm as c,gcar as gc
|
|
where c.id = gcc.comm_id and gc.id = gcc.g_id and g_id in (select id from gcar where user_id = #{user_id} and gstatus = 1)
|
|
</select>
|
|
|
|
<!-- 修改 删除 -->
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.fhy.pojo.GcarComm" >
|
|
update gcar_comm
|
|
<set >
|
|
<if test="commId != null" >
|
|
comm_id = #{commId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="gId != null" >
|
|
g_id = #{gId,jdbcType=INTEGER},
|
|
</if>
|
|
<if test="commNum != null" >
|
|
comm_num = #{commNum,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="commPrice != null" >
|
|
comm_price = #{commPrice,jdbcType=VARCHAR},
|
|
</if>
|
|
</set>
|
|
where id = #{id,jdbcType=INTEGER}
|
|
</update>
|
|
</mapper> |