RuoYi/MengYu-Trade/src/main/resources/mapper/mengyu/YearPlanMapper.xml

80 lines
3.5 KiB
XML

<?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.cronie.mengyu.mapper.YearPlanMapper">
<resultMap type="YearPlan" id="YearPlanResult">
<result property="year" column="year" />
<result property="profit" column="profit" />
<result property="planStatus" column="plan_status" />
<result property="taskStatus" column="task_status" />
<result property="createTime" column="create_time" />
<result property="creater" column="creater" />
</resultMap>
<sql id="selectYearPlanVo">
select year, profit, plan_status, task_status, create_time, creater from my_year_plan
</sql>
<select id="selectYearPlanList" parameterType="YearPlan" resultMap="YearPlanResult">
<include refid="selectYearPlanVo"/>
<where>
<if test="year != null and year != '' "> and year = #{year}</if>
<if test="profit != null "> and profit = #{profit}</if>
<if test="planStatus != null "> and plan_status = #{planStatus}</if>
<if test="taskStatus != null "> and task_status = #{taskStatus}</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="creater != null "> and creater = #{creater}</if>
</where>
</select>
<select id="selectYearPlanById" parameterType="String" resultMap="YearPlanResult">
<include refid="selectYearPlanVo"/>
where year = #{year}
</select>
<insert id="insertYearPlan" parameterType="YearPlan">
insert into my_year_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="year != null and year != '' ">year,</if>
<if test="profit != null ">profit,</if>
<if test="planStatus != null ">plan_status,</if>
<if test="taskStatus != null ">task_status,</if>
<if test="createTime != null ">create_time,</if>
<if test="creater != null ">creater,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="year != null and year != '' ">#{year},</if>
<if test="profit != null ">#{profit},</if>
<if test="planStatus != null ">#{planStatus},</if>
<if test="taskStatus != null ">#{taskStatus},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="creater != null ">#{creater},</if>
</trim>
</insert>
<update id="updateYearPlan" parameterType="YearPlan">
update my_year_plan
<trim prefix="SET" suffixOverrides=",">
<if test="profit != null ">profit = #{profit},</if>
<if test="planStatus != null ">plan_status = #{planStatus},</if>
<if test="taskStatus != null ">task_status = #{taskStatus},</if>
<if test="createTime != null ">create_time = #{createTime},</if>
<if test="creater != null ">creater = #{creater},</if>
</trim>
where year = #{year}
</update>
<delete id="deleteYearPlanById" parameterType="String">
delete from my_year_plan where year = #{year}
</delete>
<delete id="deleteYearPlanByIds" parameterType="String">
delete from my_year_plan where year in
<foreach item="year" collection="array" open="(" separator="," close=")">
#{year}
</foreach>
</delete>
</mapper>