|
|
@@ -0,0 +1,139 @@
|
|
|
+<?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.goafanti.common.dao.OrderYearMaxDurationMapper">
|
|
|
+
|
|
|
+ <resultMap type="com.goafanti.common.model.OrderYearMaxDuration" id="OrderYearMaxDurationMap">
|
|
|
+ <result property="id" column="id" jdbcType="INTEGER"/>
|
|
|
+ <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
|
|
|
+ <result property="year" column="year" jdbcType="INTEGER"/>
|
|
|
+ <result property="status" column="status" jdbcType="INTEGER"/>
|
|
|
+ <result property="maxDuration" column="max_duration" jdbcType="VARCHAR"/>
|
|
|
+ <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!--查询单个-->
|
|
|
+ <select id="queryById" resultMap="OrderYearMaxDurationMap">
|
|
|
+ select id,
|
|
|
+ order_no,
|
|
|
+ year,
|
|
|
+ status,
|
|
|
+ max_duration,
|
|
|
+ create_time
|
|
|
+ from order_year_max_duration
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--查询指定行数据-->
|
|
|
+ <select id="findOrderYearMaxDurationCount" resultMap="OrderYearMaxDurationMap">
|
|
|
+ select
|
|
|
+ id, order_no, year, status, max_duration, create_time
|
|
|
+ from order_year_max_duration
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null and orderNo != ''">
|
|
|
+ and order_no = #{orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="year != null">
|
|
|
+ and year = #{year}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="maxDuration != null">
|
|
|
+ and max_duration = #{maxDuration}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ limit #{pageable.offset}, #{pageable.pageSize}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--统计总行数-->
|
|
|
+ <select id="queryAllByCount" resultType="java.lang.Intger">
|
|
|
+ select count(1)
|
|
|
+ from order_year_max_duration
|
|
|
+ <where>
|
|
|
+ <if test="id != null">
|
|
|
+ and id = #{id}
|
|
|
+ </if>
|
|
|
+ <if test="orderNo != null and orderNo != ''">
|
|
|
+ and order_no = #{orderNo}
|
|
|
+ </if>
|
|
|
+ <if test="year != null">
|
|
|
+ and year = #{year}
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ and status = #{status}
|
|
|
+ </if>
|
|
|
+ <if test="maxDuration != null">
|
|
|
+ and max_duration = #{maxDuration}
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ and create_time = #{createTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--新增所有列-->
|
|
|
+ <insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into order_year_max_duration(order_no, year, status, max_duration, create_time)
|
|
|
+ values (#{orderNo}, #{year}, #{status}, #{maxDuration}, #{createTime})
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into order_year_max_duration(order_no, year, status, max_duration, create_time)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.orderNo}, #{entity.year}, #{entity.status}, #{entity.maxDuration}, #{entity.createTime})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
|
|
+ insert into order_year_max_duration(order_no, year, status, max_duration, create_time)
|
|
|
+ values
|
|
|
+ <foreach collection="entities" item="entity" separator=",">
|
|
|
+ (#{entity.orderNo}, #{entity.year}, #{entity.status}, #{entity.maxDuration}, #{entity.createTime})
|
|
|
+ </foreach>
|
|
|
+ on duplicate key update
|
|
|
+ order_no = values(order_no),
|
|
|
+ year = values(year),
|
|
|
+ status = values(status),
|
|
|
+ max_duration = values(max_duration),
|
|
|
+ create_time = values(create_time)
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <!--通过主键修改数据-->
|
|
|
+ <update id="update">
|
|
|
+ update order_year_max_duration
|
|
|
+ <set>
|
|
|
+ <if test="orderNo != null and orderNo != ''">
|
|
|
+ order_no = #{orderNo},
|
|
|
+ </if>
|
|
|
+ <if test="year != null">
|
|
|
+ year = #{year},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="maxDuration != null">
|
|
|
+ max_duration = #{maxDuration},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time = #{createTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <!--通过主键删除-->
|
|
|
+ <delete id="deleteById">
|
|
|
+ delete
|
|
|
+ from order_year_max_duration
|
|
|
+ where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+</mapper>
|
|
|
+
|