123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <?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.read.goods.GoodsRelatedTemplateReadMapper">
- <resultMap id="resultMap" type="com.slodon.b2b2c.goods.pojo.GoodsRelatedTemplate">
- <id column="template_id" property="templateId" />
- <result column="channel" property="channel" />
- <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="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.channel != null">
- AND `channel` = #{example.channel}
- </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>
- </mapper>
|