From fdc36d9c104e3951ec32614fb30ee7ad0195d300 Mon Sep 17 00:00:00 2001 From: Aug <17674666882@163.com> Date: Thu, 31 Oct 2024 11:23:23 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/MytestAddressController.java | 171 +++++++++++++++++++ .../mytestAddress/entity/MytestAddress.java | 58 +++++++ .../mytestAddress/mapper/MytestAddressMapper.java | 17 ++ .../mapper/xml/MytestAddressMapper.xml | 5 + .../service/IMytestAddressService.java | 14 ++ .../service/impl/MytestAddressServiceImpl.java | 19 +++ .../mytestAddress/vue/MytestAddressList.vue | 187 +++++++++++++++++++++ .../vue/modules/MytestAddressForm.vue | 109 ++++++++++++ .../modules/MytestAddressModal.Style#Drawer.vue | 84 +++++++++ .../vue/modules/MytestAddressModal.vue | 60 +++++++ .../mytestAddress/vue3/MytestAddress.api.ts | 61 +++++++ .../mytestAddress/vue3/MytestAddress.data.ts | 34 ++++ .../mytestAddress/vue3/MytestAddressList.vue | 162 ++++++++++++++++++ .../vue3/components/MytestAddressModal.vue | 58 +++++++ 14 files changed, 1039 insertions(+) create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/controller/MytestAddressController.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/entity/MytestAddress.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/MytestAddressMapper.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/xml/MytestAddressMapper.xml create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/IMytestAddressService.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/impl/MytestAddressServiceImpl.java create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/MytestAddressList.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressForm.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.Style#Drawer.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.api.ts create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.data.ts create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddressList.vue create mode 100644 jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/components/MytestAddressModal.vue diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/controller/MytestAddressController.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/controller/MytestAddressController.java new file mode 100644 index 0000000..f21d396 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/controller/MytestAddressController.java @@ -0,0 +1,171 @@ +package org.jeecg.modules.mytestAddress.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.mytestAddress.entity.MytestAddress; +import org.jeecg.modules.mytestAddress.service.IMytestAddressService; + +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("/mytestAddress/mytestAddress") +@Slf4j +public class MytestAddressController extends JeecgController { + @Autowired + private IMytestAddressService mytestAddressService; + + /** + * 分页列表查询 + * + * @param mytestAddress + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "地址表-分页列表查询") + @ApiOperation(value="地址表-分页列表查询", notes="地址表-分页列表查询") + @GetMapping(value = "/list") + public Result> queryPageList(MytestAddress mytestAddress, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(mytestAddress, req.getParameterMap()); + Page page = new Page(pageNo, pageSize); + IPage pageList = mytestAddressService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 添加 + * + * @param mytestAddress + * @return + */ + @AutoLog(value = "地址表-添加") + @ApiOperation(value="地址表-添加", notes="地址表-添加") + @PostMapping(value = "/add") + public Result add(@RequestBody MytestAddress mytestAddress) { + mytestAddressService.save(mytestAddress); + return Result.OK("添加成功!"); + } + + /** + * 编辑 + * + * @param mytestAddress + * @return + */ + @AutoLog(value = "地址表-编辑") + @ApiOperation(value="地址表-编辑", notes="地址表-编辑") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result edit(@RequestBody MytestAddress mytestAddress) { + mytestAddressService.updateById(mytestAddress); + 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) { + mytestAddressService.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.mytestAddressService.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) { + MytestAddress mytestAddress = mytestAddressService.getById(id); + if(mytestAddress==null) { + return Result.error("未找到对应数据"); + } + return Result.OK(mytestAddress); + } + + /** + * 导出excel + * + * @param request + * @param mytestAddress + */ + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MytestAddress mytestAddress) { + return super.exportXls(request, mytestAddress, MytestAddress.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, MytestAddress.class); + } + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/entity/MytestAddress.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/entity/MytestAddress.java new file mode 100644 index 0000000..43aa086 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/entity/MytestAddress.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.mytestAddress.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_address") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="mytest_address对象", description="地址表") +public class MytestAddress 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 area; + /**详细地址*/ + @Excel(name = "详细地址", width = 15) + @ApiModelProperty(value = "详细地址") + private java.lang.String address; +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/MytestAddressMapper.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/MytestAddressMapper.java new file mode 100644 index 0000000..e0649df --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/MytestAddressMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.mytestAddress.mapper; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mytestAddress.entity.MytestAddress; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + * @Description: 地址表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface MytestAddressMapper extends BaseMapper { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/xml/MytestAddressMapper.xml b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/xml/MytestAddressMapper.xml new file mode 100644 index 0000000..09241e7 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/mapper/xml/MytestAddressMapper.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/mytestAddress/service/IMytestAddressService.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/IMytestAddressService.java new file mode 100644 index 0000000..8e5e7b8 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/IMytestAddressService.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.mytestAddress.service; + +import org.jeecg.modules.mytestAddress.entity.MytestAddress; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + * @Description: 地址表 + * @Author: jeecg-boot + * @Date: 2024-10-29 + * @Version: V1.0 + */ +public interface IMytestAddressService extends IService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/impl/MytestAddressServiceImpl.java b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/impl/MytestAddressServiceImpl.java new file mode 100644 index 0000000..d4abac6 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/service/impl/MytestAddressServiceImpl.java @@ -0,0 +1,19 @@ +package org.jeecg.modules.mytestAddress.service.impl; + +import org.jeecg.modules.mytestAddress.entity.MytestAddress; +import org.jeecg.modules.mytestAddress.mapper.MytestAddressMapper; +import org.jeecg.modules.mytestAddress.service.IMytestAddressService; +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 MytestAddressServiceImpl extends ServiceImpl implements IMytestAddressService { + +} diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/MytestAddressList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/MytestAddressList.vue new file mode 100644 index 0000000..dbccace --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/MytestAddressList.vue @@ -0,0 +1,187 @@ + + + + \ No newline at end of file diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressForm.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressForm.vue new file mode 100644 index 0000000..5f5eb2f --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressForm.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/mytestAddress/vue/modules/MytestAddressModal.Style#Drawer.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.Style#Drawer.vue new file mode 100644 index 0000000..69ce514 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.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/mytestAddress/vue/modules/MytestAddressModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.vue new file mode 100644 index 0000000..5dd5295 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue/modules/MytestAddressModal.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/mytestAddress/vue3/MytestAddress.api.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.api.ts new file mode 100644 index 0000000..98a0619 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.api.ts @@ -0,0 +1,61 @@ +import {defHttp} from '/@/utils/http/axios'; +import {Modal} from 'ant-design-vue'; + +enum Api { + list = '/mytestAddress/mytestAddress/list', + save='/mytestAddress/mytestAddress/add', + edit='/mytestAddress/mytestAddress/edit', + deleteOne = '/mytestAddress/mytestAddress/delete', + deleteBatch = '/mytestAddress/mytestAddress/deleteBatch', + importExcel = '/mytestAddress/mytestAddress/importExcel', + exportXls = '/mytestAddress/mytestAddress/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/mytestAddress/vue3/MytestAddress.data.ts b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.data.ts new file mode 100644 index 0000000..66918d3 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddress.data.ts @@ -0,0 +1,34 @@ +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: 'area', + slots: { customRender: 'pcaSlot' },//TODO 未翻译 + }, + { + title: '详细地址', + align:"center", + dataIndex: 'address' + }, +]; +//查询数据 +export const searchFormSchema: FormSchema[] = [ +]; +//表单数据 +export const formSchema: FormSchema[] = [ + { + label: '所属区域', + field: 'area', + component: 'JAreaLinkage', + }, + { + label: '详细地址', + field: 'address', + component: 'Input', + }, +]; diff --git a/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddressList.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddressList.vue new file mode 100644 index 0000000..2019518 --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/MytestAddressList.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/mytestAddress/vue3/components/MytestAddressModal.vue b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/components/MytestAddressModal.vue new file mode 100644 index 0000000..9feb0fb --- /dev/null +++ b/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/mytestAddress/vue3/components/MytestAddressModal.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file