70 lines
3.0 KiB
XML
70 lines
3.0 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.ghy.customer.mapper.CustomerMapper">
|
||
|
|
|
||
|
|
<resultMap id="GoodsImgsResult" type="com.ghy.customer.domain.Customer">
|
||
|
|
<!-- 消费者属性 -->
|
||
|
|
<result property="createBy" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="updateBy" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
<result property="remark" column="remark" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectGoodsImgs">
|
||
|
|
SELECT goods_imgs_id, goods_id, img_url, create_by, create_time, remark
|
||
|
|
FROM goods_imgs
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<delete id="delete">
|
||
|
|
DELETE FROM goods_imgs WHERE goods_imgs_id IN
|
||
|
|
<foreach collection="array" item="goodsImgsId" open="(" separator="," close=")">
|
||
|
|
#{goodsImgsId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteByGoodsId">
|
||
|
|
DELETE FROM goods_imgs WHERE goods_id = #{goodsId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="selectByGoodsId" resultType="com.ghy.goods.domain.GoodsImgs">
|
||
|
|
<include refid="selectGoodsImgs"/>
|
||
|
|
<where>
|
||
|
|
<if test="goodsId != null and goodsId != 0">
|
||
|
|
AND goods_id = #{goodsId}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="batchInsert" parameterType="com.ghy.goods.domain.GoodsImgs" useGeneratedKeys="true" keyProperty="goodsImgsId">
|
||
|
|
<foreach collection="array" item="goodsImgs">
|
||
|
|
INSERT INTO goods_imgs(
|
||
|
|
<if test="goodsImgsId != null and goodsImgsId != 0">goods_imgs_id,</if>
|
||
|
|
<if test="goodsId != null and goodsId != 0">goods_id,</if>
|
||
|
|
<if test="imgUrl != null and imgUrl != ''">img_url,</if>
|
||
|
|
<if test="remark != null and remark != ''">remark,</if>
|
||
|
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||
|
|
create_time)
|
||
|
|
VALUES(
|
||
|
|
<if test="goodsImgsId != null and goodsImgsId != 0">#{goodsImgsId},</if>
|
||
|
|
<if test="goodsId != null and goodsId != 0">#{goodsId},</if>
|
||
|
|
<if test="imgUrl != null and imgUrl != ''">#{imgUrl},</if>
|
||
|
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||
|
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||
|
|
sysdate());
|
||
|
|
</foreach>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="batchUpdate" parameterType="com.ghy.goods.domain.GoodsImgs">
|
||
|
|
<foreach collection="array" item="goodsImgs">
|
||
|
|
UPDATE goods_imgs
|
||
|
|
<set>
|
||
|
|
<if test="goodsId != null and goodsId != ''">goods_id = #{goodsId},</if>
|
||
|
|
<if test="imgUrl != null and imgUrl != ''">img_url = #{imgUrl},</if>
|
||
|
|
update_time = sysdate()
|
||
|
|
</set>
|
||
|
|
WHERE goods_imgs_id = #{goodsImgsId};
|
||
|
|
</foreach>
|
||
|
|
</update>
|
||
|
|
|
||
|
|
</mapper>
|