| <?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.pt5.pthouduan.mapper.ComplainMapper"> |
| |
| <!-- 插入投诉 --> |
| <insert id="save" parameterType="com.pt5.pthouduan.entity.Complain" useGeneratedKeys="true" keyProperty="complainid"> |
| INSERT INTO complain (puse, duser, content, torrentid) |
| VALUES (#{puse}, #{duser}, #{content}, #{torrentid}) |
| </insert> |
| |
| <!-- 根据投诉ID删除投诉 --> |
| <delete id="deleteByComplainid" parameterType="int"> |
| DELETE FROM complain WHERE complainid = #{complainid} |
| </delete> |
| |
| <!-- 更新投诉 --> |
| <update id="updateComplain" parameterType="com.pt5.pthouduan.entity.Complain"> |
| UPDATE complain |
| SET puse = #{puse}, |
| duser = #{duser}, |
| content = #{content}, |
| torrentid = #{torrentid} |
| WHERE complainid = #{complainid} |
| </update> |
| |
| <!-- 根据被投诉用户ID查询投诉列表 --> |
| <select id="selectByDuser" parameterType="long" resultType="com.pt5.pthouduan.entity.Complain"> |
| SELECT * FROM complain |
| WHERE duser = #{duser} |
| ORDER BY complainid DESC |
| </select> |
| |
| <!-- 根据投诉发起人ID查询投诉列表 --> |
| <select id="selectByPuse" parameterType="long" resultType="com.pt5.pthouduan.entity.Complain"> |
| SELECT * FROM complain |
| WHERE puse = #{puse} |
| ORDER BY complainid DESC |
| </select> |
| |
| <!-- ✅ 获取所有投诉记录 --> |
| <select id="selectAllComplains" resultType="com.pt5.pthouduan.entity.Complain"> |
| SELECT * FROM complain |
| ORDER BY complainid DESC |
| </select> |
| |
| <!-- ✅ 根据投诉ID查询投诉详情 --> |
| <select id="selectByComplainId" parameterType="int" resultType="com.pt5.pthouduan.entity.Complain"> |
| SELECT * FROM complain |
| WHERE complainid = #{complainid} |
| </select> |
| |
| </mapper> |