102 lines
4.8 KiB
XML
102 lines
4.8 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">
|
|
<mapper namespace="com.ruoyi.app.mapper.AppInformMapper">
|
|
|
|
<resultMap type="AppInform" id="AppInformResult">
|
|
<result property="id" column="id" />
|
|
<result property="content" column="content" />
|
|
<result property="userId" column="user_id" />
|
|
<result property="byUserId" column="by_user_id" />
|
|
<result property="imgUrl" column="img_url" />
|
|
<result property="createTime" column="create_time" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="remark" column="remark" />
|
|
</resultMap>
|
|
|
|
<sql id="selectAppInformVo">
|
|
select id, content, user_id, by_user_id,img_url, create_time, update_time, remark from app_inform
|
|
</sql>
|
|
|
|
<select id="selectAppInformList" parameterType="AppInform" resultMap="AppInformResult">
|
|
<include refid="selectAppInformVo"/>
|
|
<where>
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
<if test="byUserId != null "> and by_user_id = #{byUserId}</if>
|
|
<if test="content != null and content != ''"> and content = #{content}</if>
|
|
<if test="imgUrl != null and imgUrl != ''"> and img_url = #{imgUrl}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectList" parameterType="AppInform" resultType="AppInform">
|
|
select a.id, a.content, a.user_id as "userId", a.by_user_id as "byUserId", a.create_time as "createTime", a.update_time, a.remark,
|
|
a.img_url as "imgUrl",
|
|
u.username as "username",
|
|
u.avatar_url as "avatarUrl",
|
|
au.username as "byUsername",
|
|
au.avatar_url as "byAvatarUrl"
|
|
from app_inform a
|
|
LEFT JOIN app_user u on u.id = a.user_id
|
|
LEFT JOIN app_user au on au.id = a.by_user_id
|
|
<where>
|
|
<if test="userId != null "> and a.user_id = #{userId}</if>
|
|
<if test="username != null "> and u.username like concat('%',#{username},'%')</if>
|
|
<if test="byUsername != null "> and au.username like concat('%',#{byUsername},'%')</if>
|
|
<if test="byUserId != null "> and a.by_user_id = #{byUserId}</if>
|
|
<if test="content != null and content != ''"> and a.content like concat('%',#{content},'%')</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectAppInformById" parameterType="Long" resultMap="AppInformResult">
|
|
<include refid="selectAppInformVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertAppInform" parameterType="AppInform" useGeneratedKeys="true" keyProperty="id">
|
|
insert into app_inform
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">user_id,</if>
|
|
<if test="byUserId != null">by_user_id,</if>
|
|
<if test="content != null">content,</if>
|
|
<if test="imgUrl != null">img_url,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="remark != null">remark,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="userId != null">#{userId},</if>
|
|
<if test="byUserId != null">#{byUserId},</if>
|
|
<if test="content != null">#{content},</if>
|
|
<if test="imgUrl != null">#{imgUrl},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateAppInform" parameterType="AppInform">
|
|
update app_inform
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="userId != null">user_id = #{userId},</if>
|
|
<if test="byUserId != null">by_user_id = #{byUserId},</if>
|
|
<if test="content != null">content = #{content},</if>
|
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteAppInformById" parameterType="Long">
|
|
delete from app_inform where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteAppInformByIds" parameterType="String">
|
|
delete from app_inform where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |