修复商城分类
This commit is contained in:
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||||||
import com.gxwebsoft.cms.entity.*;
|
import com.gxwebsoft.cms.entity.*;
|
||||||
import com.gxwebsoft.cms.param.MpParam;
|
import com.gxwebsoft.cms.param.MpParam;
|
||||||
import com.gxwebsoft.cms.service.*;
|
import com.gxwebsoft.cms.service.*;
|
||||||
|
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||||
import com.gxwebsoft.common.core.utils.RedisUtil;
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
@@ -67,7 +68,9 @@ public class MpController extends BaseController {
|
|||||||
}
|
}
|
||||||
// 从缓存读取信息
|
// 从缓存读取信息
|
||||||
if (StrUtil.isNotBlank(mpInfo)) {
|
if (StrUtil.isNotBlank(mpInfo)) {
|
||||||
// return success(JSONObject.parseObject(siteInfo,Website.class));
|
final Object object = JSONUtil.parseObject(mpInfo, Object.class);
|
||||||
|
System.out.println("object = " + object);
|
||||||
|
return success(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取小程序信息
|
// 获取小程序信息
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.*;
|
|||||||
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.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -84,4 +85,8 @@ public class MpPages implements Serializable {
|
|||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<MpAd> ads;
|
private List<MpAd> ads;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "页面参数")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private HashMap<String, Object> config;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.gxwebsoft.cms.service.impl;
|
package com.gxwebsoft.cms.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.cms.entity.MpAd;
|
import com.gxwebsoft.cms.entity.MpAd;
|
||||||
|
import com.gxwebsoft.cms.entity.MpField;
|
||||||
import com.gxwebsoft.cms.entity.MpMenu;
|
import com.gxwebsoft.cms.entity.MpMenu;
|
||||||
import com.gxwebsoft.cms.mapper.MpPagesMapper;
|
import com.gxwebsoft.cms.mapper.MpPagesMapper;
|
||||||
import com.gxwebsoft.cms.service.MpAdService;
|
import com.gxwebsoft.cms.service.MpAdService;
|
||||||
|
import com.gxwebsoft.cms.service.MpFieldService;
|
||||||
import com.gxwebsoft.cms.service.MpMenuService;
|
import com.gxwebsoft.cms.service.MpMenuService;
|
||||||
import com.gxwebsoft.cms.service.MpPagesService;
|
import com.gxwebsoft.cms.service.MpPagesService;
|
||||||
import com.gxwebsoft.cms.entity.MpPages;
|
import com.gxwebsoft.cms.entity.MpPages;
|
||||||
@@ -16,6 +19,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
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.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -32,21 +36,31 @@ public class MpPagesServiceImpl extends ServiceImpl<MpPagesMapper, MpPages> impl
|
|||||||
private MpMenuService mpMenuService;
|
private MpMenuService mpMenuService;
|
||||||
@Resource
|
@Resource
|
||||||
private MpAdService mpAdService;
|
private MpAdService mpAdService;
|
||||||
|
@Resource
|
||||||
|
private MpFieldService mpFieldService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<MpPages> pageRel(MpPagesParam param) {
|
public PageResult<MpPages> pageRel(MpPagesParam param) {
|
||||||
PageParam<MpPages, MpPagesParam> page = new PageParam<>(param);
|
PageParam<MpPages, MpPagesParam> page = new PageParam<>(param);
|
||||||
page.setDefaultOrder("sort_number asc, create_time asc");
|
page.setDefaultOrder("sort_number asc, create_time asc");
|
||||||
List<MpPages> list = baseMapper.selectPageRel(page, param);
|
List<MpPages> list = baseMapper.selectPageRel(page, param);
|
||||||
System.out.println("param = " + param);
|
System.out.println("param = " + param);
|
||||||
System.out.println("list2 = " + list);
|
System.out.println("list2 = " + list);
|
||||||
if (!CollectionUtils.isEmpty(list) && param.getSceneType() != null && param.getSceneType().equals("showMpMenus")) {
|
if (!CollectionUtils.isEmpty(list) && param.getSceneType() != null && param.getSceneType().equals("showMpMenus")) {
|
||||||
final List<MpMenu> mpMenus = mpMenuService.list(new LambdaUpdateWrapper<MpMenu>().eq(MpMenu::getPageId, list.get(0).getId()));
|
final Integer pageId = list.get(0).getId();
|
||||||
|
final List<MpMenu> mpMenus = mpMenuService.list(new LambdaUpdateWrapper<MpMenu>().eq(MpMenu::getPageId, pageId));
|
||||||
final Map<Integer, List<MpMenu>> collect = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getParentId));
|
final Map<Integer, List<MpMenu>> collect = mpMenus.stream().collect(Collectors.groupingBy(MpMenu::getParentId));
|
||||||
final List<MpAd> ads = mpAdService.list(new LambdaUpdateWrapper<MpAd>().eq(MpAd::getPageId, list.get(0).getId()));
|
final List<MpAd> ads = mpAdService.list(new LambdaUpdateWrapper<MpAd>().eq(MpAd::getPageId, pageId).eq(MpAd::getStatus,0));
|
||||||
|
final List<MpField> mpFields = mpFieldService.list(new LambdaQueryWrapper<MpField>().eq(MpField::getPageId, pageId));
|
||||||
|
// 配置信息
|
||||||
|
HashMap<String, Object> fields = new HashMap<>();
|
||||||
|
mpFields.forEach(d -> {
|
||||||
|
fields.put(d.getName(), d.getValue());
|
||||||
|
});
|
||||||
list.forEach(d -> {
|
list.forEach(d -> {
|
||||||
d.setMpMenus(collect);
|
d.setMpMenus(collect);
|
||||||
d.setAds(ads);
|
d.setAds(ads);
|
||||||
|
d.setConfig(fields);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return new PageResult<>(list, page.getTotal());
|
return new PageResult<>(list, page.getTotal());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.shop.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
|
import com.gxwebsoft.shop.entity.DealerReferee;
|
||||||
import com.gxwebsoft.shop.entity.DealerUser;
|
import com.gxwebsoft.shop.entity.DealerUser;
|
||||||
import com.gxwebsoft.shop.service.DealerApplyService;
|
import com.gxwebsoft.shop.service.DealerApplyService;
|
||||||
import com.gxwebsoft.shop.entity.DealerApply;
|
import com.gxwebsoft.shop.entity.DealerApply;
|
||||||
@@ -12,10 +13,12 @@ import com.gxwebsoft.common.core.web.PageParam;
|
|||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
|
import com.gxwebsoft.shop.service.DealerRefereeService;
|
||||||
import com.gxwebsoft.shop.service.DealerUserService;
|
import com.gxwebsoft.shop.service.DealerUserService;
|
||||||
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.security.access.prepost.PreAuthorize;
|
||||||
|
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;
|
||||||
@@ -35,6 +38,8 @@ public class DealerApplyController extends BaseController {
|
|||||||
private DealerApplyService dealerApplyService;
|
private DealerApplyService dealerApplyService;
|
||||||
@Resource
|
@Resource
|
||||||
private DealerUserService dealerUserService;
|
private DealerUserService dealerUserService;
|
||||||
|
@Resource
|
||||||
|
private DealerRefereeService dealerRefereeService;
|
||||||
|
|
||||||
@ApiOperation("分页查询分销商申请记录表")
|
@ApiOperation("分页查询分销商申请记录表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -57,6 +62,7 @@ public class DealerApplyController extends BaseController {
|
|||||||
return success(dealerApplyService.getByIdRel(id));
|
return success(dealerApplyService.getByIdRel(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
@ApiOperation("添加分销商申请记录表")
|
@ApiOperation("添加分销商申请记录表")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody DealerApply dealerApply) {
|
public ApiResult<?> save(@RequestBody DealerApply dealerApply) {
|
||||||
@@ -70,14 +76,24 @@ public class DealerApplyController extends BaseController {
|
|||||||
dealerUser.setMobile(loginUser.getPhone());
|
dealerUser.setMobile(loginUser.getPhone());
|
||||||
dealerUser.setTenantId(loginUser.getTenantId());
|
dealerUser.setTenantId(loginUser.getTenantId());
|
||||||
}
|
}
|
||||||
if (dealerUserService.count(new LambdaQueryWrapper<DealerUser>().eq(DealerUser::getUserId,refereeId)) == 0) {
|
final int count = dealerUserService.count(new LambdaQueryWrapper<DealerUser>().eq(DealerUser::getUserId, refereeId));
|
||||||
|
System.out.println("count = " + count);
|
||||||
|
if (dealerUserService.count(new LambdaQueryWrapper<DealerUser>().eq(DealerUser::getUserId,refereeId)) == 0) {
|
||||||
return fail("邀请人ID不存在");
|
return fail("邀请人ID不存在");
|
||||||
}
|
}
|
||||||
if (dealerApplyService.save(dealerApply)) {
|
if (dealerApplyService.save(dealerApply)) {
|
||||||
|
// 加入正式分销商
|
||||||
dealerUser.setRealName(dealerApply.getRealName());
|
dealerUser.setRealName(dealerApply.getRealName());
|
||||||
dealerUser.setRefereeId(dealerApply.getRefereeId());
|
dealerUser.setRefereeId(dealerApply.getRefereeId());
|
||||||
System.out.println("dealerUser = " + dealerUser);
|
|
||||||
dealerUserService.save(dealerUser);
|
dealerUserService.save(dealerUser);
|
||||||
|
// 添加关系
|
||||||
|
final DealerReferee referee = new DealerReferee();
|
||||||
|
referee.setDealerId(refereeId);
|
||||||
|
referee.setUserId(dealerUser.getUserId());
|
||||||
|
referee.setLevel(1);
|
||||||
|
referee.setTenantId(dealerApply.getTenantId());
|
||||||
|
dealerRefereeService.save(referee);
|
||||||
|
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
return fail("添加失败");
|
return fail("添加失败");
|
||||||
|
|||||||
@@ -1,114 +1,192 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.gxwebsoft.common.core.config.ConfigProperties;
|
||||||
|
import com.gxwebsoft.common.core.utils.RedisUtil;
|
||||||
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.shop.service.DealerUserService;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import com.gxwebsoft.shop.entity.DealerUser;
|
import com.gxwebsoft.shop.entity.DealerUser;
|
||||||
import com.gxwebsoft.shop.param.DealerUserParam;
|
import com.gxwebsoft.shop.param.DealerUserParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.shop.service.DealerUserService;
|
||||||
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.io.File;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.gxwebsoft.common.core.constants.RedisConstants.ACCESS_TOKEN_KEY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分销商用户记录表控制器
|
* 分销商用户记录表控制器
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
@Api(tags = "分销商用户记录表管理")
|
@Api(tags = "分销商用户记录表管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/dealer-user")
|
@RequestMapping("/api/shop/dealer-user")
|
||||||
public class DealerUserController extends BaseController {
|
public class DealerUserController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private DealerUserService dealerUserService;
|
private DealerUserService dealerUserService;
|
||||||
|
@Resource
|
||||||
|
private RedisUtil redisUtil;
|
||||||
|
@Resource
|
||||||
|
private ConfigProperties config;
|
||||||
|
|
||||||
@ApiOperation("分页查询分销商用户记录表")
|
|
||||||
@GetMapping("/page")
|
@ApiOperation("生成专属二维码")
|
||||||
public ApiResult<PageResult<DealerUser>> page(DealerUserParam param) {
|
@GetMapping("/getDealerUserQrcode")
|
||||||
// 使用关联查询
|
public ApiResult<?> getDealerUserQrcode() {
|
||||||
return success(dealerUserService.pageRel(param));
|
final Integer loginUserId = getLoginUserId();
|
||||||
|
if(loginUserId == null){
|
||||||
|
return fail("请先登录");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部分销商用户记录表")
|
final DealerUser dealerUser = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>().eq(DealerUser::getUserId, loginUserId).last("limit 1"));
|
||||||
@GetMapping()
|
|
||||||
public ApiResult<List<DealerUser>> list(DealerUserParam param) {
|
// 生成小程序码
|
||||||
// 使用关联查询
|
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||||
return success(dealerUserService.listRel(param));
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("path", "package/dealer/invite?id=" + loginUserId);
|
||||||
|
map.put("env_version", "trial"); // 正式版为"release",体验版为"trial",开发版为"develop"
|
||||||
|
|
||||||
|
// 获取图片 Buffer
|
||||||
|
byte[] qrCode = HttpRequest.post(apiUrl)
|
||||||
|
.body(JSON.toJSONString(map))
|
||||||
|
.execute().bodyBytes();
|
||||||
|
|
||||||
|
// 保存的文件名称
|
||||||
|
final String fileName = loginUserId.toString().concat(".png");
|
||||||
|
// 保存路径
|
||||||
|
String filePath = getUploadDir().concat("user-code/") + fileName;
|
||||||
|
File file = FileUtil.writeBytes(qrCode, filePath);
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
|
final String qrcode = config.getFileServer().concat("/user-code/").concat(fileName);
|
||||||
|
dealerUser.setQrcode(qrcode);
|
||||||
|
dealerUserService.updateById(dealerUser);
|
||||||
|
return success("操作成功",qrcode);
|
||||||
|
}
|
||||||
|
return success(dealerUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("分页查询分销商用户记录表")
|
||||||
|
@GetMapping("/page")
|
||||||
|
public ApiResult<PageResult<DealerUser>> page(DealerUserParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(dealerUserService.pageRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询全部分销商用户记录表")
|
||||||
|
@GetMapping()
|
||||||
|
public ApiResult<List<DealerUser>> list(DealerUserParam param) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(dealerUserService.listRel(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("根据id查询分销商用户记录表")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<DealerUser> get(@PathVariable("id") Integer id) {
|
||||||
|
// 分销商信息
|
||||||
|
final DealerUser dealerUser = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>()
|
||||||
|
.eq(DealerUser::getUserId, id)
|
||||||
|
.eq(DealerUser::getIsDelete, 0)
|
||||||
|
.last("limit 1")
|
||||||
|
);
|
||||||
|
// 上级分销商
|
||||||
|
final DealerUser dealerUser1 = dealerUserService.getOne(new LambdaQueryWrapper<DealerUser>()
|
||||||
|
.eq(DealerUser::getUserId, dealerUser.getRefereeId())
|
||||||
|
.eq(DealerUser::getIsDelete, 0));
|
||||||
|
dealerUser.setDealerName(dealerUser1.getRealName());
|
||||||
|
dealerUser.setDealerUser(dealerUser1);
|
||||||
|
return success(dealerUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加分销商用户记录表")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody DealerUser dealerUser) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
dealerUser.setUserId(loginUser.getUserId());
|
||||||
|
}
|
||||||
|
if (dealerUserService.save(dealerUser)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改分销商用户记录表")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody DealerUser dealerUser) {
|
||||||
|
if (dealerUserService.updateById(dealerUser)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除分销商用户记录表")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (dealerUserService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加分销商用户记录表")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<DealerUser> list) {
|
||||||
|
if (dealerUserService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改分销商用户记录表")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<DealerUser> batchParam) {
|
||||||
|
if (batchParam.update(dealerUserService, "id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除分销商用户记录表")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (dealerUserService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String getAccessToken() {
|
||||||
|
String key = ACCESS_TOKEN_KEY.concat(":").concat(getTenantId().toString());
|
||||||
|
// 从缓存获取access_token
|
||||||
|
final String value = redisUtil.get(key);
|
||||||
|
if (value != null) {
|
||||||
|
// 解析access_token
|
||||||
|
JSONObject response = JSON.parseObject(value);
|
||||||
|
return response.getString("access_token");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("根据id查询分销商用户记录表")
|
return null;
|
||||||
@GetMapping("/{id}")
|
}
|
||||||
public ApiResult<DealerUser> get(@PathVariable("id") Integer id) {
|
|
||||||
// 使用关联查询
|
|
||||||
return success(dealerUserService.getByIdRel(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("添加分销商用户记录表")
|
|
||||||
@PostMapping()
|
|
||||||
public ApiResult<?> save(@RequestBody DealerUser dealerUser) {
|
|
||||||
// 记录当前登录用户id
|
|
||||||
User loginUser = getLoginUser();
|
|
||||||
if (loginUser != null) {
|
|
||||||
dealerUser.setUserId(loginUser.getUserId());
|
|
||||||
}
|
|
||||||
if (dealerUserService.save(dealerUser)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改分销商用户记录表")
|
|
||||||
@PutMapping()
|
|
||||||
public ApiResult<?> update(@RequestBody DealerUser dealerUser) {
|
|
||||||
if (dealerUserService.updateById(dealerUser)) {
|
|
||||||
return success("修改成功");
|
|
||||||
}
|
|
||||||
return fail("修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除分销商用户记录表")
|
|
||||||
@DeleteMapping("/{id}")
|
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
|
||||||
if (dealerUserService.removeById(id)) {
|
|
||||||
return success("删除成功");
|
|
||||||
}
|
|
||||||
return fail("删除失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("批量添加分销商用户记录表")
|
|
||||||
@PostMapping("/batch")
|
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<DealerUser> list) {
|
|
||||||
if (dealerUserService.saveBatch(list)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("批量修改分销商用户记录表")
|
|
||||||
@PutMapping("/batch")
|
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<DealerUser> batchParam) {
|
|
||||||
if (batchParam.update(dealerUserService, "user_id")) {
|
|
||||||
return success("修改成功");
|
|
||||||
}
|
|
||||||
return fail("修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("批量删除分销商用户记录表")
|
|
||||||
@DeleteMapping("/batch")
|
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
|
||||||
if (dealerUserService.removeByIds(ids)) {
|
|
||||||
return success("删除成功");
|
|
||||||
}
|
|
||||||
return fail("删除失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private String getUploadDir() {
|
||||||
|
return config.getUploadPath() + "file/";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.gxwebsoft.shop.controller;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
|
import com.gxwebsoft.cms.entity.Navigation;
|
||||||
import com.gxwebsoft.common.core.utils.JSONUtil;
|
import com.gxwebsoft.common.core.utils.JSONUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
@@ -16,6 +17,7 @@ import com.gxwebsoft.shop.service.GoodsService;
|
|||||||
import com.gxwebsoft.shop.service.GoodsSpecService;
|
import com.gxwebsoft.shop.service.GoodsSpecService;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -37,132 +39,212 @@ import static com.gxwebsoft.common.core.utils.CommonUtil.toTreeData;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/goods-category")
|
@RequestMapping("/api/shop/goods-category")
|
||||||
public class GoodsCategoryController extends BaseController {
|
public class GoodsCategoryController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private GoodsCategoryService goodsCategoryService;
|
private GoodsCategoryService goodsCategoryService;
|
||||||
@Resource
|
@Resource
|
||||||
private GoodsSpecService goodsSpecService;
|
private GoodsSpecService goodsSpecService;
|
||||||
@Resource
|
@Resource
|
||||||
private GoodsService goodsService;
|
private GoodsService goodsService;
|
||||||
|
|
||||||
@ApiOperation("查询全部商品分类(树型结构)")
|
@ApiOperation("查询商城菜单分类级商品数据(不联动)")
|
||||||
@GetMapping("/getTree")
|
@GetMapping("/listCategoryTree")
|
||||||
public ApiResult<List<GoodsCategory>> getTree(GoodsCategoryParam param) {
|
public ApiResult<List<GoodsCategory>> listCategoryTree(GoodsCategoryParam param) {
|
||||||
final List<GoodsCategory> list = goodsCategoryService.listRel(param);
|
// 查询非店铺分类
|
||||||
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
param.setMerchantId(0);
|
||||||
if (categoryIds.isEmpty()) {
|
final List<GoodsCategory> goodsCategoryList = goodsCategoryService.listRel(param);
|
||||||
return success(list);
|
// 收集分类ID
|
||||||
|
final Set<Integer> categoryIds = goodsCategoryList.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||||
|
if (categoryIds.isEmpty()) {
|
||||||
|
return success(goodsCategoryList);
|
||||||
|
}
|
||||||
|
// List转为树形结构
|
||||||
|
final List<GoodsCategory> list = toTreeData(goodsCategoryList, 0, GoodsCategory::getParentId, GoodsCategory::getCategoryId, GoodsCategory::setChildren);
|
||||||
|
// 查询所有商品
|
||||||
|
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>()
|
||||||
|
.in(Goods::getCategoryId, categoryIds)
|
||||||
|
.eq(Goods::getIsShow, 1)
|
||||||
|
.eq(Goods::getDeleted, 0));
|
||||||
|
|
||||||
|
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||||
|
|
||||||
|
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||||
|
|
||||||
|
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||||
|
|
||||||
|
list.forEach(d -> {
|
||||||
|
d.setName(d.getTitle());
|
||||||
|
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||||
|
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||||
|
goodsList.forEach(v -> {
|
||||||
|
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||||
|
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||||
|
final GoodsSpec spec = goodsSpecs.get(0);
|
||||||
|
v.setSpecValue(spec.getSpecValue());
|
||||||
|
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||||
}
|
}
|
||||||
// System.out.println("param.getType() = " + param.getType());
|
});
|
||||||
// final List<Goods> goods = goodsService.getGoodsSpecType0();
|
return success(list);
|
||||||
// System.out.println("goodsBySpec = " + goods);
|
}
|
||||||
|
|
||||||
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds).eq(Goods::getIsShow,1).eq(Goods::getDeleted,0));
|
@ApiOperation("查询商城菜单分类级商品数据(不联动)")
|
||||||
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
@GetMapping("/listCategoryParentIdTree/{parentId}")
|
||||||
|
public ApiResult<List<GoodsCategory>> listCategoryParentIdTree(@PathVariable("parentId") Integer parentId) {
|
||||||
|
// 查询非店铺分类
|
||||||
|
final List<GoodsCategory> list = goodsCategoryService.list(new LambdaQueryWrapper<GoodsCategory>()
|
||||||
|
.eq(GoodsCategory::getParentId,parentId)
|
||||||
|
.eq(GoodsCategory::getType,0)
|
||||||
|
.eq(GoodsCategory::getMerchantId,0));
|
||||||
|
|
||||||
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||||
System.out.println("goodsIds = " + goodsIds);
|
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds));
|
||||||
|
final Map<Integer, List<Goods>> collect = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||||
|
|
||||||
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||||
System.out.println("specs = " + specs);
|
|
||||||
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
|
||||||
|
|
||||||
list.forEach(d -> {
|
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||||
d.setName(d.getTitle());
|
|
||||||
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||||
if (!CollectionUtils.isEmpty(goodsList)) {
|
|
||||||
goodsList.forEach(v -> {
|
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||||
System.out.println("v = " + v.getSpecValue());
|
|
||||||
final String specValue = v.getSpecValue();
|
list.forEach(d -> {
|
||||||
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
d.setName(d.getTitle());
|
||||||
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||||
final GoodsSpec spec = goodsSpecs.get(0);
|
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||||
v.setSpecValue(spec.getSpecValue());
|
goodsList.forEach(v -> {
|
||||||
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(),Object.class));
|
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||||
}
|
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||||
});
|
final GoodsSpec spec = goodsSpecs.get(0);
|
||||||
d.setChildrens(collectGoods.get(d.getCategoryId()));
|
v.setSpecValue(spec.getSpecValue());
|
||||||
}
|
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return success("请求成功",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询门店菜单分类及菜品数据(联动)")
|
||||||
|
@GetMapping("/listShopCategoryTree")
|
||||||
|
public ApiResult<List<GoodsCategory>> listShopCategoryTree(GoodsCategoryParam param) {
|
||||||
|
final List<GoodsCategory> list = goodsCategoryService.listRel(param);
|
||||||
|
final Set<Integer> categoryIds = list.stream().map(GoodsCategory::getCategoryId).collect(Collectors.toSet());
|
||||||
|
if (categoryIds.isEmpty()) {
|
||||||
return success(list);
|
return success(list);
|
||||||
}
|
}
|
||||||
@ApiOperation("分页查询商品分类")
|
|
||||||
@GetMapping("/page")
|
|
||||||
public ApiResult<PageResult<GoodsCategory>> page(GoodsCategoryParam param) {
|
|
||||||
// 使用关联查询
|
|
||||||
return success(goodsCategoryService.pageRel(param));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("查询全部商品分类")
|
final List<Goods> goods = goodsService.list(new LambdaQueryWrapper<Goods>().in(Goods::getCategoryId, categoryIds).eq(Goods::getIsShow, 1).eq(Goods::getDeleted, 0));
|
||||||
@GetMapping()
|
final Map<Integer, List<Goods>> collectGoods = goods.stream().collect(Collectors.groupingBy(Goods::getCategoryId));
|
||||||
public ApiResult<List<GoodsCategory>> list(GoodsCategoryParam param) {
|
|
||||||
// 使用关联查询
|
|
||||||
return success(goodsCategoryService.listRel(param));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("根据id查询商品分类")
|
final Set<Integer> goodsIds = goods.stream().map(Goods::getGoodsId).collect(Collectors.toSet());
|
||||||
@GetMapping("/{id}")
|
|
||||||
public ApiResult<GoodsCategory> get(@PathVariable("id") Integer id) {
|
|
||||||
// 使用关联查询
|
|
||||||
return success(goodsCategoryService.getByIdRel(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("添加商品分类")
|
final List<GoodsSpec> specs = goodsSpecService.list(new LambdaQueryWrapper<GoodsSpec>().in(GoodsSpec::getGoodsId, goodsIds));
|
||||||
@PostMapping()
|
|
||||||
public ApiResult<?> save(@RequestBody GoodsCategory goodsCategory) {
|
|
||||||
// 记录当前登录用户id
|
|
||||||
User loginUser = getLoginUser();
|
|
||||||
if (loginUser != null) {
|
|
||||||
goodsCategory.setUserId(loginUser.getUserId());
|
|
||||||
}
|
|
||||||
if (goodsCategoryService.save(goodsCategory)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("修改商品分类")
|
final Map<Integer, List<GoodsSpec>> collectGoodsSpec = specs.stream().collect(Collectors.groupingBy(GoodsSpec::getGoodsId));
|
||||||
@PutMapping()
|
|
||||||
public ApiResult<?> update(@RequestBody GoodsCategory goodsCategory) {
|
|
||||||
if (goodsCategoryService.updateById(goodsCategory)) {
|
|
||||||
return success("修改成功");
|
|
||||||
}
|
|
||||||
return fail("修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("删除商品分类")
|
list.forEach(d -> {
|
||||||
@DeleteMapping("/{id}")
|
d.setName(d.getTitle());
|
||||||
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
final List<Goods> goodsList = collectGoods.get(d.getCategoryId());
|
||||||
if (goodsCategoryService.removeById(id)) {
|
if (!CollectionUtils.isEmpty(goodsList)) {
|
||||||
return success("删除成功");
|
goodsList.forEach(v -> {
|
||||||
}
|
final List<GoodsSpec> goodsSpecs = collectGoodsSpec.get(v.getGoodsId());
|
||||||
return fail("删除失败");
|
if (!CollectionUtils.isEmpty(goodsSpecs)) {
|
||||||
}
|
final GoodsSpec spec = goodsSpecs.get(0);
|
||||||
|
v.setSpecValue(spec.getSpecValue());
|
||||||
|
v.setGoodsSpecValue(JSONUtil.parseObject(spec.getSpecValue(), Object.class));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
d.setGoods(collectGoods.get(d.getCategoryId()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return success(list);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("批量添加商品分类")
|
|
||||||
@PostMapping("/batch")
|
|
||||||
public ApiResult<?> saveBatch(@RequestBody List<GoodsCategory> list) {
|
|
||||||
if (goodsCategoryService.saveBatch(list)) {
|
|
||||||
return success("添加成功");
|
|
||||||
}
|
|
||||||
return fail("添加失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("批量修改商品分类")
|
@ApiOperation("分页查询商品分类")
|
||||||
@PutMapping("/batch")
|
@GetMapping("/page")
|
||||||
public ApiResult<?> removeBatch(@RequestBody BatchParam<GoodsCategory> batchParam) {
|
public ApiResult<PageResult<GoodsCategory>> page(GoodsCategoryParam param) {
|
||||||
if (batchParam.update(goodsCategoryService, "category_id")) {
|
// 使用关联查询
|
||||||
return success("修改成功");
|
return success(goodsCategoryService.pageRel(param));
|
||||||
}
|
}
|
||||||
return fail("修改失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
@ApiOperation("批量删除商品分类")
|
@ApiOperation("查询全部商品分类")
|
||||||
@DeleteMapping("/batch")
|
@GetMapping()
|
||||||
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
public ApiResult<List<GoodsCategory>> list(GoodsCategoryParam param) {
|
||||||
if (goodsCategoryService.removeByIds(ids)) {
|
// 使用关联查询
|
||||||
return success("删除成功");
|
return success(goodsCategoryService.listRel(param));
|
||||||
}
|
}
|
||||||
return fail("删除失败");
|
|
||||||
|
@ApiOperation("根据id查询商品分类")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ApiResult<GoodsCategory> get(@PathVariable("id") Integer id) {
|
||||||
|
// 使用关联查询
|
||||||
|
return success(goodsCategoryService.getByIdRel(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("添加商品分类")
|
||||||
|
@PostMapping()
|
||||||
|
public ApiResult<?> save(@RequestBody GoodsCategory goodsCategory) {
|
||||||
|
// 记录当前登录用户id
|
||||||
|
User loginUser = getLoginUser();
|
||||||
|
if (loginUser != null) {
|
||||||
|
goodsCategory.setUserId(loginUser.getUserId());
|
||||||
}
|
}
|
||||||
|
if (goodsCategoryService.save(goodsCategory)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("修改商品分类")
|
||||||
|
@PutMapping()
|
||||||
|
public ApiResult<?> update(@RequestBody GoodsCategory goodsCategory) {
|
||||||
|
if (goodsCategoryService.updateById(goodsCategory)) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("删除商品分类")
|
||||||
|
@DeleteMapping("/{id}")
|
||||||
|
public ApiResult<?> remove(@PathVariable("id") Integer id) {
|
||||||
|
if (goodsCategoryService.removeById(id)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量添加商品分类")
|
||||||
|
@PostMapping("/batch")
|
||||||
|
public ApiResult<?> saveBatch(@RequestBody List<GoodsCategory> list) {
|
||||||
|
if (goodsCategoryService.saveBatch(list)) {
|
||||||
|
return success("添加成功");
|
||||||
|
}
|
||||||
|
return fail("添加失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量修改商品分类")
|
||||||
|
@PutMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody BatchParam<GoodsCategory> batchParam) {
|
||||||
|
if (batchParam.update(goodsCategoryService, "category_id")) {
|
||||||
|
return success("修改成功");
|
||||||
|
}
|
||||||
|
return fail("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("批量删除商品分类")
|
||||||
|
@DeleteMapping("/batch")
|
||||||
|
public ApiResult<?> removeBatch(@RequestBody List<Integer> ids) {
|
||||||
|
if (goodsCategoryService.removeByIds(ids)) {
|
||||||
|
return success("删除成功");
|
||||||
|
}
|
||||||
|
return fail("删除失败");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package com.gxwebsoft.shop.entity;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import cn.hutool.core.util.DesensitizedUtil;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
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 java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -18,7 +19,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
* 分销商用户记录表
|
* 分销商用户记录表
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@@ -27,8 +28,11 @@ import lombok.EqualsAndHashCode;
|
|||||||
public class DealerUser implements Serializable {
|
public class DealerUser implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分销商用户ID")
|
@ApiModelProperty(value = "主键ID")
|
||||||
@TableId(value = "user_id", type = IdType.AUTO)
|
@TableId(value = "id", type = IdType.AUTO)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "姓名")
|
@ApiModelProperty(value = "姓名")
|
||||||
@@ -61,6 +65,9 @@ public class DealerUser implements Serializable {
|
|||||||
@ApiModelProperty(value = "成员数量(三级)")
|
@ApiModelProperty(value = "成员数量(三级)")
|
||||||
private Integer thirdNum;
|
private Integer thirdNum;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "专属二维码")
|
||||||
|
private String qrcode;
|
||||||
|
|
||||||
@ApiModelProperty(value = "是否删除")
|
@ApiModelProperty(value = "是否删除")
|
||||||
private Integer isDelete;
|
private Integer isDelete;
|
||||||
|
|
||||||
@@ -68,10 +75,14 @@ public class DealerUser implements Serializable {
|
|||||||
private Integer tenantId;
|
private Integer tenantId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "修改时间")
|
@ApiModelProperty(value = "修改时间")
|
||||||
private LocalDateTime updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "推荐人信息")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private DealerUser dealerUser;
|
||||||
|
|
||||||
@ApiModelProperty(value = "推荐人姓名(脱敏)")
|
@ApiModelProperty(value = "推荐人姓名(脱敏)")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.io.Serializable;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.gxwebsoft.cms.entity.Navigation;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -99,6 +100,10 @@ public class GoodsCategory implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("商品列表")
|
@ApiModelProperty("商品列表")
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<Goods> childrens;
|
private List<Goods> goods;
|
||||||
|
|
||||||
|
@ApiModelProperty("子菜单")
|
||||||
|
@TableField(exist = false)
|
||||||
|
private List<GoodsCategory> children;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
* 分销商用户记录表Mapper
|
* 分销商用户记录表Mapper
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
public interface DealerUserMapper extends BaseMapper<DealerUser> {
|
public interface DealerUserMapper extends BaseMapper<DealerUser> {
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,12 @@
|
|||||||
|
|
||||||
<!-- 关联查询sql -->
|
<!-- 关联查询sql -->
|
||||||
<sql id="selectSql">
|
<sql id="selectSql">
|
||||||
SELECT a.*,b.real_name as dealerName
|
SELECT a.*
|
||||||
FROM shop_dealer_user a
|
FROM shop_dealer_user a
|
||||||
LEFT JOIN shop_dealer_user b ON a.referee_id = b.user_id
|
|
||||||
<where>
|
<where>
|
||||||
|
<if test="param.id != null">
|
||||||
|
AND a.id = #{param.id}
|
||||||
|
</if>
|
||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
@@ -51,9 +53,9 @@
|
|||||||
AND a.create_time <= #{param.createTimeEnd}
|
AND a.create_time <= #{param.createTimeEnd}
|
||||||
</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}, '%')
|
||||||
)
|
)
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
<if test="param.merchantCode != null">
|
<if test="param.merchantCode != null">
|
||||||
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
AND a.merchant_code LIKE CONCAT('%', #{param.merchantCode}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.type != null">
|
||||||
|
AND a.type = #{param.type}
|
||||||
|
</if>
|
||||||
<if test="param.image != null">
|
<if test="param.image != null">
|
||||||
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
AND a.image LIKE CONCAT('%', #{param.image}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import lombok.EqualsAndHashCode;
|
|||||||
* 分销商用户记录表查询参数
|
* 分销商用户记录表查询参数
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@@ -23,7 +23,11 @@ import lombok.EqualsAndHashCode;
|
|||||||
public class DealerUserParam extends BaseParam {
|
public class DealerUserParam extends BaseParam {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@ApiModelProperty(value = "分销商用户ID")
|
@ApiModelProperty(value = "主键ID")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "自增ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,10 @@ public class MerchantParam extends BaseParam {
|
|||||||
@ApiModelProperty(value = "商户标识")
|
@ApiModelProperty(value = "商户标识")
|
||||||
private String merchantCode;
|
private String merchantCode;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "店铺类型")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
@ApiModelProperty(value = "商户图标")
|
@ApiModelProperty(value = "商户图标")
|
||||||
private String image;
|
private String image;
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
* 分销商用户记录表Service
|
* 分销商用户记录表Service
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
public interface DealerUserService extends IService<DealerUser> {
|
public interface DealerUserService extends IService<DealerUser> {
|
||||||
|
|
||||||
@@ -34,9 +34,9 @@ public interface DealerUserService extends IService<DealerUser> {
|
|||||||
/**
|
/**
|
||||||
* 根据id查询
|
* 根据id查询
|
||||||
*
|
*
|
||||||
* @param userId 分销商用户ID
|
* @param id 主键ID
|
||||||
* @return DealerUser
|
* @return DealerUser
|
||||||
*/
|
*/
|
||||||
DealerUser getByIdRel(Integer userId);
|
DealerUser getByIdRel(Integer id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import java.util.List;
|
|||||||
* 分销商用户记录表Service实现
|
* 分销商用户记录表Service实现
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2024-07-28 11:57:41
|
* @since 2024-07-28 19:21:15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class DealerUserServiceImpl extends ServiceImpl<DealerUserMapper, DealerUser> implements DealerUserService {
|
public class DealerUserServiceImpl extends ServiceImpl<DealerUserMapper, DealerUser> implements DealerUserService {
|
||||||
@@ -38,9 +38,9 @@ public class DealerUserServiceImpl extends ServiceImpl<DealerUserMapper, DealerU
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DealerUser getByIdRel(Integer userId) {
|
public DealerUser getByIdRel(Integer id) {
|
||||||
DealerUserParam param = new DealerUserParam();
|
DealerUserParam param = new DealerUserParam();
|
||||||
param.setUserId(userId);
|
param.setId(id);
|
||||||
return param.getOne(baseMapper.selectListRel(param));
|
return param.getOne(baseMapper.selectListRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,4 @@ socketio:
|
|||||||
config:
|
config:
|
||||||
# 开发环境接口
|
# 开发环境接口
|
||||||
server-url: http://127.0.0.1:9091/api
|
server-url: http://127.0.0.1:9091/api
|
||||||
upload-path: D:\Temp
|
upload-path: /Users/gxwebsoft/Documents/uploads/ # window(D:\Temp)
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ config:
|
|||||||
# 主服务器
|
# 主服务器
|
||||||
server-url: https://server.gxwebsoft.com/api
|
server-url: https://server.gxwebsoft.com/api
|
||||||
# 文件服务器
|
# 文件服务器
|
||||||
file-server: https://file.wsdns.cn
|
file-server: https://file.gxwebsoft.com
|
||||||
upload-path: /Users/gxwebsoft/Documents/uploads/
|
upload-path: /Users/gxwebsoft/Documents/uploads/
|
||||||
local-upload-path: /Users/gxwebsoft/Documents/uploads/
|
local-upload-path: /Users/gxwebsoft/Documents/uploads/
|
||||||
|
|
||||||
|
|||||||
@@ -79,13 +79,13 @@ public class ShopGenerator {
|
|||||||
// "shop_user_balance_log"
|
// "shop_user_balance_log"
|
||||||
// "shop_recharge_order"
|
// "shop_recharge_order"
|
||||||
// 经销商表
|
// 经销商表
|
||||||
"shop_dealer_apply",
|
// "shop_dealer_apply",
|
||||||
"shop_dealer_capital",
|
// "shop_dealer_capital",
|
||||||
"shop_dealer_order",
|
// "shop_dealer_order",
|
||||||
"shop_dealer_referee",
|
// "shop_dealer_referee",
|
||||||
"shop_dealer_setting",
|
// "shop_dealer_setting",
|
||||||
"shop_dealer_user",
|
"shop_dealer_user",
|
||||||
"shop_dealer_withdraw"
|
// "shop_dealer_withdraw"
|
||||||
};
|
};
|
||||||
// 需要去除的表前缀
|
// 需要去除的表前缀
|
||||||
private static final String[] TABLE_PREFIX = new String[]{
|
private static final String[] TABLE_PREFIX = new String[]{
|
||||||
|
|||||||
Reference in New Issue
Block a user