|
@@ -1,85 +1,78 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.doc.biz.mapper.DocMsgMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="DocMsg" id="DocMsgResult">
|
|
|
- <result property="msgId" column="MSG_ID" />
|
|
|
- <result property="senderId" column="SENDER_ID" />
|
|
|
- <result property="receiverId" column="RECEIVER_ID" />
|
|
|
- <result property="msgContent" column="MSG_CONTENT" />
|
|
|
- <result property="msgFiles" column="MSG_FILES" />
|
|
|
- <result property="createBy" column="CREATE_BY" />
|
|
|
- <result property="createTime" column="CREATE_TIME" />
|
|
|
- <result property="updateBy" column="UPDATE_BY" />
|
|
|
- <result property="updateTime" column="UPDATE_TIME" />
|
|
|
- <result property="remark" column="REMARK" />
|
|
|
+ <result property="msgId" column="MSG_ID"/>
|
|
|
+ <result property="from" column="FROM"/>
|
|
|
+ <result property="to" column="TO"/>
|
|
|
+ <result property="content" column="CONTENT"/>
|
|
|
+ <result property="createTime" column="CREATE_TIME"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectDocMsgVo">
|
|
|
- select MSG_ID, SENDER_ID, RECEIVER_ID, MSG_CONTENT, MSG_FILES, CREATE_BY, CREATE_TIME, UPDATE_BY, UPDATE_TIME, REMARK from doc_msg
|
|
|
+ select MSG_ID, `FROM`, `TO`, CONTENT, CREATE_TIME
|
|
|
+ from doc_msg
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectDocMsgList" parameterType="DocMsg" resultMap="DocMsgResult">
|
|
|
<include refid="selectDocMsgVo"/>
|
|
|
- <where>
|
|
|
+ <where>
|
|
|
+ <if test="from != null ">and FROM = #{from}</if>
|
|
|
+ <if test="to != null ">and TO = #{to}</if>
|
|
|
+ <if test="content != null and content != ''">and CONTENT = #{content}</if>
|
|
|
+ <if test="createTime != null ">and CREATE_TIME = #{createTime}</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
-
|
|
|
+
|
|
|
<select id="selectDocMsgByMsgId" parameterType="Long" resultMap="DocMsgResult">
|
|
|
<include refid="selectDocMsgVo"/>
|
|
|
where MSG_ID = #{msgId}
|
|
|
</select>
|
|
|
-
|
|
|
+ <select id="selectRecordList" resultType="com.doc.biz.domain.DocMsg">
|
|
|
+ <include refid="selectDocMsgVo"/>
|
|
|
+ where (`FROM` = #{from} and `TO` = #{to})
|
|
|
+ or (`FROM` = #{to} and `TO` = #{from})
|
|
|
+ order by CREATE_TIME desc
|
|
|
+ </select>
|
|
|
+
|
|
|
<insert id="insertDocMsg" parameterType="DocMsg" useGeneratedKeys="true" keyProperty="msgId">
|
|
|
insert into doc_msg
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
- <if test="senderId != null">SENDER_ID,</if>
|
|
|
- <if test="receiverId != null">RECEIVER_ID,</if>
|
|
|
- <if test="msgContent != null">MSG_CONTENT,</if>
|
|
|
- <if test="msgFiles != null">MSG_FILES,</if>
|
|
|
- <if test="createBy != null">CREATE_BY,</if>
|
|
|
+ <if test="from != null">`FROM`,</if>
|
|
|
+ <if test="to != null">`TO`,</if>
|
|
|
+ <if test="content != null">CONTENT,</if>
|
|
|
<if test="createTime != null">CREATE_TIME,</if>
|
|
|
- <if test="updateBy != null">UPDATE_BY,</if>
|
|
|
- <if test="updateTime != null">UPDATE_TIME,</if>
|
|
|
- <if test="remark != null">REMARK,</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
- <if test="senderId != null">#{senderId},</if>
|
|
|
- <if test="receiverId != null">#{receiverId},</if>
|
|
|
- <if test="msgContent != null">#{msgContent},</if>
|
|
|
- <if test="msgFiles != null">#{msgFiles},</if>
|
|
|
- <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="from != null">#{from},</if>
|
|
|
+ <if test="to != null">#{to},</if>
|
|
|
+ <if test="content != null">#{content},</if>
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
- <if test="updateBy != null">#{updateBy},</if>
|
|
|
- <if test="updateTime != null">#{updateTime},</if>
|
|
|
- <if test="remark != null">#{remark},</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateDocMsg" parameterType="DocMsg">
|
|
|
update doc_msg
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
- <if test="senderId != null">SENDER_ID = #{senderId},</if>
|
|
|
- <if test="receiverId != null">RECEIVER_ID = #{receiverId},</if>
|
|
|
- <if test="msgContent != null">MSG_CONTENT = #{msgContent},</if>
|
|
|
- <if test="msgFiles != null">MSG_FILES = #{msgFiles},</if>
|
|
|
- <if test="createBy != null">CREATE_BY = #{createBy},</if>
|
|
|
+ <if test="from != null">`FROM` = #{from},</if>
|
|
|
+ <if test="to != null">`TO` = #{to},</if>
|
|
|
+ <if test="content != null">CONTENT = #{content},</if>
|
|
|
<if test="createTime != null">CREATE_TIME = #{createTime},</if>
|
|
|
- <if test="updateBy != null">UPDATE_BY = #{updateBy},</if>
|
|
|
- <if test="updateTime != null">UPDATE_TIME = #{updateTime},</if>
|
|
|
- <if test="remark != null">REMARK = #{remark},</if>
|
|
|
</trim>
|
|
|
where MSG_ID = #{msgId}
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteDocMsgByMsgId" parameterType="Long">
|
|
|
- delete from doc_msg where MSG_ID = #{msgId}
|
|
|
+ delete
|
|
|
+ from doc_msg
|
|
|
+ where MSG_ID = #{msgId}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteDocMsgByMsgIds" parameterType="String">
|
|
|
- delete from doc_msg where MSG_ID in
|
|
|
+ delete from doc_msg where MSG_ID in
|
|
|
<foreach item="msgId" collection="array" open="(" separator="," close=")">
|
|
|
#{msgId}
|
|
|
</foreach>
|