This commit is contained in:
2025-07-01 17:54:58 +08:00
commit 57dcd609e2
5136 changed files with 346184 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,144 @@
<?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.ZdyAreaMapper">
<resultMap type="ZdyArea" id="ZdyAreaResult">
<result property="id" column="id" />
<result property="level" column="level" />
<result property="parentCode" column="parent_code" />
<result property="areaCode" column="area_code" />
<result property="zipCode" column="zip_code" />
<result property="cityCode" column="city_code" />
<result property="name" column="name" />
<result property="shortName" column="short_name" />
<result property="mergerName" column="merger_name" />
<result property="pinyin" column="pinyin" />
<result property="lng" column="lng" />
<result property="lat" column="lat" />
<result property="shortCode" column="short_code"/>
</resultMap>
<sql id="selectZdyAreaVo">
select id,
level,
parent_code,
area_code,
zip_code,
city_code,
name,
short_name,
merger_name,
pinyin,
lng,
lat,
short_code
from zdy_area
</sql>
<select id="selectZdyAreaList" parameterType="ZdyArea" resultMap="ZdyAreaResult">
<include refid="selectZdyAreaVo"/>
<where>
<if test="level != null "> and level = #{level}</if>
<if test="parentCode != null "> and parent_code = #{parentCode}</if>
<if test="areaCode != null "> and area_code = #{areaCode}</if>
<if test="zipCode != null "> and zip_code = #{zipCode}</if>
<if test="cityCode != null and cityCode != ''"> and city_code = #{cityCode}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="shortName != null and shortName != ''"> and short_name like concat('%', #{shortName}, '%')</if>
<if test="mergerName != null and mergerName != ''"> and merger_name like concat('%', #{mergerName}, '%')</if>
<if test="pinyin != null and pinyin != ''"> and pinyin = #{pinyin}</if>
<if test="lng != null "> and lng = #{lng}</if>
<if test="lat != null "> and lat = #{lat}</if>
</where>
</select>
<select id="selectZdyAreaById" parameterType="Integer" resultMap="ZdyAreaResult">
<include refid="selectZdyAreaVo"/>
where id = #{id}
</select>
<insert id="insertZdyArea" parameterType="ZdyArea" useGeneratedKeys="true" keyProperty="id">
insert into zdy_area
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="level != null">level,</if>
<if test="parentCode != null">parent_code,</if>
<if test="areaCode != null">area_code,</if>
<if test="zipCode != null">zip_code,</if>
<if test="cityCode != null and cityCode != ''">city_code,</if>
<if test="name != null and name != ''">name,</if>
<if test="shortName != null and shortName != ''">short_name,</if>
<if test="mergerName != null and mergerName != ''">merger_name,</if>
<if test="pinyin != null and pinyin != ''">pinyin,</if>
<if test="lng != null">lng,</if>
<if test="lat != null">lat,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="level != null">#{level},</if>
<if test="parentCode != null">#{parentCode},</if>
<if test="areaCode != null">#{areaCode},</if>
<if test="zipCode != null">#{zipCode},</if>
<if test="cityCode != null and cityCode != ''">#{cityCode},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="shortName != null and shortName != ''">#{shortName},</if>
<if test="mergerName != null and mergerName != ''">#{mergerName},</if>
<if test="pinyin != null and pinyin != ''">#{pinyin},</if>
<if test="lng != null">#{lng},</if>
<if test="lat != null">#{lat},</if>
</trim>
</insert>
<update id="updateZdyArea" parameterType="ZdyArea">
update zdy_area
<trim prefix="SET" suffixOverrides=",">
<if test="level != null">level = #{level},</if>
<if test="parentCode != null">parent_code = #{parentCode},</if>
<if test="areaCode != null">area_code = #{areaCode},</if>
<if test="zipCode != null">zip_code = #{zipCode},</if>
<if test="cityCode != null and cityCode != ''">city_code = #{cityCode},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="shortName != null and shortName != ''">short_name = #{shortName},</if>
<if test="mergerName != null and mergerName != ''">merger_name = #{mergerName},</if>
<if test="pinyin != null and pinyin != ''">pinyin = #{pinyin},</if>
<if test="lng != null">lng = #{lng},</if>
<if test="lat != null">lat = #{lat},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyAreaById" parameterType="Integer">
delete from zdy_area where id = #{id}
</delete>
<delete id="deleteZdyAreaByIds" parameterType="String">
delete from zdy_area where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectZdyAreaCodeList" resultType="String">
SELECT SUBSTRING(area_code, 0, 6) as areaCode FROM zdy_area where parent_code != 0
</select>
<select id="selectZdyAreaByAreaCode" parameterType="Long" resultMap="ZdyAreaResult">
<include refid="selectZdyAreaVo"/>
where area_code = #{areaCode}
</select>
<select id="selectZdyAreaByShortCode" parameterType="String" resultType="String">
select name from zdy_area
where short_code = #{shortCode}
</select>
<select id="listNamesByShortCodes" resultMap="ZdyAreaResult">
select
short_code,
name
from zdy_area
where short_code in
<foreach item="shortCode" collection="sourceCodes" open="(" separator="," close=")">
#{shortCode}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,853 @@
<?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.ZdyCmsArchivesMapper">
<resultMap type="ZdyCmsArchives" id="ZdyCmsArchivesResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="channelId" column="channel_id"/>
<result property="channelName" column="channel_name"/>
<result property="modelId" column="model_id"/>
<result property="title" column="title"/>
<result property="flag" column="flag"/>
<result property="style" column="style"/>
<result property="image" column="image"/>
<result property="keywords" column="keywords"/>
<result property="description" column="description"/>
<result property="tags" column="tags"/>
<result property="weigh" column="weigh"/>
<result property="views" column="views"/>
<result property="comments" column="comments"/>
<result property="likes" column="likes"/>
<result property="dislikes" column="dislikes"/>
<result property="diyname" column="diyname"/>
<result property="createtime" column="createtime"/>
<result property="updatetime" column="updatetime"/>
<result property="publishtime" column="publishtime"/>
<result property="deletetime" column="deletetime"/>
<result property="memo" column="memo"/>
<result property="status" column="status"/>
<result property="adminId" column="admin_id"/>
<result property="dataOrg" column="data_org"/>
<result property="subtitle" column="subtitle"/>
<result property="origin" column="origin"/>
<result property="imageList" column="image_list"/>
<result property="userName" column="user_name"/>
<result property="avatar" column="avatar"/>
<result property="channelKey" column="channelKey"/>
<result property="rejectionDesc" column="rejection_desc"/>
<result property="rejectionTime" column="rejection_time"/>
<result property="auditStatus" column="audit_status"/>
</resultMap>
<sql id="selectZdyCmsArchivesVo">
SELECT a.id,
a.user_id,
a.channel_id,
a.model_id,
a.title,
a.flag,
a.style,
a.image,
a.keywords,
a.description,
a.tags,
a.weigh,
a.views,
a.comments,
a.likes,
a.dislikes,
a.diyname,
a.createtime,
a.updatetime,
a.publishtime,
a.deletetime,
a.memo,
a.`status`,
a.admin_id,
a.data_org,
a.subtitle,
a.origin,
a.image_list,
a.rejection_desc,
a.rejection_time,
a.audit_status,
if(a.admin_id != 0, u.nick_name, zu.nickname) as user_name,
if(a.admin_id != 0, u.avatar, zu.avatar) as avatar
from zdy_cms_archives a
left join sys_user u on a.admin_id = u.user_id
left join zdy_user zu on a.user_id= zu.id
</sql>
<select id="selectZdyCmsArchivesList" parameterType="ZdyCmsArchives" resultMap="ZdyCmsArchivesResult">
<include refid="selectZdyCmsArchivesVo"/>
left join sys_dept d on u.dept_id = d.dept_id
left join zdy_cms_channel c on a.channel_id = c.id
<where>
ISNULL( deletetime )
<if test="ids != null and ids.size > 0">
and a.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="title != null and title != ''">and a.title like concat('%',#{title},'%')</if>
<if test="status != null and status != ''">and a.status = #{status}</if>
<if test="auditStatus != null and auditStatus != ''">and a.audit_status = #{auditStatus}</if>
<if test="modelId != null">and a.model_id = #{modelId}</if>
<if test="userId != null">and a.user_id = #{userId}</if>
<choose>
<when test="channelId != null">and a.channel_id = #{channelId}</when>
<when test="channelIds != null and channelIds.size>0">
and a.channel_id in
<foreach item="id" collection="channelIds" open="(" separator="," close=")">
#{id}
</foreach>
</when>
<when test="channelList != null">
and a.channel_id in
<foreach item="id" collection="channelList" open="(" separator="," close=")">
#{id}
</foreach>
</when>
<otherwise>
and c.status = 'normal'
</otherwise>
</choose>
<if test="modelList != null">
and a.model_id in
<foreach item="id" collection="modelList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="adminIds != null">and admin_id in
<foreach item="admin_id" collection="adminIds" open="(" separator="," close=")">
#{admin_id}
</foreach>
</if>
<if test="flag != null and flag != ''">
<foreach collection="flag.split(',') " item="item" index="index" open=" AND (" close=")"
separator=" AND ">
find_in_set(#{item}, flag)
</foreach>
</if>
<if test="params.publishTime != null ">
<if test="params.publishTime.start != null ">
and publishtime &gt;= #{params.publishTime.start}
</if>
<if test="params.publishTime.end != null ">
and publishtime &lt;= #{params.publishTime.end}
</if>
</if>
<if test="params.dataScope != null and params.dataScope != ''">
and ((admin_id != 0 ${params.dataScope}) OR (a.user_id != 0))
</if>
</where>
order by
<choose>
<when test="orderby == null or orderby == ''">
a.publishtime desc
</when>
<when test="orderby == 'flag'">
<if test="orderByValue != null and orderByValue != ''">
<foreach collection="orderByValue.split(',') " item="item" index="index" separator="," close=",">
find_in_set(#{item}, a.flag) desc
</foreach>
</if>
a.publishtime desc
</when>
<otherwise>
a.${orderby} ${orderway}
</otherwise>
</choose>
</select>
<select id="selectZdyCmsArchivesById" parameterType="Integer" resultMap="ZdyCmsArchivesResult">
<include refid="selectZdyCmsArchivesVo"/>
where a.id = #{id}
</select>
<insert id="insertZdyCmsArchives" parameterType="ZdyCmsArchives" useGeneratedKeys="true" keyProperty="id">
insert into zdy_cms_archives
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="channelId != null">channel_id,</if>
<if test="modelId != null">model_id,</if>
<if test="title != null">title,</if>
<if test="flag != null">flag,</if>
<if test="style != null">style,</if>
<if test="image != null">image,</if>
<if test="keywords != null">keywords,</if>
<if test="description != null">description,</if>
<if test="tags != null">tags,</if>
<if test="weigh != null">weigh,</if>
<if test="views != null">views,</if>
<if test="comments != null">comments,</if>
<if test="likes != null">likes,</if>
<if test="dislikes != null">dislikes,</if>
<if test="diyname != null">diyname,</if>
<if test="createtime != null">createtime,</if>
<if test="updatetime != null">updatetime,</if>
<if test="publishtime != null">publishtime,</if>
<if test="deletetime != null">deletetime,</if>
<if test="memo != null">memo,</if>
<if test="status != null and status != ''">status,</if>
<if test="adminId != null">admin_id,</if>
<if test="subtitle != null and subtitle != ''">subtitle,</if>
<if test="origin != null and origin != ''">origin,</if>
<if test="imageList != null and imageList!=''">image_list,</if>
<if test="rejectionDesc != null and rejectionDesc!=''">rejection_desc,</if>
<if test="rejectionTime != null">rejection_time</if>
<if test="auditStatus != null and auditStatus!=''">audit_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="channelId != null">#{channelId},</if>
<if test="modelId != null">#{modelId},</if>
<if test="title != null">#{title},</if>
<if test="flag != null">#{flag},</if>
<if test="style != null">#{style},</if>
<if test="image != null">#{image},</if>
<if test="keywords != null">#{keywords},</if>
<if test="description != null">#{description},</if>
<if test="tags != null">#{tags},</if>
<if test="weigh != null">#{weigh},</if>
<if test="views != null">#{views},</if>
<if test="comments != null">#{comments},</if>
<if test="likes != null">#{likes},</if>
<if test="dislikes != null">#{dislikes},</if>
<if test="diyname != null">#{diyname},</if>
<if test="createtime != null">#{createtime},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="publishtime != null">#{publishtime},</if>
<if test="deletetime != null">#{deletetime},</if>
<if test="memo != null">#{memo},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="adminId != null">#{adminId},</if>
<if test="subtitle != null and subtitle != ''">#{subtitle},</if>
<if test="origin != null and origin != ''">#{origin},</if>
<if test="imageList != null and imageList!=''">#{imageList},</if>
<if test="rejectionDesc != null and rejectionDesc!=''">#{rejectionDesc},</if>
<if test="rejectionTime != null">#{rejectionTime},</if>
<if test="auditStatus != null and auditStatus!=''">#{auditStatus},</if>
</trim>
</insert>
<update id="updateZdyCmsArchives" parameterType="ZdyCmsArchives">
update zdy_cms_archives
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="channelId != null">channel_id = #{channelId},</if>
<if test="modelId != null">model_id = #{modelId},</if>
<if test="title != null">title = #{title},</if>
<choose>
<when test="flag != null and flag != '' ">
flag = #{flag},
</when>
<otherwise>
flag = '',
</otherwise>
</choose>
<if test="style != null">style = #{style},</if>
<if test="image != null">image = #{image},</if>
<if test="keywords != null">keywords = #{keywords},</if>
<if test="description != null">description = #{description},</if>
<if test="tags != null">tags = #{tags},</if>
<if test="weigh != null">weigh = #{weigh},</if>
<if test="views != null">views = #{views},</if>
<if test="comments != null">comments = #{comments},</if>
<if test="likes != null">likes = #{likes},</if>
<if test="dislikes != null">dislikes = #{dislikes},</if>
<if test="diyname != null">diyname = #{diyname},</if>
<if test="createtime != null">createtime = #{createtime},</if>
<if test="updatetime != null">updatetime = #{updatetime},</if>
<if test="publishtime != null">publishtime = #{publishtime},</if>
<if test="deletetime != null">deletetime = #{deletetime},</if>
<if test="memo != null">memo = #{memo},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="adminId != null">admin_id = #{adminId},</if>
<if test="subtitle != null">subtitle = #{subtitle},</if>
<if test="origin != null">origin = #{origin},</if>
<if test="imageList != null and imageList!=''">image_list = #{imageList},</if>
<if test="rejectionDesc != null and rejectionDesc!=''">rejection_desc = #{rejectionDesc},</if>
<if test="rejectionTime != null">rejection_time = #{rejectionTime},</if>
<if test="auditStatus != null and auditStatus!=''">audit_status = #{auditStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCmsArchivesById" parameterType="Integer">
delete
from zdy_cms_archives
where id = #{id}
</delete>
<delete id="deleteZdyCmsArchivesByIds" parameterType="String">
delete from zdy_cms_archives where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateZdyCmsArchivesByIds" parameterType="String">
update zdy_cms_archives set deletetime = UNIX_TIMESTAMP(now())
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectArchivesListByCustom" resultType="java.util.Map">
select
<choose>
<when test="field != null and field != ''">a.${field}</when>
<otherwise>a.*
</otherwise>
</choose>
<choose>
<when test="addon == 'true'">
<foreach collection='params.fileds' item="key" open="," separator="," close="">b.${key} as B_${key}
</foreach>
from ${tableName} b left join zdy_cms_archives a on a.id = b.id
</when>
<otherwise>
from zdy_cms_archives a
</otherwise>
</choose>
<where>
ISNULL( a.deletetime )
<if test="addPageIds != null">
and a.id not in
<foreach item="pageId" collection="addPageIds" open="(" separator="," close=")">
#{pageId}
</foreach>
</if>
<if test="model != null and model != ''">and a.model_id = #{model}</if>
<if test="channel != null and channel != '' ">and a.channel_id = #{channel}</if>
<if test="channels != null and channels.length != 0">and a.channel_id in
<foreach item="channel_id" collection="channels" open="(" separator="," close=")">
#{channel_id}
</foreach>
</if>
<if test="params.user_id != null and params.user_id != ''">and a.user_id = #{params.user_id}</if>
<if test="tags != null and tags != ''">and FIND_IN_SET(#{tags},a.tags)</if>
<if test="tagArr != null and tagArr.length != 0">and a.tags in
<foreach item="tag" collection="tagArr" open="(" separator="," close=")">
#{tag}
</foreach>
</if>
<if test="status != null and status != ''">and a.status = #{status}</if>
<if test="title != null and title != ''">and a.title like concat('%',#{title},'%')</if>
<if test="noFlags != null and noFlags != ''">and
<foreach item="flag" collection="noFlags" open="(" separator=" and " close=")">
!FIND_IN_SET(#{flag},a.flag)
</foreach>
</if>
<if test="flags != null and flags != ''">and
<foreach item="flag" collection="flags" open="(" separator=" OR " close=")">
FIND_IN_SET(#{flag},a.flag)
</foreach>
</if>
<if test="content != null and content != ''">and b.content like concat('%',#{content},'%')</if>
<if test="conditionmap != null and conditionmap.size()!=0">and
<foreach collection="conditionmap.entrySet()" index="key" item="val" separator="and">
b.${key} = "${val}"
</foreach>
</if>
<if test="conditiontime != null and conditiontime != ''">and b.${conditiontime} > now()</if>
<if test="conditionArray != null and conditionArray.size()!=0">and
<foreach collection="conditionArray.entrySet()" index="key" item="val" open="(" separator="and"
close=")">
FIND_IN_SET(#{val},b.${key})
</foreach>
</if>
<if test="conditionList != null and conditionList.size()!=0">and
<foreach collection="conditionList.entrySet()" index="key" item="val" open="(" separator="and"
close=")">
<foreach collection="val" index="key0" item="val0" open="(" separator="or" close=")">
FIND_IN_SET(#{val0},b.${key})
</foreach>
</foreach>
</if>
and a.id is not null
<if test="params.orderby != null and params.orderway != null">
order by b.${params.orderby} ${params.orderway}
</if>
</where>
<if test="groupby != null and groupby != ''">group by a.${groupby}</if>
<if test="orderby != null and orderby != ''">order by a.${orderby} ${orderway}</if>
<if test="orderbyList != null and orderbyList.size != 0">order by
<foreach item="o" collection="orderbyList" open="" separator="," close="">
<choose>
<when test="o.orderby == 'flag'">
FIND_IN_SET(#{o.field},a.${o.orderby}) ${o.orderway}
</when>
<otherwise>
a.${o.orderby} ${o.orderway}
</otherwise>
</choose>
</foreach>
</if>
<if test="limit != null and limit != ''">limit ${limit}</if>
</select>
<select id="selectArchivesByCustomId" resultType="map">
select a.*
<if test="params.fileds != null">
<foreach collection='params.fileds' item="key" open="," separator="," close="">b.${key} as B_${key}
</foreach>
</if>
from zdy_cms_archives a
left join ${tableName} b on a.id = b.id
where a.id = #{id}
</select>
<select id="selectColumns" resultType="java.lang.String">
select COLUMN_NAME
from information_schema.COLUMNS
where table_name = #{tableName}
</select>
<select id="listJoinSubData" parameterType="com.zhwl.cms.domain.ZdyCmsArchives" resultType="java.util.Map">
SELECT
a.id,
a.user_id,
a.channel_id,
a.model_id,
a.title,
a.flag,
a.style,
a.image,
a.keywords,
a.description,
a.tags,
a.weigh,
a.views,
a.comments,
a.likes,
a.dislikes,
a.diyname,
a.createtime,
a.updatetime,
a.publishtime,
a.deletetime,
a.memo,
a.status,
a.subtitle,
a.data_org as dataOrg,
a.origin,
a.image_list,
a.rejection_desc,
a.audit_status
<if test="zdyCmsModel.fields != null and zdyCmsModel.fields != ''">
,
<foreach item="field" collection="zdyCmsModel.fields.split(',')" separator=",">
b.${field}
</foreach>
</if>
FROM
zdy_cms_archives a
LEFT JOIN ${zdyCmsModel.table} b on a.id = b.id
<where>
ISNULL( a.deletetime )
<if test="ids != null and ids.size > 0">
and a.id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="title != null and title != ''">and a.title like concat('%', #{title}, '%')</if>
<if test="tags != null and tags != ''">and FIND_IN_SET(#{tags}, a.tags)</if>
<if test="status != null and status != ''">and a.status = #{status}</if>
<if test="modelId != null">and a.model_id = #{modelId}</if>
<if test="channelId != null">and a.channel_id = #{channelId}</if>
<if test="flag != null">and FIND_IN_SET(#{flag}, a.flag)</if>
<if test="modelList != null">
and a.model_id in
<foreach item="id" collection="modelList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="channelList != null">
and a.channel_id in
<foreach item="id" collection="channelList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="params != null">
<if test="params.createTime != null ">
<if test="params.createTime.start != null ">
and createtime &gt;= #{params.createTime.start}
</if>
<if test="params.createTime.end != null ">
and createtime &lt;= #{params.createTime.end}
</if>
</if>
<if test="params.updateTime != null ">
<if test="params.updateTime.start != null ">
and updatetime &gt;= #{params.updateTime.start}
</if>
<if test="params.updateTime.end != null ">
and updatetime &lt;= #{params.updateTime.end}
</if>
</if>
<if test="params.publishTime != null ">
<if test="params.publishTime.start != null ">
and publishtime &gt;= #{params.publishTime.start}
</if>
<if test="params.publishTime.end != null ">
and publishtime &lt;= #{params.publishTime.end}
</if>
</if>
</if>
</where>
order by a.publishtime desc
</select>
<select id="joinSubDataById" parameterType="com.zhwl.cms.domain.ZdyCmsArchives" resultType="java.util.Map">
SELECT
a.id,
a.user_id,
a.channel_id,
a.model_id,
a.title,
a.flag,
a.style,
a.image,
a.keywords,
a.description,
a.tags,
a.weigh,
a.views,
a.comments,
a.likes,
a.dislikes,
a.diyname,
a.createtime,
a.updatetime,
a.publishtime,
a.deletetime,
a.memo,
a.status,
a.subtitle,
b.content,
a.origin,
a.image_list,
a.rejection_desc,
a.audit_status,
u.user_name as userName,
u.avatar
<if test="zdyCmsModel.fields != null and zdyCmsModel.fields != ''">
,
<foreach item="field" collection="zdyCmsModel.fields.split(',')" separator=",">
b.${field}
</foreach>
</if>
FROM
zdy_cms_archives a
LEFT JOIN ${zdyCmsModel.table} b on a.id = b.id
LEFT JOIN sys_user u on u.user_id = a.admin_id
where a.id = #{id}
and a.model_id = #{modelId}
</select>
<insert id="commonInsertOrUpdateSubData">
insert into ${tableName}
<trim prefix="(" suffix=")" suffixOverrides=",">
<foreach collection="fieldData" index="key" item="value" separator=",">
${key}
</foreach>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<foreach collection="fieldData" index="key" item="value" separator=",">
#{value}
</foreach>
</trim>
on duplicate key update
<foreach collection="fieldData" index="key" item="value" separator=",">
${key} = values(${key})
</foreach>
</insert>
<select id="selectContentById" parameterType="com.zhwl.cms.domain.ZdyCmsArchives" resultType="java.lang.String">
select content
from ${zdyCmsModel.table}
where id = #{id}
</select>
<insert id="insertOrUpdateContentById" parameterType="com.zhwl.cms.domain.ZdyCmsArchives">
insert into ${zdyCmsModel.table} (id, content)
values (#{id}, #{content}) on duplicate key
update
content =
values (content)
</insert>
<select id="countByChannelIds" parameterType="com.zhwl.cms.domain.ZdyCmsArchives" resultType="java.lang.Long">
SELECT count(*)
FROM
`zdy_cms_archives` `a`
WHERE `a`.`status` = 'normal'
AND ISNULL(a.deletetime)
<if test="channelList != null">
and a.channel_id in
<foreach item="id" collection="channelList" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
<select id="countGroupByChannelId" parameterType="java.util.List" resultType="com.zhwl.cms.domain.ZdyCmsArchives">
SELECT
a.channel_id as channelId,
count(*) AS total
FROM
zdy_cms_archives a
WHERE
`a`.`status` = 'normal'
AND ISNULL( a.deletetime )
AND a.channel_id IN
<foreach item="id" collection="list" open="(" separator="," close=")">
#{id}
</foreach>
GROUP BY
a.channel_id
</select>
<select id="globalSearch" resultType="com.zhwl.cms.domain.ZdyCmsArchives">
select id, user_id, channel_id, model_id, title, flag, style, image, keywords, description, tags, weigh, views,
comments, likes, dislikes, diyname, memo, status,admin_id,data_org,subtitle,image_list from zdy_cms_archives
<where>
ISNULL(deletetime) and status = 'normal'
<if test="key != null and key != ''">
and (title like concat("%",#{key},"%")
or keywords like concat("%",#{key},"%")
or description like concat("%",#{key},"%"))
</if>
<if test="modelId != null and modelId != ''">
and model_id = #{modelId}
</if>
</where>
order by publishtime desc
</select>
<select id="querySubDataById" parameterType="com.zhwl.cms.domain.ZdyCmsArchives" resultType="java.util.Map">
SELECT
b.id,
b.content
<if test="zdyCmsModel.fields != null and zdyCmsModel.fields != ''">
,
<foreach item="field" collection="zdyCmsModel.fields.split(',')" separator=",">
b.${field}
</foreach>
</if>
FROM
${zdyCmsModel.table} b
where b.id = #{id}
</select>
<select id="getInfo" resultType="java.util.Map" parameterType="com.zhwl.cms.domain.ZdyCmsModel">
SELECT
<choose>
<when test="fields != null and fields != ''">
${fields}
</when>
<otherwise>
*
</otherwise>
</choose>
FROM
${table}
where id = #{id}
</select>
<select id="searchZdyCmsArchivesList" parameterType="ZdyCmsArchives" resultType="java.util.Map">
SELECT
b.id,
a.content,
b.model_id as modelId,
b.channel_id as channelId,
b.title,
b.image,
b.description,
b.weigh,
publishtime,
b.deletetime,
b.STATUS,
b.data_org as dataOrg
FROM
zdy_cms_archives b
LEFT JOIN
<if test="tables != null">
<foreach item="name" collection="tables" open="(" separator="UNION ALL" close=")">
SELECT
id,
content
FROM
${name}
</foreach>
</if>
a ON a.id = b.id
WHERE
b.STATUS = 'normal'
AND ISNULL( b.deletetime )
AND ( b.title LIKE concat('%',#{title},'%') OR a.content LIKE concat('%',#{title},'%') )
<if test="adminIds != null and adminIds.length != 0">and b.admin_id in
<foreach item="admin_id" collection="adminIds" open="(" separator="," close=")">
#{admin_id}
</foreach>
</if>
<if test="userIds != null and userIds.length != 0">and b.user_id in
<foreach item="user_id" collection="userIds" open="(" separator="," close=")">
#{user_id}
</foreach>
</if>
ORDER BY
b.publishtime DESC
</select>
<select id="selectZdyCmsArchivesListByChannelId" parameterType="Integer" resultMap="ZdyCmsArchivesResult">
SELECT
arc.id,
arc.model_id,
arc.channel_id,
arc.title,
arc.image,
arc.description,
arc.weigh,
arc.publishtime,
arc.deletetime,
arc.STATUS,
arc.flag,
arc.views,
arc.admin_id,
arc.user_id,
arc.keywords,
arc.image_list,
arc.subtitle,
arc.rejection_desc,
arc.audit_status,
u.user_name,
u.avatar,
ch.keywords AS channelKey
FROM
zdy_cms_archives arc
LEFT JOIN sys_user u ON u.user_id = arc.admin_id
LEFT JOIN zdy_cms_channel ch ON ch.id = arc.channel_id
WHERE
arc.channel_id = #{channelId} and ISNULL(arc.deletetime) and arc.status = 'normal'
<if test="flag != null and flag != ''">and FIND_IN_SET(#{flag},arc.flag)</if>
ORDER BY
arc.publishtime DESC
</select>
<select id="selectZdyUserCollect" parameterType="Long" resultMap="ZdyCmsArchivesResult">
SELECT a.id,
a.user_id,
a.channel_id,
c.name as channel_name,
a.model_id,
a.title,
a.flag,
a.style,
a.image,
a.keywords,
a.description,
a.tags,
a.weigh,
a.views,
a.comments,
a.likes,
a.dislikes,
a.diyname,
a.createtime,
a.updatetime,
a.publishtime,
a.deletetime,
a.memo,
a.`status`,
a.admin_id,
a.data_org,
a.subtitle,
a.origin,
a.image_list,
a.rejection_desc,
a.rejection_time,
a.audit_status,
if(a.admin_id != 0, u.nick_name, zu.nickname) as user_name,
if(a.admin_id != 0, u.avatar, zu.avatar) as avatar
from zdy_cms_archives a
inner join zdy_user_collect b on a.id = b.archives_id
left join sys_user u on a.admin_id = u.user_id
left join zdy_user zu on a.user_id= zu.id
left join zdy_cms_channel c on a.channel_id = c.id
<where>
b.user_id = #{userId}
<if test="zdyCmsArchives.flag != null and zdyCmsArchives.flag != ''">
<foreach collection="zdyCmsArchives.flag.split(',') " item="item" index="index" open=" AND (" close=")"
separator=" AND ">
find_in_set(#{item}, a.flag)
</foreach>
</if>
<choose>
<when test="zdyCmsArchives.channelId != null">and a.channel_id = #{zdyCmsArchives.channelId}</when>
<when test="zdyCmsArchives.channelIds != null and zdyCmsArchives.channelIds.size>0">
and a.channel_id in
<foreach item="id" collection="zdyCmsArchives.channelIds" open="(" separator="," close=")">
#{id}
</foreach>
</when>
<when test="zdyCmsArchives.channelList != null">
and a.channel_id in
<foreach item="id" collection="zdyCmsArchives.channelList" open="(" separator="," close=")">
#{id}
</foreach>
</when>
</choose>
</where>
order by b.create_time desc
</select>
<update id="addComments">
update zdy_cms_archives set comments = comments + #{comments} where id = #{id}
</update>
<select id="existsArchivesNotOwnedByOperator" resultType="Integer">
select exists(
select 1 from
zdy_cms_archives
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
and user_id != #{operatorId}
)
</select>
<select id="selectFoodRecommendList" resultType="java.util.Map">
SELECT
title,description
FROM
zdy_cms_archives
where channel_id in (17,22) and ISNULL(deletetime)
</select>
<update id="updateVisibility" parameterType="ZdyCmsArchives">
update zdy_cms_archives
set `status` = #{status}
where id = #{id}
</update>
</mapper>

View File

@@ -0,0 +1,238 @@
<?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.ZdyCmsArticleCommentMapper">
<resultMap type="ZdyCmsArticleComment" id="ZdyCmsArticleCommentResult">
<result property="id" column="id"/>
<result property="articleId" column="article_id"/>
<result property="zdyUserId" column="zdy_user_id"/>
<result property="parentCommentId" column="parent_comment_id"/>
<result property="content" column="content"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
</resultMap>
<resultMap type="ZdyCmsArticleCommentVO" id="ZdyCmsArticleCommentVOResult">
<result property="id" column="id"/>
<result property="articleId" column="article_id"/>
<result property="zdyUserId" column="zdy_user_id"/>
<result property="parentCommentId" column="parent_comment_id"/>
<result property="content" column="content"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="avatar" column="avatar"/>
<result property="nickname" column="nickname"/>
</resultMap>
<resultMap type="ZdyCmsArchives" id="ZdyCmsArchivesResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="channelId" column="channel_id"/>
<result property="modelId" column="model_id"/>
<result property="title" column="title"/>
<result property="flag" column="flag"/>
<result property="style" column="style"/>
<result property="image" column="image"/>
<result property="keywords" column="keywords"/>
<result property="description" column="description"/>
<result property="tags" column="tags"/>
<result property="weigh" column="weigh"/>
<result property="views" column="views"/>
<result property="collects" column="collects"/>
<result property="comments" column="comments"/>
<result property="likes" column="likes"/>
<result property="dislikes" column="dislikes"/>
<result property="diyname" column="diyname"/>
<result property="createtime" column="createtime"/>
<result property="updatetime" column="updatetime"/>
<result property="publishtime" column="publishtime"/>
<result property="deletetime" column="deletetime"/>
<result property="memo" column="memo"/>
<result property="status" column="status"/>
<result property="adminId" column="admin_id"/>
<result property="dataOrg" column="data_org"/>
<result property="subtitle" column="subtitle"/>
<result property="origin" column="origin"/>
<result property="imageList" column="image_list"/>
<result property="userName" column="user_name"/>
<result property="avatar" column="avatar"/>
<result property="channelKey" column="channelKey"/>
</resultMap>
<sql id="selectZdyCmsArticleCommentVo">
select zcac.id,
zcac.article_id,
zcac.zdy_user_id,
zcac.parent_comment_id,
zcac.content,
zcac.status,
zcac.del_flag,
zcac.create_time,
zcac.update_time,
zcac.update_by,
zu.avatar,
zu.nickname
from zdy_cms_article_comment zcac
left join zdy_user zu on zcac.zdy_user_id = zu.id
</sql>
<select id="selectZdyCmsArticleCommentList" parameterType="ZdyCmsArticleComment"
resultMap="ZdyCmsArticleCommentVOResult">
<include refid="selectZdyCmsArticleCommentVo"/>
<where>
zcac.del_flag = '0'
<if test="articleId != null ">
and zcac.article_id = #{articleId}
</if>
<if test="zdyUserId != null ">
and zcac.zdy_user_id = #{zdyUserId}
</if>
<if test="parentCommentId != null ">
and zcac.parent_comment_id = #{parentCommentId}
</if>
<if test="content != null and content != ''">
and zcac.content like concat('%',#{content},'%')
</if>
<if test="status != null and status != ''">
and zcac.status = #{status}
</if>
</where>
order by zcac.create_time desc
</select>
<select id="selectZdyCmsArticleCommentById" parameterType="Long"
resultMap="ZdyCmsArticleCommentVOResult">
<include refid="selectZdyCmsArticleCommentVo"/>
where zcac.id = #{id}
</select>
<insert id="insertZdyCmsArticleComment" parameterType="ZdyCmsArticleComment" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_cms_article_comment
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="articleId != null">article_id,
</if>
<if test="zdyUserId != null">zdy_user_id,
</if>
<if test="parentCommentId != null">parent_comment_id,
</if>
<if test="content != null">content,
</if>
<if test="status != null and status != ''">status,
</if>
<if test="delFlag != null and delFlag != ''">del_flag,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="updateBy != null">update_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="articleId != null">#{articleId},
</if>
<if test="zdyUserId != null">#{zdyUserId},
</if>
<if test="parentCommentId != null">#{parentCommentId},
</if>
<if test="content != null">#{content},
</if>
<if test="status != null and status != ''">#{status},
</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="updateBy != null">#{updateBy},
</if>
</trim>
</insert>
<update id="updateZdyCmsArticleComment" parameterType="ZdyCmsArticleComment">
update zdy_cms_article_comment
<trim prefix="SET" suffixOverrides=",">
<if test="articleId != null">article_id =
#{articleId},
</if>
<if test="zdyUserId != null">zdy_user_id =
#{zdyUserId},
</if>
<if test="parentCommentId != null">parent_comment_id =
#{parentCommentId},
</if>
<if test="content != null">content =
#{content},
</if>
<if test="status != null and status != ''">status =
#{status},
</if>
<if test="delFlag != null and delFlag != ''">del_flag =
#{delFlag},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
</trim>
where id = #{id}
</update>
<update id="deleteZdyCmsArticleCommentById" parameterType="Long">
update zdy_cms_article_comment
set del_flag = '1'
where id = #{id}
</update>
<update id="deleteZdyCmsArticleCommentByIds" parameterType="String">
update zdy_cms_article_comment set del_flag = '1'
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="existsCommentsNotOwnedByOperator" resultType="Integer">
select exists(
select 1 from
zdy_cms_article_comment
where id in
<foreach item="id" collection="ids" open="(" separator="," close=")">
#{id}
</foreach>
and zdy_user_id != #{operatorId}
)
</select>
<select id="countCommentsByArticleIds" resultMap="ZdyCmsArchivesResult">
SELECT
article_id AS id,
count(*) AS comments
FROM
zdy_cms_article_comment
WHERE
del_flag = '0'
and article_id in
<foreach item="archiveId" collection="list" open="(" separator="," close=")">
#{archiveId}
</foreach>
GROUP BY
article_id
</select>
</mapper>

View File

@@ -0,0 +1,117 @@
<?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.ZdyCmsBlockMapper">
<resultMap type="ZdyCmsBlock" id="ZdyCmsBlockResult">
<result property="id" column="id"/>
<result property="type" column="type"/>
<result property="name" column="name"/>
<result property="title" column="title"/>
<result property="image" column="image"/>
<result property="url" column="url"/>
<result property="content" column="content"/>
<result property="weigh" column="weigh"/>
<result property="createtime" column="createtime"/>
<result property="updatetime" column="updatetime"/>
<result property="status" column="status"/>
</resultMap>
<sql id="selectZdyCmsBlockVo">
select id,
type,
name,
title,
image,
url,
content,
weigh,
FROM_UNIXTIME(createtime) as createtime,
FROM_UNIXTIME(updatetime) as updatetime,
status
from zdy_cms_block
</sql>
<select id="selectZdyCmsBlockList" parameterType="ZdyCmsBlock" resultMap="ZdyCmsBlockResult">
<include refid="selectZdyCmsBlockVo"/>
<where>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
order by type asc,weigh desc,createtime desc
</select>
<select id="selectZdyCmsBlockById" parameterType="Integer" resultMap="ZdyCmsBlockResult">
<include refid="selectZdyCmsBlockVo"/>
where id = #{id}
</select>
<insert id="insertZdyCmsBlock" parameterType="ZdyCmsBlock" useGeneratedKeys="true" keyProperty="id">
insert into zdy_cms_block
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="type != null">type,</if>
<if test="name != null">name,</if>
<if test="title != null">title,</if>
<if test="image != null">image,</if>
<if test="url != null">url,</if>
<if test="content != null">content,</if>
<if test="weigh != null">weigh,</if>
<if test="createtime != null">createtime,</if>
<if test="updatetime != null">updatetime,</if>
<if test="status != null and status != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="type != null">#{type},</if>
<if test="name != null">#{name},</if>
<if test="title != null">#{title},</if>
<if test="image != null">#{image},</if>
<if test="url != null">#{url},</if>
<if test="content != null">#{content},</if>
<if test="weigh != null">#{weigh},</if>
<if test="createtime != null">UNIX_TIMESTAMP(#{createtime}),</if>
<if test="updatetime != null">UNIX_TIMESTAMP(#{updatetime}),</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
<update id="updateZdyCmsBlock" parameterType="ZdyCmsBlock">
update zdy_cms_block
<trim prefix="SET" suffixOverrides=",">
<if test="type != null">type = #{type},</if>
<if test="name != null">name = #{name},</if>
<if test="title != null">title = #{title},</if>
<if test="image != null">image = #{image},</if>
<if test="url != null">url = #{url},</if>
<if test="content != null">content = #{content},</if>
<if test="weigh != null">weigh = #{weigh},</if>
<if test="updatetime != null">updatetime = UNIX_TIMESTAMP(#{updatetime}),</if>
<if test="status != null and status != ''">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCmsBlockById" parameterType="Integer">
delete
from zdy_cms_block
where id = #{id}
</delete>
<delete id="deleteZdyCmsBlockByIds" parameterType="String">
delete from zdy_cms_block where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDistinctType" resultMap="ZdyCmsBlockResult">
select DISTINCT type, name
from zdy_cms_block
</select>
<select id="selectNameByType" resultMap="ZdyCmsBlockResult">
select id, type, name
from zdy_cms_block
where type = #{type}
</select>
</mapper>

View File

@@ -0,0 +1,301 @@
<?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>

View File

@@ -0,0 +1,389 @@
<?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.ZdyCmsFieldsMapper">
<resultMap type="ZdyCmsFields" id="ZdyCmsFieldsResult">
<result property="id" column="id"/>
<result property="modelId" column="model_id"/>
<result property="diyformId" column="diyform_id"/>
<result property="name" column="name"/>
<result property="type" column="type"/>
<result property="title" column="title"/>
<result property="content" column="content"/>
<result property="defaultvalue" column="defaultvalue"/>
<result property="rule" column="rule"/>
<result property="msg" column="msg"/>
<result property="ok" column="ok"/>
<result property="tip" column="tip"/>
<result property="decimals" column="decimals"/>
<result property="length" column="length"/>
<result property="minimum" column="minimum"/>
<result property="maximum" column="maximum"/>
<result property="extend" column="extend"/>
<result property="weigh" column="weigh"/>
<result property="createtime" column="createtime"/>
<result property="updatetime" column="updatetime"/>
<result property="iscontribute" column="iscontribute"/>
<result property="isfilter" column="isfilter"/>
<result property="status" column="status"/>
</resultMap>
<sql id="selectZdyCmsFieldsVo">
select id,
model_id,
diyform_id,
name,
type,
title,
content,
defaultvalue,
rule,
msg,
ok,
tip,
decimals,
length,
minimum,
maximum,
extend,
weigh,
createtime,
updatetime,
iscontribute,
isfilter,
status
from zdy_cms_fields
</sql>
<select id="selectZdyCmsFieldsList" parameterType="ZdyCmsFields" resultMap="ZdyCmsFieldsResult">
<include refid="selectZdyCmsFieldsVo"/>
<where>
<if test="modelId != null ">and model_id = #{modelId}</if>
<if test="diyformId != null ">and diyform_id = #{diyformId}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''">and type = #{type}</if>
<if test="title != null and title != ''">and title = #{title}</if>
<if test="content != null and content != ''">and content = #{content}</if>
<if test="defaultvalue != null and defaultvalue != ''">and defaultvalue = #{defaultvalue}</if>
<if test="rule != null and rule != ''">and rule = #{rule}</if>
<if test="msg != null and msg != ''">and msg = #{msg}</if>
<if test="ok != null and ok != ''">and ok = #{ok}</if>
<if test="tip != null and tip != ''">and tip = #{tip}</if>
<if test="decimals != null ">and decimals = #{decimals}</if>
<if test="length != null ">and length = #{length}</if>
<if test="minimum != null ">and minimum = #{minimum}</if>
<if test="maximum != null ">and maximum = #{maximum}</if>
<if test="extend != null and extend != ''">and extend = #{extend}</if>
<if test="weigh != null ">and weigh = #{weigh}</if>
<if test="createtime != null ">and createtime = #{createtime}</if>
<if test="updatetime != null ">and updatetime = #{updatetime}</if>
<if test="iscontribute != null ">and iscontribute = #{iscontribute}</if>
<if test="isfilter != null ">and isfilter = #{isfilter}</if>
<if test="status != null and status != ''">and status = #{status}</if>
</where>
</select>
<select id="selectZdyCmsFieldsById" parameterType="Integer" resultMap="ZdyCmsFieldsResult">
<include refid="selectZdyCmsFieldsVo"/>
where id = #{id}
</select>
<insert id="insertZdyCmsFields" parameterType="ZdyCmsFields" useGeneratedKeys="true" keyProperty="id">
insert into zdy_cms_fields
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="modelId != null">model_id,</if>
<if test="diyformId != null">diyform_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null and type != ''">type,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null">content,</if>
<if test="defaultvalue != null and defaultvalue != ''">defaultvalue,</if>
<if test="rule != null">rule,</if>
<if test="msg != null">msg,</if>
<if test="ok != null">ok,</if>
<if test="tip != null">tip,</if>
<if test="decimals != null">decimals,</if>
<if test="length != null">length,</if>
<if test="minimum != null">minimum,</if>
<if test="maximum != null">maximum,</if>
<if test="extend != null and extend != ''">extend,</if>
<if test="weigh != null">weigh,</if>
<if test="createtime != null">createtime,</if>
<if test="updatetime != null">updatetime,</if>
<if test="iscontribute != null">iscontribute,</if>
<if test="isfilter != null">isfilter,</if>
<if test="status != null and status != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="modelId != null">#{modelId},</if>
<if test="diyformId != null">#{diyformId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null">#{content},</if>
<if test="defaultvalue != null and defaultvalue != ''">#{defaultvalue},</if>
<if test="rule != null">#{rule},</if>
<if test="msg != null">#{msg},</if>
<if test="ok != null">#{ok},</if>
<if test="tip != null">#{tip},</if>
<if test="decimals != null">#{decimals},</if>
<if test="length != null">#{length},</if>
<if test="minimum != null">#{minimum},</if>
<if test="maximum != null">#{maximum},</if>
<if test="extend != null and extend != ''">#{extend},</if>
<if test="weigh != null">#{weigh},</if>
<if test="createtime != null">#{createtime},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="iscontribute != null">#{iscontribute},</if>
<if test="isfilter != null">#{isfilter},</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
<update id="updateZdyCmsFields" parameterType="ZdyCmsFields">
update zdy_cms_fields
<trim prefix="SET" suffixOverrides=",">
<if test="modelId != null">model_id = #{modelId},</if>
<if test="diyformId != null">diyform_id = #{diyformId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="defaultvalue != null and defaultvalue != ''">defaultvalue = #{defaultvalue},</if>
<if test="rule != null">rule = #{rule},</if>
<if test="msg != null">msg = #{msg},</if>
<if test="ok != null">ok = #{ok},</if>
<if test="tip != null">tip = #{tip},</if>
<if test="decimals != null">decimals = #{decimals},</if>
<if test="length != null">length = #{length},</if>
<if test="minimum != null">minimum = #{minimum},</if>
<if test="maximum != null">maximum = #{maximum},</if>
<if test="extend != null and extend != ''">extend = #{extend},</if>
<if test="weigh != null">weigh = #{weigh},</if>
<if test="createtime != null">createtime = #{createtime},</if>
<if test="updatetime != null">updatetime = #{updatetime},</if>
<if test="iscontribute != null">iscontribute = #{iscontribute},</if>
<if test="isfilter != null">isfilter = #{isfilter},</if>
<if test="status != null and status != ''">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCmsFieldsById" parameterType="Integer">
delete
from zdy_cms_fields
where id = #{id}
</delete>
<delete id="deleteZdyCmsFieldsByIds" parameterType="String">
delete from zdy_cms_fields where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectFieldsNameCount" parameterType="ZdyCmsFields" resultType="String">
SELECT * from (
SELECT COLUMN_NAME as name FROM information_schema.`COLUMNS` WHERE TABLE_NAME = 'zdy_cms_archives'
UNION
SELECT name FROM zdy_cms_fields
<where>
<if test="modelId != null ">and model_id = #{modelId}</if>
<if test="diyformId != null ">and diyform_id = #{diyformId}</if>
</where>
) as a
<where>
<if test="name != null and name != ''">and name = #{name}</if>
</where>
</select>
<select id="selectDiyFormFieldsNameCount" parameterType="ZdyCmsFields" resultType="String">
SELECT * from (
SELECT COLUMN_NAME as name FROM information_schema.`COLUMNS`
WHERE TABLE_NAME = (SELECT `table` from zdy_cms_diyform where id = #{diyformId})
UNION
SELECT name FROM zdy_cms_fields WHERE diyform_id = #{diyformId}
) as a
<where>
<if test="name != null and name != ''">and name = #{name}</if>
</where>
</select>
<select id="selectTableDataList" resultType="hashmap">
SELECT * from ${tables}
<where>
<if test="paramsMap != null">
<foreach collection="paramsMap" index="key" item="value">
<if test="key != 'begintime' and key != 'endtime'">
and ${key} =#{value}
</if>
</foreach>
</if>
<if test="paramLikeMap != null">
<foreach collection="paramLikeMap" index="key" item="value">
and ${key} like concat('%',#{value},'%')
</foreach>
</if>
<if test="paramInMap != null">
<foreach collection="paramInMap" index="key" item="values">
<if test="values != null and values.size > 0">
and ${key} in
<foreach item="value" collection="values" open="(" separator="," close=")">
#{value}
</foreach>
</if>
</foreach>
</if>
</where>
order by id desc
</select>
<select id="selectTableDataDetailById" resultType="java.util.Map">
select *
from ${table}
where id = #{id}
</select>
<update id="editTableDataDetail" parameterType="java.util.Map">
update ${table}
<trim prefix="SET" suffixOverrides=",">
<foreach collection="params" index="key" item="value">
${key} = #{value},
</foreach>
</trim>
where id = #{id}
</update>
<insert id="batchCmsField">
insert into zdy_cms_fields
(model_id,diyform_id,name,type,title,content,defaultvalue,rule,msg,ok,tip,decimals,length,minimum,maximum,extend,weigh,createtime,updatetime,iscontribute,isfilter,status)
values
<foreach item="item" index="index" collection="list" separator=",">
<trim prefix="(" suffix=")" suffixOverrides=",">
<choose>
<when test="item.modelId != null">#{item.modelId},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.diyformId != null">#{item.diyformId},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.name != null and item.name != ''">#{item.name},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.type != null and item.type != ''">#{item.type},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.title != null and item.title != ''">#{item.title},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.content != null">#{item.content},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.defaultvalue != null and item.defaultvalue != ''">#{item.defaultvalue},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.rule != null">#{item.rule},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.msg != null">#{item.msg},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.ok != null">#{item.ok},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.tip != null">#{item.tip},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.decimals != null">#{item.decimals},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.length != null">#{item.length},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.minimum != null">#{item.minimum},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.maximum != null">#{item.maximum},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.extend != null and item.extend != ''">#{item.extend},</when>
<otherwise>'',</otherwise>
</choose>
<choose>
<when test="item.weigh != null">#{item.weigh},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.createtime != null">#{item.createtime},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.updatetime != null">#{item.updatetime},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.iscontribute != null">#{item.iscontribute},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.isfilter != null">#{item.isfilter},</when>
<otherwise>null,</otherwise>
</choose>
<choose>
<when test="item.status != null and item.status != ''">#{item.status},</when>
<otherwise>null,</otherwise>
</choose>
</trim>
</foreach>
</insert>
<delete id="deleteZdyCmsFieldsByLinkId" parameterType="ZdyCmsFields">
delete from zdy_cms_fields
<where>
<if test="modelId != null">and model_id = #{modelId}</if>
</where>
</delete>
<select id="getAppendixFields" resultMap="ZdyCmsFieldsResult">
select f.id,
f.model_id,
f.name,
f.type,
f.title,
f.content,
f.defaultvalue,
f.decimals,
f.length,
f.minimum,
f.maximum,
f.weigh,
f.status,
f.rule,
f.extend
from zdy_cms_fields f
LEFT JOIN zdy_cms_channel c ON c.model_id = f.model_id
WHERE c.id = #{channelId}
order by f.weigh
</select>
</mapper>

View File

@@ -0,0 +1,95 @@
<?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.ZdyCmsModelMapper">
<resultMap type="ZdyCmsModel" id="ZdyCmsModelResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="table" column="table" />
<result property="fields" column="fields" />
<result property="channeltpl" column="channeltpl" />
<result property="listtpl" column="listtpl" />
<result property="showtpl" column="showtpl" />
<result property="createtime" column="createtime" />
<result property="updatetime" column="updatetime" />
<result property="setting" column="setting" />
</resultMap>
<sql id="selectZdyCmsModelVo">
select id, name, `table`, fields, channeltpl, listtpl, showtpl, createtime, updatetime, setting from zdy_cms_model
</sql>
<select id="selectZdyCmsModelList" parameterType="ZdyCmsModel" resultMap="ZdyCmsModelResult">
<include refid="selectZdyCmsModelVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="table != null and table != ''"> and table =#{table}</if>
</where>
order by id desc
</select>
<select id="selectZdyCmsModelById" parameterType="Integer" resultMap="ZdyCmsModelResult">
<include refid="selectZdyCmsModelVo"/>
where id = #{id}
</select>
<insert id="insertZdyCmsModel" parameterType="ZdyCmsModel" useGeneratedKeys="true" keyProperty="id">
insert into zdy_cms_model
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="table != null">`table`,</if>
<if test="fields != null">fields,</if>
<if test="channeltpl != null">channeltpl,</if>
<if test="listtpl != null">listtpl,</if>
<if test="showtpl != null">showtpl,</if>
<if test="createtime != null">createtime,</if>
<if test="updatetime != null">updatetime,</if>
<if test="setting != null">setting,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="table != null">#{table},</if>
<if test="fields != null">#{fields},</if>
<if test="channeltpl != null">#{channeltpl},</if>
<if test="listtpl != null">#{listtpl},</if>
<if test="showtpl != null">#{showtpl},</if>
<if test="createtime != null">#{createtime},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="setting != null">#{setting},</if>
</trim>
</insert>
<update id="updateZdyCmsModel" parameterType="ZdyCmsModel">
update zdy_cms_model
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="table != null">`table` = #{table},</if>
<if test="fields != null">fields = #{fields},</if>
<if test="channeltpl != null">channeltpl = #{channeltpl},</if>
<if test="listtpl != null">listtpl = #{listtpl},</if>
<if test="showtpl != null">showtpl = #{showtpl},</if>
<if test="createtime != null">createtime = #{createtime},</if>
<if test="updatetime != null">updatetime = #{updatetime},</if>
<if test="setting != null">setting = #{setting},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCmsModelById" parameterType="Integer">
delete from zdy_cms_model where id = #{id}
</delete>
<delete id="deleteZdyCmsModelByIds" parameterType="String">
delete from zdy_cms_model where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectCounts" resultType="Integer">
select count(0) from ${tableName}
</select>
</mapper>

View File

@@ -0,0 +1,181 @@
<?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.ZdyCmsPageMapper">
<resultMap type="ZdyCmsPage" id="ZdyCmsPageResult">
<result property="id" column="id" />
<result property="categoryId" column="category_id" />
<result property="type" column="type" />
<result property="title" column="title" />
<result property="keywords" column="keywords" />
<result property="description" column="description" />
<result property="flag" column="flag" />
<result property="image" column="image" />
<result property="content" column="content" />
<result property="icon" column="icon" />
<result property="views" column="views" />
<result property="likes" column="likes" />
<result property="dislikes" column="dislikes" />
<result property="comments" column="comments" />
<result property="diyname" column="diyname" />
<result property="showtpl" column="showtpl" />
<result property="createtime" column="createtime" />
<result property="updatetime" column="updatetime" />
<result property="weigh" column="weigh" />
<result property="status" column="status" />
</resultMap>
<sql id="selectZdyCmsPageVo">
select id, category_id, type, title, keywords, description, flag, image, content, icon, views, likes, dislikes, comments, diyname, showtpl, createtime, updatetime, weigh, status from zdy_cms_page
</sql>
<select id="selectZdyCmsPageList" parameterType="ZdyCmsPage" resultMap="ZdyCmsPageResult">
<include refid="selectZdyCmsPageVo"/>
<where>
<if test="categoryId != null "> and category_id = #{categoryId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="keywords != null and keywords != ''"> and keywords = #{keywords}</if>
<if test="description != null and description != ''"> and description = #{description}</if>
<if test="flag != null and flag != ''"> and flag = #{flag}</if>
<if test="image != null and image != ''"> and image = #{image}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="icon != null and icon != ''"> and icon = #{icon}</if>
<if test="views != null "> and views = #{views}</if>
<if test="likes != null "> and likes = #{likes}</if>
<if test="dislikes != null "> and dislikes = #{dislikes}</if>
<if test="comments != null "> and comments = #{comments}</if>
<if test="diyname != null and diyname != ''"> and diyname like concat('%', #{diyname}, '%')</if>
<if test="showtpl != null and showtpl != ''"> and showtpl = #{showtpl}</if>
<if test="createtime != null "> and createtime = #{createtime}</if>
<if test="updatetime != null "> and updatetime = #{updatetime}</if>
<if test="weigh != null "> and weigh = #{weigh}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
order by weigh desc, id desc
</select>
<select id="selectZdyCmsPageById" parameterType="Integer" resultMap="ZdyCmsPageResult">
<include refid="selectZdyCmsPageVo"/>
where id = #{id}
</select>
<insert id="insertZdyCmsPage" parameterType="ZdyCmsPage" useGeneratedKeys="true" keyProperty="id">
insert into zdy_cms_page
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="categoryId != null">category_id,</if>
<if test="type != null and type != ''">type,</if>
<if test="title != null and title != ''">title,</if>
<if test="keywords != null and keywords != ''">keywords,</if>
<if test="description != null and description != ''">description,</if>
<if test="flag != null and flag != ''">flag,</if>
<if test="image != null and image != ''">image,</if>
<if test="content != null">content,</if>
<if test="icon != null and icon != ''">icon,</if>
<if test="views != null">views,</if>
<if test="likes != null">likes,</if>
<if test="dislikes != null">dislikes,</if>
<if test="comments != null">comments,</if>
<if test="diyname != null and diyname != ''">diyname,</if>
<if test="showtpl != null and showtpl != ''">showtpl,</if>
<if test="createtime != null">createtime,</if>
<if test="updatetime != null">updatetime,</if>
<if test="weigh != null">weigh,</if>
<if test="status != null and status != ''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="categoryId != null">#{categoryId},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="keywords != null and keywords != ''">#{keywords},</if>
<if test="description != null and description != ''">#{description},</if>
<if test="flag != null and flag != ''">#{flag},</if>
<if test="image != null and image != ''">#{image},</if>
<if test="content != null">#{content},</if>
<if test="icon != null and icon != ''">#{icon},</if>
<if test="views != null">#{views},</if>
<if test="likes != null">#{likes},</if>
<if test="dislikes != null">#{dislikes},</if>
<if test="comments != null">#{comments},</if>
<if test="diyname != null and diyname != ''">#{diyname},</if>
<if test="showtpl != null and showtpl != ''">#{showtpl},</if>
<if test="createtime != null">#{createtime},</if>
<if test="updatetime != null">#{updatetime},</if>
<if test="weigh != null">#{weigh},</if>
<if test="status != null and status != ''">#{status},</if>
</trim>
</insert>
<update id="updateZdyCmsPage" parameterType="ZdyCmsPage">
update zdy_cms_page
<trim prefix="SET" suffixOverrides=",">
<if test="categoryId != null">category_id = #{categoryId},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="keywords != null and keywords != ''">keywords = #{keywords},</if>
<if test="description != null and description != ''">description = #{description},</if>
<if test="flag != null and flag != ''">flag = #{flag},</if>
<if test="image != null and image != ''">image = #{image},</if>
<if test="content != null">content = #{content},</if>
<if test="icon != null and icon != ''">icon = #{icon},</if>
<if test="views != null">views = #{views},</if>
<if test="likes != null">likes = #{likes},</if>
<if test="dislikes != null">dislikes = #{dislikes},</if>
<if test="comments != null">comments = #{comments},</if>
<if test="diyname != null and diyname != ''">diyname = #{diyname},</if>
<if test="showtpl != null and showtpl != ''">showtpl = #{showtpl},</if>
<if test="createtime != null">createtime = #{createtime},</if>
<if test="updatetime != null">updatetime = #{updatetime},</if>
<if test="weigh != null">weigh = #{weigh},</if>
<if test="status != null and status != ''">status = #{status},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyCmsPageById" parameterType="Integer">
delete from zdy_cms_page where id = #{id}
</delete>
<delete id="deleteZdyCmsPageByIds" parameterType="String">
delete from zdy_cms_page where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectDistinctType" resultMap="ZdyCmsPageResult">
select DISTINCT type from zdy_cms_page
</select>
<select id="selectZdyCmsPageByDiyname" parameterType="String" resultMap="ZdyCmsPageResult">
<include refid="selectZdyCmsPageVo"/>
<where>
diyname = #{diyname}
</where>
</select>
<select id="selectPageListByCustom" resultType="com.zhwl.vo.PageResultVo">
<include refid="selectZdyCmsPageVo"/>
<where>
<if test="type != null and type != ''"> and type = #{type}</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>
</mapper>

View File

@@ -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.zhwl.cms.mapper.ZdyUserCollectMapper">
<resultMap type="ZdyUserCollect" id="ZdyUserCollectResult">
<result property="userId" column="user_id"/>
<result property="archivesId" column="archives_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="type" column="type"/>
</resultMap>
<resultMap type="ZdyCmsArchives" id="ZdyCmsArchivesResult">
<result property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="channelId" column="channel_id"/>
<result property="modelId" column="model_id"/>
<result property="title" column="title"/>
<result property="flag" column="flag"/>
<result property="style" column="style"/>
<result property="image" column="image"/>
<result property="keywords" column="keywords"/>
<result property="description" column="description"/>
<result property="tags" column="tags"/>
<result property="weigh" column="weigh"/>
<result property="views" column="views"/>
<result property="collects" column="collects"/>
<result property="comments" column="comments"/>
<result property="likes" column="likes"/>
<result property="dislikes" column="dislikes"/>
<result property="diyname" column="diyname"/>
<result property="createtime" column="createtime"/>
<result property="updatetime" column="updatetime"/>
<result property="publishtime" column="publishtime"/>
<result property="deletetime" column="deletetime"/>
<result property="memo" column="memo"/>
<result property="status" column="status"/>
<result property="adminId" column="admin_id"/>
<result property="dataOrg" column="data_org"/>
<result property="subtitle" column="subtitle"/>
<result property="origin" column="origin"/>
<result property="imageList" column="image_list"/>
<result property="userName" column="user_name"/>
<result property="avatar" column="avatar"/>
<result property="channelKey" column="channelKey"/>
</resultMap>
<sql id="selectZdyUserCollectVo">
select user_id, archives_id, create_time, update_time, type
from zdy_user_collect
</sql>
<select id="selectZdyUserCollectList" parameterType="ZdyUserCollect" resultMap="ZdyUserCollectResult">
<include refid="selectZdyUserCollectVo"/>
<where>
</where>
</select>
<select id="selectZdyUserCollectByUserId" parameterType="Long"
resultMap="ZdyUserCollectResult">
<include refid="selectZdyUserCollectVo"/>
where user_id = #{userId}
</select>
<insert id="insertZdyUserCollect" parameterType="ZdyUserCollect">
insert into zdy_user_collect
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,
</if>
<if test="archivesId != null">archives_id,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="type != null">type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},
</if>
<if test="archivesId != null">#{archivesId},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="type != null">#{type},
</if>
</trim>
</insert>
<update id="updateZdyUserCollect" parameterType="ZdyUserCollect">
update zdy_user_collect
<trim prefix="SET" suffixOverrides=",">
<if test="archivesId != null">archives_id =
#{archivesId},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
<if test="type != null">type =
#{type},
</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteZdyUserCollectByUserId" parameterType="Long">
delete
from zdy_user_collect
where user_id = #{userId}
</delete>
<delete id="deleteZdyUserCollectByUserIds" parameterType="String">
delete from zdy_user_collect where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<delete id="deleteZdyUserCollect">
delete
from zdy_user_collect
where user_id = #{userId}
and archives_id = #{archivesId}
</delete>
<select id="selectZdyUserCollect" resultType="java.lang.Integer">
select count(1)
from zdy_user_collect
where user_id = #{userId}
and archives_id = #{archivesId}
</select>
<select id="selectArchivesIdsByUserIdAndArchivesIds" resultType="java.lang.Integer">
select archives_id
from zdy_user_collect
where user_id = #{userId}
and archives_id in
<foreach item="archivesId" collection="archivesIds" open="(" separator="," close=")">
#{archivesId}
</foreach>
</select>
<select id="countCollectsByArchiveIds" resultMap="ZdyCmsArchivesResult">
select archives_id as id, count(*) as collects
from zdy_user_collect
where
archives_id in
<foreach item="archivesId" collection="list" open="(" separator="," close=")">
#{archivesId}
</foreach>
group by archives_id
</select>
</mapper>