<?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.cesgroup.mapper.ArticleMapper">
    <resultMap id="BaseResultMap" type="com.cesgroup.entity.Article">
        <id column="id" property="id" />
        <result column="title" property="title" />
        <result column="content" property="content" />
        <result column="content" property="contentJson" javaType="com.cesgroup.entity.ContentJson" jdbcType="LONGVARCHAR" typeHandler="com.cesgroup.config.JSONHandler"/>
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
    <sql id="BaseSql">
        id,title,content,create_time,update_time
    </sql>

    <select id="queryAll" resultMap="BaseResultMap">
        SELECT <include refid="BaseSql"/> FROM b_article
    </select>

    <insert id="batchAdd" parameterType="java.util.List">
        INSERT INTO b_article
        (id, title, content,create_time,update_time)
        VALUES
        <foreach collection ="list" item="item" separator =",">
            (#{item.id}, #{item.title}, #{item.content},now(),now())
        </foreach>
    </insert>

</mapper>
