1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.lqkj.info.mapper.PlanInfoMapper">
- <resultMap type="PlanInfo" id="PlanInfoResult">
- <result property="planId" column="plan_id" />
- <result property="areaId" column="area_id" />
- <result property="typeId" column="type_id" />
- <result property="planName" column="plan_name" />
- <result property="content" column="content" />
- <result property="colour" column="colour" />
- <result property="acreage" column="acreage" />
- </resultMap>
- <sql id="selectPlanInfoVo">
- select plan_id, area_id, type_id, plan_name, content, colour, acreage from plan_info
- </sql>
- <select id="selectPlanInfoList" parameterType="PlanInfo" resultMap="PlanInfoResult">
- <include refid="selectPlanInfoVo"/>
- <where>
- <if test="areaId != null "> and area_id = #{areaId}</if>
- <if test="typeId != null "> and type_id = #{typeId}</if>
- <if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
- </where>
- order by plan_id
- </select>
- <select id="selectPlanInfoByPlanId" parameterType="Integer" resultMap="PlanInfoResult">
- <include refid="selectPlanInfoVo"/>
- where plan_id = #{planId}
- </select>
- <insert id="insertPlanInfo" parameterType="PlanInfo" useGeneratedKeys="true" keyProperty="planId">
- insert into plan_info
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="areaId != null">area_id,</if>
- <if test="typeId != null">type_id,</if>
- <if test="planName != null and planName != ''">plan_name,</if>
- <if test="content != null and content != ''">content,</if>
- <if test="colour != null and colour != ''">colour,</if>
- <if test="acreage != null">acreage,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="areaId != null">#{areaId},</if>
- <if test="typeId != null">#{typeId},</if>
- <if test="planName != null and planName != ''">#{planName},</if>
- <if test="content != null and content != ''">#{content},</if>
- <if test="colour != null and colour != ''">#{colour},</if>
- <if test="acreage != null">#{acreage},</if>
- </trim>
- </insert>
- <update id="updatePlanInfo" parameterType="PlanInfo">
- update plan_info
- <trim prefix="SET" suffixOverrides=",">
- area_id = #{areaId},
- type_id = #{typeId},
- plan_name = #{planName},
- content = #{content},
- colour = #{colour},
- acreage = #{acreage},
- </trim>
- where plan_id = #{planId}
- </update>
- <delete id="deletePlanInfoByPlanId" parameterType="Integer">
- delete from plan_info where plan_id = #{planId}
- </delete>
- <delete id="deletePlanInfoByPlanIds" parameterType="String">
- delete from plan_info where plan_id in
- <foreach item="planId" collection="array" open="(" separator="," close=")">
- #{planId}
- </foreach>
- </delete>
- </mapper>
|