|
|
|
@@ -4,21 +4,21 @@
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.cxyxiaomo.epp.shop.dao.GoodDao">
|
|
|
|
|
<resultMap id="GoodsResultMap" type="com.cxyxiaomo.epp.common.pojo.Good">
|
|
|
|
|
<id column="id" property="id" />
|
|
|
|
|
<result column="goods_name" property="goodsName" />
|
|
|
|
|
<result column="category_id" property="categoryId" />
|
|
|
|
|
<result column="brand" property="brand" />
|
|
|
|
|
<result column="gallery" property="gallery" />
|
|
|
|
|
<result column="brief" property="brief" />
|
|
|
|
|
<result column="is_on_sale" property="isOnSale" />
|
|
|
|
|
<result column="sort_order" property="sortOrder" />
|
|
|
|
|
<result column="pic_url" property="picUrl" />
|
|
|
|
|
<result column="type" property="type" />
|
|
|
|
|
<result column="unit" property="unit" />
|
|
|
|
|
<result column="counter_price" property="counterPrice" />
|
|
|
|
|
<result column="retail_price" property="retailPrice" />
|
|
|
|
|
<result column="detail" property="detail" />
|
|
|
|
|
<result column="deleted" property="deleted" />
|
|
|
|
|
<id column="id" property="id"/>
|
|
|
|
|
<result column="goods_name" property="goodsName"/>
|
|
|
|
|
<result column="category_id" property="categoryId"/>
|
|
|
|
|
<result column="brand" property="brand"/>
|
|
|
|
|
<result column="gallery" property="gallery"/>
|
|
|
|
|
<result column="brief" property="brief"/>
|
|
|
|
|
<result column="is_on_sale" property="isOnSale"/>
|
|
|
|
|
<result column="sort_order" property="sortOrder"/>
|
|
|
|
|
<result column="pic_url" property="picUrl"/>
|
|
|
|
|
<result column="type" property="type"/>
|
|
|
|
|
<result column="unit" property="unit"/>
|
|
|
|
|
<result column="counter_price" property="counterPrice"/>
|
|
|
|
|
<result column="retail_price" property="retailPrice"/>
|
|
|
|
|
<result column="detail" property="detail"/>
|
|
|
|
|
<result column="deleted" property="deleted"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!--<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
|
|
|
@@ -76,98 +76,64 @@
|
|
|
|
|
<!--</select>-->
|
|
|
|
|
|
|
|
|
|
<insert id="insert" parameterType="com.cxyxiaomo.epp.common.pojo.Good" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO goods (goods_name, category_id, brand, gallery, brief, is_on_sale, sort_order, pic_url, type, unit, counter_price, retail_price, detail, deleted)
|
|
|
|
|
VALUES (#{goodsName}, #{categoryId}, #{brand}, #{gallery}, #{brief}, #{isOnSale}, #{sortOrder}, #{picUrl}, #{type}, #{unit}, #{counterPrice}, #{retailPrice}, #{detail}, #{deleted})
|
|
|
|
|
INSERT INTO goods (goods_name, category_id, brand, gallery, brief, is_on_sale, sort_order, pic_url, type, unit,
|
|
|
|
|
counter_price, retail_price, detail, deleted)
|
|
|
|
|
VALUES (#{goodsName}, #{categoryId}, #{brand}, #{gallery}, #{brief}, #{isOnSale}, #{sortOrder}, #{picUrl},
|
|
|
|
|
#{type}, #{unit}, #{counterPrice}, #{retailPrice}, #{detail}, #{deleted})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="update" parameterType="com.cxyxiaomo.epp.common.pojo.Good">
|
|
|
|
|
UPDATE goods
|
|
|
|
|
SET goods_name = #{goodsName},
|
|
|
|
|
category_id = #{categoryId},
|
|
|
|
|
brand = #{brand},
|
|
|
|
|
gallery = #{gallery},
|
|
|
|
|
brief = #{brief},
|
|
|
|
|
is_on_sale = #{isOnSale},
|
|
|
|
|
sort_order = #{sortOrder},
|
|
|
|
|
pic_url = #{picUrl},
|
|
|
|
|
type = #{type},
|
|
|
|
|
unit = #{unit},
|
|
|
|
|
SET goods_name = #{goodsName},
|
|
|
|
|
category_id = #{categoryId},
|
|
|
|
|
brand = #{brand},
|
|
|
|
|
gallery = #{gallery},
|
|
|
|
|
brief = #{brief},
|
|
|
|
|
is_on_sale = #{isOnSale},
|
|
|
|
|
sort_order = #{sortOrder},
|
|
|
|
|
pic_url = #{picUrl},
|
|
|
|
|
type = #{type},
|
|
|
|
|
unit = #{unit},
|
|
|
|
|
counter_price = #{counterPrice},
|
|
|
|
|
retail_price = #{retailPrice},
|
|
|
|
|
detail = #{detail},
|
|
|
|
|
deleted = #{deleted}
|
|
|
|
|
retail_price = #{retailPrice},
|
|
|
|
|
detail = #{detail},
|
|
|
|
|
deleted = #{deleted}
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteById">
|
|
|
|
|
DELETE FROM goods
|
|
|
|
|
DELETE
|
|
|
|
|
FROM goods
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--<insert id="addGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
|
|
|
|
<!-- INSERT INTO user (username, `password`, realname, id_number, phone_number, role_id, building_id, doorplate,-->
|
|
|
|
|
<!-- permission, permission_time)-->
|
|
|
|
|
<!-- VALUES (#{username}, #{password}, #{realname}, #{idNumber}, #{phoneNumber}, #{roleId}, #{buildingId},-->
|
|
|
|
|
<!-- #{doorplate}, #{permission}, #{permissionTime})-->
|
|
|
|
|
<!--</insert>-->
|
|
|
|
|
<!--<update id="updateGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
|
|
|
|
<!-- UPDATE user-->
|
|
|
|
|
<!-- <set>-->
|
|
|
|
|
<!-- <if test="username != null and username != ''">-->
|
|
|
|
|
<!-- username = #{username},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="password != null and password != ''">-->
|
|
|
|
|
<!-- `password` = #{password},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="realname != null and realname != ''">-->
|
|
|
|
|
<!-- realname = #{realname},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="idNumber != null and idNumber != ''">-->
|
|
|
|
|
<!-- id_number = #{idNumber},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="phoneNumber != null and phoneNumber != ''">-->
|
|
|
|
|
<!-- phone_number = #{phoneNumber},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="roleId != null">-->
|
|
|
|
|
<!-- role_id = #{roleId},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="buildingId != null and buildingId != ''">-->
|
|
|
|
|
<!-- building_id = #{buildingId},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="doorplate != null and doorplate != ''">-->
|
|
|
|
|
<!-- doorplate = #{doorplate},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="permission != null">-->
|
|
|
|
|
<!-- permission = #{permission},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="permissionTime != null">-->
|
|
|
|
|
<!-- permission_time = #{permissionTime},-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- </set>-->
|
|
|
|
|
<!-- WHERE id = #{id}-->
|
|
|
|
|
<!--</update>-->
|
|
|
|
|
<!--<select id="getGoodById" parameterType="java.lang.Long" resultType="com.cxyxiaomo.epp.common.pojo.Good">-->
|
|
|
|
|
<!-- SELECT *-->
|
|
|
|
|
<!-- FROM user-->
|
|
|
|
|
<!-- WHERE id = #{id}-->
|
|
|
|
|
<!--</select>-->
|
|
|
|
|
<insert id="addGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">
|
|
|
|
|
INSERT INTO goods (goods_name, category_id, brand, gallery, brief, is_on_sale, sort_order, pic_url, type, unit,
|
|
|
|
|
counter_price, retail_price, detail)
|
|
|
|
|
VALUES (#{goodsName}, #{categoryId}, #{brand}, #{gallery}, #{brief}, #{isOnSale}, #{sortOrder}, #{picUrl},
|
|
|
|
|
#{type}, #{unit}, #{counterPrice}, #{retailPrice}, #{detail})
|
|
|
|
|
</insert>
|
|
|
|
|
<update id="updateGood" parameterType="com.cxyxiaomo.epp.common.pojo.Good">
|
|
|
|
|
UPDATE goods
|
|
|
|
|
<set>
|
|
|
|
|
<if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
|
|
|
|
|
<if test="categoryId != null">category_id = #{categoryId},</if>
|
|
|
|
|
<if test="brand != null and brand != ''">brand = #{brand},</if>
|
|
|
|
|
<if test="gallery != null and gallery != ''">gallery = #{gallery},</if>
|
|
|
|
|
<if test="brief != null and brief != ''">brief = #{brief},</if>
|
|
|
|
|
<if test="isOnSale != null">is_on_sale = #{isOnSale},</if>
|
|
|
|
|
<if test="sortOrder != null">sort_order = #{sortOrder},</if>
|
|
|
|
|
<if test="picUrl != null and picUrl != ''">pic_url = #{picUrl},</if>
|
|
|
|
|
<if test="type != null">type = #{type},</if>
|
|
|
|
|
<if test="unit != null and unit != ''">unit = #{unit},</if>
|
|
|
|
|
<if test="counterPrice != null">counter_price = #{counterPrice},</if>
|
|
|
|
|
<if test="retailPrice != null">retail_price = #{retailPrice},</if>
|
|
|
|
|
<if test="detail != null and detail != ''">detail = #{detail},</if>
|
|
|
|
|
<if test="deleted != null">deleted = #{deleted}</if>
|
|
|
|
|
</set>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<select id="getGoodList" resultType="com.cxyxiaomo.epp.common.pojo.Good">
|
|
|
|
|
select *
|
|
|
|
|
from goods
|
|
|
|
@@ -213,9 +179,9 @@
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!--<delete id="deleteGoodById">-->
|
|
|
|
|
<!-- DELETE-->
|
|
|
|
|
<!-- FROM user-->
|
|
|
|
|
<!-- WHERE id = #{userId}-->
|
|
|
|
|
<!--</delete>-->
|
|
|
|
|
<delete id="deleteGoodById">
|
|
|
|
|
DELETE
|
|
|
|
|
FROM goods
|
|
|
|
|
WHERE id = #{goodId}
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|
|
|
|
|