OperatingReportMapper.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.ym.mec.biz.dal.dao.OperatingReportDao">
  4. <resultMap id="OperatingReport" type="com.ym.mec.biz.dal.entity.OperatingReport">
  5. <!--@mbg.generated-->
  6. <!--@Table operating_report-->
  7. <id column="id_" property="id" />
  8. <result column="organ_id_" property="organId" />
  9. <result column="organ_name_" property="organName"/>
  10. <result column="school_id_" property="schoolId" />
  11. <result column="school_name_" property="schoolName"/>
  12. <result column="sell_amount_" property="sellAmount" />
  13. <result column="service_amount_" property="serviceAmount" />
  14. <result column="refund_amount_" property="refundAmount" />
  15. <result column="income_total_" property="incomeTotal" />
  16. <result column="sell_cost_" property="sellCost" />
  17. <result column="expenses_amount_" property="expensesAmount" />
  18. <result column="variable_cost_" property="variableCost" />
  19. <result column="distribution_amount_" property="distributionAmount" />
  20. <result column="cost_amount_" property="costAmount" />
  21. <result column="profit_" property="profit" />
  22. <result column="month_" property="month" />
  23. <result column="create_time_" property="createTime" />
  24. </resultMap>
  25. <sql id="Base_Column_List">
  26. <!--@mbg.generated-->
  27. id_, organ_id_, school_id_, sell_amount_, service_amount_, refund_amount_, income_total_,
  28. sell_cost_, expenses_amount_, variable_cost_, distribution_amount_, cost_amount_,
  29. profit_, month_, create_time_
  30. </sql>
  31. <select id="get" parameterType="java.lang.Integer" resultMap="OperatingReport">
  32. <!--@mbg.generated-->
  33. select
  34. <include refid="Base_Column_List" />
  35. from operating_report
  36. where id_ = #{id}
  37. </select>
  38. <delete id="delete" parameterType="java.lang.Integer">
  39. <!--@mbg.generated-->
  40. delete from operating_report
  41. where id_ = #{id}
  42. </delete>
  43. <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.OperatingReport" useGeneratedKeys="true">
  44. <!--@mbg.generated-->
  45. insert into operating_report (organ_id_, school_id_, sell_amount_, service_amount_, refund_amount_,
  46. income_total_, sell_cost_, expenses_amount_, variable_cost_, distribution_amount_,
  47. cost_amount_, profit_, month_, create_time_)
  48. values (#{organId}, #{schoolId}, #{sellAmount}, #{serviceAmount}, #{refundAmount},
  49. #{incomeTotal}, #{sellCost}, #{expensesAmount}, #{variableCost}, #{distributionAmount},
  50. #{costAmount}, #{profit}, #{month}, #{createTime})
  51. </insert>
  52. <update id="update" parameterType="com.ym.mec.biz.dal.entity.OperatingReport">
  53. <!--@mbg.generated-->
  54. update operating_report
  55. <set>
  56. <if test="organId != null">
  57. organ_id_ = #{organId},
  58. </if>
  59. <if test="schoolId != null">
  60. school_id_ = #{schoolId},
  61. </if>
  62. <if test="sellAmount != null">
  63. sell_amount_ = #{sellAmount},
  64. </if>
  65. <if test="serviceAmount != null">
  66. service_amount_ = #{serviceAmount},
  67. </if>
  68. <if test="refundAmount != null">
  69. refund_amount_ = #{refundAmount},
  70. </if>
  71. <if test="incomeTotal != null">
  72. income_total_ = #{incomeTotal},
  73. </if>
  74. <if test="sellCost != null">
  75. sell_cost_ = #{sellCost},
  76. </if>
  77. <if test="expensesAmount != null">
  78. expenses_amount_ = #{expensesAmount},
  79. </if>
  80. <if test="variableCost != null">
  81. variable_cost_ = #{variableCost},
  82. </if>
  83. <if test="distributionAmount != null">
  84. distribution_amount_ = #{distributionAmount},
  85. </if>
  86. <if test="costAmount != null">
  87. cost_amount_ = #{costAmount},
  88. </if>
  89. <if test="profit != null">
  90. profit_ = #{profit},
  91. </if>
  92. <if test="month != null">
  93. month_ = #{month},
  94. </if>
  95. <if test="createTime != null">
  96. create_time_ = #{createTime},
  97. </if>
  98. </set>
  99. where id_ = #{id}
  100. </update>
  101. <!-- 分页查询 -->
  102. <select id="queryPage" resultMap="OperatingReport" parameterType="map">
  103. SELECT opr.*,o.name_ organ_name_ FROM operating_report opr
  104. LEFT JOIN organization o ON o.id_ = opr.organ_id_
  105. LEFT JOIN school s ON s.id_= opr.school_id_
  106. <include refid="queryPageSql"/>
  107. ORDER BY opr.month_ DESC,opr.organ_id_ ASC
  108. <include refid="global.limit"/>
  109. </select>
  110. <!-- 查询当前表的总记录数 -->
  111. <select id="queryCount" resultType="int">
  112. SELECT COUNT(*) FROM operating_report opr
  113. <include refid="queryPageSql"/>
  114. </select>
  115. <sql id="queryPageSql">
  116. <where>
  117. <if test="organIdList != null and organIdList != ''">
  118. AND FIND_IN_SET(opr.organ_id_,#{organIdList})
  119. </if>
  120. <if test="schoolId != null">
  121. AND opr.school_id_ = #{schoolId}
  122. </if>
  123. <if test="startTime != null">
  124. AND opr.month_ >= #{startTime}
  125. </if>
  126. <if test="endTime != null">
  127. AND opr.month_ &lt;= #{endTime}
  128. </if>
  129. </where>
  130. </sql>
  131. </mapper>