liurunyu
2025-04-23 e5c29d6ac2b210a9385723598d79a42ae5a9679e
pipIrr-platform/pipIrr-global/src/main/resources/mapper/BaDictItemMapper.xml
New file
@@ -0,0 +1,202 @@
<?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.dy.pipIrrGlobal.daoBa.BaDictItemMapper">
  <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    <!--@Table ba_dict_item-->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="dict_code" jdbcType="VARCHAR" property="dictCode" />
    <result column="value" jdbcType="VARCHAR" property="value" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="attributes" jdbcType="LONGVARCHAR" property="attributes" />
    <result column="sort" jdbcType="INTEGER" property="sort" />
    <result column="remarks" jdbcType="VARCHAR" property="remarks" />
    <result column="deleted" jdbcType="BIGINT" property="deleted" />
    <result column="create_by" jdbcType="INTEGER" property="createBy" />
    <result column="update_by" jdbcType="INTEGER" property="updateBy" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, dict_code, `value`, `name`, `status`, `attributes`, sort, remarks, deleted, create_by,
    update_by, create_time, update_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    <!--@mbg.generated-->
    select
    <include refid="Base_Column_List" />
    from ba_dict_item
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    <!--@mbg.generated-->
    delete from ba_dict_item
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict_item (dict_code, `value`, `name`,
      `status`, `attributes`, sort,
      remarks, deleted, create_by,
      update_by, create_time, update_time
      )
    values (#{dictCode,jdbcType=VARCHAR}, #{value,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
      #{status,jdbcType=TINYINT}, #{attributes,jdbcType=LONGVARCHAR}, #{sort,jdbcType=INTEGER},
      #{remarks,jdbcType=VARCHAR}, #{deleted,jdbcType=BIGINT}, #{createBy,jdbcType=INTEGER},
      #{updateBy,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem" useGeneratedKeys="true">
    <!--@mbg.generated-->
    insert into ba_dict_item
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dictCode != null">
        dict_code,
      </if>
      <if test="value != null">
        `value`,
      </if>
      <if test="name != null">
        `name`,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="attributes != null">
        `attributes`,
      </if>
      <if test="sort != null">
        sort,
      </if>
      <if test="remarks != null">
        remarks,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="createBy != null">
        create_by,
      </if>
      <if test="updateBy != null">
        update_by,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dictCode != null">
        #{dictCode,jdbcType=VARCHAR},
      </if>
      <if test="value != null">
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="attributes != null">
        #{attributes,jdbcType=LONGVARCHAR},
      </if>
      <if test="sort != null">
        #{sort,jdbcType=INTEGER},
      </if>
      <if test="remarks != null">
        #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    update ba_dict_item
    <set>
      <if test="dictCode != null">
        dict_code = #{dictCode,jdbcType=VARCHAR},
      </if>
      <if test="value != null">
        `value` = #{value,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        `name` = #{name,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=TINYINT},
      </if>
      <if test="attributes != null">
        `attributes` = #{attributes,jdbcType=LONGVARCHAR},
      </if>
      <if test="sort != null">
        sort = #{sort,jdbcType=INTEGER},
      </if>
      <if test="remarks != null">
        remarks = #{remarks,jdbcType=VARCHAR},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIGINT},
      </if>
      <if test="createBy != null">
        create_by = #{createBy,jdbcType=INTEGER},
      </if>
      <if test="updateBy != null">
        update_by = #{updateBy,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoBa.BaDictItem">
    <!--@mbg.generated-->
    update ba_dict_item
    set dict_code = #{dictCode,jdbcType=VARCHAR},
      `value` = #{value,jdbcType=VARCHAR},
      `name` = #{name,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=TINYINT},
      `attributes` = #{attributes,jdbcType=LONGVARCHAR},
      sort = #{sort,jdbcType=INTEGER},
      remarks = #{remarks,jdbcType=VARCHAR},
      deleted = #{deleted,jdbcType=BIGINT},
      create_by = #{createBy,jdbcType=INTEGER},
      update_by = #{updateBy,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <!--根据字典Code获取字典项-->
  <select id="getDictItemsByDictCode" resultType="com.dy.pipIrrGlobal.voBa.VoDictItem">
    SELECT
        id AS dictItemId,
        name,
        value
    FROM ba_dict_item
    WHERE deleted = 0 AND status = 1 AND dict_code = #{dictCode}
    ORDER BY sort
  </select>
</mapper>