<?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.diagbot.mapper.StrTalkInformMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.StrTalkInform">
        <id column="rec_id" property="recId" />
        <result column="behospital_code" property="behospitalCode" />
        <result column="hospital_id" property="hospitalId" />
        <result column="rec_title" property="recTitle" />
        <result column="content" property="content" />
        <result column="rec_type" property="recType" />
        <result column="is_deleted" property="isDeleted" />
        <result column="gmt_create" property="gmtCreate" />
        <result column="gmt_modified" property="gmtModified" />
        <result column="creator" property="creator" />
        <result column="modifier" property="modifier" />
    </resultMap>

    <update id="updateBatchByKey">
        <foreach collection="list" item="item"  separator=";">
            update str_talk_inform
            <set>
                rec_title= #{item.recTitle},
                content= #{item.content},
                rec_type= #{item.recType},
                <if test="item.gmtModified != null">
                    gmt_modified = #{item.gmtModified},
                </if>
                <if test="item.modifier != null">
                    modifier = #{item.modifier},
                </if>
            </set>
            where rec_id = #{item.recId} and hospital_id = #{item.hospitalId} and behospital_code = #{item.behospitalCode}
        </foreach>
    </update>

    <select id="getColumnZhAndCh" resultType="com.diagbot.dto.data.ColumnZhAndChDTO">
        select COLUMN_NAME as en,column_comment as ch from INFORMATION_SCHEMA.Columns where table_name='str_talk_inform'
    </select>

</mapper>
