All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mybatis.iam.ContactGroupRefMapper.xml Maven / Gradle / Ivy

The newest version!
<?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.wl4g.iam.data.ContactGroupRefDao" >
  <resultMap id="BaseResultMap" type="com.wl4g.iam.common.bean.ContactGroupRef" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="contact_group_id" property="contactGroupId" jdbcType="INTEGER" />
    <result column="contact_id" property="contactId" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, contact_group_id, contact_id
  </sql>
  <sql id="Base_Column_List_r" >
    r.id, r.contact_group_id, r.contact_id
  </sql>

  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select 
    <include refid="Base_Column_List" />
    from sys_contact_group_ref
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from sys_contact_group_ref
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.wl4g.iam.common.bean.ContactGroupRef" >
    insert into sys_contact_group_ref (id, contact_group_id, contact_id
      )
    values (#{id,jdbcType=BIGINT}, #{contactGroupId,jdbcType=BIGINT}, #{contactId,jdbcType=BIGINT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.wl4g.iam.common.bean.ContactGroupRef" useGeneratedKeys="true" keyProperty="id">
    insert into sys_contact_group_ref
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="contactGroupId != null" >
        contact_group_id,
      </if>
      <if test="contactId != null" >
        contact_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="contactGroupId != null" >
        #{contactGroupId,jdbcType=BIGINT},
      </if>
      <if test="contactId != null" >
        #{contactId,jdbcType=BIGINT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.wl4g.iam.common.bean.ContactGroupRef" >
    update sys_contact_group_ref
    <set >
      <if test="contactGroupId != null" >
        contact_group_id = #{contactGroupId,jdbcType=BIGINT},
      </if>
      <if test="contactId != null" >
        contact_id = #{contactId,jdbcType=BIGINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.wl4g.iam.common.bean.ContactGroupRef" >
    update sys_contact_group_ref
    set contact_group_id = #{contactGroupId,jdbcType=BIGINT},
      contact_id = #{contactId,jdbcType=BIGINT}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <delete id="deleteByContactId" parameterType="java.lang.Long" >
    delete from sys_contact_group_ref
    where contact_id = #{id,jdbcType=BIGINT}
  </delete>

  <select id="selectByContactId" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List_r" />
    from sys_contact_group_ref r
    where contact_id = #{id,jdbcType=BIGINT}
    and EXISTS(select 1 from sys_contact_group g where g.del_flag!=1 and r.contact_group_id=g.id)
  </select>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy