整理商品模块
This commit is contained in:
@@ -438,7 +438,6 @@ public class WebsiteController extends BaseController {
|
|||||||
return success("清除失败");
|
return success("清除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('cms:website:list')")
|
|
||||||
@ApiOperation("分页查询网站信息记录表")
|
@ApiOperation("分页查询网站信息记录表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Website>> page(WebsiteParam param) {
|
public ApiResult<PageResult<Website>> page(WebsiteParam param) {
|
||||||
|
|||||||
@@ -48,12 +48,21 @@ public class Website implements Serializable {
|
|||||||
@ApiModelProperty(value = "网站类型")
|
@ApiModelProperty(value = "网站类型")
|
||||||
private String websiteType;
|
private String websiteType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "域名前缀")
|
||||||
|
private String prefix;
|
||||||
|
|
||||||
@ApiModelProperty(value = "绑定域名")
|
@ApiModelProperty(value = "绑定域名")
|
||||||
private String domain;
|
private String domain;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "后台管理地址")
|
||||||
|
private String adminUrl;
|
||||||
|
|
||||||
@ApiModelProperty(value = "网站关键词")
|
@ApiModelProperty(value = "网站关键词")
|
||||||
private String keywords;
|
private String keywords;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前版本")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
@ApiModelProperty(value = "服务到期时间")
|
@ApiModelProperty(value = "服务到期时间")
|
||||||
private Date expirationTime;
|
private Date expirationTime;
|
||||||
|
|
||||||
@@ -109,7 +118,7 @@ public class Website implements Serializable {
|
|||||||
private Integer recommend;
|
private Integer recommend;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态")
|
@ApiModelProperty(value = "状态")
|
||||||
private Boolean status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序号")
|
@ApiModelProperty(value = "排序号")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|||||||
@@ -63,11 +63,11 @@ public class MybatisPlusConfig {
|
|||||||
"sys_tenant",
|
"sys_tenant",
|
||||||
"sys_dictionary",
|
"sys_dictionary",
|
||||||
"sys_dictionary_data",
|
"sys_dictionary_data",
|
||||||
"apps_test_data",
|
"apps_test_data"
|
||||||
"shop_users",
|
// "shop_users",
|
||||||
"shop_order",
|
// "shop_order",
|
||||||
"shop_order_info",
|
// "shop_order_info",
|
||||||
"booking_user_invoice"
|
// "booking_user_invoice"
|
||||||
).contains(tableName);
|
).contains(tableName);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.gxwebsoft.shop.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.oa.entity.App;
|
||||||
import com.gxwebsoft.shop.entity.GoodsSku;
|
import com.gxwebsoft.shop.entity.GoodsSku;
|
||||||
import com.gxwebsoft.shop.entity.GoodsSpec;
|
import com.gxwebsoft.shop.entity.GoodsSpec;
|
||||||
import com.gxwebsoft.shop.entity.SpecValue;
|
import com.gxwebsoft.shop.entity.SpecValue;
|
||||||
@@ -25,7 +27,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,6 +49,30 @@ public class GoodsController extends BaseController {
|
|||||||
@Resource
|
@Resource
|
||||||
private GoodsSkuService goodsSkuService;
|
private GoodsSkuService goodsSkuService;
|
||||||
|
|
||||||
|
@ApiOperation("统计信息")
|
||||||
|
@GetMapping("/data")
|
||||||
|
public ApiResult<Map<String, Integer>> data() {
|
||||||
|
Map<String, Integer> data = new HashMap<>();
|
||||||
|
Integer totalNum = goodsService.count(
|
||||||
|
new LambdaQueryWrapper<Goods>().eq(Goods::getIsShow,1).gt(Goods::getStock,0)
|
||||||
|
);
|
||||||
|
Integer totalNum2 = goodsService.count(
|
||||||
|
new LambdaQueryWrapper<Goods>().eq(Goods::getIsShow,0)
|
||||||
|
);
|
||||||
|
Integer totalNum3 = goodsService.count(
|
||||||
|
new LambdaQueryWrapper<Goods>().eq(Goods::getStock,0)
|
||||||
|
);
|
||||||
|
|
||||||
|
data.put("totalNum", totalNum);
|
||||||
|
data.put("totalNum2", totalNum2);
|
||||||
|
data.put("totalNum3", totalNum3);
|
||||||
|
|
||||||
|
// 下架已售罄的商品
|
||||||
|
goodsService.update(new LambdaUpdateWrapper<Goods>().eq(Goods::getStock,0).eq(Goods::getIsShow,1).set(Goods::getIsShow,0));
|
||||||
|
|
||||||
|
return success(data);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("分页查询商品记录表")
|
@ApiOperation("分页查询商品记录表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Goods>> page(GoodsParam param) {
|
public ApiResult<PageResult<Goods>> page(GoodsParam param) {
|
||||||
|
|||||||
@@ -1,59 +1,66 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.shop.service.SpecService;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
|
||||||
import com.gxwebsoft.shop.entity.Spec;
|
import com.gxwebsoft.shop.entity.Spec;
|
||||||
import com.gxwebsoft.shop.param.SpecParam;
|
import com.gxwebsoft.shop.param.SpecParam;
|
||||||
import com.gxwebsoft.shop.service.SpecService;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格控制器
|
* 规格控制器
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
@Api(tags = "商品规格管理")
|
@Api(tags = "规格管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/spec")
|
@RequestMapping("/api/shop/spec")
|
||||||
public class SpecController extends BaseController {
|
public class SpecController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private SpecService specService;
|
private SpecService specService;
|
||||||
|
|
||||||
@ApiOperation("分页查询商品规格")
|
@ApiOperation("分页查询规格")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
public ApiResult<PageResult<Spec>> page(SpecParam param) {
|
public ApiResult<PageResult<Spec>> page(SpecParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(specService.pageRel(param));
|
return success(specService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部商品规格")
|
@ApiOperation("查询全部规格")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<Spec>> list(SpecParam param) {
|
public ApiResult<List<Spec>> list(SpecParam param) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(specService.listRel(param));
|
return success(specService.listRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据id查询商品规格")
|
@PreAuthorize("hasAuthority('shop:spec:list')")
|
||||||
|
@ApiOperation("根据id查询规格")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ApiResult<Spec> get(@PathVariable("id") Integer id) {
|
public ApiResult<Spec> get(@PathVariable("id") Integer id) {
|
||||||
// 使用关联查询
|
// 使用关联查询
|
||||||
return success(specService.getByIdRel(id));
|
return success(specService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("添加商品规格")
|
@PreAuthorize("hasAuthority('shop:spec:save')")
|
||||||
|
@ApiOperation("添加规格")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody Spec spec) {
|
public ApiResult<?> save(@RequestBody Spec spec) {
|
||||||
if (specService.count(new LambdaQueryWrapper<Spec>().eq(Spec::getSpecName,spec.getSpecName())) > 0) {
|
// 记录当前登录用户id
|
||||||
return fail("规格名称已存在");
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
spec.setUserId(loginUser.getUserId());
|
||||||
}
|
}
|
||||||
if (specService.save(spec)) {
|
if (specService.save(spec)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
@@ -61,7 +68,8 @@ public class SpecController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("修改商品规格")
|
@PreAuthorize("hasAuthority('shop:spec:update')")
|
||||||
|
@ApiOperation("修改规格")
|
||||||
@PutMapping()
|
@PutMapping()
|
||||||
public ApiResult<?> update(@RequestBody Spec spec) {
|
public ApiResult<?> update(@RequestBody Spec spec) {
|
||||||
if (specService.updateById(spec)) {
|
if (specService.updateById(spec)) {
|
||||||
@@ -70,7 +78,8 @@ public class SpecController extends BaseController {
|
|||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除商品规格")
|
@PreAuthorize("hasAuthority('shop:spec:remove')")
|
||||||
|
@ApiOperation("删除规格")
|
||||||
@DeleteMapping("/{id}")
|
@DeleteMapping("/{id}")
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
if (specService.removeById(id)) {
|
if (specService.removeById(id)) {
|
||||||
@@ -79,7 +88,8 @@ public class SpecController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("批量添加商品规格")
|
@PreAuthorize("hasAuthority('shop:spec:save')")
|
||||||
|
@ApiOperation("批量添加规格")
|
||||||
@PostMapping("/batch")
|
@PostMapping("/batch")
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<Spec> list) {
|
public ApiResult<?> saveBatch(@RequestBody List<Spec> list) {
|
||||||
if (specService.saveBatch(list)) {
|
if (specService.saveBatch(list)) {
|
||||||
@@ -88,7 +98,9 @@ public class SpecController extends BaseController {
|
|||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("批量修改商品规格")
|
|
||||||
|
@PreAuthorize("hasAuthority('shop:spec:update')")
|
||||||
|
@ApiOperation("批量修改规格")
|
||||||
@PutMapping("/batch")
|
@PutMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<Spec> batchParam) {
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<Spec> batchParam) {
|
||||||
if (batchParam.update(specService, "spec_id")) {
|
if (batchParam.update(specService, "spec_id")) {
|
||||||
@@ -96,8 +108,8 @@ public class SpecController extends BaseController {
|
|||||||
}
|
}
|
||||||
return fail("修改失败");
|
return fail("修改失败");
|
||||||
}
|
}
|
||||||
|
@PreAuthorize("hasAuthority('shop:spec:remove')")
|
||||||
@ApiOperation("批量删除商品规格")
|
@ApiOperation("批量删除规格")
|
||||||
@DeleteMapping("/batch")
|
@DeleteMapping("/batch")
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
if (specService.removeByIds(ids)) {
|
if (specService.removeByIds(ids)) {
|
||||||
|
|||||||
@@ -85,7 +85,10 @@ public class Goods implements Serializable {
|
|||||||
@ApiModelProperty(value = "推荐")
|
@ApiModelProperty(value = "推荐")
|
||||||
private Integer recommend;
|
private Integer recommend;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0正常, 1待修,2异常已修,3异常未修")
|
@ApiModelProperty(value = "1上架 0下架")
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0上架 1下架 2待审核 3审核不通过")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package com.gxwebsoft.shop.entity;
|
package com.gxwebsoft.shop.entity;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@@ -15,39 +13,47 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格组记录表
|
* 规格
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@ApiModel(value = "Spec对象", description = "商品规格组记录表")
|
@ApiModel(value = "Spec对象", description = "规格")
|
||||||
@TableName("shop_spec")
|
@TableName("shop_spec")
|
||||||
public class Spec implements Serializable {
|
public class Spec implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格组ID")
|
@ApiModelProperty(value = "规格ID")
|
||||||
@TableId(value = "spec_id", type = IdType.AUTO)
|
@TableId(value = "spec_id", type = IdType.AUTO)
|
||||||
private Integer specId;
|
private Integer specId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格组名称")
|
@ApiModelProperty(value = "规格名称")
|
||||||
private String specName;
|
private String specName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格值")
|
||||||
|
private String specValue;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建用户")
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新者")
|
||||||
|
private Integer updater;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0正常, 1待修,2异常已修,3异常未修")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序号")
|
@ApiModelProperty(value = "排序号")
|
||||||
private Integer sortNumber;
|
private Integer sortNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0正常, 1禁用")
|
|
||||||
private Integer status;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "租户id")
|
@ApiModelProperty(value = "租户id")
|
||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规则值列表")
|
@ApiModelProperty(value = "创建时间")
|
||||||
@TableField(exist = false)
|
private Date createTime;
|
||||||
private List<SpecValue> specValues;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格组记录表Mapper
|
* 规格Mapper
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
public interface SpecMapper extends BaseMapper<Spec> {
|
public interface SpecMapper extends BaseMapper<Spec> {
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,15 @@
|
|||||||
<if test="param.recommend != null">
|
<if test="param.recommend != null">
|
||||||
AND a.recommend = #{param.recommend}
|
AND a.recommend = #{param.recommend}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.isShow != null">
|
||||||
|
AND a.is_show = #{param.isShow}
|
||||||
|
</if>
|
||||||
<if test="param.status != null">
|
<if test="param.status != null">
|
||||||
AND a.status = #{param.status}
|
AND a.status = #{param.status}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.stock != null">
|
||||||
|
AND a.stock = #{param.stock}
|
||||||
|
</if>
|
||||||
<if test="param.comments != null">
|
<if test="param.comments != null">
|
||||||
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
</if>
|
</if>
|
||||||
@@ -78,6 +84,8 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.goods_name = #{param.keywords}
|
||||||
|
OR a.code = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -40,6 +40,8 @@
|
|||||||
</if>
|
</if>
|
||||||
<if test="param.keywords != null">
|
<if test="param.keywords != null">
|
||||||
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
OR a.phone = #{param.keywords}
|
||||||
|
OR a.real_name = #{param.keywords}
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
|
|||||||
@@ -10,8 +10,26 @@
|
|||||||
<if test="param.specId != null">
|
<if test="param.specId != null">
|
||||||
AND a.spec_id = #{param.specId}
|
AND a.spec_id = #{param.specId}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.name != null">
|
<if test="param.specName != null">
|
||||||
AND a.name LIKE CONCAT('%', #{param.name}, '%')
|
AND a.spec_name LIKE CONCAT('%', #{param.specName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.specValue != null">
|
||||||
|
AND a.spec_value LIKE CONCAT('%', #{param.specValue}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.userId != null">
|
||||||
|
AND a.user_id = #{param.userId}
|
||||||
|
</if>
|
||||||
|
<if test="param.updater != null">
|
||||||
|
AND a.updater = #{param.updater}
|
||||||
|
</if>
|
||||||
|
<if test="param.comments != null">
|
||||||
|
AND a.comments LIKE CONCAT('%', #{param.comments}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="param.status != null">
|
||||||
|
AND a.status = #{param.status}
|
||||||
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
</if>
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
AND a.create_time >= #{param.createTimeStart}
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
@@ -19,6 +37,10 @@
|
|||||||
<if test="param.createTimeEnd != null">
|
<if test="param.createTimeEnd != null">
|
||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.keywords != null">
|
||||||
|
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -70,10 +70,18 @@ public class GoodsParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer recommend;
|
private Integer recommend;
|
||||||
|
|
||||||
@ApiModelProperty(value = "状态, 0正常, 1待修,2异常已修,3异常未修")
|
@ApiModelProperty(value = "1上架 0下架")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer isShow;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0上架 1下架 2待审核 3审核不通过")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "库存")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
private String comments;
|
private String comments;
|
||||||
|
|
||||||
|
|||||||
@@ -11,23 +11,45 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格组记录表查询参数
|
* 规格查询参数
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@ApiModel(value = "SpecParam对象", description = "商品规格组记录表查询参数")
|
@ApiModel(value = "SpecParam对象", description = "规格查询参数")
|
||||||
public class SpecParam extends BaseParam {
|
public class SpecParam extends BaseParam {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格组ID")
|
@ApiModelProperty(value = "规格ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer specId;
|
private Integer specId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "规格组名称")
|
@ApiModelProperty(value = "规格名称")
|
||||||
private String name;
|
private String specName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "规格值")
|
||||||
|
private String specValue;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建用户")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新者")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer updater;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "备注")
|
||||||
|
private String comments;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "状态, 0正常, 1待修,2异常已修,3异常未修")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,10 @@ import com.gxwebsoft.shop.param.SpecParam;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格组记录表Service
|
* 规格Service
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
public interface SpecService extends IService<Spec> {
|
public interface SpecService extends IService<Spec> {
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ public interface SpecService extends IService<Spec> {
|
|||||||
/**
|
/**
|
||||||
* 根据id查询
|
* 根据id查询
|
||||||
*
|
*
|
||||||
* @param specId 规格组ID
|
* @param specId 规格ID
|
||||||
* @return Spec
|
* @return Spec
|
||||||
*/
|
*/
|
||||||
Spec getByIdRel(Integer specId);
|
Spec getByIdRel(Integer specId);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import com.gxwebsoft.shop.service.GoodsSpecService;
|
|||||||
import org.apache.tomcat.util.buf.StringUtils;
|
import org.apache.tomcat.util.buf.StringUtils;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -62,18 +63,22 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|||||||
public void saveBatchByAsync(Goods goods) {
|
public void saveBatchByAsync(Goods goods) {
|
||||||
// 保存商品规格
|
// 保存商品规格
|
||||||
final List<GoodsSpec> goodsSpecs = goods.getGoodsSpecs();
|
final List<GoodsSpec> goodsSpecs = goods.getGoodsSpecs();
|
||||||
|
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||||
goodsSpecs.forEach(d -> {
|
goodsSpecs.forEach(d -> {
|
||||||
d.setGoodsId(goods.getGoodsId());
|
d.setGoodsId(goods.getGoodsId());
|
||||||
final List<String> collect = d.getValueList().stream().map(SpecValue::getSpecValue).collect(Collectors.toList());
|
final List<String> collect = d.getValueList().stream().map(SpecValue::getSpecValue).collect(Collectors.toList());
|
||||||
d.setSpecValues(StringUtils.join(collect, ','));
|
d.setSpecValues(StringUtils.join(collect, ','));
|
||||||
});
|
});
|
||||||
goodsSpecService.saveBatch(goodsSpecs);
|
goodsSpecService.saveBatch(goodsSpecs);
|
||||||
|
}
|
||||||
// 保存商品sku表
|
// 保存商品sku表
|
||||||
final List<GoodsSku> goodsSkus = goods.getGoodsSkus();
|
final List<GoodsSku> goodsSkus = goods.getGoodsSkus();
|
||||||
|
if (!CollectionUtils.isEmpty(goodsSkus)) {
|
||||||
goodsSkus.forEach(d -> {
|
goodsSkus.forEach(d -> {
|
||||||
d.setGoodsId(goods.getGoodsId());
|
d.setGoodsId(goods.getGoodsId());
|
||||||
});
|
});
|
||||||
goodsSkuService.saveBatch(goodsSkus);
|
goodsSkuService.saveBatch(goodsSkus);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,40 +1,30 @@
|
|||||||
package com.gxwebsoft.shop.service.impl;
|
package com.gxwebsoft.shop.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.shop.entity.SpecValue;
|
|
||||||
import com.gxwebsoft.shop.mapper.SpecMapper;
|
import com.gxwebsoft.shop.mapper.SpecMapper;
|
||||||
import com.gxwebsoft.shop.param.SpecValueParam;
|
|
||||||
import com.gxwebsoft.shop.service.SpecService;
|
import com.gxwebsoft.shop.service.SpecService;
|
||||||
import com.gxwebsoft.shop.entity.Spec;
|
import com.gxwebsoft.shop.entity.Spec;
|
||||||
import com.gxwebsoft.shop.param.SpecParam;
|
import com.gxwebsoft.shop.param.SpecParam;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.shop.service.SpecValueService;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品规格组记录表Service实现
|
* 规格Service实现
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-04-01 09:29:43
|
* @since 2024-07-25 03:00:41
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements SpecService {
|
public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements SpecService {
|
||||||
@Resource
|
|
||||||
private SpecValueService specValueService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<Spec> pageRel(SpecParam param) {
|
public PageResult<Spec> pageRel(SpecParam param) {
|
||||||
PageParam<Spec, SpecParam> page = new PageParam<>(param);
|
PageParam<Spec, SpecParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("sort_number asc");
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
List<Spec> list = baseMapper.selectPageRel(page, param);
|
List<Spec> list = baseMapper.selectPageRel(page, param);
|
||||||
list.forEach(item -> {
|
|
||||||
item.setSpecValues(specValueService.list(new LambdaQueryWrapper<SpecValue>().eq(SpecValue::getSpecId,item.getSpecId())));
|
|
||||||
});
|
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,10 +33,7 @@ public class SpecServiceImpl extends ServiceImpl<SpecMapper, Spec> implements Sp
|
|||||||
List<Spec> list = baseMapper.selectListRel(param);
|
List<Spec> list = baseMapper.selectListRel(param);
|
||||||
// 排序
|
// 排序
|
||||||
PageParam<Spec, SpecParam> page = new PageParam<>();
|
PageParam<Spec, SpecParam> page = new PageParam<>();
|
||||||
page.setDefaultOrder("sort_number asc");
|
page.setDefaultOrder("sort_number asc, create_time desc");
|
||||||
list.forEach(item -> {
|
|
||||||
item.setSpecValues(specValueService.list(new LambdaQueryWrapper<SpecValue>().eq(SpecValue::getSpecId,item.getSpecId())));
|
|
||||||
});
|
|
||||||
return page.sortRecords(list);
|
return page.sortRecords(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class OrderInfoTask extends BaseController {
|
|||||||
final int minute = DateUtil.minute(DateUtil.date());
|
final int minute = DateUtil.minute(DateUtil.date());
|
||||||
final int second = DateUtil.second(DateUtil.date());
|
final int second = DateUtil.second(DateUtil.date());
|
||||||
final String startTime = String.format("%02d", hour).concat(":").concat(String.format("%02d", minute)).concat(":").concat(String.format("%02d", second));
|
final String startTime = String.format("%02d", hour).concat(":").concat(String.format("%02d", minute)).concat(":").concat(String.format("%02d", second));
|
||||||
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderStatus, 0).ne(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,startTime));
|
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getTenantId,10150).eq(OrderInfo::getOrderStatus, 0).ne(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,startTime));
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setOrderStatus(1);
|
d.setOrderStatus(1);
|
||||||
order.setOrderId(d.getOrderId());
|
order.setOrderId(d.getOrderId());
|
||||||
@@ -61,7 +61,7 @@ public class OrderInfoTask extends BaseController {
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public void settledExpirationOrderBy3028() {
|
public void settledExpirationOrderBy3028() {
|
||||||
final Order order = new Order();
|
final Order order = new Order();
|
||||||
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getOrderStatus, 0).eq(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,"21:30:00"));
|
final List<OrderInfo> list = orderInfoService.list(new LambdaQueryWrapper<OrderInfo>().eq(OrderInfo::getTenantId,10150).eq(OrderInfo::getOrderStatus, 0).eq(OrderInfo::getMerchantId,3028).eq(OrderInfo::getDateTime,DateUtil.today()).lt(OrderInfo::getStartTime,"21:30:00"));
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setOrderStatus(1);
|
d.setOrderStatus(1);
|
||||||
order.setOrderId(d.getOrderId());
|
order.setOrderId(d.getOrderId());
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class CmsGenerator {
|
|||||||
// "cms_mp_pages",
|
// "cms_mp_pages",
|
||||||
// "cms_mp"
|
// "cms_mp"
|
||||||
// "cms_mp_field"
|
// "cms_mp_field"
|
||||||
"cms_mp_ad"
|
// "cms_mp_ad"
|
||||||
|
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
|
|||||||
@@ -28,7 +28,9 @@ public class ShopGenerator {
|
|||||||
// 输出目录
|
// 输出目录
|
||||||
private static final String OUTPUT_DIR = "/src/main/java";
|
private static final String OUTPUT_DIR = "/src/main/java";
|
||||||
// Vue文件输出位置
|
// Vue文件输出位置
|
||||||
private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/com.gxwebsoft.core-web";
|
private static final String OUTPUT_LOCATION_VUE = "/Users/gxwebsoft/VUE/gxtyzx-admin-vue";
|
||||||
|
// Vue文件输出目录
|
||||||
|
private static final String OUTPUT_LOCATION_UNIAPP = "/Users/gxwebsoft/VUE/nbg";
|
||||||
// Vue文件输出目录
|
// Vue文件输出目录
|
||||||
private static final String OUTPUT_DIR_VUE = "/src";
|
private static final String OUTPUT_DIR_VUE = "/src";
|
||||||
// 作者名称
|
// 作者名称
|
||||||
@@ -46,7 +48,7 @@ public class ShopGenerator {
|
|||||||
private static final String MODULE_NAME = "shop";
|
private static final String MODULE_NAME = "shop";
|
||||||
// 需要生成的表
|
// 需要生成的表
|
||||||
private static final String[] TABLE_NAMES = new String[]{
|
private static final String[] TABLE_NAMES = new String[]{
|
||||||
// "shop_spec",
|
"shop_spec",
|
||||||
// "shop_spec_value",
|
// "shop_spec_value",
|
||||||
// "shop_goods",
|
// "shop_goods",
|
||||||
// "shop_goods_spec",
|
// "shop_goods_spec",
|
||||||
@@ -72,7 +74,7 @@ public class ShopGenerator {
|
|||||||
// "shop_order_info_log",
|
// "shop_order_info_log",
|
||||||
// "shop_order_goods",
|
// "shop_order_goods",
|
||||||
// "shop_wechat_deposit",
|
// "shop_wechat_deposit",
|
||||||
"shop_users",
|
// "shop_users",
|
||||||
// "shop_user_address",
|
// "shop_user_address",
|
||||||
// "shop_user_balance_log"
|
// "shop_user_balance_log"
|
||||||
};
|
};
|
||||||
@@ -204,6 +206,14 @@ public class ShopGenerator {
|
|||||||
+ tableInfo.getEntityPath() + "/" + "index.ts";
|
+ tableInfo.getEntityPath() + "/" + "index.ts";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
focList.add(new FileOutConfig() {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE
|
||||||
|
+ "/api/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/" + "index.ts";
|
||||||
|
}
|
||||||
|
});
|
||||||
// 生成TS文件 (/api/shop/goods/model/index.ts)
|
// 生成TS文件 (/api/shop/goods/model/index.ts)
|
||||||
templatePath = TEMPLATES_DIR + "/model.ts.btl";
|
templatePath = TEMPLATES_DIR + "/model.ts.btl";
|
||||||
focList.add(new FileOutConfig(templatePath) {
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
@@ -214,6 +224,14 @@ public class ShopGenerator {
|
|||||||
+ tableInfo.getEntityPath() + "/model/" + "index.ts";
|
+ tableInfo.getEntityPath() + "/model/" + "index.ts";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
@Override
|
||||||
|
public String outputFile(TableInfo tableInfo) {
|
||||||
|
return OUTPUT_LOCATION_UNIAPP + OUTPUT_DIR_VUE
|
||||||
|
+ "/api/" + pc.getModuleName() + "/"
|
||||||
|
+ tableInfo.getEntityPath() + "/model/" + "index.ts";
|
||||||
|
}
|
||||||
|
});
|
||||||
// 生成Vue文件(/views/shop/goods/index.vue)
|
// 生成Vue文件(/views/shop/goods/index.vue)
|
||||||
templatePath = TEMPLATES_DIR + "/index.vue.btl";
|
templatePath = TEMPLATES_DIR + "/index.vue.btl";
|
||||||
focList.add(new FileOutConfig(templatePath) {
|
focList.add(new FileOutConfig(templatePath) {
|
||||||
|
|||||||
Reference in New Issue
Block a user