123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?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" />
- <result property="cost" column="cost"/>
- <result property="totalPct" column="total_pct"/>
- <result property="risk" column="risk"/>
- <result property="earnings" column="earnings"/>
- </resultMap>
- <sql id="selectPlanInfoVo">
- select plan_id, area_id, type_id, plan_name, content, colour, acreage, cost, total_pct, risk, earnings 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>
- <if test="cost != null and cost != ''">cost,</if>
- <if test="totalPct != null and totalPct != ''">total_pct,</if>
- <if test="risk != null and risk != ''">risk,</if>
- <if test="earnings != null and earnings != ''">earnings,</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>
- <if test="cost != null and cost != ''">#{cost},</if>
- <if test="totalPct != null and totalPct != ''">#{totalPct},</if>
- <if test="risk != null and risk != ''">#{risk},</if>
- <if test="earnings != null and earnings != ''">#{earnings},</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},
- cost = #{cost},
- total_pct = #{totalPct},
- risk = #{risk},
- earnings = #{earnings},
- </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>
|