302 lines
15 KiB
XML
302 lines
15 KiB
XML
|
<?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.zhwl.cms.mapper.ZdyCmsChannelMapper">
|
||
|
|
||
|
<resultMap type = "ZdyCmsChannel" id = "ZdyCmsChannelResult">
|
||
|
<result property = "id" column = "id"/>
|
||
|
<result property = "type" column = "type"/>
|
||
|
<result property = "modelId" column = "model_id"/>
|
||
|
<result property = "parentId" column = "parent_id"/>
|
||
|
<result property = "name" column = "name"/>
|
||
|
<result property = "image" column = "image"/>
|
||
|
<result property = "flag" column = "flag"/>
|
||
|
<result property = "keywords" column = "keywords"/>
|
||
|
<result property = "description" column = "description"/>
|
||
|
<result property = "outlink" column = "outlink"/>
|
||
|
<result property = "items" column = "items"/>
|
||
|
<result property = "weigh" column = "weigh"/>
|
||
|
<result property = "iscontribute" column = "iscontribute"/>
|
||
|
<result property = "isnav" column = "isnav"/>
|
||
|
<result property = "isTopNav" column = "is_top_nav"/>
|
||
|
<result property = "isBanner" column = "is_banner"/>
|
||
|
<result property = "isPhoneNav" column = "is_phone_nav"/>
|
||
|
<result property = "createtime" column = "createtime"/>
|
||
|
<result property = "updatetime" column = "updatetime"/>
|
||
|
<result property = "status" column = "status"/>
|
||
|
<result property = "icon" column = "icon"/>
|
||
|
<result property = "appImage" column = "app_image"/>
|
||
|
<result property = "commentEnabled" column = "is_comment_enabled"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id = "selectZdyCmsChannelVo">
|
||
|
select id,
|
||
|
type,
|
||
|
model_id,
|
||
|
parent_id,
|
||
|
name,
|
||
|
image,
|
||
|
flag,
|
||
|
keywords,
|
||
|
description,
|
||
|
outlink,
|
||
|
items,
|
||
|
weigh,
|
||
|
iscontribute,
|
||
|
isnav,
|
||
|
is_phone_nav,
|
||
|
is_top_nav,
|
||
|
is_banner,
|
||
|
createtime,
|
||
|
updatetime,
|
||
|
status,
|
||
|
icon,
|
||
|
app_image,
|
||
|
is_comment_enabled
|
||
|
from zdy_cms_channel
|
||
|
</sql>
|
||
|
|
||
|
<select id = "selectZdyCmsChannelList" parameterType = "ZdyCmsChannel" resultMap = "ZdyCmsChannelResult">
|
||
|
<include refid = "selectZdyCmsChannelVo"/>
|
||
|
<where>
|
||
|
<if test = "type != null and type != ''">and type = #{type}</if>
|
||
|
<if test = "modelId != null ">and model_id = #{modelId}</if>
|
||
|
<if test = "parentId != null ">and parent_id = #{parentId}</if>
|
||
|
<if test = "name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||
|
<if test = "image != null and image != ''">and image = #{image}</if>
|
||
|
<if test = "flag != null and flag != ''">and flag = #{flag}</if>
|
||
|
<if test = "keywords != null and keywords != ''">and keywords = #{keywords}</if>
|
||
|
<if test = "description != null and description != ''">and description = #{description}</if>
|
||
|
<if test = "outlink != null and outlink != ''">and outlink = #{outlink}</if>
|
||
|
<if test = "items != null ">and items = #{items}</if>
|
||
|
<if test = "weigh != null ">and weigh = #{weigh}</if>
|
||
|
<if test = "iscontribute != null ">and iscontribute = #{iscontribute}</if>
|
||
|
<if test = "isnav != null ">and isnav = #{isnav}</if>
|
||
|
<if test = "isPhoneNav != null ">and is_phone_nav = #{isPhoneNav}</if>
|
||
|
<if test = "isBanner != null ">and is_banner = #{isBanner}</if>
|
||
|
<if test = "isTopNav != null ">and is_top_nav = #{isTopNav}</if>
|
||
|
<if test = "createtime != null ">and createtime = #{createtime}</if>
|
||
|
<if test = "updatetime != null ">and updatetime = #{updatetime}</if>
|
||
|
<if test = "status != null and status != ''">and status = #{status}</if>
|
||
|
<if test = "icon != null and icon != ''">and icon = #{icon}</if>
|
||
|
<if test = "types != null and types.length != 0 ">
|
||
|
and type in
|
||
|
<foreach item = "type" collection = "types" open = "(" separator = "," close = ")">
|
||
|
#{type}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
<if test = "notEqualParentId != null">and parent_id != #{notEqualParentId}</if>
|
||
|
<if test = "ids != null and ids.size != 0 ">
|
||
|
and id in
|
||
|
<foreach item = "id" collection = "ids" open = "(" separator = "," close = ")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</where>
|
||
|
order by weigh asc
|
||
|
</select>
|
||
|
|
||
|
<select id = "selectZdyCmsChannelById" parameterType = "Integer" resultMap = "ZdyCmsChannelResult">
|
||
|
<include refid = "selectZdyCmsChannelVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
|
||
|
<insert id = "insertZdyCmsChannel" parameterType = "ZdyCmsChannel" useGeneratedKeys = "true" keyProperty = "id">
|
||
|
insert into zdy_cms_channel
|
||
|
<trim prefix = "(" suffix = ")" suffixOverrides = ",">
|
||
|
<if test = "type != null and type != ''">type,</if>
|
||
|
<if test = "modelId != null">model_id,</if>
|
||
|
<if test = "parentId != null">parent_id,</if>
|
||
|
<if test = "name != null">name,</if>
|
||
|
<if test = "image != null">image,</if>
|
||
|
<if test = "flag != null">flag,</if>
|
||
|
<if test = "keywords != null">keywords,</if>
|
||
|
<if test = "description != null">description,</if>
|
||
|
<if test = "outlink != null">outlink,</if>
|
||
|
<if test = "items != null">items,</if>
|
||
|
<if test = "weigh != null">weigh,</if>
|
||
|
<if test = "iscontribute != null">iscontribute,</if>
|
||
|
<if test = "isnav != null">isnav,</if>
|
||
|
<if test = "isPhoneNav != null">is_phone_nav,</if>
|
||
|
<if test = "isBanner != null ">is_banner,</if>
|
||
|
<if test = "isTopNav != null ">is_top_nav,</if>
|
||
|
<if test = "createtime != null">createtime,</if>
|
||
|
<if test = "updatetime != null">updatetime,</if>
|
||
|
<if test = "status != null and status != ''">status,</if>
|
||
|
<if test = "icon != null and icon != ''">icon,</if>
|
||
|
<if test = "appImage != null and appImage != ''">app_image,</if>
|
||
|
<if test = "commentEnabled != null">is_comment_enabled,</if>
|
||
|
</trim>
|
||
|
<trim prefix = "values (" suffix = ")" suffixOverrides = ",">
|
||
|
<if test = "type != null and type != ''">#{type},</if>
|
||
|
<if test = "modelId != null">#{modelId},</if>
|
||
|
<if test = "parentId != null">#{parentId},</if>
|
||
|
<if test = "name != null">#{name},</if>
|
||
|
<if test = "image != null">#{image},</if>
|
||
|
<if test = "flag != null">#{flag},</if>
|
||
|
<if test = "keywords != null">#{keywords},</if>
|
||
|
<if test = "description != null">#{description},</if>
|
||
|
<if test = "outlink != null">#{outlink},</if>
|
||
|
<if test = "items != null">#{items},</if>
|
||
|
<if test = "weigh != null">#{weigh},</if>
|
||
|
<if test = "iscontribute != null">#{iscontribute},</if>
|
||
|
<if test = "isnav != null">#{isnav},</if>
|
||
|
<if test = "isPhoneNav != null">#{isPhoneNav},</if>
|
||
|
<if test = "isBanner != null ">#{isBanner},</if>
|
||
|
<if test = "isTopNav != null ">#{isTopNav},</if>
|
||
|
<if test = "createtime != null">#{createtime},</if>
|
||
|
<if test = "updatetime != null">#{updatetime},</if>
|
||
|
<if test = "status != null and status != ''">#{status},</if>
|
||
|
<if test = "icon != null and icon != ''">#{icon},</if>
|
||
|
<if test = "appImage != null and appImage != ''">#{appImage},</if>
|
||
|
<if test = "commentEnabled != null">#{commentEnabled},</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id = "updateZdyCmsChannel" parameterType = "ZdyCmsChannel">
|
||
|
update zdy_cms_channel
|
||
|
<trim prefix = "SET" suffixOverrides = ",">
|
||
|
<if test = "type != null and type != ''">type = #{type},</if>
|
||
|
<if test = "modelId != null">model_id = #{modelId},</if>
|
||
|
<if test = "parentId != null">parent_id = #{parentId},</if>
|
||
|
<if test = "name != null">name = #{name},</if>
|
||
|
<if test = "image != null">image = #{image},</if>
|
||
|
<if test = "flag != null">flag = #{flag},</if>
|
||
|
<if test = "keywords != null">keywords = #{keywords},</if>
|
||
|
<if test = "description != null">description = #{description},</if>
|
||
|
<if test = "outlink != null">outlink = #{outlink},</if>
|
||
|
<if test = "items != null">items = #{items},</if>
|
||
|
<if test = "weigh != null">weigh = #{weigh},</if>
|
||
|
<if test = "iscontribute != null">iscontribute = #{iscontribute},</if>
|
||
|
<if test = "isnav != null">isnav = #{isnav},</if>
|
||
|
<if test = "isPhoneNav != null">is_phone_nav = #{isPhoneNav},</if>
|
||
|
<if test = "isBanner != null ">is_banner = #{isBanner},</if>
|
||
|
<if test = "isTopNav != null ">is_top_nav = #{isTopNav},</if>
|
||
|
<if test = "createtime != null">createtime = #{createtime},</if>
|
||
|
<if test = "updatetime != null">updatetime = #{updatetime},</if>
|
||
|
<if test = "status != null and status != ''">status = #{status},</if>
|
||
|
<if test = "icon != null and icon != ''">icon = #{icon},</if>
|
||
|
<if test = "appImage != null and appImage != ''">app_image = #{appImage},</if>
|
||
|
<if test = "commentEnabled != null">is_comment_enabled = #{commentEnabled},</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id = "deleteZdyCmsChannelById" parameterType = "Integer">
|
||
|
delete
|
||
|
from zdy_cms_channel
|
||
|
where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id = "deleteZdyCmsChannelByIds" parameterType = "String">
|
||
|
delete from zdy_cms_channel where id in
|
||
|
<foreach item = "id" collection = "array" open = "(" separator = "," close = ")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
|
||
|
|
||
|
<select id = "selectChannelListByCustom" parameterType = "ZdyCmsChannel" resultType = "com.zhwl.vo.ChannelResultVo">
|
||
|
<include refid = "selectZdyCmsChannelVo"/>
|
||
|
<where>
|
||
|
<if test = "model != null and model != ''">and model_id = #{model}</if>
|
||
|
<if test = "type != null and type != ''">and type = #{type}</if>
|
||
|
<if test = "parent != null and parent != ''">and parent_id = #{parent}</if>
|
||
|
|
||
|
<if test = "flags != null and flags != ''">and flag in
|
||
|
<foreach item = "flag" collection = "flags" open = "(" separator = "," close = ")">
|
||
|
#{flag}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
|
||
|
<if test = "conditionmap != null and conditionmap != ''">and
|
||
|
<foreach collection = "conditionmap.entrySet()" index = "key" item = "val" open = "(" separator = "and" close = ")">
|
||
|
${key} = #{val}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</where>
|
||
|
<if test = "orderby != null and orderby != ''">order by ${orderby} ${orderway}</if>
|
||
|
|
||
|
<if test = "limit != null and limit != ''">limit ${limit}</if>
|
||
|
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<select id = "selectModelCount" resultType = "int" parameterType = "String">
|
||
|
select count(DISTINCT model_id) from zdy_cms_channel where id in
|
||
|
<foreach item = "channel_id" collection = "channels" open = "(" separator = "," close = ")">
|
||
|
#{channel_id}
|
||
|
</foreach>
|
||
|
</select>
|
||
|
|
||
|
<select id = "selectModelIdByChannelId" resultType = "java.lang.String">
|
||
|
select model_id
|
||
|
from zdy_cms_channel
|
||
|
where id = #{channel_id}
|
||
|
</select>
|
||
|
<select id = "getChildrenIds" resultType = "java.lang.String">
|
||
|
SELECT id FROM zdy_cms_channel WHERE id = #{channelId} or parent_id = #{channelId}
|
||
|
<if test = "type == 'sons'">
|
||
|
or parent_id IN (SELECT id FROM zdy_cms_channel WHERE parent_id = #{channelId})
|
||
|
</if>
|
||
|
</select>
|
||
|
<select id = "getKeys" resultType = "java.util.Map">
|
||
|
SELECT id,
|
||
|
name
|
||
|
FROM zdy_cms_channel
|
||
|
WHERE parent_id = 20
|
||
|
AND model_id = 2
|
||
|
ORDER BY weigh ASC
|
||
|
</select>
|
||
|
<select id = "selectCmsChannelList" resultType = "com.zhwl.cms.domain.ZdyCmsChannel"
|
||
|
parameterType = "com.zhwl.cms.domain.ZdyCmsChannel">
|
||
|
<include refid = "selectZdyCmsChannelVo"/>
|
||
|
<where>
|
||
|
<if test = "type != null and type != ''">and type = #{type}</if>
|
||
|
<if test = "modelId != null ">and model_id = #{modelId}</if>
|
||
|
<if test = "parentId != null ">and parent_id = #{parentId}</if>
|
||
|
<if test = "name != null and name != ''">and name like concat('%', #{name}, '%')</if>
|
||
|
<if test = "image != null and image != ''">and image = #{image}</if>
|
||
|
<if test = "flag != null and flag != ''">AND FIND_IN_SET( #{flag}, flag)</if>
|
||
|
<if test = "keywords != null and keywords != ''">and keywords = #{keywords}</if>
|
||
|
<if test = "description != null and description != ''">and description = #{description}</if>
|
||
|
<if test = "outlink != null and outlink != ''">and outlink = #{outlink}</if>
|
||
|
<if test = "items != null ">and items = #{items}</if>
|
||
|
<if test = "weigh != null ">and weigh = #{weigh}</if>
|
||
|
<if test = "iscontribute != null ">and iscontribute = #{iscontribute}</if>
|
||
|
<if test = "isnav != null ">and isnav = #{isnav}</if>
|
||
|
<if test = "isPhoneNav != null ">and is_phone_nav = #{isPhoneNav}</if>
|
||
|
<if test = "isBanner != null ">and is_banner = #{isBanner}</if>
|
||
|
<if test = "isTopNav != null ">and is_top_nav = #{isTopNav}</if>
|
||
|
<if test = "createtime != null ">and createtime = #{createtime}</if>
|
||
|
<if test = "updatetime != null ">and updatetime = #{updatetime}</if>
|
||
|
<if test = "status != null and status != ''">and status = #{status}</if>
|
||
|
<if test = "icon != null and icon != ''">and icon = #{icon}</if>
|
||
|
<if test = "types != null and types.length != 0 ">
|
||
|
and type in
|
||
|
<foreach item = "type" collection = "types" open = "(" separator = "," close = ")">
|
||
|
#{type}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
<if test = "notEqualParentId != null">and parent_id != #{notEqualParentId}</if>
|
||
|
</where>
|
||
|
<choose>
|
||
|
<when test = "orderby != null and orderby != '' and orderway!= null and orderway != ''">
|
||
|
order by ${orderby} ${orderway}
|
||
|
</when>
|
||
|
<otherwise>
|
||
|
order by weigh, id desc
|
||
|
</otherwise>
|
||
|
</choose>
|
||
|
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<select id = "selectHumanityList" parameterType = "int" resultMap = "ZdyCmsChannelResult">
|
||
|
<include refid = "selectZdyCmsChannelVo"/>
|
||
|
where id = #{parentId} or parent_id = #{parentId} order by weigh asc
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|