<?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.ruoyi.system.mapper.zb.ZbReportRelationshipMapper">
  <resultMap id="BaseResultMap" type="com.ruoyi.system.domain.zb.ZbReportRelationship">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="dep_id" jdbcType="VARCHAR" property="depId" />
    <result column="dep_name" jdbcType="VARCHAR" property="depName" />
    <result column="report_id" jdbcType="VARCHAR" property="reportId" />
    <result column="bs_common_id" jdbcType="VARCHAR" property="bsCommonId" />
    <result column="bs_common_parent_id" jdbcType="VARCHAR" property="bsCommonParentId" />
    <result column="leader_flag" jdbcType="TINYINT" property="leaderFlag" />
    <result column="fill_flag" jdbcType="TINYINT" property="fillFlag" />
    <result column="todo_id" jdbcType="VARCHAR" property="todoId" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" 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="(" prefixOverrides="and" suffix=")">
            <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 close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, user_id, user_name, dep_id, dep_name, report_id, bs_common_id, bs_common_parent_id, 
    leader_flag, fill_flag, todo_id
  </sql>
  <select id="selectByExample" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationshipExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from zb_report_relationship
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from zb_report_relationship
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from zb_report_relationship
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationshipExample">
    delete from zb_report_relationship
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationship">
    insert into zb_report_relationship (id, user_id, user_name, 
      dep_id, dep_name, report_id, 
      bs_common_id, bs_common_parent_id, leader_flag, 
      fill_flag, todo_id)
    values (#{id,jdbcType=VARCHAR}, #{userId,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, 
      #{depId,jdbcType=VARCHAR}, #{depName,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, 
      #{bsCommonId,jdbcType=VARCHAR}, #{bsCommonParentId,jdbcType=VARCHAR}, #{leaderFlag,jdbcType=TINYINT}, 
      #{fillFlag,jdbcType=TINYINT}, #{todoId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationship">
    insert into zb_report_relationship
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="depId != null">
        dep_id,
      </if>
      <if test="depName != null">
        dep_name,
      </if>
      <if test="reportId != null">
        report_id,
      </if>
      <if test="bsCommonId != null">
        bs_common_id,
      </if>
      <if test="bsCommonParentId != null">
        bs_common_parent_id,
      </if>
      <if test="leaderFlag != null">
        leader_flag,
      </if>
      <if test="fillFlag != null">
        fill_flag,
      </if>
      <if test="todoId != null">
        todo_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="depId != null">
        #{depId,jdbcType=VARCHAR},
      </if>
      <if test="depName != null">
        #{depName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="bsCommonId != null">
        #{bsCommonId,jdbcType=VARCHAR},
      </if>
      <if test="bsCommonParentId != null">
        #{bsCommonParentId,jdbcType=VARCHAR},
      </if>
      <if test="leaderFlag != null">
        #{leaderFlag,jdbcType=TINYINT},
      </if>
      <if test="fillFlag != null">
        #{fillFlag,jdbcType=TINYINT},
      </if>
      <if test="todoId != null">
        #{todoId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationshipExample" resultType="java.lang.Long">
    select count(*) from zb_report_relationship
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update zb_report_relationship
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=VARCHAR},
      </if>
      <if test="record.userName != null">
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.depId != null">
        dep_id = #{record.depId,jdbcType=VARCHAR},
      </if>
      <if test="record.depName != null">
        dep_name = #{record.depName,jdbcType=VARCHAR},
      </if>
      <if test="record.reportId != null">
        report_id = #{record.reportId,jdbcType=VARCHAR},
      </if>
      <if test="record.bsCommonId != null">
        bs_common_id = #{record.bsCommonId,jdbcType=VARCHAR},
      </if>
      <if test="record.bsCommonParentId != null">
        bs_common_parent_id = #{record.bsCommonParentId,jdbcType=VARCHAR},
      </if>
      <if test="record.leaderFlag != null">
        leader_flag = #{record.leaderFlag,jdbcType=TINYINT},
      </if>
      <if test="record.fillFlag != null">
        fill_flag = #{record.fillFlag,jdbcType=TINYINT},
      </if>
      <if test="record.todoId != null">
        todo_id = #{record.todoId,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update zb_report_relationship
    set id = #{record.id,jdbcType=VARCHAR},
      user_id = #{record.userId,jdbcType=VARCHAR},
      user_name = #{record.userName,jdbcType=VARCHAR},
      dep_id = #{record.depId,jdbcType=VARCHAR},
      dep_name = #{record.depName,jdbcType=VARCHAR},
      report_id = #{record.reportId,jdbcType=VARCHAR},
      bs_common_id = #{record.bsCommonId,jdbcType=VARCHAR},
      bs_common_parent_id = #{record.bsCommonParentId,jdbcType=VARCHAR},
      leader_flag = #{record.leaderFlag,jdbcType=TINYINT},
      fill_flag = #{record.fillFlag,jdbcType=TINYINT},
      todo_id = #{record.todoId,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationship">
    update zb_report_relationship
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="depId != null">
        dep_id = #{depId,jdbcType=VARCHAR},
      </if>
      <if test="depName != null">
        dep_name = #{depName,jdbcType=VARCHAR},
      </if>
      <if test="reportId != null">
        report_id = #{reportId,jdbcType=VARCHAR},
      </if>
      <if test="bsCommonId != null">
        bs_common_id = #{bsCommonId,jdbcType=VARCHAR},
      </if>
      <if test="bsCommonParentId != null">
        bs_common_parent_id = #{bsCommonParentId,jdbcType=VARCHAR},
      </if>
      <if test="leaderFlag != null">
        leader_flag = #{leaderFlag,jdbcType=TINYINT},
      </if>
      <if test="fillFlag != null">
        fill_flag = #{fillFlag,jdbcType=TINYINT},
      </if>
      <if test="todoId != null">
        todo_id = #{todoId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ruoyi.system.domain.zb.ZbReportRelationship">
    update zb_report_relationship
    set user_id = #{userId,jdbcType=VARCHAR},
      user_name = #{userName,jdbcType=VARCHAR},
      dep_id = #{depId,jdbcType=VARCHAR},
      dep_name = #{depName,jdbcType=VARCHAR},
      report_id = #{reportId,jdbcType=VARCHAR},
      bs_common_id = #{bsCommonId,jdbcType=VARCHAR},
      bs_common_parent_id = #{bsCommonParentId,jdbcType=VARCHAR},
      leader_flag = #{leaderFlag,jdbcType=TINYINT},
      fill_flag = #{fillFlag,jdbcType=TINYINT},
      todo_id = #{todoId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>