YdbpMapper.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.siwei.apply.mapper.YdbpMapper">
  6. <!-- ResultMap 映射 -->
  7. <resultMap id="YdbpResultMap" type="com.siwei.apply.domain.Ydbp">
  8. <id property="id" column="id"/>
  9. <result property="projectId" column="project_id"/>
  10. <result property="tdyt" column="tdyt"/>
  11. <result property="ydArea" column="yd_area"/>
  12. <result property="ydUnit" column="yd_unit"/>
  13. <result property="zsArea" column="zs_area"/>
  14. <result property="zsUnit" column="zs_unit"/>
  15. <result property="hasZZ" column="has_zz"/>
  16. <result property="bpDate" column="bp_date"/>
  17. <result property="pfwh" column="pfwh"/>
  18. <result property="pfDate" column="pf_date"/>
  19. <result property="attachment" column="attachment" typeHandler="com.siwei.apply.handler.JsonbTypeHandler"/>
  20. <result property="hasOnchain" column="has_onchain"/>
  21. <result property="creatorId" column="creator_id"/>
  22. <result property="createdAt" column="created_at"/>
  23. <result property="updatedAt" column="updated_at"/>
  24. </resultMap>
  25. <select id="isExit" resultType="Boolean">
  26. SELECT COUNT(1) > 0
  27. FROM t_ydbp
  28. WHERE project_id = #{projectId}
  29. </select>
  30. <!-- 插入语句 -->
  31. <insert id="add" parameterType="com.siwei.apply.domain.Ydbp">
  32. INSERT INTO t_ydbp (id, project_id, tdyt, yd_area, yd_unit, zs_area, zs_unit, has_zz,
  33. bp_date, pfwh, pf_date, has_onchain, creator_id, created_at, updated_at)
  34. VALUES (#{id}, #{projectId}, #{tdyt}, #{ydArea}, #{ydUnit}, #{zsArea}, #{zsUnit}, #{hasZZ},
  35. #{bpDate}, #{pfwh}, #{pfDate}, false, #{creatorId}, now(), now())
  36. </insert>
  37. <!-- 查询语句 -->
  38. <select id="get" resultMap="YdbpResultMap">
  39. SELECT *
  40. FROM t_ydbp
  41. WHERE project_id = #{projectId}
  42. </select>
  43. <!-- 更新语句 -->
  44. <update id="update" parameterType="com.siwei.apply.domain.vo.YdbpUpdateVo">
  45. UPDATE t_ydbp
  46. <set>
  47. <if test="projectId != null">project_id = #{projectId},</if>
  48. <if test="tdyt != null">tdyt = #{tdyt},</if>
  49. <if test="ydArea != null">yd_area = #{ydArea},</if>
  50. <if test="ydUnit != null">yd_unit = #{ydUnit},</if>
  51. <if test="zsArea != null">zs_area = #{zsArea},</if>
  52. <if test="zsUnit != null">zs_unit = #{zsUnit},</if>
  53. <if test="hasZZ != null">has_zz = #{hasZZ},</if>
  54. <if test="bpDate != null">bp_date = #{bpDate},</if>
  55. <if test="pfwh != null">pfwh = #{pfwh},</if>
  56. <if test="pfDate != null">pf_date = #{pfDate},</if>
  57. <if test="hasOnchain != null">has_onchain = #{hasOnchain},</if>
  58. updated_at = now()
  59. </set>
  60. WHERE id = #{id}
  61. </update>
  62. </mapper>