XH-Power-Cloud/xhpc-modules/xhpc-message-board/src/main/resources/mapper/XhpcMessageBoardReceiveUserMapper.xml
2022-01-20 22:52:42 +08:00

143 lines
5.5 KiB
XML

<?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">
<!--suppress ALL -->
<mapper namespace="com.xhpc.board.mapper.XhpcMessageBoardReceiveUserMapper">
<resultMap id="BaseResultMap" type="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="tenant_type" jdbcType="INTEGER" property="tenantType"/>
<result column="sender_account" jdbcType="VARCHAR" property="senderAccount"/>
<result column="sender_type" jdbcType="INTEGER" property="senderType"/>
<result column="user_icon" jdbcType="VARCHAR" property="userIcon"/>
<result column="have_new_info" jdbcType="BOOLEAN" property="haveNewInfo"/>
<result column="del_flag" jdbcType="BOOLEAN" property="delFlag"/>
</resultMap>
<sql id="Base_Column_List">
tenant_id
,
tenant_type,
sender_account,
sender_type,
user_icon,
have_new_info,
del_flag
</sql>
<insert id="insert" parameterType="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
insert into xhpc_message_board_receive_user (tenant_id, tenant_type, sender_account,
sender_type, user_icon, have_new_info,
del_flag)
values (#{tenantId,jdbcType=VARCHAR}, #{tenantType,jdbcType=INTEGER}, #{senderAccount,jdbcType=VARCHAR},
#{senderType,jdbcType=INTEGER}, #{userIcon,jdbcType=VARCHAR}, #{haveNewInfo,jdbcType=BOOLEAN},
#{delFlag,jdbcType=BOOLEAN})
</insert>
<insert id="insertSelective" parameterType="com.xhpc.board.pojo.XhpcMessageBoardReceiveUser">
insert into xhpc_message_board_receive_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tenantId != null">
tenant_id,
</if>
<if test="tenantType != null">
tenant_type,
</if>
<if test="senderAccount != null">
sender_account,
</if>
<if test="senderType != null">
sender_type,
</if>
<if test="userIcon != null">
user_icon,
</if>
<if test="haveNewInfo != null">
have_new_info,
</if>
<if test="delFlag != null">
del_flag,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tenantId != null">
#{tenantId,jdbcType=VARCHAR},
</if>
<if test="tenantType != null">
#{tenantType,jdbcType=INTEGER},
</if>
<if test="senderAccount != null">
#{senderAccount,jdbcType=VARCHAR},
</if>
<if test="senderType != null">
#{senderType,jdbcType=INTEGER},
</if>
<if test="userIcon != null">
#{userIcon,jdbcType=VARCHAR},
</if>
<if test="haveNewInfo != null">
#{haveNewInfo,jdbcType=BOOLEAN},
</if>
<if test="delFlag != null">
#{delFlag,jdbcType=BOOLEAN},
</if>
</trim>
</insert>
<update id="updateHaveNewInfoFiledByUserCondition">
UPDATE xhpc_message_board_receive_user
SET have_new_info = 0
WHERE tenant_type = #{tenantType}
AND tenant_id = #{tenantId}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL;
</update>
<update id="updateHaveNewInfoIsNull">
UPDATE xhpc_message_board_receive_user
SET have_new_info = null
WHERE tenant_type = #{tenantType}
AND tenant_id = #{tenantId}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL;
</update>
<select id="findOneByCondition" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
xhpc_message_board_receive_user
WHERE
tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND sender_account = #{senderAccount}
AND sender_type = #{senderType}
AND del_flag IS NULL
</select>
<select id="findAllBy" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
`xhpc_message_board_receive_user`
WHERE
tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND del_flag IS NULL
AND have_new_info = 0
<if test="userType!=null and userType!=''">
AND sender_type = #{userType}
</if>
<if test="senderAccount!=null and senderAccount!=''">
AND sender_account = #{senderAccount}
</if>
LIMIT #{currentPage},#{items}
</select>
<select id="totalUserNumber" resultType="java.lang.Long">
SELECT count(tenant_id)
FROM `xhpc_message_board_receive_user`
WHERE tenant_id = #{tenantId}
AND tenant_type = #{tenantType}
AND del_flag IS NULL
AND have_new_info = 0
<if test="userType!=null and userType!=''">
AND sender_type = #{userType}
</if>
<if test="senderAccount!=null and senderAccount!=''">
AND sender_account = #{senderAccount}
</if>
</select>
</mapper>