提交 e5e96ddc 作者: 张小凤

webDevice

上级 af077d59
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.dto.WareInfoDTO;
import com.mmc.pms.model.dto.WareInfoItemDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.vo.LeaseVo;
......@@ -59,7 +61,10 @@ public class MiniProgramDeviceController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody detail(@RequestParam(value = "id", required = true) Integer id) {
return webDeviceService.detail(id);
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
......
package com.mmc.pms.controller;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.common.ResultEnum;
import com.mmc.pms.model.dto.WareInfoDTO;
import com.mmc.pms.model.dto.WareInfoItemDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.vo.LeaseVo;
......@@ -60,7 +62,10 @@ public class WebDeviceController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("/detail")
public ResultBody detail(@RequestParam(value = "id", required = true) Integer id) {
return webDeviceService.detail(id);
WareInfoDTO wareInfoDTO = webDeviceService.getWareInfoById(id);
return wareInfoDTO == null
? ResultBody.error(ResultEnum.NOT_FOUND)
: ResultBody.success(wareInfoDTO);
}
@ApiOperation(value = "立即租赁")
......
......@@ -32,4 +32,8 @@ public interface WebDeviceDao {
int countListWareInfoPage(WareInfoQO param);
List<WareInfoDO> listWareInfoPage(WareInfoQO param);
WareInfoDO getWareInfoById(Integer id);
WareDetailDO getWareDetailById(Integer id);
}
package com.mmc.pms.entity;
import com.mmc.pms.model.dto.WareDetailDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author small @Date 2023/5/16 17:22 @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WareDetailDO implements Serializable {
private static final long serialVersionUID = -911783253410987965L;
private Integer id;
private Integer wareInfoId;
private String content;
private Date createTime;
private Date updateTime;
public WareDetailDTO buildWareDetailDTO() {
return WareDetailDTO.builder()
.id(this.id)
.wareInfoId(this.wareInfoId)
.content(this.content)
.createTime(this.createTime)
.updateTime(this.updateTime)
.build();
}
}
package com.mmc.pms.model.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Author small @Date 2023/5/16 17:23 @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.dto.WareDetailDTO", description = "商品详情信息DTO")
public class WareDetailDTO implements Serializable {
private static final long serialVersionUID = -5359420720425156463L;
@ApiModelProperty(value = "商品详情id")
private Integer id;
@ApiModelProperty(value = "商品id")
private Integer wareInfoId;
@ApiModelProperty(value = "商品详情内容")
private String content;
@ApiModelProperty(value = "生成时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
}
package com.mmc.pms.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author small @Date 2023/5/16 17:20 @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.vo.WareInfoVO", description = "新增/修改参数类")
public class WareInfoVO implements Serializable {
private static final long serialVersionUID = -4503117649945902464L;
@ApiModelProperty(value = "id")
@NotNull(
message = "更新时ID不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "商品名称")
@NotEmpty(
message = "商品名称不能为空",
groups = {Create.class})
@Size(
max = 60,
message = "商品名称不能超过60个字符",
groups = {Create.class, Update.class})
private String wareTitle;
@ApiModelProperty(value = "商品类型id")
@NotNull(
message = "商品类型ID不能为空",
groups = {Create.class})
private Integer wareTypeId;
@ApiModelProperty(value = "商品活动id")
private Integer propInfoId;
@ApiModelProperty(value = "商品活动海报url")
private String propPoster;
@ApiModelProperty(value = "商品状态")
@NotNull(
message = "商品状态不能为空",
groups = {Create.class})
private Integer wareStatus;
@ApiModelProperty(value = "支付信息(减库方式)")
@NotNull(
message = "支付信息(减库方式)不能为空",
groups = {Create.class})
private Integer payStatus;
@ApiModelProperty(value = "一口押金-最小押金")
@NotNull(
message = "最小押金不能为空",
groups = {Create.class})
@Min(
value = 0,
groups = {Create.class, Update.class})
private BigDecimal minDeposit;
@ApiModelProperty(value = "一口价-最小日租金")
@NotNull(
message = "最小租金不能为空",
groups = {Create.class})
@Min(
value = 0,
groups = {Create.class, Update.class})
private BigDecimal minRent;
@ApiModelProperty(value = "商品标签")
private String tags;
@ApiModelProperty(value = "商品总量")
@Min(
value = 0,
groups = {Create.class})
private Integer totalStock;
@ApiModelProperty(value = "商品详情")
@NotEmpty(
message = "商品详情不能为空",
groups = {Create.class})
private String wareDetailContent;
@ApiModelProperty(value = "sku总数量")
@Min(
value = 0,
groups = {Create.class, Update.class})
private Integer skuNum;
@ApiModelProperty(value = "商品图片")
@NotEmpty(
message = "商品图片不能为空",
groups = {Create.class})
private List<WareImgVO> imgList;
@ApiModelProperty(value = "新加的商品sku")
@NotEmpty(
message = "商品sku不能为空",
groups = {Create.class})
private List<WareSkuInfoVO> wareSkuInfoList;
@ApiModelProperty(value = "更新的商品sku")
private List<WareSkuInfoVO> updateSkuList;
@ApiModelProperty(value = "需要删除的sku的id列表")
private List<Integer> deleteSkuIds;
@ApiModelProperty(value = "需要删除的照片id列表")
private List<Integer> deleteImgIds;
}
package com.mmc.pms.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @Author small @Date 2023/5/16 17:20 @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.vo.WareSkuInfoVO", description = "新增/修改参数类")
public class WareSkuInfoVO implements Serializable {
private static final long serialVersionUID = 7401232386069965527L;
@ApiModelProperty(value = "sku的id")
@NotNull(
message = "sku的id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "商品skuTitle名称")
@NotEmpty(
message = "商品skuTitle名称不能为空",
groups = {Create.class})
private String skuTitle;
@ApiModelProperty(value = "出租押金")
@NotNull(
message = "出租押金不能为空",
groups = {Create.class})
@Min(
value = 0,
message = "出租押金不能小于0",
groups = {Create.class, Update.class})
@Max(
value = 100000000,
message = "出租押金不能大于100000000",
groups = {Create.class, Update.class})
private BigDecimal rentDeposit;
@ApiModelProperty(value = "sku库存数量")
@NotNull(
message = "sku库存数量不能为空",
groups = {Create.class})
@Min(
value = 0,
message = "sku库存数量不能小于0",
groups = {Create.class, Update.class})
private Integer stockNum;
@ApiModelProperty(value = "sku对应价格列表")
@NotEmpty(
message = "sku对应价格列表不能为空",
groups = {Create.class})
List<WareSkuPriceVO> wareSkuPriceVOList;
}
package com.mmc.pms.model.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author small @Date 2023/5/16 17:21 @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "com.mmc.csf.model.vo.WareSkuInfoVO", description = "新增/修改参数类")
public class WareSkuPriceVO implements Serializable {
private static final long serialVersionUID = -3033801564005806565L;
@ApiModelProperty(value = "sku对应的id")
@NotNull(
message = "sku对应的id不能为空",
groups = {Update.class})
private Integer id;
@ApiModelProperty(value = "出租价格")
@NotNull(
message = "出租价格不能为空",
groups = {Create.class})
@Min(
value = 0,
message = "出租价格不能小于0",
groups = {Create.class, Update.class})
@Max(
value = 100000000,
message = "出租价格不能大于100000000",
groups = {Create.class, Update.class})
private BigDecimal rentPrice;
@ApiModelProperty(value = "起租天数")
@NotNull(
message = "起租天数不能为空",
groups = {Create.class})
@Min(
value = 0,
message = "起租天数不能小于0",
groups = {Create.class, Update.class})
private Integer minDay;
@ApiModelProperty(value = "最大天数")
@NotNull(
message = "最大天数不能为空",
groups = {Create.class})
@Min(
value = 0,
message = "最大天数不能小于0",
groups = {Create.class, Update.class})
private Integer maxDay;
}
......@@ -131,4 +131,14 @@ public class WebDeviceServiceImpl implements WebDeviceService {
.collect(Collectors.toList());
return ResultBody.success(PageResult.buildPage(pageNo, param.getPageSize(), count, pageList));
}
@Override
public WareInfoDTO getWareInfoById(Integer id) {
WareInfoDO wareInfoDO = webDeviceDao.getWareInfoById(id);
WareDetailDO wareDetailDO = webDeviceDao.getWareDetailById(id);
if (wareInfoDO != null) {
wareInfoDO.setWareDetailContent(wareDetailDO.getContent());
}
return wareInfoDO == null ? null : wareInfoDO.buildWareInfoDTO();
}
}
package com.mmc.pms.service;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.dto.WareInfoDTO;
import com.mmc.pms.model.qo.WareInfoQO;
import com.mmc.pms.model.vo.LeaseVo;
......@@ -23,4 +24,6 @@ public interface WebDeviceService {
ResultBody detail(Integer id);
ResultBody listWareInfoPage(WareInfoQO param);
WareInfoDTO getWareInfoById(Integer id);
}
......@@ -190,4 +190,47 @@
order by wi.create_time DESC
limit #{pageNo},#{pageSize}
</select>
<select id="getWareInfoById" resultMap="wareInfoResultMap" parameterType="java.lang.Integer">
select wi.id,
wi.ware_no,
wi.ware_type_id,
wi.ware_title,
wi.ware_status,
wi.pay_status,
wi.min_deposit,
wi.max_deposit,
wi.is_deleted,
wi.min_rent,
wi.max_rent,
wi.total_stock,
wi.total_sale,
wi.sku_num,
wi.tags,
wi.create_time,
wi.update_time,
wp.id as ware_prop_id,
wp.ware_info_id,
wp.prop_info_id,
wp.prop_poster,
img.id as ware_img_id,
img.img_url,
img.img_type
from ware_info wi
INNER JOIN ware_img img ON wi.id = img.ware_info_id
LEFT JOIN ware_prop wp ON wi.id = wp.ware_info_id
where wi.is_deleted = 0
and wi.id = #{id}
</select>
<resultMap id="wareDetailResultMap" type="com.mmc.pms.entity.WareDetailDO">
<id property="id" column="id"/>
<result property="wareInfoId" column="ware_info_id"/>
<result property="content" column="content"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="getWareDetailById" resultMap="wareDetailResultMap" parameterType="java.lang.Integer">
select id, ware_info_id, content, create_time, update_time
from ware_detail
where ware_info_id = #{wareInfoId}
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论