<?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.liquidnet.service.account.wallet.mapper.FinDictValueMapper" >
  <resultMap id="BaseResultMap" type="com.liquidnet.service.account.wallet.entity.FinDictValue" >
    <id column="FDV0" property="valueId" jdbcType="VARCHAR" />
    <result column="FDV1" property="dictId" jdbcType="VARCHAR" />
    <result column="FDV2" property="valueCode" jdbcType="VARCHAR" />
    <result column="FDV3" property="valueName" jdbcType="VARCHAR" />
    <result column="FDV4" property="status" jdbcType="DECIMAL" />
    <result column="FDV5" property="remark" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    FDV0, FDV1, FDV2, FDV3, FDV4, FDV5
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValueExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from FIN_N02
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select 
    <include refid="Base_Column_List" />
    from FIN_N02
    where FDV0 = #{valueId,jdbcType=VARCHAR}
  </select>
  <insert id="insert" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValue" >
    insert into FIN_N02 (FDV0, FDV1, FDV2,
      FDV3, FDV4, FDV5
      )
    values (#{valueId,jdbcType=VARCHAR}, #{dictId,jdbcType=VARCHAR}, #{valueCode,jdbcType=VARCHAR}, 
      #{valueName,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, #{remark,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValue" >
    insert into FIN_N02
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="valueId != null" >
        FDV0,
      </if>
      <if test="dictId != null" >
        FDV1,
      </if>
      <if test="valueCode != null" >
        FDV2,
      </if>
      <if test="valueName != null" >
        FDV3,
      </if>
      <if test="status != null" >
        FDV4,
      </if>
      <if test="remark != null" >
        FDV5,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="valueId != null" >
        #{valueId,jdbcType=VARCHAR},
      </if>
      <if test="dictId != null" >
        #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="valueCode != null" >
        #{valueCode,jdbcType=VARCHAR},
      </if>
      <if test="valueName != null" >
        #{valueName,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        #{status,jdbcType=DECIMAL},
      </if>
      <if test="remark != null" >
        #{remark,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValueExample" resultType="java.lang.Integer" >
    select count(*) from FIN_N02
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update FIN_N02
    <set >
      <if test="record.valueId != null" >
        FDV0 = #{record.valueId,jdbcType=VARCHAR},
      </if>
      <if test="record.dictId != null" >
        FDV1 = #{record.dictId,jdbcType=VARCHAR},
      </if>
      <if test="record.valueCode != null" >
        FDV2 = #{record.valueCode,jdbcType=VARCHAR},
      </if>
      <if test="record.valueName != null" >
        FDV3 = #{record.valueName,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null" >
        FDV4 = #{record.status,jdbcType=DECIMAL},
      </if>
      <if test="record.remark != null" >
        FDV5 = #{record.remark,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update FIN_N02
    set FDV0 = #{record.valueId,jdbcType=VARCHAR},
      FDV1 = #{record.dictId,jdbcType=VARCHAR},
      FDV2 = #{record.valueCode,jdbcType=VARCHAR},
      FDV3 = #{record.valueName,jdbcType=VARCHAR},
      FDV4 = #{record.status,jdbcType=DECIMAL},
      FDV5 = #{record.remark,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValue" >
    update FIN_N02
    <set >
      <if test="dictId != null" >
        FDV1 = #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="valueCode != null" >
        FDV2 = #{valueCode,jdbcType=VARCHAR},
      </if>
      <if test="valueName != null" >
        FDV3 = #{valueName,jdbcType=VARCHAR},
      </if>
      <if test="status != null" >
        FDV4 = #{status,jdbcType=DECIMAL},
      </if>
      <if test="remark != null" >
        FDV5 = #{remark,jdbcType=VARCHAR},
      </if>
    </set>
    where FDV0 = #{valueId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.liquidnet.service.account.wallet.entity.FinDictValue" >
    update FIN_N02
    set FDV1 = #{dictId,jdbcType=VARCHAR},
      FDV2 = #{valueCode,jdbcType=VARCHAR},
      FDV3 = #{valueName,jdbcType=VARCHAR},
      FDV4 = #{status,jdbcType=DECIMAL},
      FDV5 = #{remark,jdbcType=VARCHAR}
    where FDV0 = #{valueId,jdbcType=VARCHAR}
  </update>
  <select id="selectJoinDict" resultMap="BaseResultMap" parameterType="java.lang.String">
    SELECT
    FDV.FDV0, FD.FD1 FDV1, FDV.FDV2, FDV.FDV3, FDV.FDV5
    FROM FIN_N02 FDV
    LEFT JOIN FIN_N01 FD ON FDV.FDV1 = FD.FD0
    WHERE FD.FD3 = 1 AND FDV.FDV4 = 1
    <if test="dictCode != null and dictCode != ''" >
      AND FD.FD1 = #{dictCode,jdbcType=VARCHAR}
    </if>
  </select>
</mapper>