<?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.simuwang.base.mapper.EmailTypeRuleMapper">
    <resultMap id="BaseResultMap" type="com.simuwang.base.pojo.dos.EmailTypeRuleDO">
        <id column="id" property="id"/>
        <result column="nav" property="nav"/>
        <result column="valuation" property="valuation"/>
        <result column="report" property="report"/>
        <result column="isvalid" property="isvalid"/>
        <result column="creatorid" property="creatorId"/>
        <result column="createtime" property="createTime"/>
        <result column="updaterid" property="updaterId"/>
        <result column="updatetime" property="updateTime"/>
    </resultMap>

    <select id="getEmailTypeRule" resultMap="BaseResultMap">
        select *
        from PPW_EMAIL.email_type_rule
        where isvalid = 1 limit 1
    </select>
    <select id="searchEmailType" resultMap="BaseResultMap">
        select id,nav,valuation,report,isvalid,creatorid,createtime,updaterid,updatetime from PPW_EMAIL.email_type_rule where isvalid =1
    </select>
    <insert id="saveEmailType">
        insert into PPW_EMAIL.email_type_rule(nav,valuation,report,isvalid,creatorid,createtime,updaterid,updatetime)
        values (#{nav},#{valuation},#{report},1,#{creatorId},#{createTime},#{updaterId},#{updateTime})
    </insert>
    <update id="updateEmailType">
        update PPW_EMAIL.email_type_rule set nav=#{nav},valuation=#{valuation},report=#{report},updatetime=sysdate(),updaterid=#{updaterId} where id=#{id} and isvalid =1
    </update>
</mapper>