yujian
2020-06-09 554de444b87aab5f93cb1593a8095612cf9479a7
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgAccountDetailMapper.xml
@@ -1,107 +1,119 @@
<?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.MsgAccountDetailMapper">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
      <id column="ma_id" property="id" jdbcType="BIGINT" />
      <result column="ma_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeAccountTypeEnumHandler" />
      <result column="ma_title" property="title" jdbcType="VARCHAR" />
      <result column="ma_content" property="content" jdbcType="VARCHAR" />
      <result column="ma_beizhu" property="beiZhu" jdbcType="VARCHAR" />
      <result column="ma_read" property="read" jdbcType="BOOLEAN" />
      <result column="ma_create_time" property="createTime" jdbcType="TIMESTAMP" />
      <result column="ma_update_time" property="updateTime" jdbcType="TIMESTAMP" />
      <association property="user" column="ma_uid">
         <id column="ma_uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="listByUid" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_msg_account where ma_uid = #{uid,jdbcType=BIGINT} order
      by ma_update_time desc limit #{start},#{count}
   </select>
   <select id="countByUid" resultType="java.lang.Long"
      parameterType="java.lang.Long">
      select
      count(ma_id)
      from yeshi_ec_msg_account where ma_uid
      = #{uid,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_account
      (ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time)
      values
      (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_msg_account
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ma_id,</if>
         <if test="user != null">ma_uid,</if>
         <if test="type != null">ma_type,</if>
         <if test="title != null">ma_title,</if>
         <if test="content != null">ma_content,</if>
         <if test="beiZhu != null">ma_beizhu,</if>
         <if test="read != null">ma_read,</if>
         <if test="createTime != null">ma_create_time,</if>
         <if test="updateTime != null">ma_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="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">#{content,jdbcType=VARCHAR},</if>
         <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
         <if test="read != null">#{read,jdbcType=BOOLEAN},</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.MsgAccountDetail">update
      yeshi_ec_msg_account set ma_uid = #{user.id,jdbcType=BIGINT},ma_type
      =
      #{type,jdbcType=VARCHAR},ma_title =
      #{title,jdbcType=VARCHAR},ma_content =
      #{content,jdbcType=VARCHAR},ma_beizhu =
      #{beiZhu,jdbcType=VARCHAR},ma_read =
      #{read,jdbcType=BOOLEAN},ma_create_time =
      #{createTime,jdbcType=TIMESTAMP},ma_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ma_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
      update yeshi_ec_msg_account
      <set>
         <if test="user != null">ma_uid=#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">ma_type=#{type,jdbcType=VARCHAR},</if>
         <if test="title != null">ma_title=#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">ma_content=#{content,jdbcType=VARCHAR},</if>
         <if test="beiZhu != null">ma_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
         <if test="read != null">ma_read=#{read,jdbcType=BOOLEAN},</if>
         <if test="createTime != null">ma_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ma_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ma_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.MsgAccountDetailMapper">
   <resultMap id="BaseResultMap"
      type="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
      <id column="ma_id" property="id" jdbcType="BIGINT" />
      <result column="ma_type" property="type"
         typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeAccountTypeEnumHandler" />
      <result column="ma_title" property="title" jdbcType="VARCHAR" />
      <result column="ma_content" property="content" jdbcType="VARCHAR" />
      <result column="ma_beizhu" property="beiZhu" jdbcType="VARCHAR" />
      <result column="ma_read" property="read" jdbcType="BOOLEAN" />
      <result column="ma_create_time" property="createTime" jdbcType="TIMESTAMP" />
      <result column="ma_update_time" property="updateTime" jdbcType="TIMESTAMP" />
      <result column="extraInfo" property="extraInfo" jdbcType="VARCHAR"/>
      <association property="user" column="ma_uid"
         javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
         <id column="ma_uid" property="id" jdbcType="BIGINT" />
      </association>
   </resultMap>
   <sql id="Base_Column_List">ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time
   </sql>
   <select id="selectByPrimaryKey" resultMap="BaseResultMap"
      parameterType="java.lang.Long">
      select
      <include refid="Base_Column_List" />
      from yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
   </select>
   <select id="listByUid" resultMap="BaseResultMap">
      select d.*,t.`mea_content` AS extraInfo from yeshi_ec_msg_account d
      LEFT JOIN  `yeshi_ec_msg_extra` t  ON (t.`mea_rid` = d.`ma_id` AND t.`mea_type` = 'account')
      where d.ma_uid = #{uid,jdbcType=BIGINT}
      order by d.ma_update_time desc
      limit #{start},#{count}
   </select>
   <select id="countByUid" resultType="java.lang.Long"
      parameterType="java.lang.Long">
      select
      count(ma_id)
      from yeshi_ec_msg_account where ma_uid
      = #{uid,jdbcType=BIGINT}
   </select>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
      yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
   </delete>
   <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
      useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_account
      (ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time)
      values
      (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
   </insert>
   <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
      useGeneratedKeys="true" keyProperty="id">
      insert into yeshi_ec_msg_account
      <trim prefix="(" suffix=")" suffixOverrides=",">
         <if test="id != null">ma_id,</if>
         <if test="user != null">ma_uid,</if>
         <if test="type != null">ma_type,</if>
         <if test="title != null">ma_title,</if>
         <if test="content != null">ma_content,</if>
         <if test="beiZhu != null">ma_beizhu,</if>
         <if test="read != null">ma_read,</if>
         <if test="createTime != null">ma_create_time,</if>
         <if test="updateTime != null">ma_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="title != null">#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">#{content,jdbcType=VARCHAR},</if>
         <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
         <if test="read != null">#{read,jdbcType=BOOLEAN},</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.MsgAccountDetail">update
      yeshi_ec_msg_account set ma_uid = #{user.id,jdbcType=BIGINT},ma_type
      =
      #{type,jdbcType=VARCHAR},ma_title =
      #{title,jdbcType=VARCHAR},ma_content =
      #{content,jdbcType=VARCHAR},ma_beizhu =
      #{beiZhu,jdbcType=VARCHAR},ma_read =
      #{read,jdbcType=BOOLEAN},ma_create_time =
      #{createTime,jdbcType=TIMESTAMP},ma_update_time =
      #{updateTime,jdbcType=TIMESTAMP} where ma_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
      update yeshi_ec_msg_account
      <set>
         <if test="user != null">ma_uid=#{user.id,jdbcType=BIGINT},</if>
         <if test="type != null">ma_type=#{type,jdbcType=VARCHAR},</if>
         <if test="title != null">ma_title=#{title,jdbcType=VARCHAR},</if>
         <if test="content != null">ma_content=#{content,jdbcType=VARCHAR},</if>
         <if test="beiZhu != null">ma_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
         <if test="read != null">ma_read=#{read,jdbcType=BOOLEAN},</if>
         <if test="createTime != null">ma_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
         <if test="updateTime != null">ma_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
      </set>
      where ma_id = #{id,jdbcType=BIGINT}
   </update>
   <update id="setMsgReadByUid" parameterType="java.lang.Long">
      update
      yeshi_ec_msg_account set ma_read=1 where ma_uid=#{0}
   </update>
</mapper>