|
|
|
<?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="xyz.wbsite.module.admin.mpr.ConfigDataMapper">
|
|
|
|
|
|
|
|
<sql id="table">"NA_CONFIG_DATA"</sql>
|
|
|
|
|
|
|
|
<sql id="entityColumnList">
|
|
|
|
"ID","TARGET_ID","RULE_ID","CONF_NAME","CONF_VALUE","CONF_NOTE","ROW_VERSION","IS_DELETED","CREATE_BY","CREATE_TIME","LAST_UPDATE_BY","LAST_UPDATE_TIME"
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
<resultMap id="configData" type="xyz.wbsite.module.admin.ent.ConfigData">
|
|
|
|
<result column="ID" jdbcType="BIGINT" property="id"/>
|
|
|
|
<result column="TARGET_ID" jdbcType="BIGINT" property="targetId"/>
|
|
|
|
<result column="RULE_ID" jdbcType="BIGINT" property="ruleId"/>
|
|
|
|
<result column="CONF_NAME" jdbcType="VARCHAR" property="confName"/>
|
|
|
|
<result column="CONF_VALUE" jdbcType="VARCHAR" property="confValue"/>
|
|
|
|
<result column="CONF_NOTE" jdbcType="VARCHAR" property="confNote"/>
|
|
|
|
<result column="ROW_VERSION" jdbcType="BIGINT" property="rowVersion"/>
|
|
|
|
<result column="IS_DELETED" jdbcType="BIT" property="isDeleted"/>
|
|
|
|
<result column="CREATE_BY" jdbcType="BIGINT" property="createBy"/>
|
|
|
|
<result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
|
<result column="LAST_UPDATE_BY" jdbcType="BIGINT" property="lastUpdateBy"/>
|
|
|
|
<result column="LAST_UPDATE_TIME" jdbcType="TIMESTAMP" property="lastUpdateTime"/>
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
<insert id="insert">
|
|
|
|
INSERT INTO
|
|
|
|
<include refid="table"/>
|
|
|
|
(
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
(
|
|
|
|
#{request.id},
|
|
|
|
#{request.targetId,jdbcType=BIGINT},
|
|
|
|
#{request.ruleId,jdbcType=BIGINT},
|
|
|
|
#{request.confName,jdbcType=VARCHAR},
|
|
|
|
#{request.confValue,jdbcType=VARCHAR},
|
|
|
|
#{request.confNote,jdbcType=VARCHAR},
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
#{token.userId,jdbcType=NUMERIC},
|
|
|
|
datetime('now','localtime'),
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
)
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insertBatch">
|
|
|
|
INSERT INTO
|
|
|
|
<include refid="table"/>
|
|
|
|
(
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item.id},
|
|
|
|
#{item.targetId,jdbcType=BIGINT},
|
|
|
|
#{item.ruleId,jdbcType=BIGINT},
|
|
|
|
#{item.confName,jdbcType=VARCHAR},
|
|
|
|
#{item.confValue,jdbcType=VARCHAR},
|
|
|
|
#{item.confNote,jdbcType=VARCHAR},
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
#{token.userId,jdbcType=NUMERIC},
|
|
|
|
datetime('now','localtime'),
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
</foreach >
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<update id="delete">
|
|
|
|
UPDATE
|
|
|
|
<include refid="table"/>
|
|
|
|
SET "IS_DELETED" = 1
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
AND "ID" = #{id}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="deleteBatch">
|
|
|
|
UPDATE
|
|
|
|
<include refid="table"/>
|
|
|
|
SET "IS_DELETED" = 1
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
AND "ID" IN
|
|
|
|
<foreach collection="list" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<update id="update">
|
|
|
|
UPDATE
|
|
|
|
<include refid="table"/>
|
|
|
|
SET
|
|
|
|
TARGET_ID = #{request.targetId,jdbcType=BIGINT},
|
|
|
|
RULE_ID = #{request.ruleId,jdbcType=BIGINT},
|
|
|
|
CONF_NAME = #{request.confName,jdbcType=VARCHAR},
|
|
|
|
CONF_VALUE = #{request.confValue,jdbcType=VARCHAR},
|
|
|
|
CONF_NOTE = #{request.confNote,jdbcType=VARCHAR},
|
|
|
|
"ROW_VERSION" = "ROW_VERSION" + 1,
|
|
|
|
"LAST_UPDATE_BY" = #{token.userId},
|
|
|
|
"LAST_UPDATE_TIME" = datetime('now','localtime')
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
AND "ID" = #{request.id}
|
|
|
|
AND "ROW_VERSION" = #{request.rowVersion}
|
|
|
|
</update>
|
|
|
|
|
|
|
|
<select id="select" resultMap="configData">
|
|
|
|
SELECT
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
FROM
|
|
|
|
<include refid="table"/>
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
<if test="request.targetId != null">
|
|
|
|
AND "TARGET_ID" = #{request.targetId}
|
|
|
|
</if>
|
|
|
|
<if test="request.confName != null and request.confName != ''">
|
|
|
|
AND "CONF_NAME" = #{request.confName}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="find" resultMap="configData">
|
|
|
|
SELECT
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
FROM
|
|
|
|
<include refid="table"/>
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
<if test="request.targetId != null">
|
|
|
|
AND "TARGET_ID" = #{request.targetId}
|
|
|
|
</if>
|
|
|
|
<if test="request.confName != null and request.confName != ''">
|
|
|
|
AND "CONF_NAME" = #{request.confName}
|
|
|
|
</if>
|
|
|
|
<if test="request.confNameLike != null and request.confNameLike != ''">
|
|
|
|
AND "CONF_NAME" LIKE '%'||#{request.confNameLike}||'%'
|
|
|
|
</if>
|
|
|
|
<if test="request.confValueLike != null and request.confValueLike != ''">
|
|
|
|
AND "CONF_VALUE" LIKE '%'||#{request.confValueLike}||'%'
|
|
|
|
</if>
|
|
|
|
<if test="request.confNoteLike != null and request.confNoteLike != ''">
|
|
|
|
AND "CONF_NOTE" LIKE '%'||#{request.confNoteLike}||'%'
|
|
|
|
</if>
|
|
|
|
<if test="request.startDate != null">
|
|
|
|
AND strftime('%s',"CREATE_TIME", 'utc')*1000 >= #{request.startDate}
|
|
|
|
</if>
|
|
|
|
<if test="request.endDate != null">
|
|
|
|
AND strftime('%s',"CREATE_TIME", 'utc')*1000 <= #{request.endDate}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="search" resultMap="configData">
|
|
|
|
SELECT
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
FROM
|
|
|
|
<include refid="table"/>
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getById" resultMap="configData">
|
|
|
|
SELECT
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
FROM
|
|
|
|
<include refid="table"/>
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
AND "ID" = #{id}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getByIds" resultMap="configData">
|
|
|
|
SELECT
|
|
|
|
<include refid="entityColumnList"/>
|
|
|
|
FROM
|
|
|
|
<include refid="table"/>
|
|
|
|
WHERE "IS_DELETED" = 0
|
|
|
|
AND "ID" IN
|
|
|
|
<foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</select>
|
|
|
|
</mapper>
|