admin
2020-04-13 dd5b15229cb15459fa7c31ccea77dac28cbfafbd
fanli/src/main/java/com/yeshi/fanli/mapping/msg/UserSystemMsgMapper.xml
@@ -1,101 +1,151 @@
<?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.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper">
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
      <id column="ms_id" property="id" jdbcType="BIGINT" />
      <result column="ms_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.msg.UserSystemMsgTypeEnumHandler" />
      <result column="ms_read" property="read" jdbcType="BOOLEAN" />
      <result column="ms_solved" property="solved" jdbcType="BOOLEAN" />
      <result column="ms_title" property="title" jdbcType="VARCHAR" />
      <result column="ms_content" property="content" jdbcType="VARCHAR" />
      <result column="ms_time_tag" property="timeTag" jdbcType="INTEGER" />
      <result column="ms_create_time" property="createTime" jdbcType="TIMESTAMP" />
      <result column="ms_update_time" property="updateTime" jdbcType="TIMESTAMP" />
      <association property="user" column="ms_uid">
         <id column="ms_uid" property="id" jdbcType="BIGINT" />
      </association>
      <association property="systemZNX" column="ms_system_znx_id">
         <id column="ms_system_znx_id" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_msg_system where ms_id = #{id,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_msg_system where ms_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_system
      (ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time)
      values
      (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{systemZNX.id,jdbcType=BIGINT},#{read,jdbcType=BOOLEAN},#{solved,jdbcType=BOOLEAN},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{timeTag,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_msg_system
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ms_id,</if>
         <if test="user != null">ms_uid,</if>
         <if test="type != null">ms_type,</if>
         <if test="systemZNX != null">ms_system_znx_id,</if>
         <if test="read != null">ms_read,</if>
         <if test="solved != null">ms_solved,</if>
         <if test="title != null">ms_title,</if>
         <if test="content != null">ms_content,</if>
         <if test="timeTag != null">ms_time_tag,</if>
         <if test="createTime != null">ms_create_time,</if>
         <if test="updateTime != null">ms_update_time,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">#{type,jdbcType=VARCHAR},</if>
         <if test="systemZNX != null">#{systemZNX.id,jdbcType=BIGINT},</if>
         <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
         <if test="solved != null">#{solved,jdbcType=BOOLEAN},</if>
         <if test="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">#{content,jdbcType=VARCHAR},</if>
         <if test="timeTag != null">#{timeTag,jdbcType=INTEGER},</if>
         <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">update
      yeshi_ec_msg_system set ms_uid = #{user.id,jdbcType=BIGINT},ms_type =
      #{type,jdbcType=VARCHAR},ms_system_znx_id =
      #{systemZNX.id,jdbcType=BIGINT},ms_read =
      #{read,jdbcType=BOOLEAN},ms_solved =
      #{solved,jdbcType=BOOLEAN},ms_title =
      #{title,jdbcType=VARCHAR},ms_content =
      #{content,jdbcType=VARCHAR},ms_time_tag =
      #{timeTag,jdbcType=INTEGER},ms_create_time =
      #{createTime,jdbcType=TIMESTAMP},ms_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ms_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
      update yeshi_ec_msg_system
      <set>
         <if test="user != null">ms_uid=#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">ms_type=#{type,jdbcType=VARCHAR},</if>
         <if test="systemZNX != null">ms_system_znx_id=#{systemZNX.id,jdbcType=BIGINT},</if>
         <if test="read != null">ms_read=#{read,jdbcType=BOOLEAN},</if>
         <if test="solved != null">ms_solved=#{solved,jdbcType=BOOLEAN},</if>
         <if test="title != null">ms_title=#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">ms_content=#{content,jdbcType=VARCHAR},</if>
         <if test="timeTag != null">ms_time_tag=#{timeTag,jdbcType=INTEGER},</if>
         <if test="createTime != null">ms_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ms_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ms_id = #{id,jdbcType=BIGINT}
   </update>
</mapper>
<?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.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper">
   <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
      <id column="ms_id" property="id" jdbcType="BIGINT" />
      <result column="ms_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.msg.UserSystemMsgTypeEnumHandler" />
      <result column="ms_read" property="read" jdbcType="BOOLEAN" />
      <result column="ms_solved" property="solved" jdbcType="BOOLEAN" />
      <result column="ms_title" property="title" jdbcType="VARCHAR" />
      <result column="ms_content" property="content" jdbcType="VARCHAR" />
      <result column="ms_time_tag" property="timeTag" jdbcType="INTEGER" />
      <result column="ms_create_time" property="createTime" jdbcType="TIMESTAMP" />
      <result column="ms_update_time" property="updateTime" jdbcType="TIMESTAMP" />
      <association property="user" column="ms_uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="ms_uid" property="id" jdbcType="BIGINT" />
      </association>
      <association property="systemZNX" column="ms_system_znx_id"
         select="com.yeshi.fanli.dao.mybatis.msg.SystemZnxMapper.selectByPrimaryKey">
      </association>
   </resultMap>
   <sql id="Base_Column_List">ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_msg_system where ms_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="listByUid" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_msg_system where ms_uid = #{uid,jdbcType=BIGINT}
      order by ms_create_time desc limit #{start},#{count}
   </select>
   <select id="countByUid" resultType="java.lang.Long"
      parameterType="java.lang.Long">
      select
      count(ms_id)
      from yeshi_ec_user_msg_system where
      ms_uid =
      #{uid,jdbcType=BIGINT}
   </select>
   <select id="selectBySystemZNXId" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_msg_system where ms_system_znx_id =
      #{id,jdbcType=BIGINT} and ms_uid=#{uid}
   </select>
   <select id="selectLatestUserSystemMsg" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_user_msg_system where ms_uid = #{uid} order by
      ms_create_time desc limit 1
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_user_msg_system where ms_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
      useGeneratedKeys="true" keyProperty="id">insert into
      yeshi_ec_user_msg_system
      (ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time)
      values
      (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{systemZNX.id,jdbcType=BIGINT},#{read,jdbcType=BOOLEAN},#{solved,jdbcType=BOOLEAN},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{timeTag,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_user_msg_system
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ms_id,</if>
         <if test="user != null">ms_uid,</if>
         <if test="type != null">ms_type,</if>
         <if test="systemZNX != null">ms_system_znx_id,</if>
         <if test="read != null">ms_read,</if>
         <if test="solved != null">ms_solved,</if>
         <if test="title != null">ms_title,</if>
         <if test="content != null">ms_content,</if>
         <if test="timeTag != null">ms_time_tag,</if>
         <if test="createTime != null">ms_create_time,</if>
         <if test="updateTime != null">ms_update_time,</if>
      </trim>
      values
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">#{id,jdbcType=BIGINT},</if>
         <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">#{type,jdbcType=VARCHAR},</if>
         <if test="systemZNX != null">#{systemZNX.id,jdbcType=BIGINT},</if>
         <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
         <if test="solved != null">#{solved,jdbcType=BOOLEAN},</if>
         <if test="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">#{content,jdbcType=VARCHAR},</if>
         <if test="timeTag != null">#{timeTag,jdbcType=INTEGER},</if>
         <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
      </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">update
      yeshi_ec_user_msg_system set ms_uid =
      #{user.id,jdbcType=BIGINT},ms_type =
      #{type,jdbcType=VARCHAR},ms_system_znx_id =
      #{systemZNX.id,jdbcType=BIGINT},ms_read =
      #{read,jdbcType=BOOLEAN},ms_solved =
      #{solved,jdbcType=BOOLEAN},ms_title =
      #{title,jdbcType=VARCHAR},ms_content =
      #{content,jdbcType=VARCHAR},ms_time_tag =
      #{timeTag,jdbcType=INTEGER},ms_create_time =
      #{createTime,jdbcType=TIMESTAMP},ms_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ms_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
      update yeshi_ec_user_msg_system
      <set>
         <if test="user != null">ms_uid=#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">ms_type=#{type,jdbcType=VARCHAR},</if>
         <if test="systemZNX != null">ms_system_znx_id=#{systemZNX.id,jdbcType=BIGINT},</if>
         <if test="read != null">ms_read=#{read,jdbcType=BOOLEAN},</if>
         <if test="solved != null">ms_solved=#{solved,jdbcType=BOOLEAN},</if>
         <if test="title != null">ms_title=#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">ms_content=#{content,jdbcType=VARCHAR},</if>
         <if test="timeTag != null">ms_time_tag=#{timeTag,jdbcType=INTEGER},</if>
         <if test="createTime != null">ms_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ms_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ms_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="setMsgReadByUid" parameterType="java.lang.Long">
      update
      yeshi_ec_user_msg_system set ms_read=1 where ms_uid=#{0}
   </update>
</mapper>