<?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.lzbi.asset.mapper.DcBaseParamModelMapper">
    <resultMap type="com.lzbi.asset.domain.DcBaseParamModel" id="rmDcBaseParamModel">
        <!-- 租户号 -->
        <result property="tenantId" column="TENANT_ID"/>
        <!-- 乐观锁 -->
        <result property="revision" column="REVISION"/>
        <!-- 创建人 -->
        <result property="createdBy" column="CREATED_BY"/>
        <!-- 创建时间 -->
        <result property="createdTime" column="CREATED_TIME"/>
        <!-- 更新人 -->
        <result property="updatedBy" column="UPDATED_BY"/>
        <!-- 更新时间 -->
        <result property="updatedTime" column="UPDATED_TIME"/>
        <!-- 删除人 -->
        <result property="deleteBy" column="DELETE_BY"/>
        <!-- 删除时间 -->
        <result property="deleteTime" column="DELETE_TIME"/>
        <!-- 主键 -->
        <result property="id" column="id"/>
        <!-- 参数模型编码 -->
        <result property="paramModelCode" column="param_model_code"/>
        <!-- 参数模型名称 -->
        <result property="paramModelName" column="param_model_name"/>
        <!-- 所属专业 -->
        <result property="paramModelField" column="param_model_field"/>
        <!-- 参数模型分组 -->
        <result property="paramModelGroup" column="param_model_group"/>
        <!-- 参数来源 -->
        <result property="paramModelSource" column="param_model_source"/>
        <!-- 状态标识 -->
        <result property="flagStatus" column="flag_status"/>
    </resultMap>
    <sql id="baseQuerySql">
        select
            TENANT_ID,
            REVISION,
            CREATED_BY,
            CREATED_TIME,
            UPDATED_BY,
            UPDATED_TIME,
            DELETE_BY,
            DELETE_TIME,
            id,
            param_model_code,
            param_model_name,
            param_model_field,
            param_model_group,
            param_model_source,
            flag_status
        from  dc_base_param_model
    </sql>
    <select id="selectByVo" resultMap="rmDcBaseParamModel" parameterType="com.lzbi.asset.domain.DcBaseParamModel">
        <include refid="baseQuerySql"/>
        <where>
            <if test="tenantId != null and tenantId != ''"> and TENANT_ID = #{tenantId}</if>
            <if test="revision != null and revision != ''"> and REVISION = #{revision}</if>
            <if test="createdBy != null and createdBy != ''"> and CREATED_BY = #{createdBy}</if>
            <if test="createdTime != null and createdTime != ''"> and CREATED_TIME = #{createdTime}</if>
            <if test="updatedBy != null and updatedBy != ''"> and UPDATED_BY = #{updatedBy}</if>
            <if test="updatedTime != null and updatedTime != ''"> and UPDATED_TIME = #{updatedTime}</if>
            <if test="deleteBy != null and deleteBy != ''"> and DELETE_BY = #{deleteBy}</if>
            <if test="deleteTime != null and deleteTime != ''"> and DELETE_TIME = #{deleteTime}</if>
            <if test="paramModelCode != null and paramModelCode != ''"> and param_model_code = #{paramModelCode}</if>
            <if test="paramModelName != null and paramModelName != ''"> and param_model_name = #{paramModelName}</if>
            <if test="paramModelField != null and paramModelField != ''"> and param_model_field = #{paramModelField}</if>
            <if test="paramModelGroup != null and paramModelGroup != ''"> and param_model_group = #{paramModelGroup}</if>
            <if test="paramModelSource != null and paramModelSource != ''"> and param_model_source = #{paramModelSource}</if>
            <if test="flagStatus != null and flagStatus != ''"> and flag_status = #{flagStatus}</if>

        </where>
    </select>
    <insert id="insertByVo" parameterType="com.lzbi.asset.domain.DcBaseParamModel">
        insert into dc_base_param_model
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="tenantId != null ">TENANT_ID,</if>
            <if test="revision != null ">REVISION,</if>
            <if test="createdBy != null and createdBy != ''">CREATED_BY,</if>
            <if test="createdTime != null ">CREATED_TIME,</if>
            <if test="updatedBy != null and updatedBy != ''">UPDATED_BY,</if>
            <if test="updatedTime != null ">UPDATED_TIME,</if>
            <if test="deleteBy != null and deleteBy != ''">DELETE_BY,</if>
            <if test="deleteTime != null ">DELETE_TIME,</if>
            <if test="paramModelCode != null and paramModelCode != ''">param_model_code,</if>
            <if test="paramModelName != null and paramModelName != ''">param_model_name,</if>
            <if test="paramModelField != null and paramModelField != ''">param_model_field,</if>
            <if test="paramModelGroup != null and paramModelGroup != ''">param_model_group,</if>
            <if test="paramModelSource != null and paramModelSource != ''">param_model_source,</if>
            <if test="flagStatus != null and flagStatus != ''">flag_status,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="tenantId != null ">#{tenantId},</if>
            <if test="revision != null ">#{revision},</if>
            <if test="createdBy != null and createdBy != ''">#{createdBy},</if>
            <if test="createdTime != null ">#{createdTime},</if>
            <if test="updatedBy != null and updatedBy != ''">#{updatedBy},</if>
            <if test="updatedTime != null ">#{updatedTime},</if>
            <if test="deleteBy != null and deleteBy != ''">#{deleteBy},</if>
            <if test="deleteTime != null ">#{deleteTime},</if>
            <if test="paramModelCode != null and paramModelCode != ''">#{paramModelCode},</if>
            <if test="paramModelName != null and paramModelName != ''">#{paramModelName},</if>
            <if test="paramModelField != null and paramModelField != ''">#{paramModelField},</if>
            <if test="paramModelGroup != null and paramModelGroup != ''">#{paramModelGroup},</if>
            <if test="paramModelSource != null and paramModelSource != ''">#{paramModelSource},</if>
            <if test="flagStatus != null and flagStatus != ''">#{flagStatus},</if>

        </trim>
    </insert>
</mapper>