Commit a138c678 by wutong

同步采购单详情新增字段.

parent 4d0370a6
......@@ -7,6 +7,7 @@ import com.bailuntec.domain.constant.CommonConstant;
import com.bailuntec.domain.dto.PurchaseDetailDTO;
import com.bailuntec.domain.entity.DcBasePurchaseDetails;
import com.bailuntec.domain.entity.JobPointLog;
import com.bailuntec.domain.example.DcBasePurchaseDetailsExample;
import com.bailuntec.mapper.DcBasePurchaseDetailsMapper;
import com.bailuntec.mapper.JobPointLogMapper;
import com.bailuntec.support.PointJob;
......@@ -81,15 +82,17 @@ public class SyncPurchaseDetailsJob extends PointJob {
e.printStackTrace();
throw new RuntimeException("BeanUtils.copyProperties采购单sku详细信息异常");
}
dcBasePurchaseDetails.setQuantityNotInbound(purchaseDetail.getQuantityPurchase() - purchaseDetail.getQuantityInbound());
dcBasePurchaseDetails.setCreateTime(LocalDateTime.parse(purchaseDetail.getCreateTimed(), DateTimeFormatter.ofPattern("yyyy/M/d H:m:s")));
dcBasePurchaseDetails.setUpdateTime(LocalDateTime.parse(purchaseDetail.getUpdateTimed(), DateTimeFormatter.ofPattern("yyyy/M/d H:m:s")));
dcBasePurchaseDetails.setGmtModified(LocalDateTime.now());
mapper.upsertSelective(dcBasePurchaseDetails);
SessionUtil.getSession().commit();
int i = mapper.updateByExampleSelective(dcBasePurchaseDetails, DcBasePurchaseDetailsExample.newAndCreateCriteria().andBailunSkuEqualTo(dcBasePurchaseDetails.getBailunSku()).andPurchaseIdEqualTo(dcBasePurchaseDetails.getPurchaseId()).example());
if (i == 0) {
mapper.insertSelective(dcBasePurchaseDetails);
}
});
} catch (Exception e) {
e.printStackTrace();
log.error("MYBATIS操作DB失败", e);
throw new RuntimeException("MYBATIS操作DB失败");
} finally {
SessionUtil.closeSession();
......
......@@ -39,6 +39,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
<result column="quantity_not_inbound" jdbcType="INTEGER" property="quantityNotInbound" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
......@@ -117,7 +118,7 @@
quantity_return, quantity_inbound, quantity_deliver, quantity_not_deliver, quantity_arrival,
quantity_not_arrival, quantity_inspect, quantity_qualified_inspect, quantity_unqualified_inspect,
quantity_wait_transfer, quantity_exchange, quantity_lose_inbound, create_time, update_time,
gmt_create, gmt_modified
gmt_create, gmt_modified, quantity_not_inbound
</sql>
<select id="selectByExample" parameterType="com.bailuntec.domain.example.DcBasePurchaseDetailsExample" resultMap="BaseResultMap">
<!--
......@@ -189,7 +190,8 @@
quantity_qualified_inspect, quantity_unqualified_inspect,
quantity_wait_transfer, quantity_exchange,
quantity_lose_inbound, create_time, update_time,
gmt_create, gmt_modified)
gmt_create, gmt_modified, quantity_not_inbound
)
values (#{id,jdbcType=INTEGER}, #{purchaseId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
#{purchaseCategoryName,jdbcType=VARCHAR}, #{deliverId,jdbcType=INTEGER}, #{deliverName,jdbcType=VARCHAR},
#{buyerName,jdbcType=VARCHAR}, #{warehouseFromCode,jdbcType=VARCHAR}, #{warehouseFromName,jdbcType=VARCHAR},
......@@ -200,8 +202,9 @@
#{quantityArrival,jdbcType=INTEGER}, #{quantityNotArrival,jdbcType=INTEGER}, #{quantityInspect,jdbcType=INTEGER},
#{quantityQualifiedInspect,jdbcType=INTEGER}, #{quantityUnqualifiedInspect,jdbcType=INTEGER},
#{quantityWaitTransfer,jdbcType=INTEGER}, #{quantityExchange,jdbcType=INTEGER},
#{quantityLoseInbound,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
#{quantityLoseInbound,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{quantityNotInbound,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.bailuntec.domain.entity.DcBasePurchaseDetails">
<!--
......@@ -309,6 +312,9 @@
<if test="gmtModified != null">
gmt_modified,
</if>
<if test="quantityNotInbound != null">
quantity_not_inbound,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
......@@ -410,6 +416,9 @@
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="quantityNotInbound != null">
#{quantityNotInbound,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.bailuntec.domain.example.DcBasePurchaseDetailsExample" resultType="java.lang.Long">
......@@ -528,6 +537,9 @@
<if test="record.gmtModified != null">
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="record.quantityNotInbound != null">
quantity_not_inbound = #{record.quantityNotInbound,jdbcType=INTEGER},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -571,7 +583,8 @@
create_time = #{record.createTime,jdbcType=TIMESTAMP},
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
gmt_create = #{record.gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP}
gmt_modified = #{record.gmtModified,jdbcType=TIMESTAMP},
quantity_not_inbound = #{record.quantityNotInbound,jdbcType=INTEGER}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -679,6 +692,9 @@
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="quantityNotInbound != null">
quantity_not_inbound = #{quantityNotInbound,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
......@@ -719,7 +735,8 @@
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
quantity_not_inbound = #{quantityNotInbound,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="upsertSelective" parameterType="com.bailuntec.domain.entity.DcBasePurchaseDetails">
......@@ -829,6 +846,9 @@
<if test="gmtModified != null">
gmt_modified,
</if>
<if test="quantityNotInbound != null">
quantity_not_inbound,
</if>
</trim>
values
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -931,6 +951,9 @@
<if test="gmtModified != null">
#{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="quantityNotInbound != null">
#{quantityNotInbound,jdbcType=INTEGER},
</if>
</trim>
on duplicate key update
<trim suffixOverrides=",">
......@@ -1033,6 +1056,9 @@
<if test="gmtModified != null">
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
</if>
<if test="quantityNotInbound != null">
quantity_not_inbound = #{quantityNotInbound,jdbcType=INTEGER},
</if>
</trim>
</insert>
<insert id="upsert" parameterType="com.bailuntec.domain.entity.DcBasePurchaseDetails">
......@@ -1048,7 +1074,7 @@
quantity_return, quantity_inbound, quantity_deliver, quantity_not_deliver, quantity_arrival,
quantity_not_arrival, quantity_inspect, quantity_qualified_inspect, quantity_unqualified_inspect,
quantity_wait_transfer, quantity_exchange, quantity_lose_inbound, create_time,
update_time, gmt_create, gmt_modified)
update_time, gmt_create, gmt_modified, quantity_not_inbound)
values
(#{id,jdbcType=INTEGER}, #{purchaseId,jdbcType=VARCHAR}, #{status,jdbcType=TINYINT},
#{purchaseCategoryName,jdbcType=VARCHAR}, #{deliverId,jdbcType=INTEGER}, #{deliverName,jdbcType=VARCHAR},
......@@ -1060,8 +1086,9 @@
#{quantityArrival,jdbcType=INTEGER}, #{quantityNotArrival,jdbcType=INTEGER}, #{quantityInspect,jdbcType=INTEGER},
#{quantityQualifiedInspect,jdbcType=INTEGER}, #{quantityUnqualifiedInspect,jdbcType=INTEGER},
#{quantityWaitTransfer,jdbcType=INTEGER}, #{quantityExchange,jdbcType=INTEGER},
#{quantityLoseInbound,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP})
#{quantityLoseInbound,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{gmtCreate,jdbcType=TIMESTAMP}, #{gmtModified,jdbcType=TIMESTAMP}, #{quantityNotInbound,jdbcType=INTEGER}
)
on duplicate key update
id = #{id,jdbcType=INTEGER},
purchase_id = #{purchaseId,jdbcType=VARCHAR},
......@@ -1092,10 +1119,11 @@
quantity_wait_transfer = #{quantityWaitTransfer,jdbcType=INTEGER},
quantity_exchange = #{quantityExchange,jdbcType=INTEGER},
quantity_lose_inbound = #{quantityLoseInbound,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP}
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP},
gmt_create = #{gmtCreate,jdbcType=TIMESTAMP},
gmt_modified = #{gmtModified,jdbcType=TIMESTAMP},
quantity_not_inbound = #{quantityNotInbound,jdbcType=INTEGER}
</insert>
<select id="selectOneByExample" parameterType="com.bailuntec.domain.example.DcBasePurchaseDetailsExample" resultMap="BaseResultMap">
<!--
......
......@@ -305,6 +305,15 @@ public class DcBasePurchaseDetails {
private LocalDateTime gmtModified;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column dc_base_purchase_details.quantity_not_inbound
*
* @mbg.generated
*/
private Integer quantityNotInbound;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table dc_base_purchase_details
*
......@@ -349,6 +358,7 @@ public class DcBasePurchaseDetails {
sb.append(", updateTime=").append(updateTime);
sb.append(", gmtCreate=").append(gmtCreate);
sb.append(", gmtModified=").append(gmtModified);
sb.append(", quantityNotInbound=").append(quantityNotInbound);
sb.append("]");
return sb.toString();
}
......@@ -403,7 +413,8 @@ public class DcBasePurchaseDetails {
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
&& (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
&& (this.getGmtCreate() == null ? other.getGmtCreate() == null : this.getGmtCreate().equals(other.getGmtCreate()))
&& (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()));
&& (this.getGmtModified() == null ? other.getGmtModified() == null : this.getGmtModified().equals(other.getGmtModified()))
&& (this.getQuantityNotInbound() == null ? other.getQuantityNotInbound() == null : this.getQuantityNotInbound().equals(other.getQuantityNotInbound()));
}
/**
......@@ -449,6 +460,7 @@ public class DcBasePurchaseDetails {
result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
result = prime * result + ((getGmtCreate() == null) ? 0 : getGmtCreate().hashCode());
result = prime * result + ((getGmtModified() == null) ? 0 : getGmtModified().hashCode());
result = prime * result + ((getQuantityNotInbound() == null) ? 0 : getQuantityNotInbound().hashCode());
return result;
}
}
\ No newline at end of file
......@@ -2460,6 +2460,66 @@ public class DcBasePurchaseDetailsExample {
addCriterion("gmt_modified not between", value1, value2, "gmtModified");
return (Criteria) this;
}
public Criteria andQuantityNotInboundIsNull() {
addCriterion("quantity_not_inbound is null");
return (Criteria) this;
}
public Criteria andQuantityNotInboundIsNotNull() {
addCriterion("quantity_not_inbound is not null");
return (Criteria) this;
}
public Criteria andQuantityNotInboundEqualTo(Integer value) {
addCriterion("quantity_not_inbound =", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundNotEqualTo(Integer value) {
addCriterion("quantity_not_inbound <>", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundGreaterThan(Integer value) {
addCriterion("quantity_not_inbound >", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundGreaterThanOrEqualTo(Integer value) {
addCriterion("quantity_not_inbound >=", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundLessThan(Integer value) {
addCriterion("quantity_not_inbound <", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundLessThanOrEqualTo(Integer value) {
addCriterion("quantity_not_inbound <=", value, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundIn(List<Integer> values) {
addCriterion("quantity_not_inbound in", values, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundNotIn(List<Integer> values) {
addCriterion("quantity_not_inbound not in", values, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundBetween(Integer value1, Integer value2) {
addCriterion("quantity_not_inbound between", value1, value2, "quantityNotInbound");
return (Criteria) this;
}
public Criteria andQuantityNotInboundNotBetween(Integer value1, Integer value2) {
addCriterion("quantity_not_inbound not between", value1, value2, "quantityNotInbound");
return (Criteria) this;
}
}
/**
......
table-name=dc_auto_turnover
table-name=dc_base_purchase_details
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment