Commit e4c8db58 authored by sml's avatar sml

数据管理相关代码提交

parent e2ed01d9
package com.jz.manage.moduls.controller.goods;
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.entity.DataGoods;
import com.jz.manage.moduls.controller.BaseController;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.manage.moduls.service.DataGoodsService;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
/**
* 数据商品(TDataGoods)表控制层
* 数据商品(dataGoods)表控制层
*
* @author Bellamy
* @since 2020-12-01 10:41:30
......@@ -19,7 +31,98 @@ public class DataGoodsController extends BaseController {
* 服务对象
*/
@Autowired
private DataGoodsService tDataGoodsService;
private DataGoodsService dataGoodsService;
/**列表查询数据商品
* @param DataGoodsRequest
* @return
*/
@RequestMapping(method = RequestMethod.POST, 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;
}
}
\ No newline at end of file
package com.jz.manage.moduls.mapper;
import java.util.List;
import java.util.Map;
import com.jz.common.base.BaseMapper;
import com.jz.common.entity.DataGoods;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
/**
* 数据商品(TDataGoods)表数据库访问层
* 数据商品(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.manage.moduls.service;
import javax.servlet.http.HttpServletRequest;
import com.jz.common.bean.BaseBeanResponse;
import com.jz.common.bean.BaseResponse;
import com.jz.common.bean.PageInfoResponse;
import com.jz.common.entity.DataGoods;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
/**
* 数据商品(TDataGoods)表服务接口
* 数据商品(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.manage.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.common.entity.DataGoods;
import com.jz.manage.moduls.controller.goods.bean.dto.DataGoodsDto;
import com.jz.manage.moduls.controller.goods.bean.request.DataGoodsRequest;
import com.jz.manage.moduls.mapper.DataGoodsDao;
import com.jz.manage.moduls.service.DataGoodsService;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 数据商品(TDataGoods)表服务实现类
* 数据商品(DataGoods)表服务实现类
*
* @author Bellamy
* @since 2020-12-01 10:41:30
......@@ -14,6 +35,219 @@ import org.springframework.stereotype.Service;
@Service("dataGoodsService")
public class DataGoodsServiceImpl implements DataGoodsService {
@Autowired
private DataGoodsDao tDataGoodsDao;
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
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