diff --git a/pom.xml b/pom.xml index 9d4b4a9..cf861d0 100644 --- a/pom.xml +++ b/pom.xml @@ -188,6 +188,7 @@ ruoyi-quartz ruoyi-generator ruoyi-common + ttsbg-platform pom diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 9a4cde8..7029f3a 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -61,6 +61,14 @@ ruoyi-generator + + + com.ruoyi + ttsbg-platform + 3.8.5 + compile + + @@ -80,17 +88,17 @@ - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 + + org.apache.maven.plugins + maven-war-plugin + 3.1.0 false ${project.artifactId} - - + + ${project.artifactId} - \ No newline at end of file + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformAddressController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformAddressController.java new file mode 100644 index 0000000..2ced039 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformAddressController.java @@ -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 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 list = platformAddressService.selectPlatformAddressList(platformAddress); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java index 67269ff..7566a4a 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java @@ -1,16 +1,18 @@ package com.ruoyi.common.core.domain; +import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; + import java.io.Serializable; import java.util.Date; import java.util.HashMap; import java.util.Map; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; /** * Entity基类 - * + * * @author ruoyi */ public class BaseEntity implements Serializable @@ -19,6 +21,7 @@ public class BaseEntity implements Serializable /** 搜索值 */ @JsonIgnore + @TableField(exist = false) private String searchValue; /** 创建者 */ @@ -39,6 +42,7 @@ public class BaseEntity implements Serializable private String remark; /** 请求参数 */ + @TableField(exist = false) @JsonInclude(JsonInclude.Include.NON_EMPTY) private Map params; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java index 2635144..5f56bf2 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java @@ -5,7 +5,6 @@ import com.ruoyi.common.core.domain.entity.SysUser; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; /** * 用户表 数据层 @@ -127,6 +126,4 @@ public interface SysUserMapper extends BaseMapper * @return 结果 */ public SysUser checkEmailUnique(String email); - - public int updateStatusByIds(Map params); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 52c9980..6a57c92 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -25,9 +25,8 @@ import org.springframework.util.CollectionUtils; import javax.validation.Validator; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Arrays; import java.util.List; -import java.util.Map; import java.util.stream.Collectors; /** @@ -550,9 +549,10 @@ public class SysUserServiceImpl implements ISysUserService @Override public int updateStatusByIds(Long[] userIds,String status) { - Map params=new HashMap<>(); - params.put("userIds",userIds); - params.put("status",status); - return userMapper.updateStatusByIds(params); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(SysUser::getUserId, Arrays.asList(userIds)); + SysUser sysUser = new SysUser(); + sysUser.setStatus(status); + return userMapper.update(sysUser, wrapper); } } diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml index 39d678b..003ac6b 100644 --- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml @@ -218,13 +218,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update sys_user set status = #{status} where user_id = #{userId} - - update sys_user set status = #{status} where user_id in - - #{userId} - - - update sys_user set avatar = #{avatar} where user_name = #{userName} diff --git a/sql/ttsbg.sql b/sql/ttsbg.sql index 255dd18..f35c31e 100644 --- a/sql/ttsbg.sql +++ b/sql/ttsbg.sql @@ -9,3 +9,23 @@ alter table sys_user foreign key (referrer_id) references sys_user (user_id); alter table sys_user modify user_name varchar(30) null comment '用户账号'; +# 收货地址表 +create table ttsbg.platform_address +( + id bigint auto_increment + primary key, + create_time datetime default CURRENT_TIMESTAMP not null comment '创建时间', + consignee varchar(10) not null comment '收货人', + phone varchar(11) not null comment '电话', + province varchar(10) not null comment '省', + city varchar(10) not null comment '市', + area varchar(10) not null comment '区', + address varchar(50) not null comment '详细地址', + is_default tinyint(1) not null comment '是否默认', + create_by varchar(64) null, + update_by varchar(64) null, + remark varchar(500) null, + update_time datetime null +) + comment '收货地址表'; + diff --git a/ttsbg-platform/pom.xml b/ttsbg-platform/pom.xml new file mode 100644 index 0000000..37b2f8d --- /dev/null +++ b/ttsbg-platform/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + + com.ruoyi + ruoyi + 3.8.5 + + + ttsbg-platform + + + 总平台 + + + + 11 + 11 + UTF-8 + + + + + + + + com.ruoyi + ruoyi-common + + + + diff --git a/ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformAddress.java b/ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformAddress.java new file mode 100644 index 0000000..686f50a --- /dev/null +++ b/ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformAddress.java @@ -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(); + } +} diff --git a/ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformAddressMapper.java b/ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformAddressMapper.java new file mode 100644 index 0000000..3a969df --- /dev/null +++ b/ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformAddressMapper.java @@ -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 { + +} diff --git a/ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformAddressService.java b/ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformAddressService.java new file mode 100644 index 0000000..a0ebda2 --- /dev/null +++ b/ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformAddressService.java @@ -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 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); +} diff --git a/ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformAddressServiceImpl.java b/ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformAddressServiceImpl.java new file mode 100644 index 0000000..78308de --- /dev/null +++ b/ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformAddressServiceImpl.java @@ -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 selectPlatformAddressList(PlatformAddress platformAddress) { + LambdaQueryWrapper 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); + } +}