RevenueInfo.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. <!-- namespace必须指向DAO接口 -->
  5. <mapper namespace="com.jpsoft.employment.modules.base.dao.RevenueInfoDAO">
  6. <resultMap id="RevenueInfoMap" type="com.jpsoft.employment.modules.base.entity.RevenueInfo">
  7. <id property="id" column="id_" />
  8. <result property="amount" column="amount_" />
  9. <result property="workOrderId" column="work_order_id" />
  10. <result property="dateTime" column="date_time" />
  11. <result property="status" column="status_" />
  12. <result property="createTime" column="create_time" />
  13. <result property="updateTime" column="update_time" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="createBy" column="create_by" />
  16. <result property="updateBy" column="update_by" />
  17. </resultMap>
  18. <insert id="insert" parameterType="com.jpsoft.employment.modules.base.entity.RevenueInfo">
  19. <!--
  20. <selectKey resultType="java.lang.String" order="BEFORE" keyProperty="id">
  21. select sys_guid() from dual
  22. </selectKey>
  23. -->
  24. <![CDATA[
  25. insert into base_revenue_info
  26. (id_,amount_,work_order_id,date_time,status_,create_time,update_time,del_flag,create_by,update_by)
  27. values
  28. (
  29. #{id,jdbcType=VARCHAR}
  30. ,#{amount,jdbcType= NUMERIC }
  31. ,#{workOrderId,jdbcType=VARCHAR}
  32. ,#{dateTime,jdbcType= TIMESTAMP }
  33. ,#{status,jdbcType=VARCHAR}
  34. ,#{createTime,jdbcType= TIMESTAMP }
  35. ,#{updateTime,jdbcType= TIMESTAMP }
  36. ,#{delFlag,jdbcType= NUMERIC }
  37. ,#{createBy,jdbcType=VARCHAR}
  38. ,#{updateBy,jdbcType=VARCHAR}
  39. )
  40. ]]>
  41. </insert>
  42. <delete id="delete" parameterType="string">
  43. delete from base_revenue_info where id_=#{id,jdbcType=VARCHAR}
  44. </delete>
  45. <update id="update" parameterType="com.jpsoft.employment.modules.base.entity.RevenueInfo">
  46. update base_revenue_info
  47. <set>
  48. <if test="amount!=null">
  49. amount_=#{amount,jdbcType= NUMERIC },
  50. </if>
  51. <if test="workOrderId!=null">
  52. work_order_id=#{workOrderId,jdbcType=VARCHAR},
  53. </if>
  54. <if test="dateTime!=null">
  55. date_time=#{dateTime,jdbcType= TIMESTAMP },
  56. </if>
  57. <if test="status!=null">
  58. status_=#{status,jdbcType=VARCHAR},
  59. </if>
  60. <if test="createTime!=null">
  61. create_time=#{createTime,jdbcType= TIMESTAMP },
  62. </if>
  63. <if test="updateTime!=null">
  64. update_time=#{updateTime,jdbcType= TIMESTAMP },
  65. </if>
  66. <if test="delFlag!=null">
  67. del_flag=#{delFlag,jdbcType= NUMERIC },
  68. </if>
  69. <if test="createBy!=null">
  70. create_by=#{createBy,jdbcType=VARCHAR},
  71. </if>
  72. <if test="updateBy!=null">
  73. update_by=#{updateBy,jdbcType=VARCHAR},
  74. </if>
  75. </set>
  76. where id_=#{id}
  77. </update>
  78. <select id="get" parameterType="string" resultMap="RevenueInfoMap">
  79. select
  80. id_,amount_,work_order_id,date_time,status_,create_time,update_time,del_flag,create_by,update_by from base_revenue_info where id_=#{0}
  81. </select>
  82. <select id="exist" parameterType="string" resultType="int">
  83. select count(*) from base_revenue_info where id_=#{0}
  84. </select>
  85. <select id="list" resultMap="RevenueInfoMap">
  86. select * from base_revenue_info
  87. </select>
  88. <select id="search" parameterType="hashmap" resultMap="RevenueInfoMap">
  89. <![CDATA[
  90. select * from base_revenue_info
  91. ]]>
  92. <where>
  93. <if test="searchParams.id != null">
  94. and ID_ like #{searchParams.id}
  95. </if>
  96. </where>
  97. <foreach item="sort" collection="sortList" open="order by" separator=",">
  98. ${sort.name} ${sort.order}
  99. </foreach>
  100. </select>
  101. <select id="getRevenueAmount" resultType="integer">
  102. SELECT SUM(amount_) FROM base_revenue_info a
  103. LEFT JOIN base_work_order b ON a.work_order_id = b.id_
  104. WHERE a.del_flag = FALSE
  105. <if test="paid = true">
  106. AND a.status_ = '2'
  107. </if>
  108. <if test="technicianId != null">
  109. AND b.technician_id = #{technicianId}
  110. </if>
  111. </select>
  112. </mapper>