Commit 8e1c12c5 authored by ysongq's avatar ysongq

commit

parent b7eb2d1a
package com.jz.dm.mall.moduls.controller.goods;
import com.jz.common.base.BaseController;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* api商品(TDataGoodsApi)表控制层
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
@RestController
@RequestMapping("dataGoodsApi")
public class DataGoodsApiController extends BaseController {
/**
* 服务对象
*/
@Autowired
private DataGoodsApiService tDataGoodsApiService;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.goods;
import com.jz.common.base.BaseController;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.common.utils.Result;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.dm.mall.moduls.entity.DataGoods;
import com.jz.dm.mall.moduls.service.DataGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/**
* 数据商品(dataGoods)表控制层
*
* @author Bellamy
* @since 2020-12-01 10:41:30
*/
@RestController
@RequestMapping("dataGoods")
public class DataGoodsController extends BaseController {
/**
* 服务对象
*/
@Autowired
private DataGoodsService dataGoodsService;
/**列表查询数据商品
* @param DataGoodsRequest
* @return
*/
@PostMapping(value = "/findList")
public PageInfoResponse<DataGoodsDto> findList(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
PageInfoResponse<DataGoodsDto> pageInfo = new PageInfoResponse<DataGoodsDto>();
try {
pageInfo = dataGoodsService.findList(DataGoodsRequest, httpRequest);
} catch (Exception e) {
pageInfo.setMessage("查询失败");
pageInfo.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return pageInfo;
}
/**主键查询数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/view")
public BaseBeanResponse<DataGoodsDto> view(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<DataGoodsDto>();
try {
baseBeanResponse = dataGoodsService.findById(DataGoodsRequest, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("请求失败");
baseBeanResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**删除数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/delete")
public BaseResponse delete(@RequestBody DataGoodsRequest DataGoodsRequest, HttpServletRequest httpRequest){
BaseResponse baseResponse = new BaseResponse();
try {
baseResponse = dataGoodsService.deleteById(DataGoodsRequest, httpRequest);
} catch (Exception e) {
baseResponse.setMessage("删除失败");
baseResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseResponse;
}
/**新增数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/add")
public BaseBeanResponse<DataGoods> add(@RequestBody DataGoods dataGoods, HttpServletRequest httpRequest){
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<DataGoods>();
try {
baseBeanResponse = dataGoodsService.add(dataGoods, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("新增失败");
baseBeanResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
/**修改数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, value = "/edit")
public BaseBeanResponse<DataGoods> edit(@RequestBody DataGoods dataGoods, HttpServletRequest httpRequest){
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<DataGoods>();
try {
baseBeanResponse = dataGoodsService.edit(dataGoods, httpRequest);
} catch (Exception e) {
baseBeanResponse.setMessage("修改失败");
baseBeanResponse.setCode(Constants.FAILURE_CODE);
e.printStackTrace();
}
return baseBeanResponse;
}
// @PostMapping(value = "/search")
// @ApiOperation(value = "条件查询商品列表")
// public Result<List<DataGoodsRequest>> findList(@RequestBody(required = false) DataGoodsRequest dataGoodsRequest, HttpServletRequest request) {
// dataGoodsService.findList(dataGoodsRequest, request);
// }
}
\ No newline at end of file
package com.jz.dm.mall.moduls.controller.goods.bean.dto;
import com.jz.common.entity.DataGoods;
public class DataGoodsDto extends DataGoods {
}
package com.jz.dm.mall.moduls.controller.goods.bean.request;
import com.jz.common.bean.BasePageBean;
import java.math.BigDecimal;
import java.util.Date;
/**数据商品参数请求封装
* @author ybz
*
*/
public class DataGoodsRequest extends BasePageBean {
/**
* 数据商品id
*/
private Long dataGoodsId;
/**
* 商品分类id(行业)
*/
private Long categoryId;
/**
* 数据商户id
*/
private Long userId;
/**
* 数据商品名称
*/
private String dataName;
/**
* 数据类型:01api,02数据包
*/
private String dataType;
/**
* 数据商品标签
*/
private String dataLabel;
/**
* 数据商品图片
*/
private String dataPicture;
/**
* 数据商品价格
*/
private BigDecimal dataPrice;
/**
* 优惠价格
*/
private BigDecimal discountPrice;
/**
* 价格类型:01免费,02收费
*/
private String priceType;
/**
* 商品规格
*/
private String goodsStandards;
/**
* 数据状态:01预售,02在售中,03下架,04上架
*/
private String dataStatus;
/**
* 审核状态:01待审核,02已审核,03未通过
*/
private String auditStatus;
/**
* 清洗规则(脱敏校验)
*/
private String cleanRule;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 审核人
*/
private String auditPerson;
/**
* 审核时间起
*/
private Date auditTimeStart;
/**
* 审核时间止
*/
private Date auditTimeEnd;
/**
* 创建时间起
*/
private Date creTimeStart;
/**
* 创建时间止
*/
private Date creTimeEnd;
/**
* 创建人
*/
private String crePerson;
/**
* 更新时间起
*/
private Date uptTimeStart;
/**
* 更新时间止
*/
private Date uptTimeEnd;
/**
* 更新人
*/
private String uptPerson;
/**
* 删除标识
*/
private String delFlag;
/**
* 年(元)
*/
private BigDecimal yearType;
/**
* 季(元)
*/
private BigDecimal seasonType;
/**
* 月(元)
*/
private BigDecimal monthType;
/**
* 次(元)
*/
private BigDecimal secondType;
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDataLabel() {
return dataLabel;
}
public void setDataLabel(String dataLabel) {
this.dataLabel = dataLabel;
}
public String getDataPicture() {
return dataPicture;
}
public void setDataPicture(String dataPicture) {
this.dataPicture = dataPicture;
}
public BigDecimal getDataPrice() {
return dataPrice;
}
public void setDataPrice(BigDecimal dataPrice) {
this.dataPrice = dataPrice;
}
public BigDecimal getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getGoodsStandards() {
return goodsStandards;
}
public void setGoodsStandards(String goodsStandards) {
this.goodsStandards = goodsStandards;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getCleanRule() {
return cleanRule;
}
public void setCleanRule(String cleanRule) {
this.cleanRule = cleanRule;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public String getAuditPerson() {
return auditPerson;
}
public void setAuditPerson(String auditPerson) {
this.auditPerson = auditPerson;
}
public Date getAuditTimeStart() {
return auditTimeStart;
}
public void setAuditTimeStart(Date auditTimeStart) {
this.auditTimeStart = auditTimeStart;
}
public Date getAuditTimeEnd() {
return auditTimeEnd;
}
public void setAuditTimeEnd(Date auditTimeEnd) {
this.auditTimeEnd = auditTimeEnd;
}
public Date getCreTimeStart() {
return creTimeStart;
}
public void setCreTimeStart(Date creTimeStart) {
this.creTimeStart = creTimeStart;
}
public Date getCreTimeEnd() {
return creTimeEnd;
}
public void setCreTimeEnd(Date creTimeEnd) {
this.creTimeEnd = creTimeEnd;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getUptTimeStart() {
return uptTimeStart;
}
public void setUptTimeStart(Date uptTimeStart) {
this.uptTimeStart = uptTimeStart;
}
public Date getUptTimeEnd() {
return uptTimeEnd;
}
public void setUptTimeEnd(Date uptTimeEnd) {
this.uptTimeEnd = uptTimeEnd;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public BigDecimal getYearType() {
return yearType;
}
public void setYearType(BigDecimal yearType) {
this.yearType = yearType;
}
public BigDecimal getSeasonType() {
return seasonType;
}
public void setSeasonType(BigDecimal seasonType) {
this.seasonType = seasonType;
}
public BigDecimal getMonthType() {
return monthType;
}
public void setMonthType(BigDecimal monthType) {
this.monthType = monthType;
}
public BigDecimal getSecondType() {
return secondType;
}
public void setSecondType(BigDecimal secondType) {
this.secondType = secondType;
}
}
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 数据商品(TDataGoods)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:30
*/
@TableName("t_data_goods")
@ApiModel
public class DataGoods implements Serializable {
private static final long serialVersionUID = 938517475031285541L;
/**
* 数据商品id
*/
private Long dataGoodsId;
/**
* 商品分类id(行业)
*/
private Long categoryId;
/**
* 数据商户id
*/
private Long userId;
/**
* 数据商品名称
*/
private String dataName;
/**
* 数据类型:01api,02数据包
*/
private String dataType;
/**
* 数据商品标签
*/
private String dataLabel;
/**
* 数据商品图片
*/
private String dataPicture;
/**
* 数据商品价格
*/
private BigDecimal dataPrice;
/**
* 优惠价格
*/
private BigDecimal discountPrice;
/**
* 价格类型:01免费,02收费
*/
private String priceType;
/**
* 商品规格
*/
private String goodsStandards;
/**
* 数据状态:01预售,02在售中,03下架,04上架
*/
private String dataStatus;
/**
* 审核状态:01待审核,02已审核,03未通过
*/
private String auditStatus;
/**
* 清洗规则(脱敏校验)
*/
private String cleanRule;
/**
* 驳回原因
*/
private String rejectReason;
/**
* 审核人
*/
private String auditPerson;
/**
* 审核时间
*/
private Date auditTime;
/**
* 创建时间
*/
private Date creTime;
/**
* 创建人
*/
private String crePerson;
/**
* 更新时间
*/
private Date uptTime;
/**
* 更新人
*/
private String uptPerson;
/**
* 删除标识
*/
private String delFlag;
/**
* 年(元)
*/
private BigDecimal yearType;
/**
* 季(元)
*/
private BigDecimal seasonType;
/**
* 月(元)
*/
private BigDecimal monthType;
/**
* 次(元)
*/
private BigDecimal secondType;
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public Long getCategoryId() {
return categoryId;
}
public void setCategoryId(Long categoryId) {
this.categoryId = categoryId;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getDataType() {
return dataType;
}
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getDataLabel() {
return dataLabel;
}
public void setDataLabel(String dataLabel) {
this.dataLabel = dataLabel;
}
public String getDataPicture() {
return dataPicture;
}
public void setDataPicture(String dataPicture) {
this.dataPicture = dataPicture;
}
public BigDecimal getDataPrice() {
return dataPrice;
}
public void setDataPrice(BigDecimal dataPrice) {
this.dataPrice = dataPrice;
}
public BigDecimal getDiscountPrice() {
return discountPrice;
}
public void setDiscountPrice(BigDecimal discountPrice) {
this.discountPrice = discountPrice;
}
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType;
}
public String getGoodsStandards() {
return goodsStandards;
}
public void setGoodsStandards(String goodsStandards) {
this.goodsStandards = goodsStandards;
}
public String getDataStatus() {
return dataStatus;
}
public void setDataStatus(String dataStatus) {
this.dataStatus = dataStatus;
}
public String getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(String auditStatus) {
this.auditStatus = auditStatus;
}
public String getCleanRule() {
return cleanRule;
}
public void setCleanRule(String cleanRule) {
this.cleanRule = cleanRule;
}
public String getRejectReason() {
return rejectReason;
}
public void setRejectReason(String rejectReason) {
this.rejectReason = rejectReason;
}
public String getAuditPerson() {
return auditPerson;
}
public void setAuditPerson(String auditPerson) {
this.auditPerson = auditPerson;
}
public Date getAuditTime() {
return auditTime;
}
public void setAuditTime(Date auditTime) {
this.auditTime = auditTime;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public BigDecimal getYearType() {
return yearType;
}
public void setYearType(BigDecimal yearType) {
this.yearType = yearType;
}
public BigDecimal getSeasonType() {
return seasonType;
}
public void setSeasonType(BigDecimal seasonType) {
this.seasonType = seasonType;
}
public BigDecimal getMonthType() {
return monthType;
}
public void setMonthType(BigDecimal monthType) {
this.monthType = monthType;
}
public BigDecimal getSecondType() {
return secondType;
}
public void setSecondType(BigDecimal secondType) {
this.secondType = secondType;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import java.io.Serializable;
import java.util.Date;
/**
* api商品(DataGoodsApi)实体类
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
@TableName("t_data_goods_api")
@ApiModel
public class DataGoodsApi implements Serializable {
private static final long serialVersionUID = -14346819849726413L;
/**
* api商品id
*/
private Long goodsApi;
/**
* 数据id
*/
private Long dataGoodsId;
/**
* api服务名称
*/
private String apiName;
/**
* 请求类型(方式)
*/
private String requestType;
/**
* api接口地址
*/
private String apiUrl;
/**
* api接口方法
*/
private String apiMethod;
/**
* api请求协议:http,https
*/
private String apiProtocl;
/**
* api返回数据样例
*/
private String returnDataExample;
/**
* api请求样例
*/
private String requestExample;
/**
* 返回类型
*/
private String returnType;
/**
* apikey
*/
private String apiKey;
/**
* 创建时间
*/
private Date creTime;
/**
* 创建人
*/
private String crePerson;
/**
* 更新人
*/
private String uptPerson;
/**
* 更新时间
*/
private Date uptTime;
/**
* 删除标识
*/
private String delFlag;
public Long getGoodsApi() {
return goodsApi;
}
public void setGoodsApi(Long goodsApi) {
this.goodsApi = goodsApi;
}
public Long getDataGoodsId() {
return dataGoodsId;
}
public void setDataGoodsId(Long dataGoodsId) {
this.dataGoodsId = dataGoodsId;
}
public String getApiName() {
return apiName;
}
public void setApiName(String apiName) {
this.apiName = apiName;
}
public String getRequestType() {
return requestType;
}
public void setRequestType(String requestType) {
this.requestType = requestType;
}
public String getApiUrl() {
return apiUrl;
}
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
public String getApiMethod() {
return apiMethod;
}
public void setApiMethod(String apiMethod) {
this.apiMethod = apiMethod;
}
public String getApiProtocl() {
return apiProtocl;
}
public void setApiProtocl(String apiProtocl) {
this.apiProtocl = apiProtocl;
}
public String getReturnDataExample() {
return returnDataExample;
}
public void setReturnDataExample(String returnDataExample) {
this.returnDataExample = returnDataExample;
}
public String getRequestExample() {
return requestExample;
}
public void setRequestExample(String requestExample) {
this.requestExample = requestExample;
}
public String getReturnType() {
return returnType;
}
public void setReturnType(String returnType) {
this.returnType = returnType;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public Date getCreTime() {
return creTime;
}
public void setCreTime(Date creTime) {
this.creTime = creTime;
}
public String getCrePerson() {
return crePerson;
}
public void setCrePerson(String crePerson) {
this.crePerson = crePerson;
}
public String getUptPerson() {
return uptPerson;
}
public void setUptPerson(String uptPerson) {
this.uptPerson = uptPerson;
}
public Date getUptTime() {
return uptTime;
}
public void setUptTime(Date uptTime) {
this.uptTime = uptTime;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.DataGoodsApi;
/**
* api商品(TDataGoodsApi)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
public interface DataGoodsApiDao extends BaseMapper<DataGoodsApi> {
}
\ No newline at end of file
package com.jz.dm.mall.moduls.mapper;
import java.util.List;
import java.util.Map;
import com.jz.common.base.BaseMapper;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.dm.mall.moduls.entity.DataGoods;
/**
* 数据商品(DataGoods)表数据库访问层
*
* @author Bellamy
* @since 2020-12-01 10:41:30
*/
public interface DataGoodsDao extends BaseMapper<DataGoods> {
/**选择性增加数据商品
* @param dataGoods
* @return
* @throws Exception
*/
public int insertSelective(DataGoods dataGoods)throws Exception;
/**主键修改数据商品
* @param dataGoods
* @return
* @throws Exception
*/
public int updateByPrimaryKey(DataGoods dataGoods)throws Exception;
/**选择性修改数据商品
* @param dataGoods
* @return
* @throws Exception
*/
public int updateByPrimaryKeySelective(DataGoods dataGoods)throws Exception;
/**主键查询数据商品
* @param dataGoodsId
* @return
* @throws Exception
*/
public DataGoods selectByPrimaryKey(Long dataGoodsId)throws Exception;
/**主键删除数据商品
* @param dataGoodsId
* @return
* @throws Exception
*/
public int deleteByPrimaryKey(Long dataGoodsId)throws Exception;
/**条件查询数据商品
* @param param
* @return
* @throws Exception
*/
public List<DataGoodsDto> findList(Map<String, Object> param)throws Exception;
/**主键查询数据商品
* @param DataGoodsId
* @return
* @throws Exception
*/
public DataGoodsDto findById(Long dataGoodsId)throws Exception;
/**批量新增数据商品
* @param DataGoodses
* @throws Exception
*/
public void insertBatch(List<DataGoods> dataGoodses)throws Exception;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
/**
* api商品(TDataGoodsApi)表服务接口
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
public interface DataGoodsApiService {
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.dm.mall.moduls.entity.DataGoods;
import javax.servlet.http.HttpServletRequest;
/**
* 数据商品(DataGoods)表服务接口
*
* @author Bellamy
* @since 2020-12-01 10:41:30
*/
public interface DataGoodsService {
/**条件查询所有数据商品
* @param DataGoodsRequest
* @param httpRequest
* @return
* @throws Exception
*/
public PageInfoResponse<DataGoodsDto> findList(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)throws Exception;
/**新增数据商品
* @param DataGoods
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest)throws Exception;
/**主键查询数据商品
* @param DataGoodsRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)throws Exception;
/**修改数据商品
* @param DataGoods
* @param httpRequest
* @return
* @throws Exception
*/
public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest)throws Exception;
/**主键删除数据商品
* @param DataGoodsRequest
* @param httpRequest
* @return
* @throws Exception
*/
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)throws Exception;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.jz.dm.mall.moduls.mapper.DataGoodsApiDao;
import com.jz.dm.mall.moduls.service.DataGoodsApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* api商品(TDataGoodsApi)表服务实现类
*
* @author Bellamy
* @since 2020-12-01 10:41:31
*/
@Service("dataGoodsApiService")
public class DataGoodsApiServiceImpl implements DataGoodsApiService {
@Autowired
private DataGoodsApiDao tDataGoodsApiDao;
}
\ No newline at end of file
package com.jz.dm.mall.moduls.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.constant.Constants;
import com.jz.dm.mall.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.dm.mall.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.dm.mall.moduls.entity.DataGoods;
import com.jz.dm.mall.moduls.mapper.DataGoodsDao;
import com.jz.dm.mall.moduls.service.DataGoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 数据商品(DataGoods)表服务实现类
*
* @author Bellamy
* @since 2020-12-01 10:41:30
*/
@Service("dataGoodsService")
public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired
private DataGoodsDao dataGoodsDao;
@Override
public PageInfoResponse<DataGoodsDto> findList(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
PageInfoResponse<DataGoodsDto> pageInfoResponse = new PageInfoResponse<>();
Map<String, Object> param = new HashMap<>();
//数据商品id
if (dataGoodsRequest.getDataGoodsId() != null) {
param.put("dataGoodsId", dataGoodsRequest.getDataGoodsId());
}
//商品分类id(行业)
if (dataGoodsRequest.getCategoryId() != null) {
param.put("categoryId", dataGoodsRequest.getCategoryId());
}
//数据商户id
if (dataGoodsRequest.getUserId() != null) {
param.put("userId", dataGoodsRequest.getUserId());
}
//数据商品名称
if (!StringUtils.isEmpty(dataGoodsRequest.getDataName())) {
param.put("dataName", dataGoodsRequest.getDataName());
}
//数据类型:01api,02数据包
if (!StringUtils.isEmpty(dataGoodsRequest.getDataType())) {
param.put("dataType", dataGoodsRequest.getDataType());
}
//数据商品标签
if (!StringUtils.isEmpty(dataGoodsRequest.getDataLabel())) {
param.put("dataLabel", dataGoodsRequest.getDataLabel());
}
//数据商品图片
if (!StringUtils.isEmpty(dataGoodsRequest.getDataPicture())) {
param.put("dataPicture", dataGoodsRequest.getDataPicture());
}
//数据商品价格
if (dataGoodsRequest.getDataPrice() != null) {
param.put("dataPrice", dataGoodsRequest.getDataPrice());
}
//优惠价格
if (dataGoodsRequest.getDiscountPrice() != null) {
param.put("discountPrice", dataGoodsRequest.getDiscountPrice());
}
//价格类型:01免费,02收费
if (!StringUtils.isEmpty(dataGoodsRequest.getPriceType())) {
param.put("priceType", dataGoodsRequest.getPriceType());
}
//商品规格
if (!StringUtils.isEmpty(dataGoodsRequest.getGoodsStandards())) {
param.put("goodsStandards", dataGoodsRequest.getGoodsStandards());
}
//数据状态:01预售,02在售中,03下架,04上架
if (!StringUtils.isEmpty(dataGoodsRequest.getDataStatus())) {
param.put("dataStatus", dataGoodsRequest.getDataStatus());
}
//审核状态:01待审核,02已审核,03未通过
if (!StringUtils.isEmpty(dataGoodsRequest.getAuditStatus())) {
param.put("auditStatus", dataGoodsRequest.getAuditStatus());
}
//清洗规则(脱敏校验)
if (!StringUtils.isEmpty(dataGoodsRequest.getCleanRule())) {
param.put("cleanRule", dataGoodsRequest.getCleanRule());
}
//驳回原因
if (!StringUtils.isEmpty(dataGoodsRequest.getRejectReason())) {
param.put("rejectReason", dataGoodsRequest.getRejectReason());
}
//审核人
if (!StringUtils.isEmpty(dataGoodsRequest.getAuditPerson())) {
param.put("auditPerson", dataGoodsRequest.getAuditPerson());
}
//审核时间起
if (dataGoodsRequest.getAuditTimeStart() != null) {
param.put("auditTimeStart", dataGoodsRequest.getAuditTimeStart());
}
//审核时间止
if (dataGoodsRequest.getAuditTimeEnd() != null) {
param.put("auditTimeEnd", dataGoodsRequest.getAuditTimeEnd());
}
//创建时间起
if (dataGoodsRequest.getCreTimeStart() != null) {
param.put("creTimeStart", dataGoodsRequest.getCreTimeStart());
}
//创建时间止
if (dataGoodsRequest.getCreTimeEnd() != null) {
param.put("creTimeEnd", dataGoodsRequest.getCreTimeEnd());
}
//创建人
if (!StringUtils.isEmpty(dataGoodsRequest.getCrePerson())) {
param.put("crePerson", dataGoodsRequest.getCrePerson());
}
//更新时间起
if (dataGoodsRequest.getUptTimeStart() != null) {
param.put("uptTimeStart", dataGoodsRequest.getUptTimeStart());
}
//更新时间止
if (dataGoodsRequest.getUptTimeEnd() != null) {
param.put("uptTimeEnd", dataGoodsRequest.getUptTimeEnd());
}
//更新人
if (!StringUtils.isEmpty(dataGoodsRequest.getUptPerson())) {
param.put("uptPerson", dataGoodsRequest.getUptPerson());
}
//删除标识
if (!StringUtils.isEmpty(dataGoodsRequest.getDelFlag())) {
param.put("delFlag", dataGoodsRequest.getDelFlag());
}
//年(元)
if (dataGoodsRequest.getYearType() != null) {
param.put("yearType", dataGoodsRequest.getYearType());
}
//季(元)
if (dataGoodsRequest.getSeasonType() != null) {
param.put("seasonType", dataGoodsRequest.getSeasonType());
}
//月(元)
if (dataGoodsRequest.getMonthType() != null) {
param.put("monthType", dataGoodsRequest.getMonthType());
}
//次(元)
if (dataGoodsRequest.getSecondType() != null) {
param.put("secondType", dataGoodsRequest.getSecondType());
}
PageHelper.startPage(dataGoodsRequest.getPageNum(), dataGoodsRequest.getPageSize());
List<DataGoodsDto> list = dataGoodsDao.findList(param);
PageInfo<DataGoodsDto> pageInfo = new PageInfo<>(list);
pageInfoResponse.setCode(Constants.SUCCESS_CODE);
pageInfoResponse.setMessage("查询成功");
pageInfoResponse.setData(pageInfo);
return pageInfoResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#add(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseBeanResponse<DataGoods> add(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
/*$*seDataGoodsIdCodeReplace*$*/
//创建人
//dataGoods.setCreateUser(getHttpRequestUserId(httpRequest));
//创建时间
dataGoods.setCreTime(new Date());
dataGoodsDao.insertSelective(dataGoods);
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("新增成功");
baseBeanResponse.setData(dataGoods);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#edit(com.ycxc.vmts.entity.DataGoods, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseBeanResponse<DataGoods> edit(DataGoods dataGoods, HttpServletRequest httpRequest) throws Exception {
BaseBeanResponse<DataGoods> baseBeanResponse = new BaseBeanResponse<>();
//修改人
//dataGoods.setUpdateUser(getHttpRequestUserId(httpRequest));
//修改时间
dataGoods.setUptTime(new Date());
dataGoodsDao.updateByPrimaryKeySelective(dataGoods);
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("修改成功");
baseBeanResponse.setData(dataGoods);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#findById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
public BaseBeanResponse<DataGoodsDto> findById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseBeanResponse<DataGoodsDto> baseBeanResponse = new BaseBeanResponse<>();
DataGoodsDto DataGoodsDto = dataGoodsDao.findById(dataGoodsRequest.getDataGoodsId());
baseBeanResponse.setCode(Constants.SUCCESS_CODE);
baseBeanResponse.setMessage("查询成功");
baseBeanResponse.setData(DataGoodsDto);
return baseBeanResponse;
}
/* (non-Javadoc)
* @see com.ycxc.vmts.service.DataGoodsService#deleteById(com.ycxc.vmts.controller.bean.DataGoodsRequest, javax.servlet.http.HttpServletRequest)
*/
@Override
@Transactional(rollbackFor=Exception.class)
public BaseResponse deleteById(DataGoodsRequest dataGoodsRequest, HttpServletRequest httpRequest)
throws Exception {
BaseResponse baseResponse = new BaseResponse();
dataGoodsDao.deleteByPrimaryKey(dataGoodsRequest.getDataGoodsId());
baseResponse.setCode(Constants.SUCCESS_CODE);
baseResponse.setMessage("删除成功");
return baseResponse;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mall.moduls.mapper.DataGoodsApiDao">
<resultMap type="com.jz.dm.mall.moduls.entity.DataGoodsApi" id="TDataGoodsApiMap">
<result property="goodsApi" column="goods_api" jdbcType="INTEGER"/>
<result property="dataGoodsId" column="data_goods_id" jdbcType="INTEGER"/>
<result property="apiName" column="api_name" jdbcType="VARCHAR"/>
<result property="requestType" column="request_type" jdbcType="VARCHAR"/>
<result property="apiUrl" column="api_url" jdbcType="VARCHAR"/>
<result property="apiMethod" column="api_method" jdbcType="VARCHAR"/>
<result property="apiProtocl" column="api_protocl" jdbcType="VARCHAR"/>
<result property="returnDataExample" column="return_data_example" jdbcType="VARCHAR"/>
<result property="requestExample" column="request_example" jdbcType="VARCHAR"/>
<result property="returnType" column="return_type" jdbcType="VARCHAR"/>
<result property="apiKey" column="api_key" jdbcType="VARCHAR"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>
<result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
</resultMap>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jz.dm.mall.moduls.mapper.DataGoodsDao">
<resultMap type="com.jz.dm.mall.moduls.entity.DataGoods" id="TDataGoodsMap">
<result property="dataGoodsId" column="data_goods_id" jdbcType="INTEGER"/>
<result property="categoryId" column="category_id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="INTEGER"/>
<result property="dataName" column="data_name" jdbcType="VARCHAR"/>
<result property="dataType" column="data_type" jdbcType="VARCHAR"/>
<result property="dataLabel" column="data_label" jdbcType="VARCHAR"/>
<result property="dataPicture" column="data_picture" jdbcType="VARCHAR"/>
<result property="dataPrice" column="data_price" jdbcType="NUMERIC"/>
<result property="discountPrice" column="discount_price" jdbcType="NUMERIC"/>
<result property="priceType" column="price_type" jdbcType="VARCHAR"/>
<result property="goodsStandards" column="goods_standards" jdbcType="VARCHAR"/>
<result property="dataStatus" column="data_status" jdbcType="VARCHAR"/>
<result property="auditStatus" column="audit_status" jdbcType="VARCHAR"/>
<result property="cleanRule" column="clean_rule" jdbcType="VARCHAR"/>
<result property="rejectReason" column="reject_reason" jdbcType="VARCHAR"/>
<result property="auditPerson" column="audit_person" jdbcType="VARCHAR"/>
<result property="auditTime" column="audit_time" jdbcType="TIMESTAMP"/>
<result property="creTime" column="cre_time" jdbcType="TIMESTAMP"/>
<result property="crePerson" column="cre_person" jdbcType="VARCHAR"/>
<result property="uptTime" column="upt_time" jdbcType="TIMESTAMP"/>
<result property="uptPerson" column="upt_person" jdbcType="VARCHAR"/>
<result property="delFlag" column="del_flag" jdbcType="VARCHAR"/>
<result property="yearType" column="year_type" jdbcType="NUMERIC"/>
<result property="seasonType" column="season_type" jdbcType="NUMERIC"/>
<result property="monthType" column="month_type" jdbcType="NUMERIC"/>
<result property="secondType" column="second_type" jdbcType="NUMERIC"/>
</resultMap>
<!--查询单个-->
<select id="queryById" resultMap="TDataGoodsMap">
select
data_goods_id, category_id, user_id, data_name, data_type, data_label, data_picture, data_price, discount_price, price_type, goods_standards, data_status, audit_status, clean_rule, reject_reason, audit_person, audit_time, cre_time, cre_person, upt_time, upt_person, del_flag, year_type, season_type, month_type, second_type
from t_data_goods
where data_goods_id = #{dataGoodsId}
</select>
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="TDataGoodsMap">
select
data_goods_id, category_id, user_id, data_name, data_type, data_label, data_picture, data_price, discount_price, price_type, goods_standards, data_status, audit_status, clean_rule, reject_reason, audit_person, audit_time, cre_time, cre_person, upt_time, upt_person, del_flag, year_type, season_type, month_type, second_type
from t_data_goods
limit #{offset}, #{limit}
</select>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="TDataGoodsMap">
select
data_goods_id, category_id, user_id, data_name, data_type, data_label, data_picture, data_price, discount_price,
price_type, goods_standards, data_status, audit_status, clean_rule, reject_reason, audit_person, audit_time,
cre_time, cre_person, upt_time, upt_person, del_flag, year_type, season_type, month_type, second_type
from t_data_goods
<where>
<if test="dataGoodsId != null">
and data_goods_id = #{dataGoodsId}
</if>
<if test="categoryId != null">
and category_id = #{categoryId}
</if>
<if test="userId != null">
and user_id = #{userId}
</if>
<if test="dataName != null and dataName != ''">
and data_name = #{dataName}
</if>
<if test="dataType != null and dataType != ''">
and data_type = #{dataType}
</if>
<if test="dataLabel != null and dataLabel != ''">
and data_label = #{dataLabel}
</if>
<if test="dataPicture != null and dataPicture != ''">
and data_picture = #{dataPicture}
</if>
<if test="dataPrice != null">
and data_price = #{dataPrice}
</if>
<if test="discountPrice != null">
and discount_price = #{discountPrice}
</if>
<if test="priceType != null and priceType != ''">
and price_type = #{priceType}
</if>
<if test="goodsStandards != null and goodsStandards != ''">
and goods_standards = #{goodsStandards}
</if>
<if test="dataStatus != null and dataStatus != ''">
and data_status = #{dataStatus}
</if>
<if test="auditStatus != null and auditStatus != ''">
and audit_status = #{auditStatus}
</if>
<if test="cleanRule != null and cleanRule != ''">
and clean_rule = #{cleanRule}
</if>
<if test="rejectReason != null and rejectReason != ''">
and reject_reason = #{rejectReason}
</if>
<if test="auditPerson != null and auditPerson != ''">
and audit_person = #{auditPerson}
</if>
<if test="auditTime != null">
and audit_time = #{auditTime}
</if>
<if test="creTime != null">
and cre_time = #{creTime}
</if>
<if test="crePerson != null and crePerson != ''">
and cre_person = #{crePerson}
</if>
<if test="uptTime != null">
and upt_time = #{uptTime}
</if>
<if test="uptPerson != null and uptPerson != ''">
and upt_person = #{uptPerson}
</if>
<if test="delFlag != null and delFlag != ''">
and del_flag = #{delFlag}
</if>
<if test="yearType != null">
and year_type = #{yearType}
</if>
<if test="seasonType != null">
and season_type = #{seasonType}
</if>
<if test="monthType != null">
and month_type = #{monthType}
</if>
<if test="secondType != null">
and second_type = #{secondType}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="dataGoodsId" useGeneratedKeys="true">
insert into t_data_goods(category_id, user_id, data_name, data_type, data_label, data_picture, data_price, discount_price, price_type, goods_standards, data_status, audit_status, clean_rule, reject_reason, audit_person, audit_time, cre_time, cre_person, upt_time, upt_person, del_flag, year_type, season_type, month_type, second_type)
values (#{categoryId}, #{userId}, #{dataName}, #{dataType}, #{dataLabel}, #{dataPicture}, #{dataPrice}, #{discountPrice}, #{priceType}, #{goodsStandards}, #{dataStatus}, #{auditStatus}, #{cleanRule}, #{rejectReason}, #{auditPerson}, #{auditTime}, #{creTime}, #{crePerson}, #{uptTime}, #{uptPerson}, #{delFlag}, #{yearType}, #{seasonType}, #{monthType}, #{secondType})
</insert>
<insert id="insertBatch" keyProperty="dataGoodsId" useGeneratedKeys="true">
insert into t_data_goods(category_id, user_id, data_name, data_type, data_label, data_picture,
data_price, discount_price, price_type, goods_standards, data_status, audit_status, clean_rule, reject_reason,
audit_person, audit_time, cre_time, cre_person, upt_time, upt_person, del_flag, year_type, season_type,
month_type, second_type)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.categoryId}, #{entity.userId}, #{entity.dataName}, #{entity.dataType}, #{entity.dataLabel},
#{entity.dataPicture}, #{entity.dataPrice}, #{entity.discountPrice}, #{entity.priceType},
#{entity.goodsStandards}, #{entity.dataStatus}, #{entity.auditStatus}, #{entity.cleanRule},
#{entity.rejectReason}, #{entity.auditPerson}, #{entity.auditTime}, #{entity.creTime}, #{entity.crePerson},
#{entity.uptTime}, #{entity.uptPerson}, #{entity.delFlag}, #{entity.yearType}, #{entity.seasonType},
#{entity.monthType}, #{entity.secondType})
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update t_data_goods
<set>
<if test="categoryId != null">
category_id = #{categoryId},
</if>
<if test="userId != null">
user_id = #{userId},
</if>
<if test="dataName != null and dataName != ''">
data_name = #{dataName},
</if>
<if test="dataType != null and dataType != ''">
data_type = #{dataType},
</if>
<if test="dataLabel != null and dataLabel != ''">
data_label = #{dataLabel},
</if>
<if test="dataPicture != null and dataPicture != ''">
data_picture = #{dataPicture},
</if>
<if test="dataPrice != null">
data_price = #{dataPrice},
</if>
<if test="discountPrice != null">
discount_price = #{discountPrice},
</if>
<if test="priceType != null and priceType != ''">
price_type = #{priceType},
</if>
<if test="goodsStandards != null and goodsStandards != ''">
goods_standards = #{goodsStandards},
</if>
<if test="dataStatus != null and dataStatus != ''">
data_status = #{dataStatus},
</if>
<if test="auditStatus != null and auditStatus != ''">
audit_status = #{auditStatus},
</if>
<if test="cleanRule != null and cleanRule != ''">
clean_rule = #{cleanRule},
</if>
<if test="rejectReason != null and rejectReason != ''">
reject_reason = #{rejectReason},
</if>
<if test="auditPerson != null and auditPerson != ''">
audit_person = #{auditPerson},
</if>
<if test="auditTime != null">
audit_time = #{auditTime},
</if>
<if test="creTime != null">
cre_time = #{creTime},
</if>
<if test="crePerson != null and crePerson != ''">
cre_person = #{crePerson},
</if>
<if test="uptTime != null">
upt_time = #{uptTime},
</if>
<if test="uptPerson != null and uptPerson != ''">
upt_person = #{uptPerson},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
<if test="yearType != null">
year_type = #{yearType},
</if>
<if test="seasonType != null">
season_type = #{seasonType},
</if>
<if test="monthType != null">
month_type = #{monthType},
</if>
<if test="secondType != null">
second_type = #{secondType},
</if>
</set>
where data_goods_id = #{dataGoodsId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from t_data_goods where data_goods_id = #{dataGoodsId}
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment