Compare commits

...

4 Commits

Author SHA1 Message Date
dzq 160033f107 feat(格口管理): 优化格口列表查询,添加商品信息关联查询
修改SQL查询语句,直接关联查询商品名称、价格和封面图,避免后续循环查询
移除冗余的DTO转换逻辑,直接返回包含商品信息的DTO
在查询条件中添加商品名称的模糊搜索支持
2025-05-26 09:59:32 +08:00
dzq 9dd57047b5 feat(qywx): 添加获取用户总余额功能
新增了获取企业微信用户总余额的功能,包括在QyUserService、QyUserMapper、QyUserApplicationService和QyUserController中添加相关方法和接口。同时,调整了ShopOrderGoodsMapper中的查询限制条件,并新增了用户VIP信息表和相关SQL脚本。
2025-05-24 16:12:18 +08:00
dzq 944a6bc722 feat(智能柜): 添加归属类型字段以支持分类功能
在智能柜模块中新增`belong_type`字段,用于区分柜子的归属类型(0-借还柜,1-固资通)。该字段已添加到DTO、Entity和查询条件中,并同步更新了数据库表结构。此修改为后续功能扩展提供了基础支持。
2025-05-23 10:49:42 +08:00
dzq 68bffc0b73 feat(用户标签): 添加获取用户标签名称列表功能并支持标签过滤用户列表
在用户标签模块中新增了获取所有标签名称的功能,并在用户列表查询中加入了标签过滤条件。这些改动是为了支持前端展示标签名称列表以及根据标签筛选用户的需求。
2025-05-22 15:43:25 +08:00
27 changed files with 176 additions and 46 deletions

View File

@ -65,4 +65,11 @@ public class Ab98UserTagController extends BaseController {
ab98UserTagApplicationService.deleteAb98UserTag(new BulkOperationCommand<>(ids)); ab98UserTagApplicationService.deleteAb98UserTag(new BulkOperationCommand<>(ids));
return ResponseDTO.ok(); return ResponseDTO.ok();
} }
@Operation(summary = "获取所有标签名称")
@GetMapping("/names")
public ResponseDTO<List<String>> getDistinctTagNames() {
List<String> tagNames = ab98UserTagApplicationService.selectDistinctTagNames();
return ResponseDTO.ok(tagNames);
}
} }

View File

@ -10,6 +10,7 @@ import com.agileboot.domain.cabinet.cell.command.AddCabinetCellCommand;
import com.agileboot.domain.cabinet.cell.command.UpdateCabinetCellCommand; import com.agileboot.domain.cabinet.cell.command.UpdateCabinetCellCommand;
import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity; import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity;
import com.agileboot.domain.cabinet.cell.dto.CabinetCellDTO; import com.agileboot.domain.cabinet.cell.dto.CabinetCellDTO;
import com.agileboot.domain.cabinet.cell.dto.CabinetCellWithOrderCountDTO;
import com.agileboot.domain.cabinet.cell.query.SearchCabinetCellQuery; import com.agileboot.domain.cabinet.cell.query.SearchCabinetCellQuery;
import com.agileboot.domain.cabinet.cell.query.SearchCabinetCellWithOrdersQuery; import com.agileboot.domain.cabinet.cell.query.SearchCabinetCellWithOrdersQuery;
import com.agileboot.domain.common.command.BulkOperationCommand; import com.agileboot.domain.common.command.BulkOperationCommand;
@ -39,8 +40,8 @@ public class CabinetCellController extends BaseController {
@Operation(summary = "格口列表") @Operation(summary = "格口列表")
@GetMapping @GetMapping
public ResponseDTO<PageDTO<CabinetCellDTO>> list(SearchCabinetCellWithOrdersQuery<CabinetCellEntity> query) { public ResponseDTO<PageDTO<CabinetCellWithOrderCountDTO>> list(SearchCabinetCellWithOrdersQuery<CabinetCellEntity> query) {
PageDTO<CabinetCellDTO> page = cabinetCellApplicationService.getCabinetCellList(query); PageDTO<CabinetCellWithOrderCountDTO> page = cabinetCellApplicationService.getCabinetCellList(query);
return ResponseDTO.ok(page); return ResponseDTO.ok(page);
} }

View File

@ -20,18 +20,13 @@ import com.agileboot.domain.qywx.user.db.QyUserEntity;
import com.agileboot.domain.qywx.user.dto.QyUserDTO; import com.agileboot.domain.qywx.user.dto.QyUserDTO;
import com.agileboot.domain.qywx.user.query.SearchQyUserQuery; import com.agileboot.domain.qywx.user.query.SearchQyUserQuery;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/qywx/users") @RequestMapping("/qywx/users")
@ -108,4 +103,10 @@ public class QyUserController extends BaseController {
UserIdResponse response = QywxApiUtil.convertToUserid(accessToken.getAccessToken(), openid); UserIdResponse response = QywxApiUtil.convertToUserid(accessToken.getAccessToken(), openid);
return ResponseDTO.ok(JSONUtil.toJsonStr(response)); return ResponseDTO.ok(JSONUtil.toJsonStr(response));
} }
@GetMapping("/getTotalBalance")
public ResponseDTO<BigDecimal> getTotalBalance(@RequestParam(required = false) String corpid) {
BigDecimal totalBalance = qyUserApplicationService.selectTotalBalance(corpid);
return ResponseDTO.ok(totalBalance);
}
} }

View File

@ -58,4 +58,8 @@ public class Ab98UserTagApplicationService {
public Ab98UserTagEntity getByTagId(Long tagId) { public Ab98UserTagEntity getByTagId(Long tagId) {
return ab98UserTagService.getByTagId(tagId); return ab98UserTagService.getByTagId(tagId);
} }
public List<String> selectDistinctTagNames() {
return ab98UserTagService.selectDistinctTagNames();
}
} }

View File

@ -35,4 +35,7 @@ public interface Ab98UserTagMapper extends BaseMapper<Ab98UserTagEntity> {
@Select("SELECT * FROM ab98_user_tag WHERE tag_id = #{tagId} LIMIT 1") @Select("SELECT * FROM ab98_user_tag WHERE tag_id = #{tagId} LIMIT 1")
Ab98UserTagEntity selectByTagId(@Param("tagId") Long tagId); Ab98UserTagEntity selectByTagId(@Param("tagId") Long tagId);
@Select("SELECT DISTINCT tag_name FROM ab98_user_tag WHERE deleted = 0")
List<String> selectDistinctTagNames();
} }

View File

@ -22,4 +22,6 @@ public interface Ab98UserTagService extends IService<Ab98UserTagEntity> {
Ab98UserTagEntity getFirstEnabledTag(); Ab98UserTagEntity getFirstEnabledTag();
Ab98UserTagEntity getByTagId(Long tagId); Ab98UserTagEntity getByTagId(Long tagId);
List<String> selectDistinctTagNames();
} }

View File

@ -41,4 +41,9 @@ public class Ab98UserTagServiceImpl extends ServiceImpl<Ab98UserTagMapper, Ab98U
public Ab98UserTagEntity getByTagId(Long tagId) { public Ab98UserTagEntity getByTagId(Long tagId) {
return baseMapper.selectByTagId(tagId); return baseMapper.selectByTagId(tagId);
} }
@Override
public List<String> selectDistinctTagNames() {
return baseMapper.selectDistinctTagNames();
}
} }

View File

@ -29,7 +29,7 @@ public class Ab98UserApplicationService {
private final Ab98UserModelFactory userModelFactory; private final Ab98UserModelFactory userModelFactory;
public PageDTO<Ab98UserDTO> getUserList(SearchAb98UserQuery<Ab98UserEntity> query) { public PageDTO<Ab98UserDTO> getUserList(SearchAb98UserQuery<Ab98UserEntity> query) {
Page<Ab98UserEntity> page = userService.getUserList(query); Page<Ab98UserEntity> page = userService.getUserListWithTagFilter(query);
List<Ab98UserDTO> dtoList = page.getRecords().stream() List<Ab98UserDTO> dtoList = page.getRecords().stream()
.map(Ab98UserDTO::new) .map(Ab98UserDTO::new)
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -46,4 +46,13 @@ public interface Ab98UserMapper extends BaseMapper<Ab98UserEntity> {
@Select("SELECT * FROM ab98_user WHERE openid = #{openid} AND userid = #{userid} LIMIT 1") @Select("SELECT * FROM ab98_user WHERE openid = #{openid} AND userid = #{userid} LIMIT 1")
Ab98UserEntity selectByOpenidAndUserid(@Param("openid")String openid, @Param("userid")String userid); Ab98UserEntity selectByOpenidAndUserid(@Param("openid")String openid, @Param("userid")String userid);
@Select("SELECT DISTINCT u.* " +
"FROM ab98_user u " +
"LEFT JOIN ab98_user_tag t ON u.ab98_user_id = t.ab98_user_id " +
"${ew.customSqlSegment}")
Page<Ab98UserEntity> getUserListWithTagFilter(
Page<Ab98UserEntity> page,
@Param(Constants.WRAPPER) Wrapper<Ab98UserEntity> queryWrapper
);
} }

View File

@ -1,6 +1,8 @@
package com.agileboot.domain.ab98.user.db; package com.agileboot.domain.ab98.user.db;
import com.agileboot.common.core.page.AbstractPageQuery; import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -16,7 +18,7 @@ import java.util.List;
* @since 2025-05-10 * @since 2025-05-10
*/ */
public interface Ab98UserService extends IService<Ab98UserEntity> { public interface Ab98UserService extends IService<Ab98UserEntity> {
Page<Ab98UserEntity> getUserList(AbstractPageQuery<Ab98UserEntity> query); Page<Ab98UserEntity> getUserListWithTagFilter(AbstractPageQuery<Ab98UserEntity> query);
List<Ab98UserEntity> selectAll(); List<Ab98UserEntity> selectAll();

View File

@ -20,8 +20,8 @@ import java.util.List;
public class Ab98UserServiceImpl extends ServiceImpl<Ab98UserMapper, Ab98UserEntity> implements Ab98UserService { public class Ab98UserServiceImpl extends ServiceImpl<Ab98UserMapper, Ab98UserEntity> implements Ab98UserService {
@Override @Override
public Page<Ab98UserEntity> getUserList(AbstractPageQuery<Ab98UserEntity> query) { public Page<Ab98UserEntity> getUserListWithTagFilter(AbstractPageQuery<Ab98UserEntity> query) {
return this.page(query.toPage(), query.toQueryWrapper()); return baseMapper.getUserListWithTagFilter(query.toPage(), query.toQueryWrapper());
} }
@Override @Override

View File

@ -21,21 +21,23 @@ public class SearchAb98UserQuery<T> extends AbstractPageQuery<T> {
private Boolean registered; private Boolean registered;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
private String tagName;
@Override @Override
public QueryWrapper<T> addQueryCondition() { public QueryWrapper<T> addQueryCondition() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>(); QueryWrapper<T> queryWrapper = new QueryWrapper<>();
queryWrapper queryWrapper
.eq(ab98UserId != null, "ab98_user_id", ab98UserId) .eq(ab98UserId != null, "u.ab98_user_id", ab98UserId)
.eq(StrUtil.isNotEmpty(openid), "openid", openid) .eq(StrUtil.isNotEmpty(openid), "u.openid", openid)
.eq(StrUtil.isNotEmpty(userid), "userid", userid) .eq(StrUtil.isNotEmpty(userid), "u.userid", userid)
.like(StrUtil.isNotEmpty(name), "name", name) .like(StrUtil.isNotEmpty(name), "u.name", name)
.like(StrUtil.isNotEmpty(tel), "tel", tel) .like(StrUtil.isNotEmpty(tel), "u.tel", tel)
.like(StrUtil.isNotEmpty(idnum), "idnum", idnum) .like(StrUtil.isNotEmpty(idnum), "u.idnum", idnum)
.eq(StrUtil.isNotEmpty(sex), "sex", sex) .eq(StrUtil.isNotEmpty(tagName), "t.tag_name", tagName)
.eq(registered != null, "registered", registered) .eq(StrUtil.isNotEmpty(sex), "u.sex", sex)
.between(startTime != null && endTime != null, "create_time", startTime, endTime); .eq(registered != null, "u.registered", registered)
.between(startTime != null && endTime != null, "u.create_time", startTime, endTime);
this.timeRangeColumn = "create_time"; this.timeRangeColumn = "create_time";

View File

@ -30,26 +30,9 @@ public class CabinetCellApplicationService {
private final CabinetCellModelFactory cabinetCellModelFactory; private final CabinetCellModelFactory cabinetCellModelFactory;
private final ShopGoodsService shopGoodsService; private final ShopGoodsService shopGoodsService;
public PageDTO<CabinetCellDTO> getCabinetCellList(SearchCabinetCellWithOrdersQuery<CabinetCellEntity> query) { public PageDTO<CabinetCellWithOrderCountDTO> getCabinetCellList(SearchCabinetCellWithOrdersQuery<CabinetCellEntity> query) {
// Page<CabinetCellEntity> page = cabinetCellService.getCellList(query);
Page<CabinetCellWithOrderCountDTO> page = cabinetCellService.getCellListWithOrders(query); Page<CabinetCellWithOrderCountDTO> page = cabinetCellService.getCellListWithOrders(query);
List<ShopGoodsEntity> goodsList = shopGoodsService.selectAll(); return new PageDTO<>(page.getRecords(), page.getTotal());
List<CabinetCellDTO> dtoList = page.getRecords().stream()
.map(cell -> {
CabinetCellDTO dto = new CabinetCellDTO(cell);
ShopGoodsEntity goods = goodsList.stream()
.filter(g -> g.getGoodsId().equals(cell.getGoodsId()))
.findFirst()
.orElse(null);
if (goods != null) {
dto.setGoodsName(goods.getGoodsName());
dto.setPrice(goods.getPrice());
dto.setCoverImg(goods.getCoverImg());
}
return dto;
})
.collect(Collectors.toList());
return new PageDTO<>(dtoList, page.getTotal());
} }
public void addCabinetCell(AddCabinetCellCommand command) { public void addCabinetCell(AddCabinetCellCommand command) {

View File

@ -52,9 +52,10 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
"WHERE cell_id = #{cellId}") "WHERE cell_id = #{cellId}")
void clearGoodsIdAndFreeCell(@Param("cellId") Long cellId); void clearGoodsIdAndFreeCell(@Param("cellId") Long cellId);
@Select("SELECT cc.*, COUNT(sog.order_goods_id) AS orderCount " + @Select("SELECT cc.*, COUNT(sog.order_goods_id) AS orderCount, sg.goods_name, sg.price, sg.cover_img " +
"FROM cabinet_cell cc " + "FROM cabinet_cell cc " +
"LEFT JOIN shop_order_goods sog ON cc.cell_id = sog.cell_id AND sog.deleted = 0 " + "LEFT JOIN shop_order_goods sog ON cc.cell_id = sog.cell_id AND sog.deleted = 0 " +
"LEFT JOIN shop_goods sg ON cc.goods_id = sg.goods_id AND sg.deleted = 0 " +
"${ew.customSqlSegment} ") "${ew.customSqlSegment} ")
Page<CabinetCellWithOrderCountDTO> getCellListWithOrders( Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(
Page<CabinetCellEntity> page, Page<CabinetCellEntity> page,

View File

@ -1,13 +1,28 @@
package com.agileboot.domain.cabinet.cell.dto; package com.agileboot.domain.cabinet.cell.dto;
import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity; import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class CabinetCellWithOrderCountDTO extends CabinetCellEntity { public class CabinetCellWithOrderCountDTO extends CabinetCellEntity {
@ApiModelProperty("历史订单数量") @ApiModelProperty("历史订单数量")
private Integer orderCount; private Integer orderCount;
@ApiModelProperty("关联商品名称")
@TableField("goods_name")
private String goodsName;
@ApiModelProperty("关联商品价格")
@TableField("price")
private BigDecimal price;
@ApiModelProperty("关联商品图片")
@TableField("cover_img")
private String coverImg;
} }

View File

@ -4,6 +4,7 @@ import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import java.util.Date; import java.util.Date;
@ -18,6 +19,7 @@ public class SearchCabinetCellWithOrdersQuery<T> extends AbstractPageQuery<T> {
private Integer availableStatus; private Integer availableStatus;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
private String goodsName;
@Override @Override
public QueryWrapper<T> addQueryCondition() { public QueryWrapper<T> addQueryCondition() {
@ -31,6 +33,7 @@ public class SearchCabinetCellWithOrdersQuery<T> extends AbstractPageQuery<T> {
.eq(usageStatus != null, "cc.usage_status", usageStatus) .eq(usageStatus != null, "cc.usage_status", usageStatus)
.eq(availableStatus != null, "cc.available_status", availableStatus) .eq(availableStatus != null, "cc.available_status", availableStatus)
.eq("cc.deleted", false) .eq("cc.deleted", false)
.like(StringUtils.isNotBlank(goodsName), "sg.goods_name", goodsName)
.between(startTime != null && endTime != null, "cc.create_time", startTime, endTime) .between(startTime != null && endTime != null, "cc.create_time", startTime, endTime)
.groupBy("cc.cell_id"); .groupBy("cc.cell_id");

View File

@ -43,6 +43,10 @@ public class SmartCabinetEntity extends BaseEntity<SmartCabinetEntity> {
@TableField("main_cabinet") @TableField("main_cabinet")
private Long mainCabinet; private Long mainCabinet;
@ApiModelProperty("归属类型0-借还柜 1-固资通)")
@TableField("belong_type")
private Integer belongType;
@ApiModelProperty("归属主柜名称") @ApiModelProperty("归属主柜名称")
@TableField(exist = false) @TableField(exist = false)
private String mainCabinetName; private String mainCabinetName;

View File

@ -37,6 +37,9 @@ public class SmartCabinetDTO {
@ExcelColumn(name = "归属主柜ID") @ExcelColumn(name = "归属主柜ID")
private Long mainCabinet; private Long mainCabinet;
@ExcelColumn(name = "归属类型0-借还柜 1-固资通)")
private Integer belongType;
@ExcelColumn(name = "归属主柜名称") @ExcelColumn(name = "归属主柜名称")
private String mainCabinetName; private String mainCabinetName;

View File

@ -18,6 +18,8 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
private Date endTime; private Date endTime;
private Long mqttServerId; private Long mqttServerId;
private Long shopId; private Long shopId;
private Integer belongType;
@Override @Override
public QueryWrapper<T> addQueryCondition() { public QueryWrapper<T> addQueryCondition() {
@ -28,6 +30,7 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
.eq(cabinetType != null, "sc.cabinet_type", cabinetType) .eq(cabinetType != null, "sc.cabinet_type", cabinetType)
.eq(mqttServerId!= null, "sc.mqtt_server_id", mqttServerId) .eq(mqttServerId!= null, "sc.mqtt_server_id", mqttServerId)
.eq(shopId!= null, "sc.shop_id", shopId) .eq(shopId!= null, "sc.shop_id", shopId)
.eq(belongType!= null, "sc.belong_type", belongType)
.eq(StrUtil.isNotEmpty(templateNo), "sc.template_no", templateNo) .eq(StrUtil.isNotEmpty(templateNo), "sc.template_no", templateNo)
.eq("sc.deleted", false) .eq("sc.deleted", false)
.between(startTime != null && endTime != null, "sc.create_time", startTime, endTime); .between(startTime != null && endTime != null, "sc.create_time", startTime, endTime);

View File

@ -21,6 +21,8 @@ import com.agileboot.domain.system.user.db.SysUserEntity;
import com.agileboot.domain.system.user.db.SysUserService; import com.agileboot.domain.system.user.db.SysUserService;
import com.agileboot.domain.system.user.dto.UserDTO; import com.agileboot.domain.system.user.dto.UserDTO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -133,4 +135,8 @@ public class QyUserApplicationService {
} }
} }
} }
public BigDecimal selectTotalBalance(String corpid) {
return userService.selectTotalBalance(corpid);
}
} }

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
@ -43,4 +45,14 @@ public interface QyUserMapper extends BaseMapper<QyUserEntity> {
"AND sr.role_key = 'admin'") "AND sr.role_key = 'admin'")
List<String> selectAdminUserIds(); List<String> selectAdminUserIds();
@Select("SELECT SUM(balance) " +
"FROM qy_user " +
"WHERE deleted = 0")
BigDecimal selectTotalBalance();
@Select("SELECT SUM(balance) " +
"FROM qy_user " +
"WHERE deleted = 0 AND corpid = #{corpid}")
BigDecimal selectTotalBalanceByCorpid(@Param("corpid") String corpid);
} }

View File

@ -3,6 +3,8 @@ package com.agileboot.domain.qywx.user.db;
import com.agileboot.common.core.page.AbstractPageQuery; import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
@ -22,4 +24,6 @@ public interface QyUserService extends IService<QyUserEntity> {
QyUserEntity getUserByUserId(String userid, String corpid); QyUserEntity getUserByUserId(String userid, String corpid);
List<String> selectAdminUserIds(); List<String> selectAdminUserIds();
BigDecimal selectTotalBalance(String corpid);
} }

View File

@ -1,6 +1,7 @@
package com.agileboot.domain.qywx.user.db; package com.agileboot.domain.qywx.user.db;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
@ -14,6 +15,8 @@ import org.springframework.stereotype.Service;
import com.agileboot.common.core.page.AbstractPageQuery; import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
@Service @Service
@ -43,4 +46,13 @@ public class QyUserServiceImpl extends ServiceImpl<QyUserMapper, QyUserEntity> i
public List<String> selectAdminUserIds() { public List<String> selectAdminUserIds() {
return baseMapper.selectAdminUserIds(); return baseMapper.selectAdminUserIds();
} }
@Override
public BigDecimal selectTotalBalance(String corpid) {
if (StringUtils.isBlank(corpid)) {
return baseMapper.selectTotalBalance();
} else {
return baseMapper.selectTotalBalanceByCorpid(corpid);
}
}
} }

View File

@ -3,6 +3,8 @@ package com.agileboot.domain.qywx.user.query;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.agileboot.common.core.page.AbstractPageQuery; import com.agileboot.common.core.page.AbstractPageQuery;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -21,6 +23,8 @@ public class SearchQyUserQuery<T> extends AbstractPageQuery<T> {
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
private Long sysRoleId; private Long sysRoleId;
// 是否查询余额大于0的用户1为是
private Integer balancePage;
@Override @Override
public QueryWrapper<T> addQueryCondition() { public QueryWrapper<T> addQueryCondition() {
@ -35,6 +39,7 @@ public class SearchQyUserQuery<T> extends AbstractPageQuery<T> {
.eq(StrUtil.isNotBlank(department), "department", department) .eq(StrUtil.isNotBlank(department), "department", department)
.eq(StrUtil.isNotBlank(mainDepartment), "main_department", mainDepartment) .eq(StrUtil.isNotBlank(mainDepartment), "main_department", mainDepartment)
.eq(StrUtil.isNotBlank(enable), "enable", enable) .eq(StrUtil.isNotBlank(enable), "enable", enable)
.gt(balancePage != null && balancePage.equals(1), "balance", BigDecimal.ZERO)
.between(startTime != null && endTime != null, "create_time", startTime, endTime) .between(startTime != null && endTime != null, "create_time", startTime, endTime)
.orderByDesc("id"); .orderByDesc("id");

View File

@ -30,7 +30,7 @@ public interface ShopOrderGoodsMapper extends BaseMapper<ShopOrderGoodsEntity> {
"WHERE sog.deleted = 0 AND sg.deleted = 0 AND sog.goods_id != 6 " + "WHERE sog.deleted = 0 AND sg.deleted = 0 AND sog.goods_id != 6 " +
"GROUP BY sog.goods_id, sg.goods_name, sg.cover_img " + "GROUP BY sog.goods_id, sg.goods_name, sg.cover_img " +
"ORDER BY occurrence_count DESC " + "ORDER BY occurrence_count DESC " +
"LIMIT 10") "LIMIT 9")
List<TopGoodsDTO> selectTopGoodsByOccurrence(); List<TopGoodsDTO> selectTopGoodsByOccurrence();
@Select("SELECT sog.*, so.name AS buyer_name " + @Select("SELECT sog.*, so.name AS buyer_name " +
@ -39,7 +39,7 @@ public interface ShopOrderGoodsMapper extends BaseMapper<ShopOrderGoodsEntity> {
"WHERE sog.deleted = 0 AND so.deleted = 0 " + "WHERE sog.deleted = 0 AND so.deleted = 0 " +
"AND DATE(sog.create_time) = CURRENT_DATE " + "AND DATE(sog.create_time) = CURRENT_DATE " +
"ORDER BY sog.create_time DESC " + "ORDER BY sog.create_time DESC " +
"LIMIT 10") "LIMIT 4")
List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods(); List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods();
@Select("SELECT og.* " + @Select("SELECT og.* " +

View File

@ -12,4 +12,9 @@ CREATE TABLE `ab98_user_tag` (
PRIMARY KEY (`tag_id`), PRIMARY KEY (`tag_id`),
KEY `idx_user` (`ab98_user_id`), KEY `idx_user` (`ab98_user_id`),
CONSTRAINT `fk_tag_user` FOREIGN KEY (`ab98_user_id`) REFERENCES `ab98_user` (`ab98_user_id`) CONSTRAINT `fk_tag_user` FOREIGN KEY (`ab98_user_id`) REFERENCES `ab98_user` (`ab98_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户标签表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户标签表';
ALTER TABLE `smart_cabinet`
ADD COLUMN `belong_type` TINYINT NOT NULL DEFAULT 0 COMMENT '归属类型0-借还柜 1-固资通)'
AFTER `main_cabinet`;

View File

@ -0,0 +1,38 @@
DROP TABLE IF EXISTS `ab98_user_vip`;
CREATE TABLE `ab98_user_vip` (
`vip_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`ab98_user_id` BIGINT NOT NULL COMMENT '关联用户ID',
`vip_level` TINYINT NOT NULL DEFAULT 1 COMMENT 'VIP等级',
`start_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '会员开始时间',
`end_time` DATETIME NULL COMMENT '会员结束时间',
`status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '状态1有效 0无效',
`creator_id` BIGINT DEFAULT 0 COMMENT '创建者ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater_id` BIGINT DEFAULT 0 COMMENT '更新者ID',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志0存在 1删除',
PRIMARY KEY (`vip_id`),
KEY `idx_user` (`ab98_user_id`),
KEY `idx_level` (`vip_level`),
CONSTRAINT `fk_vip_user` FOREIGN KEY (`ab98_user_id`) REFERENCES `ab98_user` (`ab98_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户VIP信息表';
DROP TABLE IF EXISTS `ab98_vip_level`;
CREATE TABLE `ab98_vip_level` (
`level_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`level_name` VARCHAR(50) NOT NULL COMMENT '等级名称',
`level_value` TINYINT NOT NULL COMMENT '等级值',
`discount_rate` DECIMAL(5,2) NOT NULL COMMENT '折扣率',
`point_multiplier` DECIMAL(5,2) NOT NULL COMMENT '积分倍数',
`free_shipping` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否免邮(0否 1是)',
`birthday_benefit` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '生日特权(0无 1有)',
`creator_id` BIGINT DEFAULT 0 COMMENT '创建者ID',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater_id` BIGINT DEFAULT 0 COMMENT '更新者ID',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志0存在 1删除',
PRIMARY KEY (`level_id`),
UNIQUE KEY `uk_level` (`level_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='VIP等级权限表';