西藏巴青项目

BizYakOutboundReportMapper.xml 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  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.ruoyi.web.modules.industryservice.mapper.BizYakOutboundReportMapper">
  4. <resultMap type="com.ruoyi.web.modules.industryservice.domain.BizYakOutboundReport" id="BizYakOutboundReportResult">
  5. <id property="id" column="id"/>
  6. <result property="statYear" column="stat_year"/>
  7. <result property="statMonth" column="stat_month"/>
  8. <result property="townDeptId" column="town_dept_id"/>
  9. <result property="townName" column="town_name"/>
  10. <result property="villageDeptId" column="village_dept_id"/>
  11. <result property="villageName" column="village_name"/>
  12. <result property="farmerHouseholdCount" column="farmer_household_count"/>
  13. <result property="farmerPopulationCount" column="farmer_population_count"/>
  14. <result property="yakOutboundCount" column="yak_outbound_count"/>
  15. <result property="cattleOutboundCount" column="cattle_outbound_count"/>
  16. <result property="sheepOutboundCount" column="sheep_outbound_count"/>
  17. <result property="goatOutboundCount" column="goat_outbound_count"/>
  18. <result property="horseMuleOutboundCount" column="horse_mule_outbound_count"/>
  19. <result property="donkeyOutboundCount" column="donkey_outbound_count"/>
  20. <result property="selfConsumptionCattleCount" column="self_consumption_cattle_count"/>
  21. <result property="selfConsumptionSheepCount" column="self_consumption_sheep_count"/>
  22. <result property="selfConsumptionGoatCount" column="self_consumption_goat_count"/>
  23. <result property="createBy" column="create_by"/>
  24. <result property="createTime" column="create_time"/>
  25. <result property="updateBy" column="update_by"/>
  26. <result property="updateTime" column="update_time"/>
  27. <result property="remark" column="remark"/>
  28. </resultMap>
  29. <sql id="selectVo">
  30. select r.id, r.stat_year, r.stat_month, r.town_dept_id, r.town_name,
  31. r.village_dept_id, r.village_name,
  32. r.farmer_household_count, r.farmer_population_count,
  33. r.yak_outbound_count, r.cattle_outbound_count,
  34. r.sheep_outbound_count, r.goat_outbound_count,
  35. r.horse_mule_outbound_count, r.donkey_outbound_count,
  36. r.self_consumption_cattle_count, r.self_consumption_sheep_count,
  37. r.self_consumption_goat_count,
  38. r.create_by, r.create_time, r.update_by, r.update_time, r.remark
  39. from biz_yak_outbound_report r
  40. </sql>
  41. <select id="selectBizYakOutboundReportById" parameterType="long" resultMap="BizYakOutboundReportResult">
  42. <include refid="selectVo"/>
  43. where r.id = #{id}
  44. </select>
  45. <select id="countByYearMonthAndVillageExcludeId" resultType="int">
  46. select count(1)
  47. from biz_yak_outbound_report
  48. where stat_year = #{statYear}
  49. and stat_month = #{statMonth}
  50. and village_dept_id = #{villageDeptId}
  51. <if test="excludeId != null">
  52. and id != #{excludeId}
  53. </if>
  54. </select>
  55. <select id="selectByYearMonthAndVillage" resultMap="BizYakOutboundReportResult">
  56. <include refid="selectVo"/>
  57. where r.stat_year = #{statYear}
  58. and r.stat_month = #{statMonth}
  59. and r.village_dept_id = #{villageDeptId}
  60. limit 1
  61. </select>
  62. <select id="selectBizYakOutboundReportList" parameterType="com.ruoyi.web.modules.industryservice.domain.BizYakOutboundReport"
  63. resultMap="BizYakOutboundReportResult">
  64. <include refid="selectVo"/>
  65. left join sys_dept d on r.town_dept_id = d.dept_id
  66. <where>
  67. <if test="statYear != null">
  68. and r.stat_year = #{statYear}
  69. </if>
  70. <if test="statMonth != null">
  71. and r.stat_month = #{statMonth}
  72. </if>
  73. <if test="townDeptId != null">
  74. and r.town_dept_id = #{townDeptId}
  75. </if>
  76. <if test="villageDeptId != null">
  77. and r.village_dept_id = #{villageDeptId}
  78. </if>
  79. <if test="townName != null and townName != ''">
  80. and r.town_name like concat('%', #{townName}, '%')
  81. </if>
  82. <if test="villageName != null and villageName != ''">
  83. and r.village_name like concat('%', #{villageName}, '%')
  84. </if>
  85. ${params.dataScope}
  86. </where>
  87. order by r.stat_year desc, r.stat_month desc, d.order_num asc, r.village_dept_id asc, r.id desc
  88. </select>
  89. <insert id="insertBizYakOutboundReport" parameterType="com.ruoyi.web.modules.industryservice.domain.BizYakOutboundReport"
  90. useGeneratedKeys="true" keyProperty="id">
  91. insert into biz_yak_outbound_report (
  92. stat_year, stat_month, town_dept_id, town_name, village_dept_id, village_name,
  93. farmer_household_count, farmer_population_count,
  94. yak_outbound_count, cattle_outbound_count,
  95. sheep_outbound_count, goat_outbound_count,
  96. horse_mule_outbound_count, donkey_outbound_count,
  97. self_consumption_cattle_count, self_consumption_sheep_count, self_consumption_goat_count,
  98. create_by, create_time, remark
  99. ) values (
  100. #{statYear}, #{statMonth}, #{townDeptId}, #{townName}, #{villageDeptId}, #{villageName},
  101. #{farmerHouseholdCount}, #{farmerPopulationCount},
  102. #{yakOutboundCount}, #{cattleOutboundCount},
  103. #{sheepOutboundCount}, #{goatOutboundCount},
  104. #{horseMuleOutboundCount}, #{donkeyOutboundCount},
  105. #{selfConsumptionCattleCount}, #{selfConsumptionSheepCount}, #{selfConsumptionGoatCount},
  106. #{createBy}, sysdate(), #{remark}
  107. )
  108. </insert>
  109. <update id="updateBizYakOutboundReport" parameterType="com.ruoyi.web.modules.industryservice.domain.BizYakOutboundReport">
  110. update biz_yak_outbound_report set
  111. stat_year = #{statYear},
  112. stat_month = #{statMonth},
  113. town_dept_id = #{townDeptId},
  114. town_name = #{townName},
  115. village_dept_id = #{villageDeptId},
  116. village_name = #{villageName},
  117. farmer_household_count = #{farmerHouseholdCount},
  118. farmer_population_count = #{farmerPopulationCount},
  119. yak_outbound_count = #{yakOutboundCount},
  120. cattle_outbound_count = #{cattleOutboundCount},
  121. sheep_outbound_count = #{sheepOutboundCount},
  122. goat_outbound_count = #{goatOutboundCount},
  123. horse_mule_outbound_count = #{horseMuleOutboundCount},
  124. donkey_outbound_count = #{donkeyOutboundCount},
  125. self_consumption_cattle_count = #{selfConsumptionCattleCount},
  126. self_consumption_sheep_count = #{selfConsumptionSheepCount},
  127. self_consumption_goat_count = #{selfConsumptionGoatCount},
  128. update_by = #{updateBy},
  129. update_time = sysdate(),
  130. remark = #{remark}
  131. where id = #{id}
  132. </update>
  133. <delete id="deleteBizYakOutboundReportByIds">
  134. delete from biz_yak_outbound_report where id in
  135. <foreach collection="ids" item="id" open="(" separator="," close=")">
  136. #{id}
  137. </foreach>
  138. </delete>
  139. <delete id="deleteByYearMonth">
  140. delete from biz_yak_outbound_report
  141. where stat_year = #{statYear}
  142. and stat_month = #{statMonth}
  143. </delete>
  144. </mapper>