123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258 |
- <?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.system.NavigationWriteMapper">
- <resultMap id="resultMap" type="com.slodon.b2b2c.system.pojo.Navigation">
- <id column="nav_id" property="navId" />
- <result column="web_site" property="webSite" />
- <result column="nav_name" property="navName" />
- <result column="sort" property="sort" />
- <result column="is_show" property="isShow" />
- <result column="data" property="data" />
- <result column="create_time" property="createTime" />
- </resultMap>
- <!--除主键外的所有字段,用于插入操作-->
- <sql id="columns">
- <trim suffixOverrides=",">
- <if test="webSite != null">
- `web_site`,
- </if>
- <if test="navName != null">
- `nav_name`,
- </if>
- <if test="sort != null">
- `sort`,
- </if>
- <if test="isShow != null">
- `is_show`,
- </if>
- <if test="data != null">
- `data`,
- </if>
- <if test="createTime != null">
- `create_time`,
- </if>
- </trim>
- </sql>
- <!--按照主键值进行操作-->
- <sql id="pkWhere">
- WHERE `nav_id` = #{primaryKey}
- </sql>
- <!--操作条件-->
- <sql id="whereCondition">
- <if test="example != null">
- <trim prefix="WHERE" prefixOverrides="AND|OR">
- <if test="example.navIdNotEquals != null">
- AND `nav_id` != #{example.navIdNotEquals}
- </if>
- <if test="example.navIdIn != null">
- AND `nav_id` in (${example.navIdIn})
- </if>
- <if test="example.webSite != null">
- AND `web_site` = #{example.webSite}
- </if>
- <if test="example.navName != null">
- AND `nav_name` = #{example.navName}
- </if>
- <if test="example.navNameLike != null">
- AND `nav_name` like concat('%',#{example.navNameLike},'%')
- </if>
- <if test="example.sort != null">
- AND `sort` = #{example.sort}
- </if>
- <if test="example.isShow != null">
- AND `is_show` = #{example.isShow}
- </if>
- <if test="example.data != null">
- AND `data` = #{example.data}
- </if>
- </trim>
- </if>
- </sql>
- <!--排序条件-->
- <sql id="orderBy">
- ORDER BY `sort` DESC ,`create_time` 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.system.example.NavigationExample" resultType="java.lang.Integer">
- SELECT
- COUNT(*)
- FROM `sys_pc_navigation`
- <include refid="whereCondition" />
- </select>
- <!--根据主键查询记录-->
- <select id="getByPrimaryKey" resultMap="resultMap">
- SELECT
- *
- FROM `sys_pc_navigation`
- <include refid="pkWhere" />
- </select>
- <!--查询符合条件的记录(所有字段)-->
- <select id="listByExample" resultMap="resultMap">
- SELECT
- *
- FROM `sys_pc_navigation`
- <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 `sys_pc_navigation`
- <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 `sys_pc_navigation`
- <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 `sys_pc_navigation`
- <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 `sys_pc_navigation`
- <include refid="whereCondition" />
- </delete>
- <!--根据主键删除记录-->
- <delete id="deleteByPrimaryKey">
- DELETE FROM `sys_pc_navigation`
- <include refid="pkWhere" />
- </delete>
- <!--插入一条记录-->
- <insert id="insert" keyColumn="nav_id" keyProperty="navId" parameterType="com.slodon.b2b2c.system.pojo.Navigation" useGeneratedKeys="true">
- INSERT INTO `sys_pc_navigation`(
- <include refid="columns" />
- )
- VALUES(
- <trim suffixOverrides=",">
- <if test="webSite != null">
- #{webSite},
- </if>
- <if test="navName != null">
- #{navName},
- </if>
- <if test="sort != null">
- #{sort},
- </if>
- <if test="isShow != null">
- #{isShow},
- </if>
- <if test="data != null">
- #{data},
- </if>
- <if test="createTime != null">
- #{createTime},
- </if>
- </trim>
- )
- </insert>
- <!--按条件更新记录中不为空的字段-->
- <update id="updateByExampleSelective">
- UPDATE `sys_pc_navigation`
- <trim prefix="SET" suffixOverrides=",">
- <if test="record.webSite != null">
- `web_site` = #{record.webSite},
- </if>
- <if test="record.navName != null">
- `nav_name` = #{record.navName},
- </if>
- <if test="record.sort != null">
- `sort` = #{record.sort},
- </if>
- <if test="record.isShow != null">
- `is_show` = #{record.isShow},
- </if>
- <if test="record.data != null">
- `data` = #{record.data},
- </if>
- </trim>
- <include refid="whereCondition" />
- </update>
- <!--按照主键更新记录中不为空的字段-->
- <update id="updateByPrimaryKeySelective">
- UPDATE `sys_pc_navigation`
- <trim prefix="SET" suffixOverrides=",">
- <if test="webSite != null">
- `web_site` = #{webSite},
- </if>
- <if test="navName != null">
- `nav_name` = #{navName},
- </if>
- <if test="sort != null">
- `sort` = #{sort},
- </if>
- <if test="isShow != null">
- `is_show` = #{isShow},
- </if>
- <if test="data != null">
- `data` = #{data},
- </if>
- </trim>
- WHERE `nav_id` = #{navId}
- </update>
- </mapper>
|