390 lines
17 KiB
XML
390 lines
17 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.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>
|