diff --git a/ruiyi-carpool/src/main/java/com/ruoyi/carpool/controller/PAddressController.java b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/controller/PAddressController.java new file mode 100644 index 000000000..644fffb77 --- /dev/null +++ b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/controller/PAddressController.java @@ -0,0 +1,104 @@ +package com.ruoyi.carpool.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.carpool.domain.PAddress; +import com.ruoyi.carpool.service.IPAddressService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 地址详情Controller + * + * @author ruoyi + * @date 2021-12-18 + */ +@RestController +@RequestMapping("/carpool/address") +public class PAddressController extends BaseController +{ + @Autowired + private IPAddressService pAddressService; + + /** + * 查询地址详情列表 + */ + @PreAuthorize("@ss.hasPermi('address:address:list')") + @GetMapping("/list") + public TableDataInfo list(PAddress pAddress) + { + startPage(); + List list = pAddressService.selectPAddressList(pAddress); + return getDataTable(list); + } + + /** + * 导出地址详情列表 + */ + @PreAuthorize("@ss.hasPermi('address:address:export')") + @Log(title = "地址详情", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PAddress pAddress) + { + List list = pAddressService.selectPAddressList(pAddress); + ExcelUtil util = new ExcelUtil(PAddress.class); + util.exportExcel(response, list, "地址详情数据"); + } + + /** + * 获取地址详情详细信息 + */ + @PreAuthorize("@ss.hasPermi('address:address:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(pAddressService.selectPAddressById(id)); + } + + /** + * 新增地址详情 + */ + @PreAuthorize("@ss.hasPermi('address:address:add')") + @Log(title = "地址详情", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PAddress pAddress) + { + return toAjax(pAddressService.insertPAddress(pAddress)); + } + + /** + * 修改地址详情 + */ + @PreAuthorize("@ss.hasPermi('address:address:edit')") + @Log(title = "地址详情", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PAddress pAddress) + { + return toAjax(pAddressService.updatePAddress(pAddress)); + } + + /** + * 删除地址详情 + */ + @PreAuthorize("@ss.hasPermi('address:address:remove')") + @Log(title = "地址详情", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(pAddressService.deletePAddressByIds(ids)); + } +} diff --git a/ruiyi-carpool/src/main/java/com/ruoyi/carpool/domain/PAddress.java b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/domain/PAddress.java new file mode 100644 index 000000000..577bd3764 --- /dev/null +++ b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/domain/PAddress.java @@ -0,0 +1,69 @@ +package com.ruoyi.carpool.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 地址详情对象 p_address + * + * @author ruoyi + * @date 2021-12-18 + */ +public class PAddress extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 自增ID */ + private Long id; + + /** 地址 */ + @Excel(name = "地址") + private String address; + + /** 地址类型,1:出发地;2:目的地 */ + @Excel(name = "地址类型,1:出发地;2:目的地") + private String type; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setAddress(String address) + { + this.address = address; + } + + public String getAddress() + { + return address; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("address", getAddress()) + .append("type", getType()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/ruiyi-carpool/src/main/java/com/ruoyi/carpool/mapper/PAddressMapper.java b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/mapper/PAddressMapper.java new file mode 100644 index 000000000..d46972b19 --- /dev/null +++ b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/mapper/PAddressMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.carpool.mapper; + +import java.util.List; +import com.ruoyi.carpool.domain.PAddress; + +/** + * 地址详情Mapper接口 + * + * @author ruoyi + * @date 2021-12-18 + */ +public interface PAddressMapper +{ + /** + * 查询地址详情 + * + * @param id 地址详情主键 + * @return 地址详情 + */ + public PAddress selectPAddressById(Long id); + + /** + * 查询地址详情列表 + * + * @param pAddress 地址详情 + * @return 地址详情集合 + */ + public List selectPAddressList(PAddress pAddress); + + /** + * 新增地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + public int insertPAddress(PAddress pAddress); + + /** + * 修改地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + public int updatePAddress(PAddress pAddress); + + /** + * 删除地址详情 + * + * @param id 地址详情主键 + * @return 结果 + */ + public int deletePAddressById(Long id); + + /** + * 批量删除地址详情 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePAddressByIds(Long[] ids); +} diff --git a/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/IPAddressService.java b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/IPAddressService.java new file mode 100644 index 000000000..0680b9095 --- /dev/null +++ b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/IPAddressService.java @@ -0,0 +1,61 @@ +package com.ruoyi.carpool.service; + +import java.util.List; +import com.ruoyi.carpool.domain.PAddress; + +/** + * 地址详情Service接口 + * + * @author ruoyi + * @date 2021-12-18 + */ +public interface IPAddressService +{ + /** + * 查询地址详情 + * + * @param id 地址详情主键 + * @return 地址详情 + */ + public PAddress selectPAddressById(Long id); + + /** + * 查询地址详情列表 + * + * @param pAddress 地址详情 + * @return 地址详情集合 + */ + public List selectPAddressList(PAddress pAddress); + + /** + * 新增地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + public int insertPAddress(PAddress pAddress); + + /** + * 修改地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + public int updatePAddress(PAddress pAddress); + + /** + * 批量删除地址详情 + * + * @param ids 需要删除的地址详情主键集合 + * @return 结果 + */ + public int deletePAddressByIds(Long[] ids); + + /** + * 删除地址详情信息 + * + * @param id 地址详情主键 + * @return 结果 + */ + public int deletePAddressById(Long id); +} diff --git a/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/impl/PAddressServiceImpl.java b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/impl/PAddressServiceImpl.java new file mode 100644 index 000000000..6ea0f2e93 --- /dev/null +++ b/ruiyi-carpool/src/main/java/com/ruoyi/carpool/service/impl/PAddressServiceImpl.java @@ -0,0 +1,96 @@ +package com.ruoyi.carpool.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.carpool.mapper.PAddressMapper; +import com.ruoyi.carpool.domain.PAddress; +import com.ruoyi.carpool.service.IPAddressService; + +/** + * 地址详情Service业务层处理 + * + * @author ruoyi + * @date 2021-12-18 + */ +@Service +public class PAddressServiceImpl implements IPAddressService +{ + @Autowired + private PAddressMapper pAddressMapper; + + /** + * 查询地址详情 + * + * @param id 地址详情主键 + * @return 地址详情 + */ + @Override + public PAddress selectPAddressById(Long id) + { + return pAddressMapper.selectPAddressById(id); + } + + /** + * 查询地址详情列表 + * + * @param pAddress 地址详情 + * @return 地址详情 + */ + @Override + public List selectPAddressList(PAddress pAddress) + { + return pAddressMapper.selectPAddressList(pAddress); + } + + /** + * 新增地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + @Override + public int insertPAddress(PAddress pAddress) + { + pAddress.setCreateTime(DateUtils.getNowDate()); + return pAddressMapper.insertPAddress(pAddress); + } + + /** + * 修改地址详情 + * + * @param pAddress 地址详情 + * @return 结果 + */ + @Override + public int updatePAddress(PAddress pAddress) + { + pAddress.setUpdateTime(DateUtils.getNowDate()); + return pAddressMapper.updatePAddress(pAddress); + } + + /** + * 批量删除地址详情 + * + * @param ids 需要删除的地址详情主键 + * @return 结果 + */ + @Override + public int deletePAddressByIds(Long[] ids) + { + return pAddressMapper.deletePAddressByIds(ids); + } + + /** + * 删除地址详情信息 + * + * @param id 地址详情主键 + * @return 结果 + */ + @Override + public int deletePAddressById(Long id) + { + return pAddressMapper.deletePAddressById(id); + } +} diff --git a/ruiyi-carpool/src/main/resources/mapper/carpool/PAddressMapper.xml b/ruiyi-carpool/src/main/resources/mapper/carpool/PAddressMapper.xml new file mode 100644 index 000000000..9d368fa69 --- /dev/null +++ b/ruiyi-carpool/src/main/resources/mapper/carpool/PAddressMapper.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + select id, address, type, create_by, create_time, update_by, update_time from p_address + + + + + + + + insert into p_address + + address, + type, + create_by, + create_time, + update_by, + update_time, + + + #{address}, + #{type}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update p_address + + address = #{address}, + type = #{type}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from p_address where id = #{id} + + + + delete from p_address where id in + + #{id} + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/carpool/address.js b/ruoyi-ui/src/api/carpool/address.js new file mode 100644 index 000000000..975769f3b --- /dev/null +++ b/ruoyi-ui/src/api/carpool/address.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 查询地址详情列表 +export function listAddress(query) { + return request({ + url: '/carpool/address/list', + method: 'get', + params: query + }) +} + +// 查询地址详情详细 +export function getAddress(id) { + return request({ + url: '/carpool/address/' + id, + method: 'get' + }) +} + +// 新增地址详情 +export function addAddress(data) { + return request({ + url: '/carpool/address', + method: 'post', + data: data + }) +} + +// 修改地址详情 +export function updateAddress(data) { + return request({ + url: '/carpool/address', + method: 'put', + data: data + }) +} + +// 删除地址详情 +export function delAddress(id) { + return request({ + url: '/carpool/address/' + id, + method: 'delete' + }) +} + +// 导出地址详情 +export function exportAddress(query) { + return request({ + url: '/carpool/address/export', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/views/carpool/address/index.vue b/ruoyi-ui/src/views/carpool/address/index.vue new file mode 100644 index 000000000..128cb5769 --- /dev/null +++ b/ruoyi-ui/src/views/carpool/address/index.vue @@ -0,0 +1,268 @@ + + +