|
|
@@ -0,0 +1,160 @@
|
|
|
+<?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.kede.common.dao.LinksMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.kede.common.model.Links">
|
|
|
+ <id column="id" jdbcType="INTEGER" property="id" />
|
|
|
+ <result column="sort" jdbcType="INTEGER" property="sort" />
|
|
|
+ <result column="status" jdbcType="INTEGER" property="status" />
|
|
|
+ <result column="mutual_chain" jdbcType="INTEGER" property="mutualChain" />
|
|
|
+ <result column="name" jdbcType="VARCHAR" property="name" />
|
|
|
+ <result column="url" jdbcType="VARCHAR" property="url" />
|
|
|
+ <result column="remarks" jdbcType="VARCHAR" property="remarks" />
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ id, sort, `status`, mutual_chain, `name`, url, remarks, create_time
|
|
|
+ </sql>
|
|
|
+ <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from links
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </select>
|
|
|
+ <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
|
|
+ delete from links
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </delete>
|
|
|
+ <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.Links" useGeneratedKeys="true">
|
|
|
+ insert into links (sort, `status`, mutual_chain,
|
|
|
+ `name`, url, remarks,
|
|
|
+ create_time)
|
|
|
+ values (#{sort,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{mutualChain,jdbcType=INTEGER},
|
|
|
+ #{name,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
|
|
|
+ #{createTime,jdbcType=TIMESTAMP})
|
|
|
+ </insert>
|
|
|
+ <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.kede.common.model.Links" useGeneratedKeys="true">
|
|
|
+ insert into links
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sort != null">
|
|
|
+ sort,
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status`,
|
|
|
+ </if>
|
|
|
+ <if test="mutualChain != null">
|
|
|
+ mutual_chain,
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ `name`,
|
|
|
+ </if>
|
|
|
+ <if test="url != null">
|
|
|
+ url,
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null">
|
|
|
+ remarks,
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time,
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="sort != null">
|
|
|
+ #{sort,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ #{status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="mutualChain != null">
|
|
|
+ #{mutualChain,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="url != null">
|
|
|
+ #{url,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null">
|
|
|
+ #{remarks,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+ <update id="updateByPrimaryKeySelective" parameterType="com.kede.common.model.Links">
|
|
|
+ update links
|
|
|
+ <set>
|
|
|
+ <if test="sort != null">
|
|
|
+ sort = #{sort,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ `status` = #{status,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="mutualChain != null">
|
|
|
+ mutual_chain = #{mutualChain,jdbcType=INTEGER},
|
|
|
+ </if>
|
|
|
+ <if test="name != null">
|
|
|
+ `name` = #{name,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="url != null">
|
|
|
+ url = #{url,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="remarks != null">
|
|
|
+ remarks = #{remarks,jdbcType=VARCHAR},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+ <update id="updateByPrimaryKey" parameterType="com.kede.common.model.Links">
|
|
|
+ update links
|
|
|
+ set sort = #{sort,jdbcType=INTEGER},
|
|
|
+ `status` = #{status,jdbcType=INTEGER},
|
|
|
+ mutual_chain = #{mutualChain,jdbcType=INTEGER},
|
|
|
+ `name` = #{name,jdbcType=VARCHAR},
|
|
|
+ url = #{url,jdbcType=VARCHAR},
|
|
|
+ remarks = #{remarks,jdbcType=VARCHAR},
|
|
|
+ create_time = #{createTime,jdbcType=TIMESTAMP}
|
|
|
+ where id = #{id,jdbcType=INTEGER}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="linkesList" resultType="com.kede.linksAndHot.bo.outLinksList">
|
|
|
+ select id,sort,status,mutual_chain mutualChain,name,url,remarks,
|
|
|
+ date_format(create_time,'%Y-%m-%d %H:%i:%S') createTimes
|
|
|
+ from links where 1=1
|
|
|
+ <if test="name !=null">
|
|
|
+ and name like concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mutualChain !=null">
|
|
|
+ and mutual_chain = #{mutualChain}
|
|
|
+ </if>
|
|
|
+ <if test="status !=null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ order by sort
|
|
|
+ <if test="sortType ==0">
|
|
|
+ desc
|
|
|
+ </if>
|
|
|
+ <if test="page_sql !=null">
|
|
|
+ ${page_sql}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="linksCount" resultType="integer">
|
|
|
+ select count(*)
|
|
|
+ from links where 1=1
|
|
|
+ <if test="name !=null">
|
|
|
+ and name like concat('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="mutualChain !=null">
|
|
|
+ and mutual_chain = #{mutualChain}
|
|
|
+ </if>
|
|
|
+ <if test="status !=null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+ <select id="getAll" resultType="com.kede.linksAndHot.bo.publicLinks">
|
|
|
+ select id,name,url from links where status =1
|
|
|
+ </select>
|
|
|
+</mapper>
|