parent
4e31911bc2
commit
f41c24f8d5
@ -0,0 +1,91 @@ |
||||
package com.ruoyi.web.controller.platform; |
||||
|
||||
import com.ruoyi.common.annotation.Log; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import com.ruoyi.common.core.page.TableDataInfo; |
||||
import com.ruoyi.common.enums.BusinessType; |
||||
import com.ruoyi.common.utils.poi.ExcelUtil; |
||||
import com.ruoyi.platform.domain.PlatformAddress; |
||||
import com.ruoyi.platform.service.IPlatformAddressService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.security.access.prepost.PreAuthorize; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 收货地址Controller |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-01-13 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/platform/address") |
||||
public class PlatformAddressController extends BaseController { |
||||
@Autowired |
||||
private IPlatformAddressService platformAddressService; |
||||
|
||||
/** |
||||
* 查询收货地址列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:list')") |
||||
@GetMapping("/list") |
||||
public TableDataInfo list(PlatformAddress platformAddress) { |
||||
startPage(); |
||||
List<PlatformAddress> list = platformAddressService.selectPlatformAddressList(platformAddress); |
||||
return getDataTable(list); |
||||
} |
||||
|
||||
/** |
||||
* 导出收货地址列表 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:export')") |
||||
@Log(title = "收货地址", businessType = BusinessType.EXPORT) |
||||
@PostMapping("/export") |
||||
public void export(HttpServletResponse response, PlatformAddress platformAddress) { |
||||
List<PlatformAddress> list = platformAddressService.selectPlatformAddressList(platformAddress); |
||||
ExcelUtil<PlatformAddress> util = new ExcelUtil<PlatformAddress>(PlatformAddress.class); |
||||
util.exportExcel(response, list, "收货地址数据"); |
||||
} |
||||
|
||||
/** |
||||
* 获取收货地址详细信息 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:query')") |
||||
@GetMapping(value = "/{id}") |
||||
public AjaxResult getInfo(@PathVariable("id") Long id) { |
||||
return success(platformAddressService.selectPlatformAddressById(id)); |
||||
} |
||||
|
||||
/** |
||||
* 新增收货地址 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:add')") |
||||
@Log(title = "收货地址", businessType = BusinessType.INSERT) |
||||
@PostMapping |
||||
public AjaxResult add(@RequestBody PlatformAddress platformAddress) { |
||||
return toAjax(platformAddressService.insertPlatformAddress(platformAddress)); |
||||
} |
||||
|
||||
/** |
||||
* 修改收货地址 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:edit')") |
||||
@Log(title = "收货地址", businessType = BusinessType.UPDATE) |
||||
@PutMapping |
||||
public AjaxResult edit(@RequestBody PlatformAddress platformAddress) { |
||||
return toAjax(platformAddressService.updatePlatformAddress(platformAddress)); |
||||
} |
||||
|
||||
/** |
||||
* 删除收货地址 |
||||
*/ |
||||
@PreAuthorize("@ss.hasPermi('platform:address:remove')") |
||||
@Log(title = "收货地址", businessType = BusinessType.DELETE) |
||||
@DeleteMapping("/{ids}") |
||||
public AjaxResult remove(@PathVariable Long[] ids) { |
||||
return toAjax(platformAddressService.deletePlatformAddressByIds(ids)); |
||||
} |
||||
} |
@ -0,0 +1,34 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" |
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
||||
<modelVersion>4.0.0</modelVersion> |
||||
<parent> |
||||
<groupId>com.ruoyi</groupId> |
||||
<artifactId>ruoyi</artifactId> |
||||
<version>3.8.5</version> |
||||
</parent> |
||||
|
||||
<artifactId>ttsbg-platform</artifactId> |
||||
|
||||
<description> |
||||
总平台 |
||||
</description> |
||||
|
||||
<properties> |
||||
<maven.compiler.source>11</maven.compiler.source> |
||||
<maven.compiler.target>11</maven.compiler.target> |
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
||||
</properties> |
||||
|
||||
|
||||
<dependencies> |
||||
|
||||
<!-- 通用工具--> |
||||
<dependency> |
||||
<groupId>com.ruoyi</groupId> |
||||
<artifactId>ruoyi-common</artifactId> |
||||
</dependency> |
||||
|
||||
</dependencies> |
||||
</project> |
@ -0,0 +1,142 @@ |
||||
package com.ruoyi.platform.domain; |
||||
|
||||
import com.ruoyi.common.annotation.Excel; |
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
import org.apache.commons.lang3.builder.ToStringStyle; |
||||
|
||||
/** |
||||
* 收货地址对象 platform_address |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-01-13 |
||||
*/ |
||||
public class PlatformAddress extends BaseEntity { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
/** |
||||
* $column.columnComment |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 收货人 |
||||
*/ |
||||
@Excel(name = "收货人") |
||||
private String consignee; |
||||
|
||||
/** |
||||
* 电话 |
||||
*/ |
||||
@Excel(name = "电话") |
||||
private String phone; |
||||
|
||||
/** |
||||
* 省 |
||||
*/ |
||||
@Excel(name = "省") |
||||
private String province; |
||||
|
||||
/** |
||||
* 市 |
||||
*/ |
||||
@Excel(name = "市") |
||||
private String city; |
||||
|
||||
/** |
||||
* 区 |
||||
*/ |
||||
@Excel(name = "区") |
||||
private String area; |
||||
|
||||
/** |
||||
* 详细地址 |
||||
*/ |
||||
@Excel(name = "详细地址") |
||||
private String address; |
||||
|
||||
/** |
||||
* 是否默认 |
||||
*/ |
||||
@Excel(name = "是否默认") |
||||
private Boolean isDefault; |
||||
|
||||
public void setId(Long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public Long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setConsignee(String consignee) { |
||||
this.consignee = consignee; |
||||
} |
||||
|
||||
public String getConsignee() { |
||||
return consignee; |
||||
} |
||||
|
||||
public void setPhone(String phone) { |
||||
this.phone = phone; |
||||
} |
||||
|
||||
public String getPhone() { |
||||
return phone; |
||||
} |
||||
|
||||
public void setProvince(String province) { |
||||
this.province = province; |
||||
} |
||||
|
||||
public String getProvince() { |
||||
return province; |
||||
} |
||||
|
||||
public void setCity(String city) { |
||||
this.city = city; |
||||
} |
||||
|
||||
public String getCity() { |
||||
return city; |
||||
} |
||||
|
||||
public void setArea(String area) { |
||||
this.area = area; |
||||
} |
||||
|
||||
public String getArea() { |
||||
return area; |
||||
} |
||||
|
||||
public void setAddress(String address) { |
||||
this.address = address; |
||||
} |
||||
|
||||
public String getAddress() { |
||||
return address; |
||||
} |
||||
|
||||
public void setIsDefault(Boolean isDefault) { |
||||
this.isDefault = isDefault; |
||||
} |
||||
|
||||
public Boolean getIsDefault() { |
||||
return isDefault; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE) |
||||
.append("id", getId()) |
||||
.append("createTime", getCreateTime()) |
||||
.append("consignee", getConsignee()) |
||||
.append("phone", getPhone()) |
||||
.append("province", getProvince()) |
||||
.append("city", getCity()) |
||||
.append("area", getArea()) |
||||
.append("address", getAddress()) |
||||
.append("isDefault", getIsDefault()) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,8 @@ |
||||
package com.ruoyi.platform.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.platform.domain.PlatformAddress; |
||||
|
||||
public interface PlatformAddressMapper extends BaseMapper<PlatformAddress> { |
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
package com.ruoyi.platform.service; |
||||
|
||||
|
||||
import com.ruoyi.platform.domain.PlatformAddress; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 收货地址Service接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-01-13 |
||||
*/ |
||||
public interface IPlatformAddressService { |
||||
/** |
||||
* 查询收货地址 |
||||
* |
||||
* @param id 收货地址主键 |
||||
* @return 收货地址 |
||||
*/ |
||||
public PlatformAddress selectPlatformAddressById(Long id); |
||||
|
||||
/** |
||||
* 查询收货地址列表 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 收货地址集合 |
||||
*/ |
||||
public List<PlatformAddress> selectPlatformAddressList(PlatformAddress platformAddress); |
||||
|
||||
/** |
||||
* 新增收货地址 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 结果 |
||||
*/ |
||||
public int insertPlatformAddress(PlatformAddress platformAddress); |
||||
|
||||
/** |
||||
* 修改收货地址 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 结果 |
||||
*/ |
||||
public int updatePlatformAddress(PlatformAddress platformAddress); |
||||
|
||||
/** |
||||
* 批量删除收货地址 |
||||
* |
||||
* @param ids 需要删除的收货地址主键集合 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformAddressByIds(Long[] ids); |
||||
|
||||
/** |
||||
* 删除收货地址信息 |
||||
* |
||||
* @param id 收货地址主键 |
||||
* @return 结果 |
||||
*/ |
||||
public int deletePlatformAddressById(Long id); |
||||
} |
@ -0,0 +1,95 @@ |
||||
package com.ruoyi.platform.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
import com.ruoyi.common.utils.DateUtils; |
||||
import com.ruoyi.platform.domain.PlatformAddress; |
||||
import com.ruoyi.platform.mapper.PlatformAddressMapper; |
||||
import com.ruoyi.platform.service.IPlatformAddressService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 收货地址Service业务层处理 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2023-01-13 |
||||
*/ |
||||
@Service |
||||
public class PlatformAddressServiceImpl implements IPlatformAddressService { |
||||
@Autowired |
||||
private PlatformAddressMapper platformAddressMapper; |
||||
|
||||
/** |
||||
* 查询收货地址 |
||||
* |
||||
* @param id 收货地址主键 |
||||
* @return 收货地址 |
||||
*/ |
||||
@Override |
||||
public PlatformAddress selectPlatformAddressById(Long id) { |
||||
return platformAddressMapper.selectById(id); |
||||
} |
||||
|
||||
/** |
||||
* 查询收货地址列表 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 收货地址 |
||||
*/ |
||||
@Override |
||||
public List<PlatformAddress> selectPlatformAddressList(PlatformAddress platformAddress) { |
||||
LambdaQueryWrapper<PlatformAddress> wrapper = new LambdaQueryWrapper<>(); |
||||
if (platformAddress.getConsignee() != null) { |
||||
wrapper.like(PlatformAddress::getConsignee, platformAddress.getAddress()); |
||||
} |
||||
return platformAddressMapper.selectList(wrapper); |
||||
} |
||||
|
||||
/** |
||||
* 新增收货地址 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int insertPlatformAddress(PlatformAddress platformAddress) { |
||||
platformAddress.setCreateTime(DateUtils.getNowDate()); |
||||
return platformAddressMapper.insert(platformAddress); |
||||
} |
||||
|
||||
/** |
||||
* 修改收货地址 |
||||
* |
||||
* @param platformAddress 收货地址 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int updatePlatformAddress(PlatformAddress platformAddress) { |
||||
return platformAddressMapper.updateById(platformAddress); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除收货地址 |
||||
* |
||||
* @param ids 需要删除的收货地址主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deletePlatformAddressByIds(Long[] ids) { |
||||
return platformAddressMapper.deleteBatchIds(Arrays.asList(ids)); |
||||
} |
||||
|
||||
/** |
||||
* 删除收货地址信息 |
||||
* |
||||
* @param id 收货地址主键 |
||||
* @return 结果 |
||||
*/ |
||||
@Override |
||||
public int deletePlatformAddressById(Long id) { |
||||
return platformAddressMapper.deleteById(id); |
||||
} |
||||
} |
Loading…
Reference in new issue