parent
087429e992
commit
3899e726b7
@ -1,7 +1,41 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsMealTableOrderChildProduct; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsMealTableOrderChildProductMapperExt { |
||||
} |
||||
|
||||
|
||||
@Insert(value = { |
||||
"<script>", |
||||
"insert into bs_meal_table_order_child_product (store_id, store_name, ", |
||||
"child_order_id, child_order_no, ", |
||||
"product_category_id, product_category_name, ", |
||||
"product_id, product_img, ", |
||||
"product_name, product_spec, ", |
||||
"product_price, product_num, ", |
||||
"product_total_price, `status`, ", |
||||
"create_time, update_time, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values " + |
||||
"<foreach collection=\"dataList\" item=\"item\" index=\"idx\" open=\"(\" separator=\"),(\" close=\")\">", |
||||
"#{item.storeId,jdbcType=BIGINT}, #{item.storeName,jdbcType=VARCHAR}, ", |
||||
"#{item.childOrderId,jdbcType=BIGINT}, #{item.childOrderNo,jdbcType=VARCHAR}, ", |
||||
"#{item.productCategoryId,jdbcType=BIGINT}, #{item.productCategoryName,jdbcType=VARCHAR}, ", |
||||
"#{item.productId,jdbcType=BIGINT}, #{item.productImg,jdbcType=VARCHAR}, ", |
||||
"#{item.productName,jdbcType=VARCHAR}, #{item.productSpec,jdbcType=VARCHAR}, ", |
||||
"#{item.productPrice,jdbcType=DECIMAL}, #{item.productNum,jdbcType=INTEGER}, ", |
||||
"#{item.productTotalPrice,jdbcType=DECIMAL}, #{item.status,jdbcType=INTEGER}, ", |
||||
"#{item.createTime,jdbcType=TIMESTAMP}, #{item.updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{item.ext1,jdbcType=VARCHAR}, #{item.ext2,jdbcType=VARCHAR}, #{item.ext3,jdbcType=VARCHAR}", |
||||
"</foreach>", |
||||
"</script>" |
||||
}) |
||||
void addPatch(@Param(value = "dataList") List<BsMealTableOrderChildProduct> dataList); |
||||
} |
||||
|
@ -1,7 +1,41 @@ |
||||
package com.hfkj.dao; |
||||
|
||||
import com.hfkj.entity.BsMealTableOrderChildProduct; |
||||
import com.hfkj.entity.BsMealTableOrderProduct; |
||||
import com.hfkj.entity.CmsPatch; |
||||
import org.apache.ibatis.annotations.Insert; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* mapper扩展类 |
||||
*/ |
||||
public interface BsMealTableOrderProductMapperExt { |
||||
} |
||||
|
||||
@Insert(value = { |
||||
"<script>", |
||||
"insert into bs_meal_table_order_product (order_id, order_no, ", |
||||
"product_category_id, product_category_name, ", |
||||
"product_id, product_img, ", |
||||
"product_name, product_spec, ", |
||||
"product_price, product_num, ", |
||||
"product_total_price, `status`, ", |
||||
"create_time, update_time, ", |
||||
"ext_1, ext_2, ext_3)", |
||||
"values " + |
||||
"<foreach collection=\"dataList\" item=\"item\" index=\"idx\" open=\"(\" separator=\"),(\" close=\")\">", |
||||
"#{orderId,jdbcType=BIGINT}, #{orderNo,jdbcType=VARCHAR}, ", |
||||
"#{productCategoryId,jdbcType=BIGINT}, #{productCategoryName,jdbcType=VARCHAR}, ", |
||||
"#{productId,jdbcType=BIGINT}, #{productImg,jdbcType=VARCHAR}, ", |
||||
"#{productName,jdbcType=VARCHAR}, #{productSpec,jdbcType=VARCHAR}, ", |
||||
"#{productPrice,jdbcType=DECIMAL}, #{productNum,jdbcType=INTEGER}, ", |
||||
"#{productTotalPrice,jdbcType=DECIMAL}, #{status,jdbcType=INTEGER}, ", |
||||
"#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, ", |
||||
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}", |
||||
"</foreach>" + |
||||
"</script>" |
||||
}) |
||||
void addPatch(@Param(value = "dataList") List<BsMealTableOrderChildProduct> dataList); |
||||
|
||||
} |
||||
|
@ -0,0 +1,63 @@ |
||||
package com.hfkj.service.meal.impl; |
||||
|
||||
import com.hfkj.dao.BsMealTableOrderProductMapper; |
||||
import com.hfkj.entity.BsMealTableOrderChild; |
||||
import com.hfkj.entity.BsMealTableOrderProduct; |
||||
import com.hfkj.entity.BsMealTableOrderProductExample; |
||||
import com.hfkj.service.meal.BsMealTableOrderProductService; |
||||
import org.apache.commons.collections4.MapUtils; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @className: BsMealTableOrderProductServiceImpl |
||||
* @author: HuRui |
||||
* @date: 2023/12/6 |
||||
**/ |
||||
@Service("mealTableOrderProductService") |
||||
public class BsMealTableOrderProductServiceImpl implements BsMealTableOrderProductService { |
||||
|
||||
@Resource |
||||
private BsMealTableOrderProductMapper mealTableOrderProductMapper; |
||||
|
||||
@Override |
||||
public void editData(BsMealTableOrderProduct data) { |
||||
if (data.getId() == null) { |
||||
data.setCreateTime(new Date()); |
||||
data.setUpdateTime(new Date()); |
||||
mealTableOrderProductMapper.insert(data); |
||||
} else { |
||||
data.setUpdateTime(new Date()); |
||||
mealTableOrderProductMapper.updateByPrimaryKey(data); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public List<BsMealTableOrderProduct> getOrderProductList(Map<String, Object> param) { |
||||
BsMealTableOrderProductExample example = new BsMealTableOrderProductExample(); |
||||
BsMealTableOrderProductExample.Criteria criteria = example.createCriteria().andStatusNotEqualTo(0); |
||||
|
||||
if (StringUtils.isNotBlank(MapUtils.getString(param, "orderNo"))) { |
||||
criteria.andOrderNoEqualTo(MapUtils.getString(param, "orderNo")); |
||||
} |
||||
|
||||
example.setOrderByClause("create_time desc"); |
||||
return mealTableOrderProductMapper.selectByExample(example); |
||||
} |
||||
|
||||
@Override |
||||
public BsMealTableOrderProduct getOrderProduct(String orderNo, Long productId) { |
||||
BsMealTableOrderProductExample example = new BsMealTableOrderProductExample(); |
||||
example.createCriteria().andOrderNoEqualTo(orderNo).andStatusNotEqualTo(0); |
||||
List<BsMealTableOrderProduct> list = mealTableOrderProductMapper.selectByExample(example); |
||||
if (!list.isEmpty()) { |
||||
return list.get(0); |
||||
} |
||||
return null; |
||||
} |
||||
} |
Loading…
Reference in new issue