PlanInfoMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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.lqkj.info.mapper.PlanInfoMapper">
  6. <resultMap type="PlanInfo" id="PlanInfoResult">
  7. <result property="planId" column="plan_id" />
  8. <result property="areaId" column="area_id" />
  9. <result property="typeId" column="type_id" />
  10. <result property="planName" column="plan_name" />
  11. <result property="content" column="content" />
  12. <result property="colour" column="colour" />
  13. <result property="acreage" column="acreage" />
  14. <result property="cost" column="cost"/>
  15. <result property="totalPct" column="total_pct"/>
  16. <result property="risk" column="risk"/>
  17. <result property="earnings" column="earnings"/>
  18. </resultMap>
  19. <sql id="selectPlanInfoVo">
  20. select plan_id, area_id, type_id, plan_name, content, colour, acreage, cost, total_pct, risk, earnings from plan_info
  21. </sql>
  22. <select id="selectPlanInfoList" parameterType="PlanInfo" resultMap="PlanInfoResult">
  23. <include refid="selectPlanInfoVo"/>
  24. <where>
  25. <if test="areaId != null "> and area_id = #{areaId}</if>
  26. <if test="typeId != null "> and type_id = #{typeId}</if>
  27. <if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
  28. </where>
  29. order by plan_id
  30. </select>
  31. <select id="selectPlanInfoByPlanId" parameterType="Integer" resultMap="PlanInfoResult">
  32. <include refid="selectPlanInfoVo"/>
  33. where plan_id = #{planId}
  34. </select>
  35. <insert id="insertPlanInfo" parameterType="PlanInfo" useGeneratedKeys="true" keyProperty="planId">
  36. insert into plan_info
  37. <trim prefix="(" suffix=")" suffixOverrides=",">
  38. <if test="areaId != null">area_id,</if>
  39. <if test="typeId != null">type_id,</if>
  40. <if test="planName != null and planName != ''">plan_name,</if>
  41. <if test="content != null and content != ''">content,</if>
  42. <if test="colour != null and colour != ''">colour,</if>
  43. <if test="acreage != null">acreage,</if>
  44. <if test="cost != null and cost != ''">cost,</if>
  45. <if test="totalPct != null and totalPct != ''">total_pct,</if>
  46. <if test="risk != null and risk != ''">risk,</if>
  47. <if test="earnings != null and earnings != ''">earnings,</if>
  48. </trim>
  49. <trim prefix="values (" suffix=")" suffixOverrides=",">
  50. <if test="areaId != null">#{areaId},</if>
  51. <if test="typeId != null">#{typeId},</if>
  52. <if test="planName != null and planName != ''">#{planName},</if>
  53. <if test="content != null and content != ''">#{content},</if>
  54. <if test="colour != null and colour != ''">#{colour},</if>
  55. <if test="acreage != null">#{acreage},</if>
  56. <if test="cost != null and cost != ''">#{cost},</if>
  57. <if test="totalPct != null and totalPct != ''">#{totalPct},</if>
  58. <if test="risk != null and risk != ''">#{risk},</if>
  59. <if test="earnings != null and earnings != ''">#{earnings},</if>
  60. </trim>
  61. </insert>
  62. <update id="updatePlanInfo" parameterType="PlanInfo">
  63. update plan_info
  64. <trim prefix="SET" suffixOverrides=",">
  65. area_id = #{areaId},
  66. type_id = #{typeId},
  67. plan_name = #{planName},
  68. content = #{content},
  69. colour = #{colour},
  70. acreage = #{acreage},
  71. cost = #{cost},
  72. total_pct = #{totalPct},
  73. risk = #{risk},
  74. earnings = #{earnings},
  75. </trim>
  76. where plan_id = #{planId}
  77. </update>
  78. <delete id="deletePlanInfoByPlanId" parameterType="Integer">
  79. delete from plan_info where plan_id = #{planId}
  80. </delete>
  81. <delete id="deletePlanInfoByPlanIds" parameterType="String">
  82. delete from plan_info where plan_id in
  83. <foreach item="planId" collection="array" open="(" separator="," close=")">
  84. #{planId}
  85. </foreach>
  86. </delete>
  87. </mapper>