2024-12-20 13:43:01 +08:00
|
|
|
<?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.bonus.material.basic.mapper.BmMessageMapper">
|
|
|
|
|
<resultMap type="com.bonus.material.basic.domain.BmMessage" id="BmMessageResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="uuid" column="uuid" />
|
|
|
|
|
<result property="fromUser" column="from_user" />
|
|
|
|
|
<result property="toUser" column="to_user" />
|
|
|
|
|
<result property="fromCompany" column="from_company" />
|
2024-12-23 18:40:08 +08:00
|
|
|
<result property="fromCompanyName" column="from_company_name" />
|
2024-12-20 13:43:01 +08:00
|
|
|
<result property="toCompany" column="to_company" />
|
2024-12-23 18:40:08 +08:00
|
|
|
<result property="toCompanyName" column="to_company_name" />
|
2024-12-20 13:43:01 +08:00
|
|
|
<result property="messageType" column="message_type" />
|
2024-12-20 13:56:34 +08:00
|
|
|
<result property="messageTopic" column="message_topic" />
|
|
|
|
|
<result property="messageContent" column="message_content" />
|
2024-12-20 13:43:01 +08:00
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectBmMessageVo">
|
2024-12-23 18:40:08 +08:00
|
|
|
select bm.id, bm.uuid, bm.from_user, bm.to_user, bm.from_company, bm.to_company, bm.message_content, bm.message_topic,
|
|
|
|
|
bm.message_type, bm.create_time, bm.update_time, sd1.dept_name as from_company_name, sd2.dept_name as to_company_name
|
|
|
|
|
from bm_message bm
|
|
|
|
|
left join sys_dept sd1 on sd1.dept_id = bm.from_company
|
|
|
|
|
left join sys_dept sd2 on sd2.dept_id = bm.to_company
|
2024-12-20 13:43:01 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectBmMessageList" parameterType="com.bonus.material.basic.domain.BmMessage" resultMap="BmMessageResult">
|
|
|
|
|
<include refid="selectBmMessageVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="uuid != null and uuid != ''"> and uuid = #{uuid}</if>
|
2024-12-20 15:21:10 +08:00
|
|
|
<if test="fromUser != null and toUser != null"> and (from_user = #{fromUser} or to_user = #{toUser})</if>
|
|
|
|
|
<if test="fromCompany != null and toCompany != null"> and (from_company = #{fromCompany} or to_company = #{toCompany})</if>
|
2024-12-20 13:43:01 +08:00
|
|
|
<if test="messageContent != null and messageContent != ''"> and message_content = #{messageContent}</if>
|
2024-12-20 13:56:34 +08:00
|
|
|
<if test="messageTopic != null and messageTopic != ''"> and message_topic = #{messageTopic}</if>
|
2024-12-20 13:43:01 +08:00
|
|
|
<if test="messageType != null and messageType != ''"> and message_type = #{messageType}</if>
|
|
|
|
|
</where>
|
2024-12-23 11:07:09 +08:00
|
|
|
order by create_time
|
2024-12-20 13:43:01 +08:00
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectBmMessageById" parameterType="Long" resultMap="BmMessageResult">
|
|
|
|
|
<include refid="selectBmMessageVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBmMessage" parameterType="com.bonus.material.basic.domain.BmMessage" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into bm_message
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="uuid != null">uuid,</if>
|
|
|
|
|
<if test="fromUser != null">from_user,</if>
|
|
|
|
|
<if test="toUser != null">to_user,</if>
|
|
|
|
|
<if test="fromCompany != null">from_company,</if>
|
|
|
|
|
<if test="toCompany != null">to_company,</if>
|
2024-12-23 13:33:27 +08:00
|
|
|
<if test="messageContent != null and messageContent != ''">message_content,</if>
|
2024-12-20 13:56:34 +08:00
|
|
|
<if test="messageTopic != null">message_topic,</if>
|
2024-12-20 13:43:01 +08:00
|
|
|
<if test="messageType != null">message_type,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="uuid != null">#{uuid},</if>
|
|
|
|
|
<if test="fromUser != null">#{fromUser},</if>
|
|
|
|
|
<if test="toUser != null">#{toUser},</if>
|
|
|
|
|
<if test="fromCompany != null">#{fromCompany},</if>
|
|
|
|
|
<if test="toCompany != null">#{toCompany},</if>
|
2024-12-23 13:33:27 +08:00
|
|
|
<if test="messageContent != null and messageContent != ''">#{messageContent},</if>
|
2024-12-20 13:56:34 +08:00
|
|
|
<if test="messageTopic != null">#{messageTopic},</if>
|
2024-12-20 13:43:01 +08:00
|
|
|
<if test="messageType != null">#{messageType},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateBmMessage" parameterType="com.bonus.material.basic.domain.BmMessage">
|
|
|
|
|
update bm_message
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="uuid != null">uuid = #{uuid},</if>
|
|
|
|
|
<if test="fromUser != null">from_user = #{fromUser},</if>
|
|
|
|
|
<if test="toUser != null">to_user = #{toUser},</if>
|
|
|
|
|
<if test="fromCompany != null">from_company = #{fromCompany},</if>
|
|
|
|
|
<if test="toCompany != null">to_company = #{toCompany},</if>
|
|
|
|
|
<if test="messageContent != null">message_content = #{messageContent},</if>
|
2024-12-20 13:56:34 +08:00
|
|
|
<if test="messageTopic != null">message_topic = #{messageTopic},</if>
|
2024-12-23 18:39:40 +08:00
|
|
|
<if test="isRead != null">is_read = #{isRead},</if>
|
2024-12-20 13:43:01 +08:00
|
|
|
<if test="messageType != null">message_type = #{messageType},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBmMessageById" parameterType="Long">
|
|
|
|
|
delete from bm_message where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBmMessageByIds" parameterType="String">
|
|
|
|
|
delete from bm_message where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
</mapper>
|