SystemNoticeMapper.xml 6.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.bjivt.entity.showtime.SystemNotice">
  <resultMap id="BaseResultMap" type="com.bjivt.entity.showtime.SystemNotice">
    <!--
    @mbggenerated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="interval_time" jdbcType="INTEGER" property="intervalTime" />
    <result column="action" jdbcType="INTEGER" property="action" />
    <result column="type" jdbcType="INTEGER" property="type" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="manager_id" jdbcType="INTEGER" property="managerId" />
    <result column="is_publish" jdbcType="BIT" property="isPublish" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
    @mbggenerated
    -->
    id, title, content, interval_time, action, type, create_time, manager_id,is_publish
  </sql>
  <select id="selectById" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select 
    <include refid="Base_Column_List" />
    from tbl_system_notice
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteById" parameterType="java.lang.Integer">
    delete from tbl_system_notice
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.bjivt.entity.showtime.SystemNotice">
    <!--
    @mbggenerated
    -->
    insert into tbl_system_notice (id, title, content, 
      interval_time, action, type, 
      create_time, manager_id,is_publish)
    values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, 
      #{intervalTime,jdbcType=INTEGER}, #{action,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, 
      #{createTime,jdbcType=TIMESTAMP}, #{managerId,jdbcType=INTEGER},#{isPublish,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.bjivt.entity.showtime.SystemNotice" useGeneratedKeys="true" keyProperty="id">
    insert into tbl_system_notice
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="intervalTime != null">
        interval_time,
      </if>
      <if test="action != null">
        action,
      </if>
      <if test="type != null">
        type,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="managerId != null">
        manager_id,
      </if>
      <if test="isPublish != null">
          is_publish,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="intervalTime != null">
        #{intervalTime,jdbcType=INTEGER},
      </if>
      <if test="action != null">
        #{action,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="managerId != null">
        #{managerId,jdbcType=INTEGER},
      </if>
      <if test="isPublish != null">
          #{isPublish,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByIdSelective" parameterType="com.bjivt.entity.showtime.SystemNotice">
    update tbl_system_notice
    <set>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="intervalTime != null">
        interval_time = #{intervalTime,jdbcType=INTEGER},
      </if>
      <if test="action != null">
        action = #{action,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="managerId != null">
        manager_id = #{managerId,jdbcType=INTEGER},
      </if>
      <if test="isPublish != null">
         is_publish=#{isPublish,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.bjivt.entity.showtime.SystemNotice">
    update tbl_system_notice
    set title = #{title,jdbcType=VARCHAR},
      content = #{content,jdbcType=VARCHAR},
      interval_time = #{intervalTime,jdbcType=INTEGER},
      action = #{action,jdbcType=INTEGER},
      type = #{type,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      manager_id = #{managerId,jdbcType=INTEGER},
      is_publish=#{isPublish,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
  
  <select id="getCountBy" resultType="java.lang.Integer" parameterType="com.bjivt.entity.showtime.SystemNotice">
    SELECT
				count(id)
			FROM
				tbl_system_notice
    <trim prefix="where" prefixOverrides="and|or">
	      <if test="action != null and action != ''" >
        	 and   tbl_system_notice.action = #{action}
    	  </if>
  	  	 <if test="type != null and type != ''" >
        	 and   tbl_system_notice.type = #{type}
    	  </if>
      </trim>
  </select>
  
     <select id="findListByMap" resultMap="BaseResultMap" parameterType="java.util.Map">
     	SELECT
				<include refid="Base_Column_List"/>
			FROM
				tbl_system_notice
  	  	<trim prefix="where" prefixOverrides="and|or">
		      <if test="action != null and action != ''" >
	        	 and   tbl_system_notice.action = #{action}
	    	  </if>
	  	  	 <if test="type != null and type != ''" >
	        	 and   tbl_system_notice.type = #{type}
	    	  </if>
  	  	</trim>
  	  	order by create_time
	    <if test="page != null and page !=''">
	    <if test="page.from != null and page.size != null">
          limit #{page.from},#{page.size}
   		</if>
   		</if>
  </select>
     <select id="getNoticeAsAction" resultMap="BaseResultMap" parameterType="java.util.Map">
     	SELECT
				<include refid="Base_Column_List"/>
			FROM
				tbl_system_notice
  	  	<trim prefix="where" prefixOverrides="and|or">
		      <if test="action != null and action != ''" >
	        	 and   tbl_system_notice.action = #{action}
	    	  </if>
	  	  	 <if test="type != null and type != ''" >
	        	 and   tbl_system_notice.type = #{type}
	    	  </if>
  	  	</trim>
  	  	order by create_time
  </select>

</mapper>