1.调整批量更新用户状态逻辑

2.增加总平台模块
2.1.增加收货地址接口
master
panqihua 2 years ago
parent 4e31911bc2
commit f41c24f8d5
  1. 1
      pom.xml
  2. 22
      ruoyi-admin/pom.xml
  3. 91
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/platform/PlatformAddressController.java
  4. 12
      ruoyi-common/src/main/java/com/ruoyi/common/core/domain/BaseEntity.java
  5. 3
      ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java
  6. 12
      ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
  7. 7
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  8. 20
      sql/ttsbg.sql
  9. 34
      ttsbg-platform/pom.xml
  10. 142
      ttsbg-platform/src/main/java/com/ruoyi/platform/domain/PlatformAddress.java
  11. 8
      ttsbg-platform/src/main/java/com/ruoyi/platform/mapper/PlatformAddressMapper.java
  12. 62
      ttsbg-platform/src/main/java/com/ruoyi/platform/service/IPlatformAddressService.java
  13. 95
      ttsbg-platform/src/main/java/com/ruoyi/platform/service/impl/PlatformAddressServiceImpl.java

@ -188,6 +188,7 @@
<module>ruoyi-quartz</module> <module>ruoyi-quartz</module>
<module>ruoyi-generator</module> <module>ruoyi-generator</module>
<module>ruoyi-common</module> <module>ruoyi-common</module>
<module>ttsbg-platform</module>
</modules> </modules>
<packaging>pom</packaging> <packaging>pom</packaging>

@ -61,6 +61,14 @@
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<!--总平台-->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ttsbg-platform</artifactId>
<version>3.8.5</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -80,17 +88,17 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId> <artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version> <version>3.1.0</version>
<configuration> <configuration>
<failOnMissingWebXml>false</failOnMissingWebXml> <failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName> <warName>${project.artifactId}</warName>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
</build> </build>
</project> </project>

@ -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));
}
}

@ -1,16 +1,18 @@
package com.ruoyi.common.core.domain; 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.io.Serializable;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
/** /**
* Entity基类 * Entity基类
* *
* @author ruoyi * @author ruoyi
*/ */
public class BaseEntity implements Serializable public class BaseEntity implements Serializable
@ -19,6 +21,7 @@ public class BaseEntity implements Serializable
/** 搜索值 */ /** 搜索值 */
@JsonIgnore @JsonIgnore
@TableField(exist = false)
private String searchValue; private String searchValue;
/** 创建者 */ /** 创建者 */
@ -39,6 +42,7 @@ public class BaseEntity implements Serializable
private String remark; private String remark;
/** 请求参数 */ /** 请求参数 */
@TableField(exist = false)
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params; private Map<String, Object> params;

@ -5,7 +5,6 @@ import com.ruoyi.common.core.domain.entity.SysUser;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 用户表 数据层 * 用户表 数据层
@ -127,6 +126,4 @@ public interface SysUserMapper extends BaseMapper<SysUser>
* @return 结果 * @return 结果
*/ */
public SysUser checkEmailUnique(String email); public SysUser checkEmailUnique(String email);
public int updateStatusByIds(Map<String,Object> params);
} }

@ -25,9 +25,8 @@ import org.springframework.util.CollectionUtils;
import javax.validation.Validator; import javax.validation.Validator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -550,9 +549,10 @@ public class SysUserServiceImpl implements ISysUserService
@Override @Override
public int updateStatusByIds(Long[] userIds,String status) { public int updateStatusByIds(Long[] userIds,String status) {
Map<String,Object> params=new HashMap<>(); LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
params.put("userIds",userIds); wrapper.in(SysUser::getUserId, Arrays.asList(userIds));
params.put("status",status); SysUser sysUser = new SysUser();
return userMapper.updateStatusByIds(params); sysUser.setStatus(status);
return userMapper.update(sysUser, wrapper);
} }
} }

@ -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 = #{userId}
</update> </update>
<update id="updateStatusByIds" parameterType="Map">
update sys_user set status = #{status} where user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</update>
<update id="updateUserAvatar" parameterType="SysUser"> <update id="updateUserAvatar" parameterType="SysUser">
update sys_user set avatar = #{avatar} where user_name = #{userName} update sys_user set avatar = #{avatar} where user_name = #{userName}
</update> </update>

@ -9,3 +9,23 @@ alter table sys_user
foreign key (referrer_id) references sys_user (user_id); foreign key (referrer_id) references sys_user (user_id);
alter table sys_user alter table sys_user
modify user_name varchar(30) null comment '用户账号'; 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 '收货地址表';

@ -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…
Cancel
Save