linhw 2024-05-28 19:20:35 +08:00
parent 4dc393189b
commit 0ba3a1df71
4 changed files with 50 additions and 3 deletions

View File

@ -22,6 +22,26 @@ public class AppInform extends BaseEntity
@Excel(name = "举报内容")
private String content;
/** 举报人 */
@Excel(name = "举报人")
private Long userId;
/** 被举报人 */
@Excel(name = "被举报人")
private Long byUserId;
@Excel(name = "头像")
private String avatarUrl;
@Excel(name = "头像")
private String byAvatarUrl;
@Excel(name = "用户名")
private String username;
@Excel(name = "用户名")
private String byUsername;
public void setId(Long id)
{
this.id = id;

View File

@ -26,6 +26,7 @@ public interface AppInformMapper
* @return
*/
public List<AppInform> selectAppInformList(AppInform appInform);
public List<AppInform> selectList(AppInform appInform);
/**
*

View File

@ -41,7 +41,7 @@ public class AppInformServiceImpl implements IAppInformService
@Override
public List<AppInform> selectAppInformList(AppInform appInform)
{
return appInformMapper.selectAppInformList(appInform);
return appInformMapper.selectList(appInform);
}
/**

View File

@ -7,18 +7,38 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectAppInformVo">
select id, content, create_time, update_time, remark from app_inform
select id, content, user_id, by_user_id, create_time, update_time, remark from app_inform
</sql>
<select id="selectAppInformList" parameterType="AppInform" resultMap="AppInformResult">
<include refid="selectAppInformVo"/>
<where>
<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>
</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,
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 user_id = #{userId}</if>
<if test="byUserId != null "> and by_user_id = #{byUserId}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
</where>
</select>
@ -31,12 +51,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="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="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
@ -47,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>