123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- <?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.slodon.b2b2c.dao.write.goods.GoodsRelatedTemplateWriteMapper">
- <resultMap id="resultMap" type="com.slodon.b2b2c.goods.pojo.GoodsRelatedTemplate">
- <id column="template_id" property="templateId" />
- <result column="distribution_channel" property="distributionChannel" />
- <result column="template_name" property="templateName" />
- <result column="template_position" property="templatePosition" />
- <result column="store_id" property="storeId" />
- <result column="create_vendor_id" property="createVendorId" />
- <result column="template_content" property="templateContent" />
- </resultMap>
- <!--除主键外的所有字段,用于插入操作-->
- <sql id="columns">
- <trim suffixOverrides=",">
- <if test="distributionChannel != null">
- `distribution_channel`,
- </if>
- <if test="templateName != null">
- `template_name`,
- </if>
- <if test="templatePosition != null">
- `template_position`,
- </if>
- <if test="storeId != null">
- `store_id`,
- </if>
- <if test="createVendorId != null">
- `create_vendor_id`,
- </if>
- <if test="templateContent != null">
- `template_content`,
- </if>
- </trim>
- </sql>
- <!--按照主键值进行操作-->
- <sql id="pkWhere">
- WHERE `template_id` = #{primaryKey}
- </sql>
- <!--操作条件-->
- <sql id="whereCondition">
- <if test="example != null">
- <trim prefix="WHERE" prefixOverrides="AND|OR">
- <if test="example.templateIdNotEquals != null">
- AND `template_id` != #{example.templateIdNotEquals}
- </if>
- <if test="example.templateIdIn != null">
- AND `template_id` in (${example.templateIdIn})
- </if>
- <if test="example.distributionChannel != null">
- AND `distribution_channel` = #{example.distributionChannel}
- </if>
- <if test="example.templateName != null">
- AND `template_name` = #{example.templateName}
- </if>
- <if test="example.templateNameLike != null">
- AND `template_name` like concat('%',#{example.templateNameLike},'%')
- </if>
- <if test="example.templatePosition != null">
- AND `template_position` = #{example.templatePosition}
- </if>
- <if test="example.storeId != null">
- AND `store_id` = #{example.storeId}
- </if>
- <if test="example.createVendorId != null">
- AND `create_vendor_id` = #{example.createVendorId}
- </if>
- <if test="example.templateContent != null">
- AND `template_content` = #{example.templateContent}
- </if>
- <if test="example.templateContentLike != null">
- AND `template_content` like concat('%',#{example.templateContentLike},'%')
- </if>
- </trim>
- </if>
- </sql>
- <!--排序条件-->
- <sql id="orderBy">
- ORDER BY `template_id` DESC
- </sql>
- <sql id="orderByOther">
- order by ${example.orderBy}
- </sql>
- <!--分组条件-->
- <sql id="groupBy">
- group by ${example.groupBy}
- </sql>
- <!--分页条件-->
- <sql id="limit">
- <if test="size != null and size > 0">
- limit #{startRow},#{size}
- </if>
- </sql>
- <!--查询符合条件的记录数-->
- <select id="countByExample" parameterType="com.slodon.b2b2c.goods.example.GoodsRelatedTemplateExample" resultType="java.lang.Integer">
- SELECT
- COUNT(*)
- FROM `goods_related_template`
- <include refid="whereCondition" />
- </select>
- <!--根据主键查询记录-->
- <select id="getByPrimaryKey" resultMap="resultMap">
- SELECT
- *
- FROM `goods_related_template`
- <include refid="pkWhere" />
- </select>
- <!--查询符合条件的记录(所有字段)-->
- <select id="listByExample" resultMap="resultMap">
- SELECT
- *
- FROM `goods_related_template`
- <include refid="whereCondition" />
- <if test="example.groupBy != null">
- <include refid="groupBy" />
- </if>
- <choose>
- <when test="example.orderBy != null">
- <include refid="orderByOther" />
- </when>
- <otherwise>
- <include refid="orderBy" />
- </otherwise>
- </choose>
- </select>
- <!--分页查询符合条件的记录(所有字段)-->
- <select id="listPageByExample" resultMap="resultMap">
- SELECT
- *
- FROM `goods_related_template`
- <include refid="whereCondition" />
- <if test="example.groupBy != null">
- <include refid="groupBy" />
- </if>
- <choose>
- <when test="example.orderBy != null">
- <include refid="orderByOther" />
- </when>
- <otherwise>
- <include refid="orderBy" />
- </otherwise>
- </choose>
- <include refid="limit" />
- </select>
- <!--查询符合条件的记录(指定字段)-->
- <select id="listFieldsByExample" resultMap="resultMap">
- SELECT
- ${fields}
- FROM `goods_related_template`
- <include refid="whereCondition" />
- <if test="example.groupBy != null">
- <include refid="groupBy" />
- </if>
- <choose>
- <when test="example.orderBy != null">
- <include refid="orderByOther" />
- </when>
- <otherwise>
- <include refid="orderBy" />
- </otherwise>
- </choose>
- </select>
- <!--分页查询符合条件的记录(指定字段)-->
- <select id="listFieldsPageByExample" resultMap="resultMap">
- SELECT
- ${fields}
- FROM `goods_related_template`
- <include refid="whereCondition" />
- <if test="example.groupBy != null">
- <include refid="groupBy" />
- </if>
- <choose>
- <when test="example.orderBy != null">
- <include refid="orderByOther" />
- </when>
- <otherwise>
- <include refid="orderBy" />
- </otherwise>
- </choose>
- <include refid="limit" />
- </select>
- <!--根据条件删除记录,可多条删除-->
- <delete id="deleteByExample">
- DELETE FROM `goods_related_template`
- <include refid="whereCondition" />
- </delete>
- <!--根据主键删除记录-->
- <delete id="deleteByPrimaryKey">
- DELETE FROM `goods_related_template`
- <include refid="pkWhere" />
- </delete>
- <!--插入一条记录-->
- <insert id="insert" keyColumn="template_id" keyProperty="templateId" parameterType="com.slodon.b2b2c.goods.pojo.GoodsRelatedTemplate" useGeneratedKeys="true">
- INSERT INTO `goods_related_template`(
- <include refid="columns" />
- )
- VALUES(
- <trim suffixOverrides=",">
- <if test="distributionChannel != null">
- #{distributionChannel},
- </if>
- <if test="templateName != null">
- #{templateName},
- </if>
- <if test="templatePosition != null">
- #{templatePosition},
- </if>
- <if test="storeId != null">
- #{storeId},
- </if>
- <if test="createVendorId != null">
- #{createVendorId},
- </if>
- <if test="templateContent != null">
- #{templateContent},
- </if>
- </trim>
- )
- </insert>
- <!--按条件更新记录中不为空的字段-->
- <update id="updateByExampleSelective">
- UPDATE `goods_related_template`
- <trim prefix="SET" suffixOverrides=",">
- <if test="record.distributionChannel != null">
- `distribution_channel` = #{record.distributionChannel},
- </if>
- <if test="record.templateName != null">
- `template_name` = #{record.templateName},
- </if>
- <if test="record.templatePosition != null">
- `template_position` = #{record.templatePosition},
- </if>
- <if test="record.storeId != null">
- `store_id` = #{record.storeId},
- </if>
- <if test="record.createVendorId != null">
- `create_vendor_id` = #{record.createVendorId},
- </if>
- <if test="record.templateContent != null">
- `template_content` = #{record.templateContent},
- </if>
- </trim>
- <include refid="whereCondition" />
- </update>
- <!--按照主键更新记录中不为空的字段-->
- <update id="updateByPrimaryKeySelective">
- UPDATE `goods_related_template`
- <trim prefix="SET" suffixOverrides=",">
- <if test="distributionChannel != null">
- `distribution_channel` = #{distributionChannel},
- </if>
- <if test="templateName != null">
- `template_name` = #{templateName},
- </if>
- <if test="templatePosition != null">
- `template_position` = #{templatePosition},
- </if>
- <if test="storeId != null">
- `store_id` = #{storeId},
- </if>
- <if test="createVendorId != null">
- `create_vendor_id` = #{createVendorId},
- </if>
- <if test="templateContent != null">
- `template_content` = #{templateContent},
- </if>
- </trim>
- WHERE `template_id` = #{templateId}
- </update>
- </mapper>
|