292 lines
12 KiB
XML
Raw Normal View History

<?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">
<!--suppress ALL -->
<mapper namespace="com.xhpc.card.mapper.XhpcMessageBoardMapper">
<resultMap id="BaseResultMap" type="com.xhpc.card.pojo.XhpcMessageBoard">
<id column="message_id" jdbcType="BIGINT" property="messageId"/>
<result column="sender_type" jdbcType="TINYINT" property="senderType"/>
<result column="sender_account" jdbcType="VARCHAR" property="senderAccount"/>
<result column="send_message_time" jdbcType="TIMESTAMP" property="sendMessageTime"/>
<result column="message_content" jdbcType="VARCHAR" property="messageContent"/>
<result column="tenant_type" jdbcType="TINYINT" property="tenantType"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="have_new_info" jdbcType="TINYINT" property="haveNewInfo"/>
<result column="del_flag" jdbcType="TINYINT" property="delFlag"/>
<result column="sender" jdbcType="TINYINT" property="sender"/>
</resultMap>
<sql id="Base_Column_List">
message_id
, sender_type, sender_account, send_message_time, message_content, tenant_type,
tenant_id, have_new_info, del_flag, sender
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from xhpc_message_board
where message_id = #{messageId,jdbcType=BIGINT}
</select>
<select id="selectBy" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board
WHERE
del_flag is NULL
AND sender_type = #{userQueryCondition.senderType}
AND sender_account = #{userQueryCondition.senderAccount}
AND send_message_time &lt;= #{userQueryCondition.sendMessageTime}
<if test="nextTimeStr!=null">
AND send_message_time &gt; #{nextTimeStr}
</if>
AND tenant_type = #{userQueryCondition.tenantType}
AND tenant_id = #{userQueryCondition.tenantId}
</select>
<select id="selectTimeRecords" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board
WHERE
sender_type = #{senderType}
AND sender_account = #{senderAccount}
AND del_flag IS NULL
AND message_content IS NULL
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete
from xhpc_message_board
where message_id = #{messageId,jdbcType=BIGINT}
</delete>
<insert id="insert" keyColumn="message_id" keyProperty="messageId"
parameterType="com.xhpc.card.pojo.XhpcMessageBoard" useGeneratedKeys="true">
insert into xhpc_message_board (sender_type, sender_account, send_message_time,
message_content, tenant_type, tenant_id,
have_new_info, del_flag, sender)
values (#{senderType,jdbcType=TINYINT}, #{senderAccount,jdbcType=VARCHAR},
#{sendMessageTime,jdbcType=TIMESTAMP},
#{messageContent,jdbcType=VARCHAR}, #{tenantType,jdbcType=TINYINT}, #{tenantId,jdbcType=VARCHAR},
#{haveNewInfo,jdbcType=BOOLEAN}, #{delFlag,jdbcType=BOOLEAN}, #{sender,jdbcType=BOOLEAN})
</insert>
<insert id="insertSelective" keyColumn="message_id" keyProperty="messageId"
parameterType="com.xhpc.card.pojo.XhpcMessageBoard" useGeneratedKeys="true">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
<if test="haveNewInfo != null">
have_new_info,
</if>
<if test="delFlag != null">
del_flag,
</if>
<if test="sender != null">
sender,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
#{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
<if test="sender != null">
#{sender,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<insert id="insertUserTimeMessageRecord">
insert into xhpc_message_board
(sender_type, sender_account, send_message_time, tenant_type, tenant_id, have_new_info, sender)
values (#{senderType}, #{senderAccount}, #{sendMessageTime}, #{tenantType}, #{tenantId}, 0, 1)
</insert>
<insert id="insertUserMessage">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
have_new_info,
sender,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
0,
0,
</trim>
</insert>
<insert id="insertPlatformMessage">
insert into xhpc_message_board
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="senderType != null">
sender_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="sendMessageTime != null">
send_message_time,
</if>
<if test="messageContent != null">
message_content,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="tenantId != null">
tenant_id,
</if>
have_new_info,
sender,
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="senderType != null">
#{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
#{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
#{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
0,
2,
</trim>
</insert>
<insert id="insertPlatformTimeMessageRecord">
insert into xhpc_message_board
(sender_type, sender_account, send_message_time, tenant_type, tenant_id, have_new_info, sender)
values (#{senderType}, #{senderAccount}, #{sendMessageTime}, #{tenantType}, #{tenantId}, 0, 1)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.xhpc.card.pojo.XhpcMessageBoard">
update xhpc_message_board
<set>
<if test="senderType != null">
sender_type = #{senderType,jdbcType=TINYINT},
</if>
<if test="senderAccount != null">
sender_account = #{senderAccount,jdbcType=VARCHAR},
</if>
<if test="sendMessageTime != null">
send_message_time = #{sendMessageTime,jdbcType=TIMESTAMP},
</if>
<if test="messageContent != null">
message_content = #{messageContent,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
tenant_type = #{tenantType,jdbcType=TINYINT},
</if>
<if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
have_new_info = #{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
del_flag = #{delFlag,jdbcType=BOOLEAN},
</if>
<if test="sender != null">
sender = #{sender,jdbcType=BOOLEAN},
</if>
</set>
where message_id = #{messageId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.xhpc.card.pojo.XhpcMessageBoard">
update xhpc_message_board
set sender_type = #{senderType,jdbcType=TINYINT},
sender_account = #{senderAccount,jdbcType=VARCHAR},
send_message_time = #{sendMessageTime,jdbcType=TIMESTAMP},
message_content = #{messageContent,jdbcType=VARCHAR},
tenant_type = #{tenantType,jdbcType=TINYINT},
tenant_id = #{tenantId,jdbcType=VARCHAR},
have_new_info = #{haveNewInfo,jdbcType=BOOLEAN},
del_flag = #{delFlag,jdbcType=BOOLEAN},
sender = #{sender,jdbcType=BOOLEAN}
where message_id = #{messageId,jdbcType=BIGINT}
</update>
<update id="setUserReadedStatus">
UPDATE `xhpc_message_board`
SET have_new_info = 1
WHERE
message_id IN
<foreach collection="list" separator="," item="messageId" open="(" close=")">
#{messageId}
</foreach>
AND del_flag IS NULL
</update>
</mapper>