DictCodeMapper.xml 9.7 KB
<?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.viontech.fanxing.code.mapper.DictCodeMapper" >
  <resultMap id="BaseResultMapRoot" type="com.viontech.fanxing.commons.model.DictCode" >
    <id column="dictCode_id" property="id" />
    <result column="dictCode_unid" property="unid" />
    <result column="dictCode_cate_id" property="cateId" />
    <result column="dictCode_parent_id" property="parentId" />
    <result column="dictCode_code" property="code" />
    <result column="dictCode_name" property="name" />
    <result column="dictCode_note" property="note" />
  </resultMap>
  <resultMap id="BaseResultMap" type="com.viontech.fanxing.commons.model.DictCode" extends="BaseResultMapRoot" />
  <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_Root" >
    `dictCode`.id as dictCode_id, `dictCode`.unid as dictCode_unid, `dictCode`.cate_id as dictCode_cate_id, 
    `dictCode`.parent_id as dictCode_parent_id, `dictCode`.code as dictCode_code, `dictCode`.`name` as `dictCode_name`, 
    `dictCode`.note as dictCode_note
  </sql>
  <sql id="Base_Column_List" >
    <if test="!(_parameter.getClass().getSimpleName() == 'DictCodeExample')" >
      <include refid="com.viontech.fanxing.code.mapper.DictCodeMapper.Base_Column_List_Root" />
    </if>
    <if test="_parameter.getClass().getSimpleName() == 'DictCodeExample'" >
      <foreach collection="columnContainerSet" item="columns" separator="," >
        <choose >
          <when test="columns.tableName == 's_dict_code'.toString()" >
            <if test="columns.valid" >
              ${columns.columnContainerStr}
            </if>
            <if test="!columns.valid" >
              <include refid="com.viontech.fanxing.code.mapper.DictCodeMapper.Base_Column_List_Root" />
            </if>
          </when>
        </choose>
      </foreach>
    </if>
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.viontech.fanxing.commons.model.DictCodeExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from `s_dict_code` `dictCode`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="groupByClause != null" >
      group by ${groupByClause}
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from `s_dict_code` `dictCode`
    where `dictCode`.id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete  from `s_dict_code` `dictCode`
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.viontech.fanxing.commons.model.DictCodeExample" >
    delete  from `s_dict_code` `dictCode`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.viontech.fanxing.commons.model.DictCode" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `s_dict_code` (unid, cate_id, parent_id, 
      code, `name`, note)
    values (#{unid,jdbcType=VARCHAR}, #{cateId,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, 
      #{code,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{note,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.viontech.fanxing.commons.model.DictCode" useGeneratedKeys="true" keyProperty="id" keyColumn="id" >
    insert into `s_dict_code`
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="unid != null" >
        unid,
      </if>
      <if test="cateId != null" >
        cate_id,
      </if>
      <if test="parentId != null" >
        parent_id,
      </if>
      <if test="code != null" >
        code,
      </if>
      <if test="name != null" >
        `name`,
      </if>
      <if test="note != null" >
        note,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="unid != null" >
        #{unid,jdbcType=VARCHAR},
      </if>
      <if test="cateId != null" >
        #{cateId,jdbcType=BIGINT},
      </if>
      <if test="parentId != null" >
        #{parentId,jdbcType=BIGINT},
      </if>
      <if test="code != null" >
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="note != null" >
        #{note,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.viontech.fanxing.commons.model.DictCodeExample" resultType="java.lang.Integer" >
    select count(*) from `s_dict_code` `dictCode`
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update `s_dict_code` `dictCode`
    <set >
      <if test="record.id != null" >
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.unid != null" >
        unid = #{record.unid,jdbcType=VARCHAR},
      </if>
      <if test="record.cateId != null" >
        cate_id = #{record.cateId,jdbcType=BIGINT},
      </if>
      <if test="record.parentId != null" >
        parent_id = #{record.parentId,jdbcType=BIGINT},
      </if>
      <if test="record.code != null" >
        code = #{record.code,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null" >
        `name` = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.note != null" >
        note = #{record.note,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update `s_dict_code` `dictCode`
    set id = #{record.id,jdbcType=BIGINT},
      unid = #{record.unid,jdbcType=VARCHAR},
      cate_id = #{record.cateId,jdbcType=BIGINT},
      parent_id = #{record.parentId,jdbcType=BIGINT},
      code = #{record.code,jdbcType=VARCHAR},
      `name` = #{record.name,jdbcType=VARCHAR},
      note = #{record.note,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.viontech.fanxing.commons.model.DictCode" >
    update `s_dict_code`
    <set >
      <if test="unid != null" >
        unid = #{unid,jdbcType=VARCHAR},
      </if>
      <if test="cateId != null" >
        cate_id = #{cateId,jdbcType=BIGINT},
      </if>
      <if test="parentId != null" >
        parent_id = #{parentId,jdbcType=BIGINT},
      </if>
      <if test="code != null" >
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="name != null" >
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="note != null" >
        note = #{note,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.viontech.fanxing.commons.model.DictCode" >
    update `s_dict_code`
    set unid = #{unid,jdbcType=VARCHAR},
      cate_id = #{cateId,jdbcType=BIGINT},
      parent_id = #{parentId,jdbcType=BIGINT},
      code = #{code,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      note = #{note,jdbcType=VARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>