PlanInfoMapper.xml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. </resultMap>
  15. <sql id="selectPlanInfoVo">
  16. select plan_id, area_id, type_id, plan_name, content, colour, acreage from plan_info
  17. </sql>
  18. <select id="selectPlanInfoList" parameterType="PlanInfo" resultMap="PlanInfoResult">
  19. <include refid="selectPlanInfoVo"/>
  20. <where>
  21. <if test="areaId != null "> and area_id = #{areaId}</if>
  22. <if test="typeId != null "> and type_id = #{typeId}</if>
  23. <if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
  24. </where>
  25. order by plan_id
  26. </select>
  27. <select id="selectPlanInfoByPlanId" parameterType="Integer" resultMap="PlanInfoResult">
  28. <include refid="selectPlanInfoVo"/>
  29. where plan_id = #{planId}
  30. </select>
  31. <insert id="insertPlanInfo" parameterType="PlanInfo" useGeneratedKeys="true" keyProperty="planId">
  32. insert into plan_info
  33. <trim prefix="(" suffix=")" suffixOverrides=",">
  34. <if test="areaId != null">area_id,</if>
  35. <if test="typeId != null">type_id,</if>
  36. <if test="planName != null and planName != ''">plan_name,</if>
  37. <if test="content != null and content != ''">content,</if>
  38. <if test="colour != null and colour != ''">colour,</if>
  39. <if test="acreage != null">acreage,</if>
  40. </trim>
  41. <trim prefix="values (" suffix=")" suffixOverrides=",">
  42. <if test="areaId != null">#{areaId},</if>
  43. <if test="typeId != null">#{typeId},</if>
  44. <if test="planName != null and planName != ''">#{planName},</if>
  45. <if test="content != null and content != ''">#{content},</if>
  46. <if test="colour != null and colour != ''">#{colour},</if>
  47. <if test="acreage != null">#{acreage},</if>
  48. </trim>
  49. </insert>
  50. <update id="updatePlanInfo" parameterType="PlanInfo">
  51. update plan_info
  52. <trim prefix="SET" suffixOverrides=",">
  53. area_id = #{areaId},
  54. type_id = #{typeId},
  55. plan_name = #{planName},
  56. content = #{content},
  57. colour = #{colour},
  58. acreage = #{acreage},
  59. </trim>
  60. where plan_id = #{planId}
  61. </update>
  62. <delete id="deletePlanInfoByPlanId" parameterType="Integer">
  63. delete from plan_info where plan_id = #{planId}
  64. </delete>
  65. <delete id="deletePlanInfoByPlanIds" parameterType="String">
  66. delete from plan_info where plan_id in
  67. <foreach item="planId" collection="array" open="(" separator="," close=")">
  68. #{planId}
  69. </foreach>
  70. </delete>
  71. </mapper>