no message
This commit is contained in:
parent
eced56a427
commit
c57c585b37
|
|
@ -749,8 +749,52 @@ public class GoodsController extends BaseController {
|
||||||
// 通过商品的服务类目获取服务店铺
|
// 通过商品的服务类目获取服务店铺
|
||||||
if (goods.getDeptGoodsCategoryId() != null) {
|
if (goods.getDeptGoodsCategoryId() != null) {
|
||||||
try {
|
try {
|
||||||
// 使用新的方法通过商品ID直接获取服务类目下的所有商品
|
// 1. 通过商品的类目ID获取类目信息
|
||||||
List<Goods> goodsList = goodsService.selectGoodsByServiceCategory(goodsId);
|
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(goods.getDeptGoodsCategoryId());
|
||||||
|
Long serviceCategoryId = null;
|
||||||
|
|
||||||
|
if (deptGoodsCategory != null) {
|
||||||
|
// 先检查当前类目是否有服务类目ID
|
||||||
|
if (deptGoodsCategory.getServiceCategoryId() != null) {
|
||||||
|
serviceCategoryId = deptGoodsCategory.getServiceCategoryId();
|
||||||
|
logger.debug("当前类目[{}]的服务类目ID: {}", deptGoodsCategory.getGoodsCategoryName(), serviceCategoryId);
|
||||||
|
} else {
|
||||||
|
// 如果当前类目没有服务类目ID,查找上一级类目
|
||||||
|
logger.debug("当前类目[{}]未配置服务类目ID,查找上一级类目", deptGoodsCategory.getGoodsCategoryName());
|
||||||
|
|
||||||
|
if (deptGoodsCategory.getParentCategoryId() != null) {
|
||||||
|
DeptGoodsCategory parentCategory = deptGoodsCategoryService.selectOneByGoodsCategoryId(deptGoodsCategory.getParentCategoryId());
|
||||||
|
if (parentCategory != null && parentCategory.getServiceCategoryId() != null) {
|
||||||
|
serviceCategoryId = parentCategory.getServiceCategoryId();
|
||||||
|
logger.debug("上一级类目[{}]的服务类目ID: {}", parentCategory.getGoodsCategoryName(), serviceCategoryId);
|
||||||
|
} else {
|
||||||
|
logger.debug("上一级类目[{}]也未配置服务类目ID", parentCategory != null ? parentCategory.getGoodsCategoryName() : "null");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.debug("当前类目没有父级类目");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Goods> goodsList = new ArrayList<>();
|
||||||
|
if (serviceCategoryId != null) {
|
||||||
|
// 2. 通过服务类目ID查询所有使用该服务类目的商品
|
||||||
|
Goods queryGoods = new Goods();
|
||||||
|
queryGoods.setDeptGoodsCategoryId(serviceCategoryId);
|
||||||
|
queryGoods.setStatus(0); // 只查询上架的商品
|
||||||
|
goodsList = goodsService.selectGoodsList(queryGoods);
|
||||||
|
if (goodsList.size() == 0) {
|
||||||
|
DeptGoodsCategory deptGoodsCategory1 = deptGoodsCategoryService.selectOneByGoodsCategoryId(serviceCategoryId);
|
||||||
|
serviceCategoryId = deptGoodsCategory1.getDeptGoodsCategoryId();
|
||||||
|
// 直接使用新方法获取商品列表
|
||||||
|
goodsList = goodsStandardService.selectGoodsByDeptGoodsCategoryId(serviceCategoryId);
|
||||||
|
// 过滤只保留上架的商品
|
||||||
|
goodsList = goodsList.stream()
|
||||||
|
.filter(g -> g.getStatus() != null && g.getStatus() == 0)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
logger.info("获取到的服务类目id{} 取到的商品列表:{}", serviceCategoryId, goodsList);
|
||||||
|
}
|
||||||
|
|
||||||
if (!goodsList.isEmpty()) {
|
if (!goodsList.isEmpty()) {
|
||||||
logger.debug("通过商品ID[{}]找到{}个相关服务商品", goodsId, goodsList.size());
|
logger.debug("通过商品ID[{}]找到{}个相关服务商品", goodsId, goodsList.size());
|
||||||
|
|
@ -901,6 +945,13 @@ public class GoodsController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult editSave(@Validated Goods goods) {
|
public AjaxResult editSave(@Validated Goods goods) {
|
||||||
goods.setUpdateBy(getLoginName());
|
goods.setUpdateBy(getLoginName());
|
||||||
|
|
||||||
|
// 处理Long类型字段的空值情况
|
||||||
|
// 当前端传入0或空字符串时,将shopId设置为null以便清空
|
||||||
|
if (goods.getShopId() != null && goods.getShopId().equals(0L)) {
|
||||||
|
goods.setShopId(null);
|
||||||
|
}
|
||||||
|
|
||||||
return toAjax(goodsService.updateGoods(goods));
|
return toAjax(goodsService.updateGoods(goods));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -908,6 +959,12 @@ public class GoodsController extends BaseController {
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult appEditSave(@RequestBody @Validated Goods goods) {
|
public AjaxResult appEditSave(@RequestBody @Validated Goods goods) {
|
||||||
|
|
||||||
|
// 处理Long类型字段的空值情况
|
||||||
|
// 当前端传入0或空字符串时,将shopId设置为null以便清空
|
||||||
|
if (goods.getShopId() != null && goods.getShopId().equals(0L)) {
|
||||||
|
goods.setShopId(null);
|
||||||
|
}
|
||||||
|
|
||||||
goodsService.edit(goods);
|
goodsService.edit(goods);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -55,4 +55,11 @@ public interface CustomerAddressMapper {
|
||||||
@Param("cityId") Long cityId,
|
@Param("cityId") Long cityId,
|
||||||
@Param("countryId") Long countryId,
|
@Param("countryId") Long countryId,
|
||||||
@Param("address") String address);
|
@Param("address") String address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询地址信息
|
||||||
|
* @param customerAddressIds 地址ID列表
|
||||||
|
* @return 地址列表
|
||||||
|
*/
|
||||||
|
List<CustomerAddress> selectByIds(@Param("customerAddressIds") List<Long> customerAddressIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,11 @@ public interface CustomerAddressService {
|
||||||
int updateCustomerAddress(CustomerAddress customerAddress);
|
int updateCustomerAddress(CustomerAddress customerAddress);
|
||||||
|
|
||||||
CustomerAddress selectByCustomerAndAddress(Long customerId, Long provinceId, Long cityId, Long countryId, String address);
|
CustomerAddress selectByCustomerAndAddress(Long customerId, Long provinceId, Long cityId, Long countryId, String address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询地址信息
|
||||||
|
* @param customerAddressIds 地址ID列表
|
||||||
|
* @return 地址列表
|
||||||
|
*/
|
||||||
|
List<CustomerAddress> selectByIds(List<Long> customerAddressIds);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,14 @@ public class CustomerAddressServiceImpl implements CustomerAddressService {
|
||||||
return customerAddressMapper.selectByCustomerAndAddress(customerId, provinceId, cityId, countryId, address);
|
return customerAddressMapper.selectByCustomerAndAddress(customerId, provinceId, cityId, countryId, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CustomerAddress> selectByIds(List<Long> customerAddressIds) {
|
||||||
|
if (customerAddressIds == null || customerAddressIds.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return customerAddressMapper.selectByIds(customerAddressIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 为地址设置经纬度信息
|
* 为地址设置经纬度信息
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -161,4 +161,13 @@
|
||||||
where customer_address_id = #{customerAddressId}
|
where customer_address_id = #{customerAddressId}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectByIds" resultMap="CustomerAddressResult">
|
||||||
|
<include refid="selectCustomerAddress"/>
|
||||||
|
WHERE customer_address_id IN
|
||||||
|
<foreach collection="customerAddressIds" item="id" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
AND deleted = 0
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
|
|
@ -50,26 +50,26 @@
|
||||||
<update id="updateGoods" parameterType="com.ghy.goods.domain.Goods">
|
<update id="updateGoods" parameterType="com.ghy.goods.domain.Goods">
|
||||||
UPDATE goods
|
UPDATE goods
|
||||||
<set>
|
<set>
|
||||||
<if test="goodsName != null and goodsName != ''">goods_name = #{goodsName},</if>
|
<if test="goodsName != null">goods_name = #{goodsName},</if>
|
||||||
<if test="goodsDesc != null and goodsDesc != ''">goods_desc = #{goodsDesc},</if>
|
<if test="goodsDesc != null">goods_desc = #{goodsDesc},</if>
|
||||||
<if test="goodsSort != null and goodsSort != ''">goods_sort = #{goodsSort},</if>
|
<if test="goodsSort != null">goods_sort = #{goodsSort},</if>
|
||||||
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">dept_goods_category_id = #{deptGoodsCategoryId},</if>
|
<if test="deptGoodsCategoryId != null and deptGoodsCategoryId != ''">dept_goods_category_id = #{deptGoodsCategoryId},</if>
|
||||||
<if test="goodsImgUrl != null and goodsImgUrl != ''">goods_img_url = #{goodsImgUrl},</if>
|
<if test="goodsImgUrl != null">goods_img_url = #{goodsImgUrl},</if>
|
||||||
<if test="goodsVideoUrl != null and goodsVideoUrl != ''">goods_video_url = #{goodsVideoUrl},</if>
|
<if test="goodsVideoUrl != null">goods_video_url = #{goodsVideoUrl},</if>
|
||||||
<if test="status != null">`status` = #{status},</if>
|
<if test="status != null">`status` = #{status},</if>
|
||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="goodsUnit != null and goodsUnit != ''">goods_unit = #{goodsUnit},</if>
|
<if test="goodsUnit != null">goods_unit = #{goodsUnit},</if>
|
||||||
<if test="warrantyPeriod != null and warrantyPeriod != ''">warranty_period = #{warrantyPeriod},</if>
|
<if test="warrantyPeriod != null">warranty_period = #{warrantyPeriod},</if>
|
||||||
<if test="servActivity != null and servActivity!=''">serv_activity = #{servActivity},</if>
|
<if test="servActivity != null">serv_activity = #{servActivity},</if>
|
||||||
<if test="expectDuration != null and expectDuration!=''">expect_duration = #{expectDuration},</if>
|
<if test="expectDuration != null">expect_duration = #{expectDuration},</if>
|
||||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
<if test="areaDesc != null and areaDesc != ''">area_desc = #{areaDesc},</if>
|
<if test="areaDesc != null">area_desc = #{areaDesc},</if>
|
||||||
<if test="type != null">type = #{type},</if>
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="storeService != null">store_service = #{storeService},</if>
|
<if test="storeService != null">store_service = #{storeService},</if>
|
||||||
<if test="installService != null">install_service = #{installService},</if>
|
<if test="installService != null">install_service = #{installService},</if>
|
||||||
<if test="deliveryService != null">delivery_service = #{deliveryService},</if>
|
<if test="deliveryService != null">delivery_service = #{deliveryService},</if>
|
||||||
<if test="shopId != null">shop_id = #{shopId},</if>
|
shop_id = #{shopId},
|
||||||
<if test="shopName != null and shopName != ''">shop_name = #{shopName},</if>
|
<if test="shopName != null">shop_name = #{shopName},</if>
|
||||||
update_time = sysdate()
|
update_time = sysdate()
|
||||||
</set>
|
</set>
|
||||||
WHERE goods_id = #{goodsId}
|
WHERE goods_id = #{goodsId}
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,9 @@
|
||||||
<if test="workerId == -2">
|
<if test="workerId == -2">
|
||||||
and om.worker_id IS not NULL
|
and om.worker_id IS not NULL
|
||||||
</if>
|
</if>
|
||||||
|
<if test="originalWorkerId != null and originalWorkerId > 0">
|
||||||
|
AND om.original_worker_id = #{originalWorkerId}
|
||||||
|
</if>
|
||||||
<if test="payMode != null">
|
<if test="payMode != null">
|
||||||
AND om.pay_mode = #{payMode}
|
AND om.pay_mode = #{payMode}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
|
|
@ -58,11 +58,7 @@
|
||||||
|
|
||||||
<select id="selectById" parameterType="long" resultMap="SysAreaResult">
|
<select id="selectById" parameterType="long" resultMap="SysAreaResult">
|
||||||
<include refid="selectSysArea"/>
|
<include refid="selectSysArea"/>
|
||||||
<where>
|
WHERE area_id = #{areaId}
|
||||||
<if test="areaId != null and areaId != 0">
|
|
||||||
AND area_id = #{areaId}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByAreaCode" parameterType="string" resultMap="SysAreaResult">
|
<select id="selectByAreaCode" parameterType="string" resultMap="SysAreaResult">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue