123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- <?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.caimei.modules.cmpage.dao.CmPageDao">
- <sql id="cmPageColumns">
- a.id AS "id",
- a.type AS "type",
- a.typeSort AS "typeSort",
- a.title AS "title",
- a.keywords AS "keywords",
- a.description AS "description",
- a.precisehKey AS "precisehKey",
- a.docBoost AS "docBoost",
- a.headImage AS "headImage",
- a.crmHeadImage AS "crmHeadImage",
- a.headLink AS "headLink",
- a.headText AS "headText",
- a.bottomImage AS "bottomImage",
- a.crmBottomImage1 AS "crmBottomImage1",
- a.crmBottomImage2 AS "crmBottomImage2",
- a.bottomText AS "bottomText",
- a.buttonName AS "buttonName",
- a.buttonLink AS "buttonLink",
- a.enabledStatus AS "enabledStatus",
- a.createBy AS "createBy.id",
- a.createDate AS "createDate",
- a.updateBy AS "updateBy.id",
- a.updateDate AS "updateDate",
- a.contentLabel as "contentLabel",
- a.backgroundType AS "backgroundType",
- a.backgroundColour AS "backgroundColour",
- a.backgroundImage AS "backgroundImage",
- a.backgroundImageWay AS "backgroundImageWay",
- a.redPacketBeginTime,
- a.redPacketEndTime,
- a.infoBarStatus
- </sql>
- <sql id="cmPageJoins">
- </sql>
- <select id="get" resultType="CmPage">
- SELECT
- <include refid="cmPageColumns"/>
- FROM cm_page a
- <include refid="cmPageJoins"/>
- WHERE a.id = #{id}
- </select>
- <select id="findList" resultType="CmPage">
- SELECT
- <include refid="cmPageColumns"/>
- FROM cm_page a
- <include refid="cmPageJoins"/>
- <where>
- <if test="id != null and id != ''">
- AND a.id = #{id}
- </if>
- <if test="type != null and type != ''">
- AND a.type = #{type}
- </if>
- <if test="title != null and title != ''">
- AND a.title LIKE
- <if test="dbName == 'oracle'">'%'||#{title}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{title}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{title},'%')</if>
- </if>
- <if test="enabledStatus != null and enabledStatus != ''">
- AND a.enabledStatus = #{enabledStatus}
- </if>
- <if test="sqlMap !=null and sqlMap !=''">
- ${sqlMap.pageType}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY enabledStatus DESC,createDate DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="CmPage">
- SELECT
- <include refid="cmPageColumns"/>
- FROM cm_page a
- <include refid="cmPageJoins"/>
- <where>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="CmPage" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_page(
- type,
- title,
- typeSort,
- keywords,
- description,
- precisehKey,
- docBoost,
- headImage,
- crmHeadImage,
- headLink,
- headText,
- bottomImage,
- crmBottomImage1,
- crmBottomImage2,
- bottomText,
- buttonName,
- buttonLink,
- enabledStatus,
- createBy,
- createDate,
- updateBy,
- updateDate,
- contentLabel,
- backgroundType,
- backgroundColour,
- backgroundImage,
- backgroundImageWay,
- redPacketBeginTime,
- redPacketEndTime,
- infoBarStatus
- ) VALUES (
- #{type},
- #{title},
- #{typeSort},
- #{keywords},
- #{description},
- #{precisehKey},
- #{docBoost},
- #{headImage},
- #{crmHeadImage},
- #{headLink},
- #{headText},
- #{bottomImage},
- #{crmBottomImage1},
- #{crmBottomImage2},
- #{bottomText},
- #{buttonName},
- #{buttonLink},
- #{enabledStatus},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{contentLabel},
- #{backgroundType},
- #{backgroundColour},
- #{backgroundImage},
- #{backgroundImageWay},
- #{redPacketBeginTime},
- #{redPacketEndTime},
- #{infoBarStatus}
- )
- </insert>
- <update id="update">
- UPDATE cm_page SET
- title = #{title},
- typeSort = #{typeSort},
- keywords = #{keywords},
- description = #{description},
- precisehKey = #{precisehKey},
- docBoost = #{docBoost},
- headImage = #{headImage},
- crmHeadImage = #{crmHeadImage},
- headLink = #{headLink},
- headText = #{headText},
- bottomImage = #{bottomImage},
- crmBottomImage1 = #{crmBottomImage1},
- crmBottomImage2 = #{crmBottomImage2},
- bottomText = #{bottomText},
- buttonName = #{buttonName},
- buttonLink = #{buttonLink},
- enabledStatus = #{enabledStatus},
- createBy = #{createBy.id},
- createDate = #{createDate},
- updateBy = #{updateBy.id},
- updateDate = #{updateDate},
- contentLabel = #{contentLabel},
- backgroundType = #{backgroundType},
- backgroundColour = #{backgroundColour},
- backgroundImage = #{backgroundImage},
- backgroundImageWay = #{backgroundImageWay},
- redPacketBeginTime = #{redPacketBeginTime},
- redPacketEndTime = #{redPacketEndTime},
- infoBarStatus = #{infoBarStatus}
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM cm_page
- WHERE id = #{id}
- </delete>
- <update id="updateEnabledStatusByIds">
- UPDATE cm_page a SET a.enabledStatus = #{param1}
- WHERE a.id IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
- #{id}
- </foreach>
- </update>
- <select id="getHotSearch" resultType="com.caimei.modules.cmpage.entity.CmPageHotSearch">
- SELECT * FROM cm_page_hot_search WHERE id = #{id}
- </select>
- <delete id="delectHotSearch">
- DELETE FROM cm_page_hot_search WHERE pageId = #{pageId}
- </delete>
- <insert id="insertHotSearch">
- INSERT INTO `cm_page_hot_search` (
- `pageId`, `name`, `link`, `sort`, `pcStatus`,
- `appletsStatus`, `isHot`, `creationTime`
- )
- VALUES
- (
- #{pageId}, #{name}, #{link}, #{sort}, #{pcStatus},
- #{appletsStatus}, #{isHot}, now()
- )
- </insert>
- <select id="findHotSearch" resultType="com.caimei.modules.cmpage.entity.CmPageHotSearch">
- SELECT * FROM cm_page_hot_search WHERE pageId = #{pageId}
- </select>
- </mapper>
|