<?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="cn.com.countrygarden.bi.main.dao.wcx.WcxContentMapper">
    <resultMap id="BaseContentDtoMap" type="cn.com.countrygarden.bi.main.dto.wcx.WcxContentDto">
        <id column="content_id" property="contentId"/>
        <result column="content" property="content"/>
    </resultMap>
    <resultMap id="BaseContentMap" type="cn.com.countrygarden.bi.main.model.wcx.WcxContent">
        <id column="content_id" property="contentId"/>
        <result column="content" property="content"/>
    </resultMap>


    <insert id="insert">
        INSERT INTO wcx_content
        (
        content_id,
        content
        )
        VALUES
        (
        #{contentId},
        #{content}
        )
    </insert>

    <select id="findById" resultMap="BaseContentMap">
        select * from wcx_content c where c.content_id = #{contentId};
    </select>

    <delete id="deleteByInnovationId">
        DELETE from wcx_content WHERE content_id = (SELECT t.innovation_content_id FROM wcx_innovation t WHERE t.innovation_id = #{innovationId})
    </delete>
</mapper>