TbExhibitionMapperCust.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.fdage.dao.cust.TbExhibitionMapperCust">
  4. <select id="findCollectionByExhibition" parameterType="java.lang.Long" resultType="com.fdage.respon.ResponExhibition">
  5. select b.name, c.name as timeName, d.name as typeName, b.id
  6. FROM tb_exhibition_collection a LEFT JOIN tb_collection b ON a.collection_id = b.id
  7. LEFT JOIN tb_collection_time c ON b.time_id = c.id
  8. LEFT JOIN tb_exhibition_type d on b.type_id = d.id
  9. where a.exhibition_id = #{id}
  10. </select>
  11. <select id="findList" parameterType="com.fdage.request.RequestExhibition" resultType="com.fdage.respon.ResponExhibition">
  12. select a.id, a.name , b.name as equipmentName, c.name as typeName, a.create_time as createTime, a.state,
  13. b.id as equipmentId, c.id as typeId, a.description, a.web_url as webUrl
  14. FROM tb_exhibition a LEFT JOIN tb_equipment b ON a.equipment_id = b.id
  15. LEFT JOIN tb_exhibition_type c on a.type_id = c.id
  16. where 1 = 1
  17. <if test="name != null and name != ''">
  18. and a.name LIKE CONCAT('%', #{name}, '%')
  19. </if>
  20. <if test="state != null">
  21. and a.state = #{state}
  22. </if>
  23. </select>
  24. <select id="getExhibitionByEquipmentId" parameterType="java.lang.Long" resultType="com.fdage.respon.ResponExhibition">
  25. select a.id, a.name , b.name as equipmentName, c.name as typeName, a.create_time as createTime, a.state, a.web_url as webUrl
  26. FROM tb_exhibition a LEFT JOIN tb_equipment b ON a.equipment_id = b.id
  27. LEFT JOIN tb_exhibition_type c on a.type_id = c.id
  28. where a.state = 0 and a.equipment_id = #{id}
  29. </select>
  30. <update id="updateStateByEquipmentId" parameterType="java.lang.Long">
  31. update tb_exhibition
  32. set state = 1
  33. where equipment_id = #{id,jdbcType=BIGINT}
  34. </update>
  35. <select id="typeList" resultType="com.fdage.pojo.TbExhibitionType">
  36. select id, name
  37. from tb_exhibition_type
  38. </select>
  39. <update id="addOpenNum" parameterType="java.lang.Long">
  40. update tb_exhibition
  41. set open_num = open_num + 1
  42. where id = #{id,jdbcType=BIGINT}
  43. </update>
  44. <select id="exhibitionTotal" resultType="java.lang.Long">
  45. SELECT COUNT(DISTINCT(collection_id))
  46. FROM `tb_exhibition_collection`
  47. </select>
  48. <select id="findListOrderBy" resultType="com.fdage.respon.ResponExhibition">
  49. select a.id, a.name , b.name as equipmentName, c.name as typeName, a.create_time as createTime, a.state,
  50. b.id as equipmentId, c.id as typeId, a.description, a.web_url as webUrl, a.open_num as openNum
  51. FROM tb_exhibition a LEFT JOIN tb_equipment b ON a.equipment_id = b.id
  52. LEFT JOIN tb_exhibition_type c on a.type_id = c.id
  53. ORDER BY a.open_num desc
  54. </select>
  55. </mapper>