2022-03-15 11:12:47 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
2022-03-18 19:24:28 +08:00
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
2022-03-15 11:12:47 +08:00
|
|
|
<mapper namespace="com.ghy.goods.mapper.GoodsImgsMapper">
|
2022-03-18 19:24:28 +08:00
|
|
|
|
2022-03-15 11:12:47 +08:00
|
|
|
<resultMap id="GoodsImgsResult" type="com.ghy.goods.domain.GoodsImgs">
|
2022-03-18 19:24:28 +08:00
|
|
|
<result property="goodsImgsId" column="goods_imgs_id" />
|
|
|
|
|
<result property="goodsId" column="goods_id" />
|
|
|
|
|
<result property="imgUrl" column="img_url" />
|
2022-05-28 15:41:42 +08:00
|
|
|
<result property="imgType" column="img_type" />
|
2022-03-15 11:12:47 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectGoodsImgs">
|
2022-05-28 15:41:42 +08:00
|
|
|
SELECT goods_imgs_id, goods_id, img_url, img_type
|
2022-03-15 11:12:47 +08:00
|
|
|
FROM goods_imgs
|
|
|
|
|
</sql>
|
|
|
|
|
|
2022-03-18 19:24:28 +08:00
|
|
|
<delete id="delete">
|
|
|
|
|
DELETE FROM goods_imgs WHERE goods_imgs_id IN
|
|
|
|
|
<foreach collection="array" item="goodsImgsId" open="(" separator="," close=")">
|
|
|
|
|
#{goodsImgsId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
2022-03-19 11:38:09 +08:00
|
|
|
<delete id="deleteByGoodsId">
|
|
|
|
|
DELETE FROM goods_imgs WHERE goods_id = #{goodsId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
2022-05-28 15:41:42 +08:00
|
|
|
<select id="selectByGoodsId" resultMap="GoodsImgsResult">
|
2022-03-18 19:24:28 +08:00
|
|
|
<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>
|
2022-05-28 15:41:42 +08:00
|
|
|
<if test="imgType != null and imgType != ''">img_type = #{imgType},</if>
|
2022-03-18 19:24:28 +08:00
|
|
|
update_time = sysdate()
|
|
|
|
|
</set>
|
|
|
|
|
WHERE goods_imgs_id = #{goodsImgsId};
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
2022-03-15 11:12:47 +08:00
|
|
|
|
|
|
|
|
</mapper>
|