diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/controller/MytestGoodsController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/controller/MytestGoodsController.java new file mode 100644 index 0000000..ac8b6fa --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/controller/MytestGoodsController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.mytestGoods.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import org.jeecg.modules.mytestGoods.service.IMytestGoodsService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 商品表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Api(tags="商品表") +@RestController +@RequestMapping("/mytestGoods/mytestGoods") +@Slf4j +public class MytestGoodsController extends JeecgController { + @Autowired + private IMytestGoodsService mytestGoodsService; + + /** + * 分页列表查询 + * + * @param mytestGoods + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "商品表-分页列表查询") + @ApiOperation(value="商品表-分页列表查询", notes="商品表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(MytestGoods mytestGoods, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(mytestGoods, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = mytestGoodsService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param mytestGoods + * @return + */ + @AutoLog(value = "商品表-添加") + @ApiOperation(value="商品表-添加", notes="商品表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody MytestGoods mytestGoods) { + mytestGoodsService.save(mytestGoods); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param mytestGoods + * @return + */ + @AutoLog(value = "商品表-编辑") + @ApiOperation(value="商品表-编辑", notes="商品表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody MytestGoods mytestGoods) { + mytestGoodsService.updateById(mytestGoods); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "商品表-通过id删除") + @ApiOperation(value="商品表-通过id删除", notes="商品表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + mytestGoodsService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "商品表-批量删除") + @ApiOperation(value="商品表-批量删除", notes="商品表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.mytestGoodsService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "商品表-通过id查询") + @ApiOperation(value="商品表-通过id查询", notes="商品表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + MytestGoods mytestGoods = mytestGoodsService.getById(id); + if(mytestGoods==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(mytestGoods); + } + + /** + * 导出excel + * + * @param request + * @param mytestGoods + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MytestGoods mytestGoods) { + return super.exportXls(request, mytestGoods, MytestGoods.class, "商品表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MytestGoods.class); + } + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/entity/MytestGoods.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/entity/MytestGoods.java new file mode 100644 index 0000000..6349c8f --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/entity/MytestGoods.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.mytestGoods.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 商品表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Data +@TableName("mytest_goods") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="mytest_goods对象", description="商品表") +public class MytestGoods implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**商品名称*/ + @Excel(name = "商品名称", width = 15) + @ApiModelProperty(value = "商品名称") + private java.lang.String name; + /**商品价格*/ + @Excel(name = "商品价格", width = 15) + @ApiModelProperty(value = "商品价格") + private java.math.BigDecimal price; +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/MytestGoodsMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/MytestGoodsMapper.java new file mode 100644 index 0000000..5441a27 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/MytestGoodsMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mytestGoods.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 商品表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface MytestGoodsMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/xml/MytestGoodsMapper.xml b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/xml/MytestGoodsMapper.xml new file mode 100644 index 0000000..f3860e1 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/mapper/xml/MytestGoodsMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/IMytestGoodsService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/IMytestGoodsService.java new file mode 100644 index 0000000..d2bc161 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/IMytestGoodsService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mytestGoods.service; + +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 商品表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface IMytestGoodsService extends IService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/impl/MytestGoodsServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/impl/MytestGoodsServiceImpl.java new file mode 100644 index 0000000..5555d5a --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/service/impl/MytestGoodsServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.mytestGoods.service.impl; + +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import org.jeecg.modules.mytestGoods.mapper.MytestGoodsMapper; +import org.jeecg.modules.mytestGoods.service.IMytestGoodsService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 商品表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Service +public class MytestGoodsServiceImpl extends ServiceImpl implements IMytestGoodsService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/MytestGoodsList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/MytestGoodsList.vue new file mode 100644 index 0000000..fc743b9 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/MytestGoodsList.vue @@ -0,0 +1,177 @@ + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsForm.vue new file mode 100644 index 0000000..4327a8d --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsForm.vue @@ -0,0 +1,109 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.Style#Drawer.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.Style#Drawer.vue new file mode 100644 index 0000000..a4cca54 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.vue new file mode 100644 index 0000000..0f897b2 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue/modules/MytestGoodsModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.api.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.api.ts new file mode 100644 index 0000000..a4b78af --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/mytestGoods/mytestGoods/list', + save='/mytestGoods/mytestGoods/add', + edit='/mytestGoods/mytestGoods/edit', + deleteOne = '/mytestGoods/mytestGoods/delete', + deleteBatch = '/mytestGoods/mytestGoods/deleteBatch', + importExcel = '/mytestGoods/mytestGoods/importExcel', + exportXls = '/mytestGoods/mytestGoods/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.data.ts new file mode 100644 index 0000000..c11dcc1 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoods.data.ts @@ -0,0 +1,33 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '商品名称', + align:"center", + dataIndex: 'name' + }, + { + title: '商品价格', + align:"center", + dataIndex: 'price' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '商品名称', + field: 'name', + component: 'Input', + }, + { + label: '商品价格', + field: 'price', + component: 'InputNumber', + }, +]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoodsList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoodsList.vue new file mode 100644 index 0000000..e1d5fa3 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/MytestGoodsList.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/components/MytestGoodsModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/components/MytestGoodsModal.vue new file mode 100644 index 0000000..304482b --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestGoods/vue3/components/MytestGoodsModal.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/controller/MytestShopcarController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/controller/MytestShopcarController.java new file mode 100644 index 0000000..ef05982 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/controller/MytestShopcarController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.mytestShopcar.controller; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.common.util.oConvertUtils; +import org.jeecg.modules.mytestShopcar.entity.MytestShopcar; +import org.jeecg.modules.mytestShopcar.service.IMytestShopcarService; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.extern.slf4j.Slf4j; + +import org.jeecgframework.poi.excel.ExcelImportUtil; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.entity.ImportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; +import org.jeecg.common.system.base.controller.JeecgController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; +import com.alibaba.fastjson.JSON; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.jeecg.common.aspect.annotation.AutoLog; + + /** + * @Description: 购物车表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Api(tags="购物车表") +@RestController +@RequestMapping("/mytestShopcar/mytestShopcar") +@Slf4j +public class MytestShopcarController extends JeecgController { + @Autowired + private IMytestShopcarService mytestShopcarService; + + /** + * 分页列表查询 + * + * @param mytestShopcar + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "购物车表-分页列表查询") + @ApiOperation(value="购物车表-分页列表查询", notes="购物车表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(MytestShopcar mytestShopcar, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(mytestShopcar, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = mytestShopcarService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param mytestShopcar + * @return + */ + @AutoLog(value = "购物车表-添加") + @ApiOperation(value="购物车表-添加", notes="购物车表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody MytestShopcar mytestShopcar) { + mytestShopcarService.save(mytestShopcar); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param mytestShopcar + * @return + */ + @AutoLog(value = "购物车表-编辑") + @ApiOperation(value="购物车表-编辑", notes="购物车表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody MytestShopcar mytestShopcar) { + mytestShopcarService.updateById(mytestShopcar); + return Result.OK("编辑成功!"); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @AutoLog(value = "购物车表-通过id删除") + @ApiOperation(value="购物车表-通过id删除", notes="购物车表-通过id删除") + @DeleteMapping(value = "/delete") + public Result delete(@RequestParam(name="id",required=true) String id) { + mytestShopcarService.removeById(id); + return Result.OK("删除成功!"); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @AutoLog(value = "购物车表-批量删除") + @ApiOperation(value="购物车表-批量删除", notes="购物车表-批量删除") + @DeleteMapping(value = "/deleteBatch") + public Result deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.mytestShopcarService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("批量删除成功!"); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + //@AutoLog(value = "购物车表-通过id查询") + @ApiOperation(value="购物车表-通过id查询", notes="购物车表-通过id查询") + @GetMapping(value = "/queryById") + public Result queryById(@RequestParam(name="id",required=true) String id) { + MytestShopcar mytestShopcar = mytestShopcarService.getById(id); + if(mytestShopcar==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(mytestShopcar); + } + + /** + * 导出excel + * + * @param request + * @param mytestShopcar + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MytestShopcar mytestShopcar) { + return super.exportXls(request, mytestShopcar, MytestShopcar.class, "购物车表"); + } + + /** + * 通过excel导入数据 + * + * @param request + * @param response + * @return + */ + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MytestShopcar.class); + } + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/entity/MytestShopcar.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/entity/MytestShopcar.java new file mode 100644 index 0000000..5c3bc49 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/entity/MytestShopcar.java @@ -0,0 +1,73 @@ +package org.jeecg.modules.mytestShopcar.entity; + +import java.io.Serializable; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.math.BigDecimal; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import org.jeecg.modules.mytestUser.entity.MytestUser; +import org.springframework.format.annotation.DateTimeFormat; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecg.common.aspect.annotation.Dict; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * @Description: 购物车表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Data +@TableName("mytest_shopcar") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="mytest_shopcar对象", description="购物车表") +public class MytestShopcar implements Serializable { + private static final long serialVersionUID = 1L; + + /**主键*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "主键") + private java.lang.String id; + /**创建人*/ + @ApiModelProperty(value = "创建人") + private java.lang.String createBy; + /**创建日期*/ + @ApiModelProperty(value = "创建日期") + private java.util.Date createTime; + /**更新人*/ + @ApiModelProperty(value = "更新人") + private java.lang.String updateBy; + /**更新日期*/ + @ApiModelProperty(value = "更新日期") + private java.util.Date updateTime; + /**购物车数量*/ + @Excel(name = "购物车数量", width = 15) + @ApiModelProperty(value = "购物车数量") + private java.lang.String number; + /**关联商品id*/ + @Excel(name = "关联商品id", width = 15, dictTable = "mytest_goods", dicText = "name", dicCode = "id") + @Dict(dictTable = "mytest_goods", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "关联商品id") + private java.lang.String goodId; + /**关联用户id*/ + @Excel(name = "关联用户id", width = 15, dictTable = "mytest_user", dicText = "name", dicCode = "id") + @Dict(dictTable = "mytest_user", dicText = "name", dicCode = "id") + @ApiModelProperty(value = "关联用户id") + private java.lang.String userId; + + @TableField(exist = false) + private MytestUser user; + + @TableField(exist = false) + private MytestGoods goods; +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/MytestShopcarMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/MytestShopcarMapper.java new file mode 100644 index 0000000..b4c4723 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/MytestShopcarMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mytestShopcar.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mytestShopcar.entity.MytestShopcar; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 购物车表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface MytestShopcarMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/xml/MytestShopcarMapper.xml b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/xml/MytestShopcarMapper.xml new file mode 100644 index 0000000..fb52775 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/mapper/xml/MytestShopcarMapper.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/IMytestShopcarService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/IMytestShopcarService.java new file mode 100644 index 0000000..21b2bd7 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/IMytestShopcarService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mytestShopcar.service; + +import org.jeecg.modules.mytestShopcar.entity.MytestShopcar; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 购物车表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface IMytestShopcarService extends IService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/impl/MytestShopcarServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/impl/MytestShopcarServiceImpl.java new file mode 100644 index 0000000..fff78f3 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/service/impl/MytestShopcarServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.mytestShopcar.service.impl; + +import org.jeecg.modules.mytestShopcar.entity.MytestShopcar; +import org.jeecg.modules.mytestShopcar.mapper.MytestShopcarMapper; +import org.jeecg.modules.mytestShopcar.service.IMytestShopcarService; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; + +/** + * @Description: 购物车表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +@Service +public class MytestShopcarServiceImpl extends ServiceImpl implements IMytestShopcarService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/MytestShopcarList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/MytestShopcarList.vue new file mode 100644 index 0000000..fd71caa --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/MytestShopcarList.vue @@ -0,0 +1,184 @@ + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarForm.vue new file mode 100644 index 0000000..01707bd --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarForm.vue @@ -0,0 +1,114 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.Style#Drawer.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.Style#Drawer.vue new file mode 100644 index 0000000..408f58d --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.Style#Drawer.vue @@ -0,0 +1,84 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.vue new file mode 100644 index 0000000..456c68e --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue/modules/MytestShopcarModal.vue @@ -0,0 +1,60 @@ + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.api.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.api.ts new file mode 100644 index 0000000..ef47d5f --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/mytestShopcar/mytestShopcar/list', + save='/mytestShopcar/mytestShopcar/add', + edit='/mytestShopcar/mytestShopcar/edit', + deleteOne = '/mytestShopcar/mytestShopcar/delete', + deleteBatch = '/mytestShopcar/mytestShopcar/deleteBatch', + importExcel = '/mytestShopcar/mytestShopcar/importExcel', + exportXls = '/mytestShopcar/mytestShopcar/exportXls', +} +/** + * 导出api + * @param params + */ +export const getExportUrl = Api.exportXls; +/** + * 导入api + */ +export const getImportUrl = Api.importExcel; +/** + * 列表接口 + * @param params + */ +export const list = (params) => + defHttp.get({url: Api.list, params}); + +/** + * 删除单个 + */ +export const deleteOne = (params,handleSuccess) => { + return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); +} +/** + * 批量删除 + * @param params + */ +export const batchDelete = (params, handleSuccess) => { + Modal.confirm({ + title: '确认删除', + content: '是否删除选中数据', + okText: '确认', + cancelText: '取消', + onOk: () => { + return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => { + handleSuccess(); + }); + } + }); +} +/** + * 保存或者更新 + * @param params + */ +export const saveOrUpdate = (params, isUpdate) => { + let url = isUpdate ? Api.edit : Api.save; + return defHttp.post({url: url, params}); +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.data.ts new file mode 100644 index 0000000..70c51a9 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcar.data.ts @@ -0,0 +1,49 @@ +import {BasicColumn} from '/@/components/Table'; +import {FormSchema} from '/@/components/Table'; +import { rules} from '/@/utils/helper/validator'; +import { render } from '/@/utils/common/renderUtils'; +//列表数据 +export const columns: BasicColumn[] = [ + { + title: '购物车数量', + align:"center", + dataIndex: 'number' + }, + { + title: '关联商品id', + align:"center", + dataIndex: 'goodId_dictText' + }, + { + title: '关联用户id', + align:"center", + dataIndex: 'userId_dictText' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '购物车数量', + field: 'number', + component: 'Input', + }, + { + label: '关联商品id', + field: 'goodId', + component: 'JDictSelectTag', + componentProps:{ + dictCode:"mytest_goods,name,id" + }, + }, + { + label: '关联用户id', + field: 'userId', + component: 'JDictSelectTag', + componentProps:{ + dictCode:"mytest_user,name,id" + }, + }, +]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcarList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcarList.vue new file mode 100644 index 0000000..924b0fc --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/MytestShopcarList.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/components/MytestShopcarModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/components/MytestShopcarModal.vue new file mode 100644 index 0000000..b884691 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestShopcar/vue3/components/MytestShopcarModal.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/mytestController/ShopController.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/mytestController/ShopController.java new file mode 100644 index 0000000..40e5fdc --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/mytestController/ShopController.java @@ -0,0 +1,33 @@ +package org.jeecg.modules.api.mytestController; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.apiBean.PageBean; +import org.jeecg.modules.apiService.ShopApiService; +import org.jeecg.modules.apiService.UserApiService; +import org.jeecg.modules.mytestUser.entity.MytestUser; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; + +@Api(tags="购物车相关接口") +@RestController +@RequestMapping("/api/shop") +@Slf4j +public class ShopController { + + @Resource + private ShopApiService shopApiService; + + @ApiOperation(value="查询购物车列表", notes="查询购物车列表") + @RequestMapping(value = "/queryShopcarList", method = {RequestMethod.GET}) + public Result queryShopcarList(PageBean pageBean){ + return shopApiService.queryShopcarList(pageBean); + } + +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/ShopApiService.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/ShopApiService.java new file mode 100644 index 0000000..8a20444 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/ShopApiService.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.apiService; + +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.apiBean.PageBean; +import org.jeecg.modules.mytestUser.entity.MytestUser; + +public interface ShopApiService { + + public Result queryShopcarList(PageBean pageBean); +} diff --git a/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/ShopApiServiceImpl.java b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/ShopApiServiceImpl.java new file mode 100644 index 0000000..593f686 --- /dev/null +++ b/jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/ShopApiServiceImpl.java @@ -0,0 +1,59 @@ +package org.jeecg.modules.apiService.impl; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.apiBean.PageBean; +import org.jeecg.modules.apiService.ShopApiService; +import org.jeecg.modules.mytestGoods.entity.MytestGoods; +import org.jeecg.modules.mytestGoods.service.IMytestGoodsService; +import org.jeecg.modules.mytestShopcar.entity.MytestShopcar; +import org.jeecg.modules.mytestShopcar.service.IMytestShopcarService; +import org.jeecg.modules.mytestUser.entity.MytestUser; +import org.jeecg.modules.mytestUser.service.IMytestUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class ShopApiServiceImpl implements ShopApiService { + + //购物车表 + @Resource + private IMytestShopcarService mytestShopcarService; + + //商品表 + @Resource + private IMytestGoodsService mytestGoodsService; + + //用户表 + @Resource + private IMytestUserService mytestUserService; + + @Override + public Result queryShopcarList(PageBean pageBean) { + //分页信息 + Page page = new Page(pageBean.getPageNo(), pageBean.getPageSize()); + //查询购物车信息 + Page pageList = mytestShopcarService + .lambdaQuery() + .page(page); + + //添加购物车关联信息 + for (MytestShopcar record : pageList.getRecords()) { + //获取关联id + String goodId = record.getGoodId(); + String userId = record.getUserId(); + + //根据关联id获取对应对象 + MytestGoods good = mytestGoodsService.getById(goodId); + MytestUser user = mytestUserService.getById(userId); + + //将关联对象添加至购物车对象 + record.setGoods(good); + record.setUser(user); + + } + + return Result.OK("购物车信息", pageList); + } +}