123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <?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.cms.FriendLinkReadMapper">
- <resultMap id="resultMap" type="com.slodon.b2b2c.cms.pojo.FriendLink">
- <id column="link_id" property="linkId" />
- <result column="web_site" property="webSite" />
- <result column="link_name" property="linkName" />
- <result column="link_image" property="linkImage" />
- <result column="show_type" property="showType" />
- <result column="link_url" property="linkUrl" />
- <result column="sort" property="sort" />
- <result column="state" property="state" />
- <result column="create_admin_id" property="createAdminId" />
- <result column="create_admin_name" property="createAdminName" />
- <result column="create_time" property="createTime" />
- <result column="update_admin_id" property="updateAdminId" />
- <result column="update_admin_name" property="updateAdminName" />
- <result column="update_time" property="updateTime" />
- </resultMap>
- <!--按照主键值进行操作-->
- <sql id="pkWhere">
- WHERE `link_id` = #{primaryKey}
- </sql>
- <!--操作条件-->
- <sql id="whereCondition">
- <if test="example != null">
- <trim prefix="WHERE" prefixOverrides="AND|OR">
- <if test="example.linkIdNotEquals != null">
- AND `link_id` != #{example.linkIdNotEquals}
- </if>
- <if test="example.linkIdIn != null">
- AND `link_id` in (${example.linkIdIn})
- </if>
- <if test="example.webSite != null">
- AND `web_site` = #{example.webSite}
- </if>
- <if test="example.linkName != null">
- AND `link_name` = #{example.linkName}
- </if>
- <if test="example.linkNameLike != null">
- AND `link_name` like concat('%',#{example.linkNameLike},'%')
- </if>
- <if test="example.linkImage != null">
- AND `link_image` = #{example.linkImage}
- </if>
- <if test="example.showType != null">
- AND `show_type` = #{example.showType}
- </if>
- <if test="example.linkUrl != null">
- AND `link_url` = #{example.linkUrl}
- </if>
- <if test="example.sort != null">
- AND `sort` = #{example.sort}
- </if>
- <if test="example.state != null">
- AND `state` = #{example.state}
- </if>
- <if test="example.createAdminId != null">
- AND `create_admin_id` = #{example.createAdminId}
- </if>
- <if test="example.createAdminName != null">
- AND `create_admin_name` = #{example.createAdminName}
- </if>
- <if test="example.createAdminNameLike != null">
- AND `create_admin_name` like concat('%',#{example.createAdminNameLike},'%')
- </if>
- <if test="example.createTimeAfter != null">
- AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
- </if>
- <if test="example.createTimeBefore != null">
- AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
- </if>
- <if test="example.updateAdminId != null">
- AND `update_admin_id` = #{example.updateAdminId}
- </if>
- <if test="example.updateAdminName != null">
- AND `update_admin_name` = #{example.updateAdminName}
- </if>
- <if test="example.updateAdminNameLike != null">
- AND `update_admin_name` like concat('%',#{example.updateAdminNameLike},'%')
- </if>
- <if test="example.updateTimeAfter != null">
- AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
- </if>
- <if test="example.updateTimeBefore != null">
- AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
- </if>
- </trim>
- </if>
- </sql>
- <!--排序条件-->
- <sql id="orderBy">
- ORDER BY `link_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.cms.example.FriendLinkExample" resultType="java.lang.Integer">
- SELECT
- COUNT(*)
- FROM `cms_friend_link`
- <include refid="whereCondition" />
- </select>
- <!--根据主键查询记录-->
- <select id="getByPrimaryKey" resultMap="resultMap">
- SELECT
- *
- FROM `cms_friend_link`
- <include refid="pkWhere" />
- </select>
- <!--查询符合条件的记录(所有字段)-->
- <select id="listByExample" resultMap="resultMap">
- SELECT
- *
- FROM `cms_friend_link`
- <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 `cms_friend_link`
- <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 `cms_friend_link`
- <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 `cms_friend_link`
- <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>
|