AttachmentDao.xml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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="platform.modules.government.dao.AttachmentDao">
  4. <select id="selectByIdAndBusinessId" resultType="platform.modules.government.entity.Attachment">
  5. select * from attachment where del_flag=0
  6. <if test="id!=null and id!=''">
  7. and id=#{id}
  8. </if>
  9. and business_type=#{business_type} and business_id=#{business_id}
  10. </select>
  11. <update id="updateAttachment">
  12. update attachment set business_type=#{business_type},business_id=#{business_id},del_flag=0
  13. where id=#{id}
  14. </update>
  15. <update id="deleteByBusiness">
  16. update attachment set del_flag=1
  17. where business_type=#{business_type} and business_id=#{business_id}
  18. </update>
  19. <update id="deleteByIdAndBusinessId">
  20. update attachment set del_flag=1
  21. where business_type=#{business_type} and business_id=#{business_id}
  22. <if test="id!=null and id!=''">
  23. and id=#{id}
  24. </if>
  25. </update>
  26. <select id="findListBySupport" resultType="platform.modules.government.entity.Attachment">
  27. select a.* from attachment a
  28. LEFT JOIN ic_park_support_attachment psa ON psa.id = a.business_id
  29. WHERE
  30. psa.del_flag = 0
  31. AND a.business_type = #{attathmentType}
  32. AND psa.support_id = #{supportId}
  33. AND psa.type = #{type}
  34. </select>
  35. <select id="findListByTypicalCompany" resultType="platform.modules.government.entity.Attachment">
  36. select a.* from attachment a
  37. LEFT JOIN ic_park_typical_company_attachment iptca ON iptca.id = a.business_id
  38. WHERE
  39. iptca.del_flag = 0
  40. AND a.business_type = #{attachmentType}
  41. AND iptca.typical_company_id = #{typicalCompanyId}
  42. </select>
  43. <select id="findMainPicture" resultType="platform.modules.government.entity.Attachment">
  44. select a.* from attachment a
  45. LEFT JOIN ic_park_attachment pa on pa.attachment_id = a.id
  46. WHERE
  47. pa.park_id = #{id}
  48. AND pa.is_main = TRUE
  49. </select>
  50. <select id="findByBusinessType" resultType="platform.modules.government.entity.Attachment">
  51. select * from attachment where del_flag = 0 AND (business_type = #{streetType} or business_type = #{parkType})
  52. </select>
  53. <select id="findAnnex2" resultType="platform.modules.government.entity.Attachment">
  54. select * from attachment where del_flag = 0 AND business_type = #{annex_template_2}
  55. </select>
  56. </mapper>