Merge branch 'test' into ww
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbConsInfo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Mapper
|
||||||
|
public interface TbConsInfoMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(TbConsInfo record);
|
||||||
|
|
||||||
|
int insertSelective(TbConsInfo record);
|
||||||
|
|
||||||
|
TbConsInfo selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(TbConsInfo record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(TbConsInfo record);
|
||||||
|
|
||||||
|
int countAll();
|
||||||
|
|
||||||
|
List<TbConsInfo> selectAllInfo();
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.dao;
|
||||||
|
|
||||||
|
import com.chaozhanggui.system.cashierservice.entity.TbProskuCon;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Mapper
|
||||||
|
public interface TbProskuConMapper {
|
||||||
|
int deleteByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int insert(TbProskuCon record);
|
||||||
|
|
||||||
|
int insertSelective(TbProskuCon record);
|
||||||
|
|
||||||
|
TbProskuCon selectByPrimaryKey(Integer id);
|
||||||
|
|
||||||
|
int updateByPrimaryKeySelective(TbProskuCon record);
|
||||||
|
|
||||||
|
int updateByPrimaryKey(TbProskuCon record);
|
||||||
|
|
||||||
|
|
||||||
|
List<TbProskuCon> selectBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||||
|
List<TbProskuCon> selectBySkuIdAndShopIdAngCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
|
||||||
|
List<Integer> selectIdBySkuIdAndShopId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
List<TbProskuCon> selectByShopIdAndSkuIdAndProductId(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||||
|
List<TbProskuCon> selectByShopIdAndSkuIdAndProductIdAndCheck(@Param("skuId") Integer skuId, @Param("shopId") Integer shopId,@Param("productId") Integer productId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,169 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TbConsInfo implements Serializable {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
private Integer conTypeId;
|
||||||
|
|
||||||
|
private String conTypeName;
|
||||||
|
|
||||||
|
private String conCode;
|
||||||
|
|
||||||
|
private String conName;
|
||||||
|
|
||||||
|
private BigDecimal stockNumber;
|
||||||
|
|
||||||
|
private String conUnit;
|
||||||
|
|
||||||
|
private BigDecimal lasterInStock;
|
||||||
|
|
||||||
|
private BigDecimal conWarning;
|
||||||
|
|
||||||
|
private BigDecimal stockConsume;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
private String isCheck;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopId(Integer shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getConTypeId() {
|
||||||
|
return conTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConTypeId(Integer conTypeId) {
|
||||||
|
this.conTypeId = conTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConTypeName() {
|
||||||
|
return conTypeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConTypeName(String conTypeName) {
|
||||||
|
this.conTypeName = conTypeName == null ? null : conTypeName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConCode() {
|
||||||
|
return conCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConCode(String conCode) {
|
||||||
|
this.conCode = conCode == null ? null : conCode.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConName() {
|
||||||
|
return conName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConName(String conName) {
|
||||||
|
this.conName = conName == null ? null : conName.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getStockNumber() {
|
||||||
|
return stockNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockNumber(BigDecimal stockNumber) {
|
||||||
|
this.stockNumber = stockNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConUnit() {
|
||||||
|
return conUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConUnit(String conUnit) {
|
||||||
|
this.conUnit = conUnit == null ? null : conUnit.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getLasterInStock() {
|
||||||
|
return lasterInStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLasterInStock(BigDecimal lasterInStock) {
|
||||||
|
this.lasterInStock = lasterInStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getConWarning() {
|
||||||
|
return conWarning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConWarning(BigDecimal conWarning) {
|
||||||
|
this.conWarning = conWarning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getUpdateTime() {
|
||||||
|
return updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateTime(Date updateTime) {
|
||||||
|
this.updateTime = updateTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getStockConsume() {
|
||||||
|
return stockConsume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStockConsume(BigDecimal stockConsume) {
|
||||||
|
this.stockConsume = stockConsume;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(BigDecimal price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsCheck() {
|
||||||
|
return isCheck;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsCheck(String isCheck) {
|
||||||
|
this.isCheck = isCheck;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.chaozhanggui.system.cashierservice.entity;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TbProskuCon implements Serializable {
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer shopId;
|
||||||
|
|
||||||
|
private Integer productId;
|
||||||
|
|
||||||
|
private Integer productSkuId;
|
||||||
|
|
||||||
|
private Integer conInfoId;
|
||||||
|
|
||||||
|
private BigDecimal surplusStock;
|
||||||
|
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
public Integer getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Integer id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getShopId() {
|
||||||
|
return shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShopId(Integer shopId) {
|
||||||
|
this.shopId = shopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductId() {
|
||||||
|
return productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductId(Integer productId) {
|
||||||
|
this.productId = productId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getProductSkuId() {
|
||||||
|
return productSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductSkuId(Integer productSkuId) {
|
||||||
|
this.productSkuId = productSkuId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getConInfoId() {
|
||||||
|
return conInfoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConInfoId(Integer conInfoId) {
|
||||||
|
this.conInfoId = conInfoId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getSurplusStock() {
|
||||||
|
return surplusStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSurplusStock(BigDecimal surplusStock) {
|
||||||
|
this.surplusStock = surplusStock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status == null ? null : status.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,6 +85,13 @@ public class CartService {
|
|||||||
|
|
||||||
private final RedisTemplate<String, Object> redisTemplate;
|
private final RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TbProskuConMapper tbProskuConMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
TbConsInfoMapper tbConsInfoMapper;
|
||||||
|
|
||||||
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
public CartService(TbUserShopMsgMapper tbUserShopMsgMapper, WechatUtil wechatUtil, WxAccountUtil wxAccountUtil, TbShopOpenIdMapper shopOpenIdMapper, ProductService productService, TbProductMapper tbProductMapper, RedisTemplate<String, Object> redisTemplate) {
|
||||||
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
this.tbUserShopMsgMapper = tbUserShopMsgMapper;
|
||||||
this.wechatUtil = wechatUtil;
|
this.wechatUtil = wechatUtil;
|
||||||
@@ -171,6 +178,25 @@ public class CartService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<TbProskuCon> proskuConList= tbProskuConMapper.selectByShopIdAndSkuIdAndProductId(Integer.valueOf(skuId),Integer.valueOf(shopId),Integer.valueOf(productId));
|
||||||
|
if(Objects.nonNull(proskuConList)&&proskuConList.size()>0){
|
||||||
|
for (TbProskuCon proskuCon : proskuConList) {
|
||||||
|
if("1".equals(proskuCon.getStatus())){
|
||||||
|
TbConsInfo consInfo= tbConsInfoMapper.selectByPrimaryKey(proskuCon.getConInfoId());
|
||||||
|
if("1".equals(consInfo.getIsCheck())){
|
||||||
|
if(N.gt(proskuCon.getSurplusStock(),consInfo.getStockNumber().abs().subtract(consInfo.getStockConsume().abs()))){
|
||||||
|
return Result.fail("商品:".concat(tbProduct.getName()).concat("对应的:").concat(consInfo.getConName()).concat("耗材不足"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONArray jsonArray = new JSONArray();
|
JSONArray jsonArray = new JSONArray();
|
||||||
BigDecimal amount = BigDecimal.ZERO;
|
BigDecimal amount = BigDecimal.ZERO;
|
||||||
try{
|
try{
|
||||||
|
|||||||
194
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
194
src/main/resources/mapper/TbConsInfoMapper.xml
Normal file
@@ -0,0 +1,194 @@
|
|||||||
|
<?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.chaozhanggui.system.cashierservice.dao.TbConsInfoMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||||
|
<result column="con_type_id" jdbcType="INTEGER" property="conTypeId" />
|
||||||
|
<result column="con_type_name" jdbcType="VARCHAR" property="conTypeName" />
|
||||||
|
<result column="con_code" jdbcType="VARCHAR" property="conCode" />
|
||||||
|
<result column="con_name" jdbcType="VARCHAR" property="conName" />
|
||||||
|
<result column="stock_number" jdbcType="DECIMAL" property="stockNumber" />
|
||||||
|
<result column="price" jdbcType="DECIMAL" property="price" />
|
||||||
|
<result column="stock_consume" jdbcType="DECIMAL" property="stockConsume" />
|
||||||
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
|
<result column="con_unit" jdbcType="VARCHAR" property="conUnit" />
|
||||||
|
<result column="laster_in_stock" jdbcType="DECIMAL" property="lasterInStock" />
|
||||||
|
<result column="con_warning" jdbcType="DECIMAL" property="conWarning" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||||
|
<result column="is_check" jdbcType="VARCHAR" property="isCheck" />
|
||||||
|
|
||||||
|
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, shop_id, con_type_id, con_type_name, con_code, con_name, stock_number,price,stock_consume,status, con_unit,
|
||||||
|
laster_in_stock, con_warning, create_time, update_time,is_check
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from tb_cons_info
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from tb_cons_info
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
insert into tb_cons_info (id, shop_id, con_type_id,
|
||||||
|
con_type_name, con_code, con_name,
|
||||||
|
stock_number, con_unit, laster_in_stock,
|
||||||
|
con_warning, create_time, update_time
|
||||||
|
)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{conTypeId,jdbcType=INTEGER},
|
||||||
|
#{conTypeName,jdbcType=VARCHAR}, #{conCode,jdbcType=VARCHAR}, #{conName,jdbcType=VARCHAR},
|
||||||
|
#{stockNumber,jdbcType=DECIMAL}, #{conUnit,jdbcType=VARCHAR}, #{lasterInStock,jdbcType=DECIMAL},
|
||||||
|
#{conWarning,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
insert into tb_cons_info
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id,
|
||||||
|
</if>
|
||||||
|
<if test="conTypeId != null">
|
||||||
|
con_type_id,
|
||||||
|
</if>
|
||||||
|
<if test="conTypeName != null">
|
||||||
|
con_type_name,
|
||||||
|
</if>
|
||||||
|
<if test="conCode != null">
|
||||||
|
con_code,
|
||||||
|
</if>
|
||||||
|
<if test="conName != null">
|
||||||
|
con_name,
|
||||||
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
stock_number,
|
||||||
|
</if>
|
||||||
|
<if test="conUnit != null">
|
||||||
|
con_unit,
|
||||||
|
</if>
|
||||||
|
<if test="lasterInStock != null">
|
||||||
|
laster_in_stock,
|
||||||
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
con_warning,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="shopId != null">
|
||||||
|
#{shopId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conTypeId != null">
|
||||||
|
#{conTypeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conTypeName != null">
|
||||||
|
#{conTypeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="conCode != null">
|
||||||
|
#{conCode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="conName != null">
|
||||||
|
#{conName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
#{stockNumber,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="conUnit != null">
|
||||||
|
#{conUnit,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="lasterInStock != null">
|
||||||
|
#{lasterInStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
#{conWarning,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
#{updateTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
update tb_cons_info
|
||||||
|
<set>
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id = #{shopId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conTypeId != null">
|
||||||
|
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conTypeName != null">
|
||||||
|
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="conCode != null">
|
||||||
|
con_code = #{conCode,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="conName != null">
|
||||||
|
con_name = #{conName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="stockNumber != null">
|
||||||
|
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="conUnit != null">
|
||||||
|
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="lasterInStock != null">
|
||||||
|
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="conWarning != null">
|
||||||
|
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
<if test="updateTime != null">
|
||||||
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
update tb_cons_info
|
||||||
|
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||||
|
con_type_id = #{conTypeId,jdbcType=INTEGER},
|
||||||
|
con_type_name = #{conTypeName,jdbcType=VARCHAR},
|
||||||
|
con_code = #{conCode,jdbcType=VARCHAR},
|
||||||
|
con_name = #{conName,jdbcType=VARCHAR},
|
||||||
|
stock_number = #{stockNumber,jdbcType=DECIMAL},
|
||||||
|
con_unit = #{conUnit,jdbcType=VARCHAR},
|
||||||
|
laster_in_stock = #{lasterInStock,jdbcType=DECIMAL},
|
||||||
|
con_warning = #{conWarning,jdbcType=DECIMAL},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||||
|
stock_consume=#{stockConsume,jdbcType=DECIMAL}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="countAll" resultType="int">
|
||||||
|
select count(id) from tb_cons_info
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAllInfo" resultType="com.chaozhanggui.system.cashierservice.entity.TbConsInfo">
|
||||||
|
select * from tb_cons_info order by id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
155
src/main/resources/mapper/TbProskuConMapper.xml
Normal file
155
src/main/resources/mapper/TbProskuConMapper.xml
Normal file
@@ -0,0 +1,155 @@
|
|||||||
|
<?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.chaozhanggui.system.cashierservice.dao.TbProskuConMapper">
|
||||||
|
<resultMap id="BaseResultMap" type="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
|
<id column="id" jdbcType="INTEGER" property="id" />
|
||||||
|
<result column="shop_id" jdbcType="INTEGER" property="shopId" />
|
||||||
|
<result column="product_id" jdbcType="INTEGER" property="productId" />
|
||||||
|
<result column="product_sku_id" jdbcType="INTEGER" property="productSkuId" />
|
||||||
|
<result column="con_info_id" jdbcType="INTEGER" property="conInfoId" />
|
||||||
|
<result column="surplus_stock" jdbcType="DECIMAL" property="surplusStock" />
|
||||||
|
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||||
|
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
<sql id="Base_Column_List">
|
||||||
|
id, shop_id,product_id ,product_sku_id, con_info_id, surplus_stock, status, create_time
|
||||||
|
</sql>
|
||||||
|
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||||
|
select
|
||||||
|
<include refid="Base_Column_List" />
|
||||||
|
from tb_prosku_con
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</select>
|
||||||
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||||
|
delete from tb_prosku_con
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
|
insert into tb_prosku_con (id, shop_id, product_sku_id,
|
||||||
|
con_info_id, surplus_stock, status,
|
||||||
|
create_time)
|
||||||
|
values (#{id,jdbcType=INTEGER}, #{shopId,jdbcType=INTEGER}, #{productSkuId,jdbcType=INTEGER},
|
||||||
|
#{conInfoId,jdbcType=INTEGER}, #{surplusStock,jdbcType=DECIMAL}, #{status,jdbcType=VARCHAR},
|
||||||
|
#{createTime,jdbcType=TIMESTAMP})
|
||||||
|
</insert>
|
||||||
|
<insert id="insertSelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
|
insert into tb_prosku_con
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
id,
|
||||||
|
</if>
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id,
|
||||||
|
</if>
|
||||||
|
<if test="productSkuId != null">
|
||||||
|
product_sku_id,
|
||||||
|
</if>
|
||||||
|
<if test="conInfoId != null">
|
||||||
|
con_info_id,
|
||||||
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
surplus_stock,
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
status,
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time,
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">
|
||||||
|
#{id,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="shopId != null">
|
||||||
|
#{shopId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="productSkuId != null">
|
||||||
|
#{productSkuId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conInfoId != null">
|
||||||
|
#{conInfoId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
#{surplusStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
#{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
#{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="updateByPrimaryKeySelective" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
|
update tb_prosku_con
|
||||||
|
<set>
|
||||||
|
<if test="shopId != null">
|
||||||
|
shop_id = #{shopId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="productSkuId != null">
|
||||||
|
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="conInfoId != null">
|
||||||
|
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||||
|
</if>
|
||||||
|
<if test="surplusStock != null">
|
||||||
|
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
status = #{status,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="createTime != null">
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<update id="updateByPrimaryKey" parameterType="com.chaozhanggui.system.cashierservice.entity.TbProskuCon">
|
||||||
|
update tb_prosku_con
|
||||||
|
set shop_id = #{shopId,jdbcType=INTEGER},
|
||||||
|
product_sku_id = #{productSkuId,jdbcType=INTEGER},
|
||||||
|
con_info_id = #{conInfoId,jdbcType=INTEGER},
|
||||||
|
surplus_stock = #{surplusStock,jdbcType=DECIMAL},
|
||||||
|
status = #{status,jdbcType=VARCHAR},
|
||||||
|
create_time = #{createTime,jdbcType=TIMESTAMP}
|
||||||
|
where id = #{id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectBySkuIdAndShopId" resultMap="BaseResultMap">
|
||||||
|
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and status=1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBySkuIdAndShopIdAngCheck" resultMap="BaseResultMap">
|
||||||
|
select a.* from tb_prosku_con as a
|
||||||
|
left join tb_cons_info as b on a.con_info_id=b.id
|
||||||
|
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.status=1 and b.is_check=1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectIdBySkuIdAndShopId" resultType="java.lang.Integer">
|
||||||
|
SELECT
|
||||||
|
p.con_info_id
|
||||||
|
FROM
|
||||||
|
tb_prosku_con p
|
||||||
|
WHERE
|
||||||
|
p.shop_id = #{shopId}
|
||||||
|
AND p.product_sku_id = #{skuId}
|
||||||
|
AND p.`status` = 1
|
||||||
|
group by p.con_info_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByShopIdAndSkuIdAndProductId" resultMap="BaseResultMap">
|
||||||
|
|
||||||
|
select * from tb_prosku_con where product_sku_id=#{skuId} and shop_id=#{shopId} and product_id=#{productId} and status=1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByShopIdAndSkuIdAndProductIdAndCheck" resultMap="BaseResultMap">
|
||||||
|
|
||||||
|
select a.* from tb_prosku_con as a
|
||||||
|
left join tb_cons_info as b on a.con_info_id=b.id
|
||||||
|
where a.product_sku_id=#{skuId} and a.shop_id=#{shopId} and a.product_id=#{productId} and a.status=1 and b.is_check=1
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user