InspectionStandardMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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.bz.smart_city.dao.InspectionStandardMapper">
  4. <!--auto generated Code-->
  5. <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.InspectionStandard">
  6. <result column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="standard_name" property="standardName" jdbcType="VARCHAR"/>
  8. <result column="status" property="status" jdbcType="INTEGER"/>
  9. <result column="date_create" property="dateCreate" jdbcType="TIMESTAMP"/>
  10. <result column="date_update" property="dateUpdate" jdbcType="TIMESTAMP"/>
  11. <result column="create_by" property="createBy" jdbcType="VARCHAR"/>
  12. <result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
  13. <result column="site_id" property="siteId" jdbcType="INTEGER"/>
  14. </resultMap>
  15. <!--auto generated Code-->
  16. <sql id="Base_Column_List">
  17. id,
  18. standard_name,
  19. status,
  20. date_create,
  21. date_update,
  22. create_by,
  23. update_by,
  24. site_id
  25. </sql>
  26. <!--auto generated Code-->
  27. <insert id="insert" useGeneratedKeys="true" keyProperty="inspectionStandard.id">
  28. INSERT INTO sc_inspection_standard (
  29. id,
  30. standard_name,
  31. status,
  32. date_create,
  33. date_update,
  34. create_by,
  35. update_by,
  36. site_id
  37. ) VALUES (
  38. #{inspectionStandard.id,jdbcType=INTEGER},
  39. #{inspectionStandard.standardName,jdbcType=VARCHAR},
  40. #{inspectionStandard.status,jdbcType=INTEGER},
  41. #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},
  42. #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},
  43. #{inspectionStandard.createBy,jdbcType=VARCHAR},
  44. #{inspectionStandard.updateBy,jdbcType=VARCHAR},
  45. #{inspectionStandard.siteId,jdbcType=INTEGER}
  46. )
  47. </insert>
  48. <!--auto generated Code-->
  49. <insert id="insertSelective" useGeneratedKeys="true" keyProperty="inspectionStandard.id">
  50. INSERT INTO sc_inspection_standard
  51. <trim prefix="(" suffix=")" suffixOverrides=",">
  52. <if test="inspectionStandard.id!=null"> id,</if>
  53. <if test="inspectionStandard.standardName!=null"> standard_name,</if>
  54. <if test="inspectionStandard.status!=null"> status,</if>
  55. <if test="inspectionStandard.dateCreate!=null"> date_create,</if>
  56. <if test="inspectionStandard.dateUpdate!=null"> date_update,</if>
  57. <if test="inspectionStandard.createBy!=null"> create_by,</if>
  58. <if test="inspectionStandard.updateBy!=null"> update_by,</if>
  59. <if test="inspectionStandard.siteId!=null"> site_id</if>
  60. </trim>
  61. VALUES
  62. <trim prefix="(" suffix=")" suffixOverrides=",">
  63. <if test="inspectionStandard.id!=null"> #{inspectionStandard.id,jdbcType=INTEGER},</if>
  64. <if test="inspectionStandard.standardName!=null"> #{inspectionStandard.standardName,jdbcType=VARCHAR},</if>
  65. <if test="inspectionStandard.status!=null"> #{inspectionStandard.status,jdbcType=INTEGER},</if>
  66. <if test="inspectionStandard.dateCreate!=null"> #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},</if>
  67. <if test="inspectionStandard.dateUpdate!=null"> #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},</if>
  68. <if test="inspectionStandard.createBy!=null"> #{inspectionStandard.createBy,jdbcType=VARCHAR},</if>
  69. <if test="inspectionStandard.updateBy!=null"> #{inspectionStandard.updateBy,jdbcType=VARCHAR},</if>
  70. <if test="inspectionStandard.siteId!=null"> #{inspectionStandard.siteId,jdbcType=INTEGER}</if>
  71. </trim>
  72. </insert>
  73. <!--auto generated Code-->
  74. <insert id="insertList">
  75. INSERT INTO sc_inspection_standard(
  76. id,
  77. standard_name,
  78. status,
  79. date_create,
  80. date_update,
  81. create_by,
  82. update_by,
  83. site_id
  84. )VALUES
  85. <foreach collection="inspectionStandards" item="inspectionStandard" index="index" separator=",">
  86. (
  87. #{inspectionStandard.id,jdbcType=INTEGER},
  88. #{inspectionStandard.standardName,jdbcType=VARCHAR},
  89. #{inspectionStandard.status,jdbcType=INTEGER},
  90. #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},
  91. #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},
  92. #{inspectionStandard.createBy,jdbcType=VARCHAR},
  93. #{inspectionStandard.updateBy,jdbcType=VARCHAR},
  94. #{inspectionStandard.siteId,jdbcType=INTEGER}
  95. )
  96. </foreach>
  97. </insert>
  98. <!--auto generated Code-->
  99. <update id="updateByPrimaryKeySelective">
  100. UPDATE sc_inspection_standard
  101. <set>
  102. <if test="inspectionStandard.id != null"> id = #{inspectionStandard.id,jdbcType=INTEGER},</if>
  103. <if test="inspectionStandard.standardName != null"> standard_name = #{inspectionStandard.standardName,jdbcType=VARCHAR},</if>
  104. <if test="inspectionStandard.status != null"> status = #{inspectionStandard.status,jdbcType=INTEGER},</if>
  105. <if test="inspectionStandard.dateCreate != null"> date_create = #{inspectionStandard.dateCreate,jdbcType=TIMESTAMP},</if>
  106. <if test="inspectionStandard.dateUpdate != null"> date_update = #{inspectionStandard.dateUpdate,jdbcType=TIMESTAMP},</if>
  107. <if test="inspectionStandard.createBy != null"> create_by = #{inspectionStandard.createBy,jdbcType=VARCHAR},</if>
  108. <if test="inspectionStandard.updateBy != null"> update_by = #{inspectionStandard.updateBy,jdbcType=VARCHAR},</if>
  109. <if test="inspectionStandard.siteId != null"> site_id = #{inspectionStandard.siteId,jdbcType=INTEGER}</if>
  110. </set>
  111. WHERE id = #{inspectionStandard.id,jdbcType=INTEGER}
  112. </update>
  113. <select id="findByNameUnique" resultType="java.lang.Integer">
  114. select count(1) from sc_inspection_standard
  115. where status = 1 and standard_name = #{standardName} and site_id = #{siteId}
  116. <if test="id != null"> and id != #{id}</if>
  117. </select>
  118. <select id="getList" resultType="com.bz.smart_city.dto.InspectionStandardDto">
  119. select <include refid="Base_Column_List"/> from sc_inspection_standard
  120. where status = 1
  121. <if test="siteId != null"> and site_id = #{siteId} </if>
  122. <if test="name != null and name != ''"> AND standard_name LIKE concat('%',#{name},'%')</if>
  123. order by date_create desc
  124. </select>
  125. </mapper>