GyjsydscdjMapper.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.siwei.apply.mapper.GyjsydscdjMapper">
  5. <resultMap id="GyjsydscdjResultMap" type="com.siwei.apply.domain.Gyjsydscdj">
  6. <id property="id" column="id"/>
  7. <result property="projectId" column="project_id"/>
  8. <result property="qlr" column="qlr"/>
  9. <result property="gyqk" column="gyqk"/>
  10. <result property="zl" column="zl"/>
  11. <result property="qllx" column="qllx"/>
  12. <result property="qlxz" column="qlxz"/>
  13. <result property="yt" column="yt"/>
  14. <result property="area" column="area"/>
  15. <result property="bdcdyh" column="bdcdyh"/>
  16. <result property="bdczh" column="bdczh"/>
  17. <result property="djjg" column="djjg"/>
  18. <result property="djDate" column="dj_date"/>
  19. <result property="hasOnchain" column="has_onchain"/>
  20. <result property="creatorId" column="creator_id"/>
  21. <result property="createdAt" column="created_at"/>
  22. <result property="updatedAt" column="updated_at"/>
  23. </resultMap>
  24. <select id="isExit" resultType="Boolean">
  25. SELECT COUNT(1) > 0
  26. FROM t_gyjsydscdj
  27. WHERE project_id = #{projectId}
  28. </select>
  29. <insert id="add" parameterType="com.siwei.apply.domain.Gyjsydscdj">
  30. INSERT INTO t_gyjsydscdj (id, project_id, qlr, gyqk, zl, qllx, qlxz, yt, area, bdcdyh, bdczh, djjg, dj_date,
  31. has_onchain, creator_id, created_at, updated_at)
  32. VALUES (#{id}, #{projectId}, #{qlr}, #{gyqk}, #{zl}, #{qllx}, #{qlxz}, #{yt}, #{area}, #{bdcdyh}, #{bdczh},
  33. #{djjg}, #{djDate},
  34. #{hasOnchain}, #{creatorId}, now(), now())
  35. </insert>
  36. <!-- 根据项目ID获取记录 -->
  37. <select id="get" resultMap="GyjsydscdjResultMap" parameterType="String">
  38. SELECT *
  39. FROM t_gyjsydscdj
  40. WHERE project_id = #{projectId}
  41. </select>
  42. <!-- 更新记录 -->
  43. <update id="update" parameterType="com.siwei.apply.domain.vo.GyjsydscdjUpdateVo">
  44. UPDATE t_gyjsydscdj
  45. <set>
  46. <if test="projectId != null">project_id = #{projectId},</if>
  47. <if test="qlr != null">qlr = #{qlr},</if>
  48. <if test="gyqk != null">gyqk = #{gyqk},</if>
  49. <if test="zl != null">zl = #{zl},</if>
  50. <if test="qllx != null">qllx = #{qllx},</if>
  51. <if test="qlxz != null">qlxz = #{qlxz},</if>
  52. <if test="yt != null">yt = #{yt},</if>
  53. <if test="area != null">area = #{area},</if>
  54. <if test="bdcdyh != null">bdcdyh = #{bdcdyh},</if>
  55. <if test="bdczh != null">bdczh = #{bdczh},</if>
  56. <if test="djjg != null">djjg = #{djjg},</if>
  57. <if test="djDate != null">dj_date = #{djDate},</if>
  58. <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
  59. updated_at = now()
  60. </set>
  61. WHERE id = #{id}
  62. </update>
  63. <update id="updateHasOnchain">
  64. UPDATE t_gyjsydscdj
  65. SET has_onchain = #{hasOnchain}, updated_at = now()
  66. WHERE id = #{id}
  67. </update>
  68. </mapper>