EntRiskPointDangerMapper.xml 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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.zhyc.xps.aqpt.mapper.EntRiskPointDangerMapper">
  4. <resultMap id="RiskPointDangerDtoResultMap" type="com.zhyc.xps.aqpt.dto.EntDangerDto" >
  5. <result column="oc_id" property="ocId" jdbcType="BIGINT" />
  6. <result column="risk_point_id" property="riskPointId" jdbcType="BIGINT" />
  7. <result column="risk_point_title" property="riskPointTitle" jdbcType="VARCHAR" />
  8. <result column="danger_id" property="dangerId" jdbcType="BIGINT" />
  9. <result column="danger_code" property="dangerCode" jdbcType="VARCHAR" />
  10. <result column="danger_title" property="dangerTitle" jdbcType="VARCHAR" />
  11. <result column="danger_desc" property="dangerDesc" jdbcType="VARCHAR" />
  12. <result column="danger_cat_id" property="dangerCatId" jdbcType="BIGINT" />
  13. <result column="danger_level" property="dangerLevel" jdbcType="BIGINT" />
  14. <result column="status" property="status" jdbcType="BIGINT" />
  15. <result column="danger_deadline" property="dangerDeadLine" jdbcType="DATE" />
  16. </resultMap>
  17. <sql id="RiskPointDangerDto_Cols">
  18. A.oc_id,
  19. A.risk_point_id,
  20. B.risk_point_title,
  21. A.danger_id,
  22. C.danger_code,
  23. C.danger_title,
  24. C.danger_desc,
  25. C.danger_cat_id,
  26. C.danger_level,
  27. C.status,
  28. C.danger_deadline
  29. </sql>
  30. <!--基于ID查询-->
  31. <select id="getById" resultMap="RiskPointDangerDtoResultMap">
  32. SELECT
  33. <include refid="RiskPointDangerDto_Cols"/>
  34. FROM ent_danger AS A
  35. LEFT JOIN ent_risk_point AS B ON (A.oc_id = B.oc_id AND A.risk_point_id = B.risk_point_id)
  36. LEFT JOIN ent_danger AS C ON (A.oc_id = C.oc_id AND A.danger_id = C.danger_id)
  37. WHERE 1 = 1
  38. <if test="ocId != null">
  39. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  40. </if>
  41. <if test="dangerId != null">
  42. AND A.danger_id = #{dangerId ,jdbcType=BIGINT}
  43. </if>
  44. </select>
  45. <!--分页查询-->
  46. <select id="getByPage" parameterType="java.util.Map" resultMap="RiskPointDangerDtoResultMap">
  47. SELECT
  48. <include refid="RiskPointDangerDto_Cols"/>
  49. FROM ent_danger AS A
  50. LEFT JOIN ent_risk_point AS B ON (A.oc_id = B.oc_id AND A.risk_point_id = B.risk_point_id)
  51. LEFT JOIN ent_danger AS C ON (A.oc_id = C.oc_id AND A.danger_id = C.danger_id)
  52. WHERE 1 = 1
  53. <if test="ocId != null">
  54. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  55. </if>
  56. <if test="riskPointId != null">
  57. AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
  58. </if>
  59. <if test="status != null">
  60. AND A.status = #{status ,jdbcType=BIGINT}
  61. </if>
  62. ORDER BY A.risk_point_id ASC
  63. </select>
  64. <!--列表查询-->
  65. <select id="getByList" parameterType="java.util.Map" resultMap="RiskPointDangerDtoResultMap">
  66. SELECT
  67. <include refid="RiskPointDangerDto_Cols"/>
  68. FROM ent_danger AS A
  69. LEFT JOIN ent_risk_point AS B ON (A.oc_id = B.oc_id AND A.risk_point_id = B.risk_point_id)
  70. LEFT JOIN ent_danger AS C ON (A.oc_id = C.oc_id AND A.danger_id = C.danger_id)
  71. WHERE 1 = 1
  72. <if test="ocId != null">
  73. AND A.oc_id = #{ocId ,jdbcType=BIGINT}
  74. </if>
  75. <if test="riskPointId != null">
  76. AND A.risk_point_id = #{riskPointId ,jdbcType=BIGINT}
  77. </if>
  78. <if test="hazardId != null">
  79. AND A.hazard_id = #{hazardId ,jdbcType=BIGINT}
  80. </if>
  81. <if test="status != null">
  82. AND A.status = #{status,jdbcType=BIGINT}
  83. </if>
  84. ORDER BY A.risk_point_id ASC
  85. </select>
  86. </mapper>