From 58b4f87b6e9e318320360f8b7102cdf0cf4b16af Mon Sep 17 00:00:00 2001 From: hurui <177768073@qq.com> Date: Thu, 13 Apr 2023 18:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4diam?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hai/dao/GoodsLogisticsMapper.java | 73 ++++++++++++++- .../hai/dao/GoodsLogisticsSqlProvider.java | 89 +++++++++++++++++++ 2 files changed, 161 insertions(+), 1 deletion(-) diff --git a/hai-service/src/main/java/com/hai/dao/GoodsLogisticsMapper.java b/hai-service/src/main/java/com/hai/dao/GoodsLogisticsMapper.java index 9f6bb4ab..5469244d 100644 --- a/hai-service/src/main/java/com/hai/dao/GoodsLogisticsMapper.java +++ b/hai-service/src/main/java/com/hai/dao/GoodsLogisticsMapper.java @@ -3,6 +3,7 @@ package com.hai.dao; import com.hai.entity.GoodsLogistics; import com.hai.entity.GoodsLogisticsExample; import java.util.List; +import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.DeleteProvider; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.InsertProvider; @@ -10,7 +11,9 @@ import org.apache.ibatis.annotations.Options; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Result; import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.UpdateProvider; import org.apache.ibatis.type.JdbcType; import org.springframework.stereotype.Repository; @@ -29,6 +32,12 @@ public interface GoodsLogisticsMapper extends GoodsLogisticsMapperExt { @DeleteProvider(type=GoodsLogisticsSqlProvider.class, method="deleteByExample") int deleteByExample(GoodsLogisticsExample example); + @Delete({ + "delete from goods_logistics", + "where id = #{id,jdbcType=BIGINT}" + }) + int deleteByPrimaryKey(Long id); + @Insert({ "insert into goods_logistics (user_id, order_id, ", "task_no, `number`, ", @@ -60,7 +69,7 @@ public interface GoodsLogisticsMapper extends GoodsLogisticsMapperExt { @SelectProvider(type=GoodsLogisticsSqlProvider.class, method="selectByExample") @Results({ - @Result(column="id", property="id", jdbcType=JdbcType.BIGINT), + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), @Result(column="task_no", property="taskNo", jdbcType=JdbcType.VARCHAR), @@ -84,9 +93,71 @@ public interface GoodsLogisticsMapper extends GoodsLogisticsMapperExt { }) List selectByExample(GoodsLogisticsExample example); + @Select({ + "select", + "id, user_id, order_id, task_no, `number`, logistics_status, logistics_status_desc, ", + "the_last_message, the_last_time, take_time, courier, courier_phone, logistics_trace_details, ", + "express_company_name, `status`, create_time, op_id, op_name, ext_1, ext_2, ext_3", + "from goods_logistics", + "where id = #{id,jdbcType=BIGINT}" + }) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT), + @Result(column="order_id", property="orderId", jdbcType=JdbcType.BIGINT), + @Result(column="task_no", property="taskNo", jdbcType=JdbcType.VARCHAR), + @Result(column="number", property="number", jdbcType=JdbcType.VARCHAR), + @Result(column="logistics_status", property="logisticsStatus", jdbcType=JdbcType.VARCHAR), + @Result(column="logistics_status_desc", property="logisticsStatusDesc", jdbcType=JdbcType.VARCHAR), + @Result(column="the_last_message", property="theLastMessage", jdbcType=JdbcType.VARCHAR), + @Result(column="the_last_time", property="theLastTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="take_time", property="takeTime", jdbcType=JdbcType.VARCHAR), + @Result(column="courier", property="courier", jdbcType=JdbcType.VARCHAR), + @Result(column="courier_phone", property="courierPhone", jdbcType=JdbcType.VARCHAR), + @Result(column="logistics_trace_details", property="logisticsTraceDetails", jdbcType=JdbcType.VARCHAR), + @Result(column="express_company_name", property="expressCompanyName", jdbcType=JdbcType.VARCHAR), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), + @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + GoodsLogistics selectByPrimaryKey(Long id); + @UpdateProvider(type=GoodsLogisticsSqlProvider.class, method="updateByExampleSelective") int updateByExampleSelective(@Param("record") GoodsLogistics record, @Param("example") GoodsLogisticsExample example); @UpdateProvider(type=GoodsLogisticsSqlProvider.class, method="updateByExample") int updateByExample(@Param("record") GoodsLogistics record, @Param("example") GoodsLogisticsExample example); + + @UpdateProvider(type=GoodsLogisticsSqlProvider.class, method="updateByPrimaryKeySelective") + int updateByPrimaryKeySelective(GoodsLogistics record); + + @Update({ + "update goods_logistics", + "set user_id = #{userId,jdbcType=BIGINT},", + "order_id = #{orderId,jdbcType=BIGINT},", + "task_no = #{taskNo,jdbcType=VARCHAR},", + "`number` = #{number,jdbcType=VARCHAR},", + "logistics_status = #{logisticsStatus,jdbcType=VARCHAR},", + "logistics_status_desc = #{logisticsStatusDesc,jdbcType=VARCHAR},", + "the_last_message = #{theLastMessage,jdbcType=VARCHAR},", + "the_last_time = #{theLastTime,jdbcType=TIMESTAMP},", + "take_time = #{takeTime,jdbcType=VARCHAR},", + "courier = #{courier,jdbcType=VARCHAR},", + "courier_phone = #{courierPhone,jdbcType=VARCHAR},", + "logistics_trace_details = #{logisticsTraceDetails,jdbcType=VARCHAR},", + "express_company_name = #{expressCompanyName,jdbcType=VARCHAR},", + "`status` = #{status,jdbcType=INTEGER},", + "create_time = #{createTime,jdbcType=TIMESTAMP},", + "op_id = #{opId,jdbcType=BIGINT},", + "op_name = #{opName,jdbcType=VARCHAR},", + "ext_1 = #{ext1,jdbcType=VARCHAR},", + "ext_2 = #{ext2,jdbcType=VARCHAR},", + "ext_3 = #{ext3,jdbcType=VARCHAR}", + "where id = #{id,jdbcType=BIGINT}" + }) + int updateByPrimaryKey(GoodsLogistics record); } \ No newline at end of file diff --git a/hai-service/src/main/java/com/hai/dao/GoodsLogisticsSqlProvider.java b/hai-service/src/main/java/com/hai/dao/GoodsLogisticsSqlProvider.java index abaef269..4a86cbee 100644 --- a/hai-service/src/main/java/com/hai/dao/GoodsLogisticsSqlProvider.java +++ b/hai-service/src/main/java/com/hai/dao/GoodsLogisticsSqlProvider.java @@ -274,6 +274,95 @@ public class GoodsLogisticsSqlProvider { return sql.toString(); } + public String updateByPrimaryKeySelective(GoodsLogistics record) { + SQL sql = new SQL(); + sql.UPDATE("goods_logistics"); + + if (record.getUserId() != null) { + sql.SET("user_id = #{userId,jdbcType=BIGINT}"); + } + + if (record.getOrderId() != null) { + sql.SET("order_id = #{orderId,jdbcType=BIGINT}"); + } + + if (record.getTaskNo() != null) { + sql.SET("task_no = #{taskNo,jdbcType=VARCHAR}"); + } + + if (record.getNumber() != null) { + sql.SET("`number` = #{number,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsStatus() != null) { + sql.SET("logistics_status = #{logisticsStatus,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsStatusDesc() != null) { + sql.SET("logistics_status_desc = #{logisticsStatusDesc,jdbcType=VARCHAR}"); + } + + if (record.getTheLastMessage() != null) { + sql.SET("the_last_message = #{theLastMessage,jdbcType=VARCHAR}"); + } + + if (record.getTheLastTime() != null) { + sql.SET("the_last_time = #{theLastTime,jdbcType=TIMESTAMP}"); + } + + if (record.getTakeTime() != null) { + sql.SET("take_time = #{takeTime,jdbcType=VARCHAR}"); + } + + if (record.getCourier() != null) { + sql.SET("courier = #{courier,jdbcType=VARCHAR}"); + } + + if (record.getCourierPhone() != null) { + sql.SET("courier_phone = #{courierPhone,jdbcType=VARCHAR}"); + } + + if (record.getLogisticsTraceDetails() != null) { + sql.SET("logistics_trace_details = #{logisticsTraceDetails,jdbcType=VARCHAR}"); + } + + if (record.getExpressCompanyName() != null) { + sql.SET("express_company_name = #{expressCompanyName,jdbcType=VARCHAR}"); + } + + if (record.getStatus() != null) { + sql.SET("`status` = #{status,jdbcType=INTEGER}"); + } + + if (record.getCreateTime() != null) { + sql.SET("create_time = #{createTime,jdbcType=TIMESTAMP}"); + } + + if (record.getOpId() != null) { + sql.SET("op_id = #{opId,jdbcType=BIGINT}"); + } + + if (record.getOpName() != null) { + sql.SET("op_name = #{opName,jdbcType=VARCHAR}"); + } + + if (record.getExt1() != null) { + sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); + } + + if (record.getExt2() != null) { + sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); + } + + if (record.getExt3() != null) { + sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); + } + + sql.WHERE("id = #{id,jdbcType=BIGINT}"); + + return sql.toString(); + } + protected void applyWhere(SQL sql, GoodsLogisticsExample example, boolean includeExamplePhrase) { if (example == null) { return;