PinglunMapper.xml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.mapper.PinglunMapper">
  5. <select id="findPinglunList"
  6. resultType="Pinglun">
  7. select * from pinglun
  8. </select>
  9. <select id="query" parameterType="java.util.Map" resultType="Pinglun">
  10. select * from pinglun
  11. <where>
  12. <if test="id!=null and id!=0">
  13. and id= #{id}
  14. </if>
  15. <if test="zid!=null and zid!=0">
  16. and zid= #{zid}
  17. </if>
  18. </where>
  19. order by id desc
  20. </select>
  21. <select id="queryPinglunById" parameterType="int" resultType="Pinglun">
  22. select * from pinglun where id=${value}
  23. </select>
  24. <!-- 添加评论 -->
  25. <insert id="insertPinglun" useGeneratedKeys="true" keyProperty="id" parameterType="Pinglun">
  26. insert into pinglun
  27. (contents,fbsj,uname,uhead,zid,huifu)
  28. values
  29. (#{contents},#{fbsj},#{uname},#{uhead},#{zid},#{huifu});
  30. </insert>
  31. <update id="updatePinglun" parameterType="Pinglun" >
  32. update pinglun set
  33. contents=#{contents},fbsj=#{fbsj},uname=#{uname},uhead=#{uhead},zid=#{zid},huifu=#{huifu}
  34. where
  35. id=#{id}
  36. </update>
  37. <delete id="deletePinglun" parameterType="int">
  38. delete from pinglun where id=${value}
  39. </delete>
  40. </mapper>