123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- <?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.newhome.dao.NewPageFirstNavigationDao">
- <sql id="newPageFirstNavigationColumns">
- a.id AS "id",
- a.navigationName AS "navigationName",
- a.type AS "type",
- a.icon AS "icon",
- a.link AS "link",
- a.remark AS "remark",
- a.sort AS "sort",
- a.wwwEnabledStatus AS "wwwEnabledStatus",
- a.crmEnabledStatus AS "crmEnabledStatus",
- a.createBy AS "createBy.id",
- a.createDate AS "createDate",
- a.updateBy AS "updateBy.id",
- a.updateDate AS "updateDate",
- a.delFlag AS "delFlag"
- </sql>
- <select id="get" resultType="NewPageFirstNavigation">
- SELECT
- <include refid="newPageFirstNavigationColumns"/>
- FROM new_page_first_navigation a
- WHERE a.id = #{id} and a.delFlag = 0
- </select>
- <select id="findList" resultType="NewPageFirstNavigation">
- SELECT
- <include refid="newPageFirstNavigationColumns"/>
- <if test="statisticsType != null and statisticsType != ''">
- ,IFNULL((select sum(c.pv) from cm_praise_statistics c where c.delFlag = 0 and c.type = #{statisticsType} and a.id = c.authorId <if test="startPvCreateTime != null ">AND c.createTime >= #{startPvCreateTime} </if><if test="endPvCreateTime != null ">AND c.createTime <![CDATA[ <= ]]> #{endPvCreateTime} </if>), 0) as pv
- </if>
- FROM new_page_first_navigation a
- <where>
- a.delFlag = 0
- <if test="type != null and type != ''">
- <if test="type == 0 ">and (a.type = 0 or a.type is null )</if>
- <if test="type != 0 ">and a.type = #{type}</if>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY -a.sort DESC, createDate DESC
- </otherwise>
- </choose>
- </select>
- <select id="findAllList" resultType="NewPageFirstNavigation">
- SELECT
- <include refid="newPageFirstNavigationColumns"/>
- FROM new_page_first_navigation a
- <where>
- a.delFlag = 0
- <if test="type != null and type != ''">
- <if test="type == 0 ">and (a.type = 0 or a.type is null )</if>
- <if test="type != 0 ">and a.type = #{type}</if>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY a.sort DESC
- </otherwise>
- </choose>
- </select>
- <insert id="insert" parameterType="NewPageFirstNavigation" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO new_page_first_navigation(
- navigationName,
- type,
- link,
- remark,
- icon,
- sort,
- wwwEnabledStatus,
- crmEnabledStatus,
- createBy,
- createDate,
- updateBy,
- updateDate,
- delFlag
- ) VALUES (
- #{navigationName},
- #{type},
- #{link},
- #{remark},
- #{icon},
- #{sort},
- #{wwwEnabledStatus},
- #{crmEnabledStatus},
- #{createBy.id},
- #{createDate},
- #{updateBy.id},
- #{updateDate},
- #{delFlag}
- )
- </insert>
- <update id="update">
- UPDATE new_page_first_navigation SET
- navigationName = #{navigationName},
- type = #{type},
- link = #{link},
- remark = #{remark},
- icon = #{icon},
- sort = #{sort},
- wwwEnabledStatus = #{wwwEnabledStatus},
- crmEnabledStatus = #{crmEnabledStatus},
- createBy = #{createBy.id},
- createDate = #{createDate},
- updateBy = #{updateBy.id},
- updateDate = #{updateDate},
- delFlag = #{delFlag}
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM new_page_first_navigation
- WHERE id = #{id}
- </delete>
- <update id="updateEnabledStatusByIds">
- UPDATE new_page_first_navigation a SET a.wwwEnabledStatus = #{param1}
- WHERE a.id IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
- #{id}
- </foreach>
- </update>
- <update id="updateCrmEnabledStatusByIds">
- UPDATE new_page_first_navigation a SET a.crmEnabledStatus = #{param1}
- WHERE a.id IN
- <foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
- #{id}
- </foreach>
- </update>
- <update id="saveSort">
- UPDATE new_page_first_navigation SET
- sort = #{sort}
- WHERE id = #{id}
- </update>
- </mapper>
|