BusinessReplyMapper.xml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.dayou.mapper.BusinessReplyMapper">
  4. <!-- 通用查询映射结果 -->
  5. <resultMap id="BaseResultMap" type="com.dayou.entity.BusinessReply">
  6. <result column="id" property="id" />
  7. <result column="deleted" property="deleted" />
  8. <result column="created" property="created" />
  9. <result column="modified" property="modified" />
  10. <result column="biz_type" property="bizType" />
  11. <result column="biz_table_id" property="bizTableId" />
  12. <result column="parent_id" property="parentId" />
  13. <result column="content" property="content" />
  14. <result column="replier_id" property="replierId" />
  15. <result column="receiver_id" property="receiverId" />
  16. <result column="state" property="state" />
  17. </resultMap>
  18. <!-- 通用查询结果列 -->
  19. <sql id="Base_Column_List">
  20. br.id,
  21. br.deleted,
  22. br.created,
  23. br.modified,
  24. br.biz_type, br.biz_table_id, br.parent_id, br.content, br.replier_id, br.receiver_id, br.state
  25. </sql>
  26. <select id="getPage" parameterType="com.dayou.entity.BusinessReply" resultType="com.dayou.vo.BusinessReplyVO">
  27. select <include refid="Base_Column_List"/> , u1.name as replier,u2.name as receiver
  28. from business_reply br
  29. left join user u1 on br.replier_id = u1.id left join user u2 on br.receiver_id = u2.id
  30. where u1.deleted = 0 and u2.deleted = 0 and br.deleted = 0 and br.biz_type = #{businessReply.bizType} and br.biz_table_id = #{businessReply.bizTableId}
  31. order by br.created DESC
  32. </select>
  33. <update id="updateState">
  34. update business_reply set state = 1 where biz_type = #{bizType} and biz_table_id = #{bizTableId} and receiver_id = #{currentId}
  35. </update>
  36. </mapper>