西藏巴青项目

BizLivestockOwnershipHouseholdMapper.xml 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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. <!-- 有无畜户数据填报 biz_livestock_ownership_household -->
  4. <mapper namespace="com.ruoyi.web.modules.industryservice.mapper.BizLivestockOwnershipHouseholdMapper">
  5. <resultMap type="com.ruoyi.web.modules.industryservice.domain.BizLivestockOwnershipHousehold"
  6. id="BizLivestockOwnershipHouseholdResult">
  7. <id property="id" column="id"/>
  8. <result property="statYear" column="stat_year"/>
  9. <result property="statMonth" column="stat_month"/>
  10. <result property="townDeptId" column="town_dept_id"/>
  11. <result property="townName" column="town_name"/>
  12. <result property="villageDeptId" column="village_dept_id"/>
  13. <result property="villageName" column="village_name"/>
  14. <result property="withLivestockHouseholdCount" column="with_livestock_household_count"/>
  15. <result property="withLivestockPopulationCount" column="with_livestock_population_count"/>
  16. <result property="withLivestockLaborCount" column="with_livestock_labor_count"/>
  17. <result property="withLivestockAnimalCount" column="with_livestock_animal_count"/>
  18. <result property="withoutLivestockHouseholdCount" column="without_livestock_household_count"/>
  19. <result property="withoutLivestockPopulationCount" column="without_livestock_population_count"/>
  20. <result property="withoutLivestockLaborCount" column="without_livestock_labor_count"/>
  21. <result property="createBy" column="create_by"/>
  22. <result property="createTime" column="create_time"/>
  23. <result property="updateBy" column="update_by"/>
  24. <result property="updateTime" column="update_time"/>
  25. <result property="remark" column="remark"/>
  26. </resultMap>
  27. <sql id="selectVo">
  28. select r.id, r.stat_year, r.stat_month, r.town_dept_id, r.town_name,
  29. r.village_dept_id, r.village_name,
  30. r.with_livestock_household_count, r.with_livestock_population_count,
  31. r.with_livestock_labor_count, r.with_livestock_animal_count,
  32. r.without_livestock_household_count, r.without_livestock_population_count,
  33. r.without_livestock_labor_count,
  34. r.create_by, r.create_time, r.update_by, r.update_time, r.remark
  35. from biz_livestock_ownership_household r
  36. </sql>
  37. <select id="selectBizLivestockOwnershipHouseholdById" parameterType="long"
  38. resultMap="BizLivestockOwnershipHouseholdResult">
  39. <include refid="selectVo"/>
  40. where r.id = #{id}
  41. </select>
  42. <select id="countByYearMonthAndVillageExcludeId" resultType="int">
  43. select count(1)
  44. from biz_livestock_ownership_household
  45. where stat_year = #{statYear}
  46. and stat_month = #{statMonth}
  47. and village_dept_id = #{villageDeptId}
  48. <if test="excludeId != null">
  49. and id != #{excludeId}
  50. </if>
  51. </select>
  52. <select id="selectByYearMonthAndVillage" resultMap="BizLivestockOwnershipHouseholdResult">
  53. <include refid="selectVo"/>
  54. where r.stat_year = #{statYear}
  55. and r.stat_month = #{statMonth}
  56. and r.village_dept_id = #{villageDeptId}
  57. limit 1
  58. </select>
  59. <select id="selectBizLivestockOwnershipHouseholdList"
  60. parameterType="com.ruoyi.web.modules.industryservice.domain.BizLivestockOwnershipHousehold"
  61. resultMap="BizLivestockOwnershipHouseholdResult">
  62. <include refid="selectVo"/>
  63. left join sys_dept d on r.town_dept_id = d.dept_id
  64. <where>
  65. <if test="statYear != null">
  66. and r.stat_year = #{statYear}
  67. </if>
  68. <if test="statMonth != null">
  69. and r.stat_month = #{statMonth}
  70. </if>
  71. <if test="townDeptId != null">
  72. and r.town_dept_id = #{townDeptId}
  73. </if>
  74. <if test="villageDeptId != null">
  75. and r.village_dept_id = #{villageDeptId}
  76. </if>
  77. <if test="townName != null and townName != ''">
  78. and r.town_name like concat('%', #{townName}, '%')
  79. </if>
  80. <if test="villageName != null and villageName != ''">
  81. and r.village_name like concat('%', #{villageName}, '%')
  82. </if>
  83. ${params.dataScope}
  84. </where>
  85. order by r.stat_year desc, r.stat_month desc, d.order_num asc, r.village_dept_id asc, r.id desc
  86. </select>
  87. <insert id="insertBizLivestockOwnershipHousehold"
  88. parameterType="com.ruoyi.web.modules.industryservice.domain.BizLivestockOwnershipHousehold"
  89. useGeneratedKeys="true" keyProperty="id">
  90. insert into biz_livestock_ownership_household (
  91. stat_year, stat_month, town_dept_id, town_name, village_dept_id, village_name,
  92. with_livestock_household_count, with_livestock_population_count,
  93. with_livestock_labor_count, with_livestock_animal_count,
  94. without_livestock_household_count, without_livestock_population_count,
  95. without_livestock_labor_count,
  96. create_by, create_time, remark
  97. ) values (
  98. #{statYear}, #{statMonth}, #{townDeptId}, #{townName}, #{villageDeptId}, #{villageName},
  99. #{withLivestockHouseholdCount}, #{withLivestockPopulationCount},
  100. #{withLivestockLaborCount}, #{withLivestockAnimalCount},
  101. #{withoutLivestockHouseholdCount}, #{withoutLivestockPopulationCount},
  102. #{withoutLivestockLaborCount},
  103. #{createBy}, sysdate(), #{remark}
  104. )
  105. </insert>
  106. <update id="updateBizLivestockOwnershipHousehold"
  107. parameterType="com.ruoyi.web.modules.industryservice.domain.BizLivestockOwnershipHousehold">
  108. update biz_livestock_ownership_household set
  109. stat_year = #{statYear},
  110. stat_month = #{statMonth},
  111. town_dept_id = #{townDeptId},
  112. town_name = #{townName},
  113. village_dept_id = #{villageDeptId},
  114. village_name = #{villageName},
  115. with_livestock_household_count = #{withLivestockHouseholdCount},
  116. with_livestock_population_count = #{withLivestockPopulationCount},
  117. with_livestock_labor_count = #{withLivestockLaborCount},
  118. with_livestock_animal_count = #{withLivestockAnimalCount},
  119. without_livestock_household_count = #{withoutLivestockHouseholdCount},
  120. without_livestock_population_count = #{withoutLivestockPopulationCount},
  121. without_livestock_labor_count = #{withoutLivestockLaborCount},
  122. update_by = #{updateBy},
  123. update_time = sysdate(),
  124. remark = #{remark}
  125. where id = #{id}
  126. </update>
  127. <delete id="deleteBizLivestockOwnershipHouseholdByIds">
  128. delete from biz_livestock_ownership_household where id in
  129. <foreach collection="ids" item="id" open="(" separator="," close=")">
  130. #{id}
  131. </foreach>
  132. </delete>
  133. </mapper>