main
parent
2e344200e2
commit
70cba32918
|
|
@ -2,16 +2,20 @@ package com.wyh.admin.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.admin.service.IIntegrationSchmeService;
|
||||
import com.wyh.admin.validate.commons.PageValidate;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import com.wyh.common.entity.schme.IntegrationSchme;
|
||||
import com.wyh.common.entity.subject.SubjectInfo;
|
||||
import com.wyh.common.mapper.CaseInfoMapper;
|
||||
import com.wyh.common.mapper.schme.IntegrationSchmeMapper;
|
||||
import com.wyh.common.mapper.subject.SubjectInfoMapper;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.util.UrlUtils;
|
||||
import com.wyh.common.validator.schme.IntegrationSchmeCreateValidate;
|
||||
import com.wyh.common.validator.schme.IntegrationSchmeSearchValidate;
|
||||
import com.wyh.common.validator.schme.IntegrationSchmeUpdateValidate;
|
||||
|
|
@ -39,6 +43,9 @@ public class IntegrationSchmeServiceImpl implements IIntegrationSchmeService {
|
|||
@Resource
|
||||
SubjectInfoMapper subjectInfoMapper;
|
||||
|
||||
@Resource
|
||||
CaseInfoMapper caseInfoMapper;
|
||||
|
||||
/**
|
||||
* 集成方案信息列表
|
||||
*
|
||||
|
|
@ -82,6 +89,11 @@ public class IntegrationSchmeServiceImpl implements IIntegrationSchmeService {
|
|||
vo.setInfoName(subjectInfo.getName());
|
||||
}
|
||||
}
|
||||
|
||||
List<CaseInfo> caseInfos = caseInfoMapper.selectList(Wrappers.<CaseInfo>lambdaQuery().eq(CaseInfo::getSchmeId, item.getId()).eq(CaseInfo::getIsDelete, 0));
|
||||
if (CollectionUtils.isNotEmpty(caseInfos)){
|
||||
vo.setCaseInfo(caseInfos);
|
||||
}
|
||||
list.add(vo);
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +119,10 @@ public class IntegrationSchmeServiceImpl implements IIntegrationSchmeService {
|
|||
|
||||
IntegrationSchmeDetailVo vo = new IntegrationSchmeDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
List<CaseInfo> caseInfos = caseInfoMapper.selectList(Wrappers.<CaseInfo>lambdaQuery().eq(CaseInfo::getSchmeId, model.getId()).eq(CaseInfo::getIsDelete, 0));
|
||||
if (CollectionUtils.isNotEmpty(caseInfos)){
|
||||
vo.setCaseInfo(caseInfos);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +145,24 @@ public class IntegrationSchmeServiceImpl implements IIntegrationSchmeService {
|
|||
model.setType(createValidate.getType());
|
||||
model.setIsDownload(createValidate.getIsDownload());
|
||||
model.setInfoId(createValidate.getInfoId());
|
||||
integrationSchmeMapper.insert(model);
|
||||
int insert = integrationSchmeMapper.insert(model);
|
||||
|
||||
|
||||
if (insert > 0) {
|
||||
if (CollectionUtils.isNotEmpty(createValidate.getCaseInfo())){
|
||||
List<CaseInfo> caseInfo = createValidate.getCaseInfo();
|
||||
for (CaseInfo item : caseInfo) {
|
||||
// 保存关联表
|
||||
item.setSchmeId(model.getId());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
item.setImage(UrlUtils.toRelativeUrl(item.getImage()));
|
||||
// 保存关联表
|
||||
caseInfoMapper.insert(item);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -159,6 +192,19 @@ public class IntegrationSchmeServiceImpl implements IIntegrationSchmeService {
|
|||
model.setIsDownload(updateValidate.getIsDownload());
|
||||
model.setInfoId(updateValidate.getInfoId());
|
||||
integrationSchmeMapper.updateById(model);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(updateValidate.getCaseInfo())){
|
||||
List<CaseInfo> caseInfo = updateValidate.getCaseInfo();
|
||||
caseInfoMapper.delete(Wrappers.<CaseInfo>lambdaQuery().eq(CaseInfo::getSchmeId, model.getId()).eq(CaseInfo::getIsDelete, 0));
|
||||
for (CaseInfo item : caseInfo) {
|
||||
// 保存关联表
|
||||
item.setSchmeId(model.getId());
|
||||
model.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
item.setImage(UrlUtils.toRelativeUrl(item.getImage()));
|
||||
// 保存关联表
|
||||
caseInfoMapper.insert(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -12,11 +12,16 @@ spring:
|
|||
username: root # 数据库账号
|
||||
password: ifpdge9z # 数据库密码
|
||||
# Redis配置
|
||||
# redis:
|
||||
# host: 101.133.172.2 # Redis服务地址
|
||||
# port: 2007 # Redis端口
|
||||
# password: 123456 # Redis密码
|
||||
# database: 14 # 数据库索引
|
||||
redis:
|
||||
host: 101.133.172.2 # Redis服务地址
|
||||
port: 2007 # Redis端口
|
||||
host: 127.0.0.1 # Redis服务地址
|
||||
port: 6379 # Redis端口
|
||||
password: 123456 # Redis密码
|
||||
database: 14 # 数据库索引
|
||||
database: 11
|
||||
|
||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||
mybatis-plus:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
package com.wyh.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案展示信息实体")
|
||||
public class CaseInfo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "是否删除: 0=否, 1=是")
|
||||
private Integer isDelete;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Long createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除时间")
|
||||
private Long deleteTime;
|
||||
|
||||
@ApiModelProperty(value = "方案名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "案例图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "案例内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "集成方案id")
|
||||
private Integer schmeId;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package com.wyh.common.mapper;
|
||||
|
||||
import com.wyh.common.core.basics.IBaseMapper;
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 集成方案展示信息Mapper
|
||||
* @author wyh
|
||||
*/
|
||||
@Mapper
|
||||
public interface CaseInfoMapper extends IBaseMapper<CaseInfo> {
|
||||
}
|
||||
|
|
@ -1,11 +1,13 @@
|
|||
package com.wyh.common.validator.schme;
|
||||
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案信息创建参数")
|
||||
|
|
@ -45,4 +47,7 @@ public class IntegrationSchmeCreateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "所属id")
|
||||
private Integer infoId;
|
||||
|
||||
|
||||
private List<CaseInfo> caseInfo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.wyh.common.validator.schme;
|
||||
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -7,6 +8,7 @@ import lombok.Data;
|
|||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 集成方案信息参数
|
||||
|
|
@ -54,4 +56,6 @@ public class IntegrationSchmeUpdateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "所属id")
|
||||
private Integer infoId;
|
||||
|
||||
private List<CaseInfo> caseInfo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.wyh.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案展示信息详情Vo")
|
||||
public class CaseInfoDetailVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "方案名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "案例图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "案例内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "集成方案id")
|
||||
private Integer schmeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package com.wyh.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案展示信息列表Vo")
|
||||
public class CaseInfoListedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private String updateTime;
|
||||
|
||||
@ApiModelProperty(value = "方案名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "案例图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "集成方案id")
|
||||
private Integer schmeId;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package com.wyh.common.vo.schme;
|
||||
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案信息详情Vo")
|
||||
|
|
@ -39,5 +41,6 @@ public class IntegrationSchmeDetailVo implements Serializable {
|
|||
@ApiModelProperty(value = "所属id")
|
||||
private Integer infoId;
|
||||
|
||||
private List<CaseInfo> caseInfo;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.wyh.common.vo.schme;
|
||||
|
||||
import com.wyh.common.entity.CaseInfo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ApiModel("集成方案信息列表Vo")
|
||||
|
|
@ -45,5 +47,7 @@ public class IntegrationSchmeListedVo implements Serializable {
|
|||
|
||||
private String infoName;
|
||||
|
||||
private List<CaseInfo> caseInfo;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,4 +37,22 @@ public class UserAddressDetailVo implements Serializable {
|
|||
private Integer userId;
|
||||
|
||||
|
||||
|
||||
@ApiModelProperty(value = "country")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty(value = "countryCode")
|
||||
private String countryCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,4 +41,23 @@ public class UserAddressListedVo implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "country")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty(value = "countryCode")
|
||||
private String countryCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ import com.alibaba.fastjson2.JSONArray;
|
|||
import com.wyh.common.aop.NotLogin;
|
||||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.annotation.IDMust;
|
||||
import com.wyh.common.validator.goods.GoodsCateSearchValidate;
|
||||
import com.wyh.common.validator.goods.GoodsSearchValidate;
|
||||
import com.wyh.common.vo.goods.GoodsDetailVo;
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import com.wyh.front.service.GoodsService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
|
|
@ -13,6 +15,7 @@ import io.swagger.annotations.Api;
|
|||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -42,4 +45,11 @@ public class GoodsController {
|
|||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@NotLogin
|
||||
@RequestMapping("/detail")
|
||||
@ApiOperation(value = "产品详情", httpMethod = "GET" )
|
||||
public AjaxResult<GoodsDetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
GoodsDetailVo detail = goodsService.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONArray;
|
|||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.validator.goods.GoodsCateSearchValidate;
|
||||
import com.wyh.common.validator.goods.GoodsSearchValidate;
|
||||
import com.wyh.common.vo.goods.GoodsDetailVo;
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
|
||||
|
|
@ -11,4 +12,13 @@ public interface GoodsService {
|
|||
JSONArray cateTree( GoodsCateSearchValidate searchValidate);
|
||||
|
||||
PageResult<GoodsListedVo> list(PageValidate pageValidate, GoodsSearchValidate searchValidate);
|
||||
|
||||
/**
|
||||
* 产品信息详情
|
||||
*
|
||||
* @author wyh
|
||||
* @param id 主键ID
|
||||
* @return GoodsDetailVo
|
||||
*/
|
||||
GoodsDetailVo detail(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.wyh.front.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -9,20 +10,26 @@ import com.wyh.common.config.GlobalConfig;
|
|||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.goods.Goods;
|
||||
import com.wyh.common.entity.goods.GoodsCate;
|
||||
import com.wyh.common.entity.goods.GoodsExpand;
|
||||
import com.wyh.common.mapper.goods.GoodsCateMapper;
|
||||
import com.wyh.common.mapper.goods.GoodsExpandMapper;
|
||||
import com.wyh.common.mapper.goods.GoodsMapper;
|
||||
import com.wyh.common.util.ListUtils;
|
||||
import com.wyh.common.util.TimeUtils;
|
||||
import com.wyh.common.validator.goods.GoodsCateSearchValidate;
|
||||
import com.wyh.common.validator.goods.GoodsSearchValidate;
|
||||
import com.wyh.common.vo.goods.GoodsCateListedVo;
|
||||
import com.wyh.common.vo.goods.GoodsDetailVo;
|
||||
import com.wyh.common.vo.goods.GoodsListedVo;
|
||||
import com.wyh.front.service.GoodsService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -35,6 +42,10 @@ public class GoodsServiceImpl implements GoodsService {
|
|||
private GoodsCateMapper goodsCateMapper;
|
||||
|
||||
|
||||
@Resource
|
||||
private GoodsExpandMapper goodsExpandMapper;
|
||||
|
||||
|
||||
@Override
|
||||
public JSONArray cateTree(GoodsCateSearchValidate searchValidate) {
|
||||
MPJQueryWrapper<GoodsCate> mpjQueryWrapper = new MPJQueryWrapper<>();
|
||||
|
|
@ -99,4 +110,26 @@ public class GoodsServiceImpl implements GoodsService {
|
|||
return PageResult.iPageHandle(iPage);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoodsDetailVo detail(Integer id) {
|
||||
|
||||
Goods model = goodsMapper.selectOne(
|
||||
new QueryWrapper<Goods>()
|
||||
.eq("id", id)
|
||||
.eq("is_delete", 0)
|
||||
.last("limit 1"));
|
||||
|
||||
Assert.notNull(model, "数据不存在");
|
||||
|
||||
GoodsDetailVo vo = new GoodsDetailVo();
|
||||
BeanUtils.copyProperties(model, vo);
|
||||
LinkedList<GoodsExpand> goodsExpands = new LinkedList<>(goodsExpandMapper.selectList(
|
||||
new QueryWrapper<GoodsExpand>()
|
||||
.eq("goods_id", id)
|
||||
.last("limit 100")
|
||||
));
|
||||
vo.setGoodsExpand(goodsExpands);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.wyh.front.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wyh.common.core.PageResult;
|
||||
import com.wyh.common.entity.user.UserAddress;
|
||||
|
|
@ -12,6 +13,7 @@ import com.wyh.common.validator.user.UserAddressSearchValidate;
|
|||
import com.wyh.common.validator.user.UserAddressUpdateValidate;
|
||||
import com.wyh.common.vo.user.UserAddressDetailVo;
|
||||
import com.wyh.common.vo.user.UserAddressListedVo;
|
||||
import com.wyh.front.ZJFrontThreadLocal;
|
||||
import com.wyh.front.service.IUserAddressService;
|
||||
import com.wyh.front.validate.common.PageValidate;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -44,11 +46,11 @@ public class UserAddressServiceImpl implements IUserAddressService {
|
|||
public PageResult<UserAddressListedVo> list(PageValidate pageValidate, UserAddressSearchValidate searchValidate) {
|
||||
Integer page = pageValidate.getPageNo();
|
||||
Integer limit = pageValidate.getPageSize();
|
||||
|
||||
Integer userId = ZJFrontThreadLocal.getUserId();
|
||||
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("is_delete", 0);
|
||||
queryWrapper.orderByDesc("id");
|
||||
|
||||
queryWrapper.eq("user_id", userId);
|
||||
userAddressMapper.setSearch(queryWrapper, searchValidate, new String[]{
|
||||
"like:mobile:str",
|
||||
"=:unit:str",
|
||||
|
|
@ -102,6 +104,18 @@ public class UserAddressServiceImpl implements IUserAddressService {
|
|||
*/
|
||||
@Override
|
||||
public void add(UserAddressCreateValidate createValidate) {
|
||||
Integer userId = ZJFrontThreadLocal.getUserId();
|
||||
if (userId == null) {
|
||||
userId = createValidate.getUserId();
|
||||
}
|
||||
System.out.println(ZJFrontThreadLocal.getUserId());
|
||||
UserAddress userAddress = userAddressMapper.selectOne(Wrappers.<UserAddress>lambdaQuery().eq(UserAddress::getUserId, userId).eq(UserAddress::getIsDefault, 1).eq(UserAddress::getIsDelete, 0));
|
||||
|
||||
if (userAddress != null) {
|
||||
userAddress.setIsDefault(0);
|
||||
userAddress.setUpdateTime(System.currentTimeMillis() / 1000);
|
||||
userAddressMapper.updateById(userAddress);
|
||||
}
|
||||
UserAddress model = new UserAddress();
|
||||
model.setMobile(createValidate.getMobile());
|
||||
model.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
|
|
@ -111,6 +125,14 @@ public class UserAddressServiceImpl implements IUserAddressService {
|
|||
model.setArea(createValidate.getArea());
|
||||
model.setAddress(createValidate.getAddress());
|
||||
model.setIsDefault(createValidate.getIsDefault());
|
||||
model.setCountry(createValidate.getCountry());
|
||||
model.setCity(createValidate.getCity());
|
||||
model.setProvince(createValidate.getProvince());
|
||||
model.setProvinceCode(createValidate.getProvinceCode());
|
||||
model.setCityCode(createValidate.getCityCode());
|
||||
model.setCountryCode(createValidate.getCountryCode());
|
||||
model.setUserId(userId);
|
||||
System.out.println(userId);
|
||||
userAddressMapper.insert(model);
|
||||
}
|
||||
|
||||
|
|
@ -138,6 +160,12 @@ public class UserAddressServiceImpl implements IUserAddressService {
|
|||
model.setArea(updateValidate.getArea());
|
||||
model.setAddress(updateValidate.getAddress());
|
||||
model.setIsDefault(updateValidate.getIsDefault());
|
||||
model.setCountry(updateValidate.getCountry());
|
||||
model.setCity(updateValidate.getCity());
|
||||
model.setProvince(updateValidate.getProvince());
|
||||
model.setProvinceCode(updateValidate.getProvinceCode());
|
||||
model.setCityCode(updateValidate.getCityCode());
|
||||
model.setCountryCode(updateValidate.getCountryCode());
|
||||
userAddressMapper.updateById(model);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,11 @@ spring:
|
|||
password: 123456 # Redis密码
|
||||
database: 14 # 数据库索引
|
||||
|
||||
# redis:
|
||||
# host: 127.0.0.1 # Redis服务地址
|
||||
# port: 6379 # Redis端口
|
||||
# password: 123456 # Redis密码
|
||||
# database: 11
|
||||
# Mybatis-plus配置 【是否开启SQL日志输出】
|
||||
#mybatis-plus:
|
||||
# configuration:
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@
|
|||
check-strictly
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品分类名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入产品分类名称" />
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="menuSort">
|
||||
<div>
|
||||
|
|
@ -62,7 +62,7 @@ const popupTitle = computed(() => {
|
|||
const formData = reactive({
|
||||
id: '',
|
||||
name: '',
|
||||
pid: '',
|
||||
pid: 0,
|
||||
sort: '',
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
<el-table-column label="创建时间" prop="createTime" min-width="100" />
|
||||
<el-table-column label="更新时间" prop="updateTime" min-width="100" />
|
||||
<el-table-column label="排序编号" prop="sort" min-width="100" />
|
||||
<el-table-column label="是否显示" prop="isShow" min-width="100"/>
|
||||
<!-- <el-table-column label="是否显示" prop="isShow" min-width="100"/>-->
|
||||
<el-table-column label="操作" width="160" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
|
|
|
|||
|
|
@ -50,6 +50,49 @@
|
|||
<el-radio :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item >
|
||||
<el-button type="primary" @click="handleAdd">添加图片</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item label="图片设置">
|
||||
<div class="flex-1">
|
||||
<draggable class="draggable" v-model="content.data" animation="400">
|
||||
<template v-slot:item="{ element: item, index }">
|
||||
<del-wrap
|
||||
:key="index"
|
||||
@close="handleDelete(index)"
|
||||
class="max-w-[600px]"
|
||||
>
|
||||
<div
|
||||
class="bg-fill-light flex items-center w-full p-4 mt-4 cursor-move"
|
||||
>
|
||||
<material-picker
|
||||
v-model="item.image"
|
||||
upload-class="bg-body"
|
||||
exclude-domain
|
||||
/>
|
||||
<div class="ml-3 flex-1">
|
||||
<el-form-item label="图片名称">
|
||||
<el-input
|
||||
v-model="item.name"
|
||||
placeholder="请输入名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item class="mt-[18px]" label="图片链接">
|
||||
<el-input
|
||||
type="textarea"
|
||||
v-model="item.content"
|
||||
placeholder="请输入内容"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
</del-wrap>
|
||||
</template>
|
||||
</draggable>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
|
|
@ -60,12 +103,9 @@ import { schmeEdit, schmeAdd, schmeDetail } from '@/api/schme'
|
|||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
const limit = 999
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
|
|
@ -74,7 +114,35 @@ const popupTitle = computed(() => {
|
|||
return mode.value == 'edit' ? '编辑集成方案信息' : '新增集成方案信息'
|
||||
})
|
||||
import {listAll} from "@/api/subject";
|
||||
import options from "@/views/decoration/component/widgets/user-banner/options";
|
||||
import Draggable from "vuedraggable";
|
||||
const optionDataList = ref<any[]>([])
|
||||
type OptionsType = ReturnType<typeof options>
|
||||
|
||||
|
||||
const content = reactive({
|
||||
data: [
|
||||
{
|
||||
name: '',
|
||||
image: '',
|
||||
content: ''
|
||||
}
|
||||
]
|
||||
})
|
||||
const props = defineProps({
|
||||
content: {
|
||||
type: Object as PropType<OptionsType['content']>,
|
||||
default: () => ({})
|
||||
},
|
||||
styles: {
|
||||
type: Object as PropType<OptionsType['styles']>,
|
||||
default: () => ({})
|
||||
},
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
|
@ -88,6 +156,7 @@ const formData = reactive({
|
|||
type: '',
|
||||
isDownload: '',
|
||||
infoId: '',
|
||||
caseInfo: [],
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
|
|
@ -159,6 +228,8 @@ const formRules = {
|
|||
const handleSubmit = async () => {
|
||||
await formRef.value?.validate()
|
||||
const data: any = { ...formData }
|
||||
|
||||
//@ts-ignore
|
||||
mode.value == 'edit' ? await schmeEdit(data) : await schmeAdd(data)
|
||||
popupRef.value?.close()
|
||||
feedback.msgSuccess('操作成功')
|
||||
|
|
@ -178,8 +249,11 @@ const setFormData = async (data: Record<string, any>) => {
|
|||
if (data[key] != null && data[key] != undefined) {
|
||||
//@ts-ignore
|
||||
formData[key] = data[key]
|
||||
|
||||
}
|
||||
}
|
||||
formData.caseInfo = data.caseInfo || []
|
||||
content.data = formData.caseInfo
|
||||
}
|
||||
|
||||
const getDetail = async (row: Record<string, any>) => {
|
||||
|
|
@ -193,6 +267,30 @@ const handleClose = () => {
|
|||
emit('close')
|
||||
}
|
||||
|
||||
|
||||
|
||||
const handleAdd = () => {
|
||||
console.log(content.data)
|
||||
if (content.data?.length < limit) {
|
||||
content.data.push({
|
||||
image: '',
|
||||
name: '',
|
||||
content: ''
|
||||
})
|
||||
} else {
|
||||
console.log(props.content.data)
|
||||
feedback.msgError(`最多添加${limit}张图片`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const handleDelete = (index: number) => {
|
||||
if (content.data?.length <= 1) {
|
||||
return feedback.msgError('最少保留一张图片')
|
||||
}
|
||||
content.data.splice(index, 1)
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
|
|
|
|||
Loading…
Reference in New Issue