广西体育中心java端

This commit is contained in:
2024-08-15 23:48:59 +08:00
parent 4de62fd2b5
commit e17c5c538b
32 changed files with 264 additions and 74 deletions
@@ -30,7 +30,7 @@ public class BaseParam implements Serializable {
@TableField(exist = false)
@ApiModelProperty(value = "排序字段", notes = "排序字段或sql, 如果是sql则order字段无用, 如: `id asc, name desc`")
private String sortNum;
private String sort;
@TableField(exist = false)
@ApiModelProperty(value = "排序方式", notes = "sort是字段名称时对应的排序方式, asc升序, desc降序")
@@ -64,12 +64,12 @@ public class PageParam<T, U extends BaseParam> extends Page<T> {
setSize(where.getLimit());
}
// 获取排序方式
if (where.getSortNum() != null) {
if (sortIsSQL(where.getSortNum())) {
setOrders(parseOrderSQL(where.getSortNum()));
if (where.getSort() != null) {
if (sortIsSQL(where.getSort())) {
setOrders(parseOrderSQL(where.getSort()));
} else {
List<OrderItem> orderItems = new ArrayList<>();
String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(where.getSortNum()) : where.getSortNum();
String column = this.isToUnderlineCase ? StrUtil.toUnderlineCase(where.getSort()) : where.getSort();
boolean asc = !Constants.ORDER_DESC_VALUE.equals(where.getOrder());
orderItems.add(new OrderItem(column, asc));
setOrders(orderItems);
@@ -1,15 +1,12 @@
package com.gxwebsoft.think.controller;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.BaseController;
import com.gxwebsoft.think.service.ThinkVipService;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.think.entity.ThinkVip;
import com.gxwebsoft.think.param.ThinkVipParam;
import com.gxwebsoft.common.core.web.ApiResult;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.BatchParam;
import com.gxwebsoft.common.core.annotation.OperationLog;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.think.service.ThinkVipService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -56,6 +53,8 @@ public class ThinkVipController extends BaseController {
@ApiOperation("添加")
@PostMapping()
public ApiResult<?> save(@RequestBody ThinkVip thinkVip) {
thinkVip.setCreateTime((int) (System.currentTimeMillis()/1000));
thinkVip.setUpdateTime((int) (System.currentTimeMillis()/1000));
if (thinkVipService.save(thinkVip)) {
return success("添加成功");
}
@@ -1,17 +1,18 @@
package com.gxwebsoft.think.entity;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
/**
*
*
*
* @author 科技小王子
* @since 2024-08-11 20:50:58
@@ -113,7 +114,7 @@ public class ThinkCard implements Serializable {
private Integer isInvoice;
@ApiModelProperty(value = "vip卡到期时间")
private Integer expireTime;
private Long expireTime;
@ApiModelProperty(value = "紧急联系人")
private String urgentName;
@@ -128,12 +129,12 @@ public class ThinkCard implements Serializable {
private String password;
@ApiModelProperty(value = "使用时间")
private Integer useTime;
private Long useTime;
@ApiModelProperty(value = "创建时间")
private Integer createTime;
private Long createTime;
private Integer updateTime;
private Long updateTime;
@ApiModelProperty(value = "身份证号码")
@TableField("IDCard")
@@ -1,6 +1,7 @@
package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -41,8 +42,49 @@ public class ThinkCardLog implements Serializable {
private String wechatOrder;
@ApiModelProperty(value = "充值时间")
private Integer createTime;
private Long createTime;
private Integer count;
@ApiModelProperty(value = "操作员")
@TableField(exist = false)
private String adminName;
@ApiModelProperty(value = "卡片名称")
@TableField(exist = false)
private String cardName;
@ApiModelProperty(value = "手机号")
@TableField(exist = false)
private String phone;
@ApiModelProperty(value = "买家姓名")
@TableField(exist = false)
private String username;
@ApiModelProperty(value = "IC卡信息")
@TableField(exist = false)
private ThinkCard thinkCard;
@ApiModelProperty(value = "剩余金额")
@TableField(exist = false)
private Integer remainingMoney;
@ApiModelProperty(value = "剩余次数")
@TableField(exist = false)
private Integer num;
@ApiModelProperty(value = "卡类型")
@TableField(exist = false)
private Integer type;
@ApiModelProperty(value = "卡类型")
@TableField(exist = false)
private Integer cardType;
@ApiModelProperty(value = "到期时间")
@TableField(exist = false)
private Long expireTime;
}
@@ -2,14 +2,15 @@ package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
*
*
*
* @author 科技小王子
* @since 2024-08-11 20:50:59
@@ -2,14 +2,15 @@ package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
*
*
*
* @author 科技小王子
* @since 2024-08-11 20:50:59
@@ -1,6 +1,7 @@
package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -40,13 +41,56 @@ public class ThinkRechargeLog implements Serializable {
@ApiModelProperty(value = "1已支付,2未支付")
private Integer status;
private Integer createTime;
@ApiModelProperty(value = "充值时间")
private Long createTime;
@ApiModelProperty(value = "VID")
private Integer vid;
@ApiModelProperty(value = "是否已开具发票")
private Integer isInvoice;
@ApiModelProperty(value = "对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单")
private Integer checkBill;
@ApiModelProperty(value = "微信昵称")
@TableField(exist = false)
private String username;
@ApiModelProperty(value = "真实姓名")
@TableField(exist = false)
private String realName;
@ApiModelProperty(value = "手机号")
@TableField(exist = false)
private String phone;
@ApiModelProperty(value = "VIP卡名称")
@TableField(exist = false)
private String vipName;
@ApiModelProperty(value = "会员卡类型")
@TableField(exist = false)
private Integer vipType;
@ApiModelProperty(value = "卡类型")
@TableField(exist = false)
private Integer cardType;
@ApiModelProperty(value = "会员卡类型")
@TableField(exist = false)
private Integer type;
@ApiModelProperty(value = "可用场馆ID")
@TableField(exist = false)
private String sid;
@ApiModelProperty(value = "可用场馆")
@TableField(exist = false)
private String siteNames;
@ApiModelProperty(value = "卡片到期时间")
@TableField(exist = false)
private Long expireTime;
}
@@ -1,6 +1,7 @@
package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -107,24 +108,40 @@ public class ThinkUsersVip implements Serializable {
private Integer isInvoice;
@ApiModelProperty(value = "使用时间")
private Integer useTime;
private Long useTime;
@ApiModelProperty(value = "vip卡到期时间")
private Integer expireTime;
private Long expireTime;
@ApiModelProperty(value = "购买时间")
private Integer createTime;
private Long createTime;
@ApiModelProperty(value = "付款时间")
private Integer payTime;
private Long payTime;
@ApiModelProperty(value = "退款时间")
private Integer refundTime;
private Long refundTime;
@ApiModelProperty(value = "申请退款时间")
private Integer refundApplyTime;
private Long refundApplyTime;
@ApiModelProperty(value = "对账情况:1=已对账;2=未对账;3=已对账,金额对不上;4=未查询到该订单")
private Integer checkBill;
@ApiModelProperty(value = "用户名")
@TableField(exist = false)
private String username;
@ApiModelProperty(value = "真实姓名")
@TableField(exist = false)
private String realName;
@ApiModelProperty(value = "手机号码")
@TableField(exist = false)
private String phone;
@ApiModelProperty(value = "可用场馆")
@TableField(exist = false)
private String siteNames;
}
@@ -1,6 +1,7 @@
package com.gxwebsoft.think.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@@ -86,4 +87,9 @@ public class ThinkVip implements Serializable {
@ApiModelProperty(value = "是否有效:1是,0否")
private Integer isUse;
@ApiModelProperty(value = "可用场馆")
@TableField(exist = false)
private String siteNames;
}
@@ -4,8 +4,10 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
SELECT a.*, b.truename as adminName, c.name as cardName, c.phone, c.username, c.remaining_money,c.num,c.card_type,c.type,c.expire_time
FROM think_card_log a
LEFT JOIN think_users b ON a.aid = b.id
LEFT JOIN think_card c ON a.code = c.code
<where>
<if test="param.id != null">
AND a.id = #{param.id}
@@ -31,11 +33,19 @@
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.timeStart != null">
AND a.create_time &gt;= #{param.timeStart}
</if>
<if test="param.timeEnd != null">
AND a.create_time &lt;= #{param.timeEnd}
</if>
<if test="param.count != null">
AND a.count = #{param.count}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
AND (a.code LIKE CONCAT('%', #{param.keywords}, '%')
OR c.phone = #{param.keywords}
OR c.username = #{param.keywords}
)
</if>
</where>
@@ -121,6 +121,12 @@
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.timeStart != null">
AND a.create_time &gt;= #{param.timeStart}
</if>
<if test="param.timeEnd != null">
AND a.create_time &lt;= #{param.timeEnd}
</if>
<if test="param.idcard != null">
AND a.IDCard LIKE CONCAT('%', #{param.idcard}, '%')
</if>
@@ -128,7 +134,9 @@
AND a.remark LIKE CONCAT('%', #{param.remark}, '%')
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
AND (a.username = #{param.keywords}
OR a.phone = #{param.keywords}
OR a.code = #{param.keywords}
)
</if>
</where>
@@ -32,7 +32,7 @@
AND a.num = #{param.num}
</if>
<if test="param.sort != null">
AND a.sort = #{param.sort}
AND a.sort = #{param.sort}
</if>
<if test="param.sid != null">
AND a.sid = #{param.sid}
@@ -4,8 +4,10 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
SELECT a.*, b.username, b.truename as realName , b.phone, v.name as vipName, v.vip_type, v.type, v.card_type, v.sid, v.expire_time
FROM think_recharge_log a
LEFT JOIN think_users b ON a.uid = b.id
LEFT JOIN think_users_vip v ON a.vid = v.id
<where>
<if test="param.id != null">
AND a.id = #{param.id}
@@ -4,8 +4,9 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
SELECT a.*, b.username,b.truename as realName, b.phone
FROM think_users_vip a
LEFT JOIN think_users b ON a.uid = b.id
<where>
<if test="param.id != null">
AND a.id = #{param.id}
@@ -103,6 +104,12 @@
<if test="param.createTimeEnd != null">
AND a.create_time &lt;= #{param.createTimeEnd}
</if>
<if test="param.timeStart != null">
AND a.create_time &gt;= #{param.timeStart}
</if>
<if test="param.timeEnd != null">
AND a.create_time &lt;= #{param.timeEnd}
</if>
<if test="param.payTime != null">
AND a.pay_time = #{param.payTime}
</if>
@@ -116,7 +123,10 @@
AND a.check_bill = #{param.checkBill}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
AND (a.name LIKE CONCAT('%', #{param.keywords}, '%')
OR a.code = #{param.keywords}
OR b.phone = #{param.keywords}
OR b.truename = #{param.keywords}
)
</if>
</where>
@@ -43,9 +43,6 @@
<if test="param.day != null">
AND a.day = #{param.day}
</if>
<if test="param.sort != null">
AND a.sort = #{param.sort}
</if>
<if test="param.type != null">
AND a.type = #{param.type}
</if>
@@ -74,9 +71,9 @@
AND a.is_use = #{param.isUse}
</if>
<if test="param.keywords != null">
AND (a.comments LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
AND (a.name LIKE CONCAT('%', #{param.keywords}, '%')
)
</if>
</where>
</sql>
@@ -46,6 +46,6 @@ public class ThinkAuthRuleParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
}
@@ -39,7 +39,7 @@ public class ThinkCarouselParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "1显示,2不显示")
@QueryField(type = QueryType.EQ)
@@ -63,7 +63,7 @@ public class ThinkCouponParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "优惠券类型:1折扣式,2抵扣式")
@QueryField(type = QueryType.EQ)
@@ -54,7 +54,7 @@ public class ThinkFieldParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "关联id")
@QueryField(type = QueryType.EQ)
@@ -1,10 +1,9 @@
package com.gxwebsoft.think.param;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -38,6 +37,6 @@ public class ThinkGoodsCategoryParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
}
@@ -81,7 +81,7 @@ public class ThinkGoodsParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "是否需要发货:1是;0否")
@QueryField(type = QueryType.EQ)
@@ -1,10 +1,9 @@
package com.gxwebsoft.think.param;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -38,6 +37,6 @@ public class ThinkNewsCategoryParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
}
@@ -38,6 +38,6 @@ public class ThinkSignupCategoryParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
}
@@ -51,7 +51,7 @@ public class ThinkSiteParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "类型:1天,2小时")
@QueryField(type = QueryType.EQ)
@@ -53,7 +53,7 @@ public class ThinkSiteTimeParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "关联id")
@QueryField(type = QueryType.EQ)
@@ -41,7 +41,7 @@ public class ThinkUsersEmergencyParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "是否默认")
@QueryField(type = QueryType.EQ)
@@ -69,7 +69,7 @@ public class ThinkVipParam extends BaseParam {
@ApiModelProperty(value = "排序")
@QueryField(type = QueryType.EQ)
private Integer sort;
private Integer sortNumber;
@ApiModelProperty(value = "会员卡类型:1年卡,2次卡,3月卡,4会员VIP,VIP充值卡")
@QueryField(type = QueryType.EQ)
@@ -1,14 +1,16 @@
package com.gxwebsoft.think.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.think.mapper.ThinkCardLogMapper;
import com.gxwebsoft.think.service.ThinkCardLogService;
import com.gxwebsoft.think.entity.ThinkCardLog;
import com.gxwebsoft.think.param.ThinkCardLogParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.think.entity.ThinkCardLog;
import com.gxwebsoft.think.mapper.ThinkCardLogMapper;
import com.gxwebsoft.think.param.ThinkCardLogParam;
import com.gxwebsoft.think.service.ThinkCardLogService;
import com.gxwebsoft.think.service.ThinkCardService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
@@ -19,11 +21,13 @@ import java.util.List;
*/
@Service
public class ThinkCardLogServiceImpl extends ServiceImpl<ThinkCardLogMapper, ThinkCardLog> implements ThinkCardLogService {
@Resource
private ThinkCardService thinkCardService;
@Override
public PageResult<ThinkCardLog> pageRel(ThinkCardLogParam param) {
PageParam<ThinkCardLog, ThinkCardLogParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
page.setDefaultOrder("id desc, create_time desc");
List<ThinkCardLog> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@@ -33,7 +37,7 @@ public class ThinkCardLogServiceImpl extends ServiceImpl<ThinkCardLogMapper, Thi
List<ThinkCardLog> list = baseMapper.selectListRel(param);
// 排序
PageParam<ThinkCardLog, ThinkCardLogParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
page.setDefaultOrder("id desc, create_time desc");
return page.sortRecords(list);
}
@@ -23,7 +23,7 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
@Override
public PageResult<ThinkCard> pageRel(ThinkCardParam param) {
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
page.setDefaultOrder("id desc, create_time desc");
List<ThinkCard> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@@ -33,7 +33,7 @@ public class ThinkCardServiceImpl extends ServiceImpl<ThinkCardMapper, ThinkCard
List<ThinkCard> list = baseMapper.selectListRel(param);
// 排序
PageParam<ThinkCard, ThinkCardParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
page.setDefaultOrder("id desc, create_time desc");
return page.sortRecords(list);
}
@@ -1,15 +1,23 @@
package com.gxwebsoft.think.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.think.entity.ThinkSite;
import com.gxwebsoft.think.mapper.ThinkUsersVipMapper;
import com.gxwebsoft.think.service.ThinkSiteService;
import com.gxwebsoft.think.service.ThinkUsersVipService;
import com.gxwebsoft.think.entity.ThinkUsersVip;
import com.gxwebsoft.think.param.ThinkUsersVipParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Service实现
@@ -19,12 +27,29 @@ import java.util.List;
*/
@Service
public class ThinkUsersVipServiceImpl extends ServiceImpl<ThinkUsersVipMapper, ThinkUsersVip> implements ThinkUsersVipService {
@Resource
private ThinkSiteService thinkSiteService;
@Override
public PageResult<ThinkUsersVip> pageRel(ThinkUsersVipParam param) {
PageParam<ThinkUsersVip, ThinkUsersVipParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<ThinkUsersVip> list = baseMapper.selectPageRel(page, param);
final List<ThinkSite> sites = thinkSiteService.list(new LambdaQueryWrapper<ThinkSite>().select(ThinkSite::getId,ThinkSite::getName));
final Map<Integer, List<ThinkSite>> collect = sites.stream().collect(Collectors.groupingBy(ThinkSite::getId));
list.forEach(d -> {
final ArrayList<String> siteNames = new ArrayList<>();
final String sid = d.getSid();
final String[] split = sid.split(",");
for(String siteId : split){
final List<ThinkSite> thinkSites = collect.get(Integer.valueOf(siteId));
if (!CollectionUtils.isEmpty(thinkSites)) {
final String name = thinkSites.get(0).getName();
siteNames.add(name);
}
}
d.setSiteNames(String.join(",",siteNames));
});
return new PageResult<>(list, page.getTotal());
}
@@ -1,15 +1,23 @@
package com.gxwebsoft.think.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.think.mapper.ThinkVipMapper;
import com.gxwebsoft.think.service.ThinkVipService;
import com.gxwebsoft.think.entity.ThinkVip;
import com.gxwebsoft.think.param.ThinkVipParam;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.think.entity.ThinkSite;
import com.gxwebsoft.think.entity.ThinkVip;
import com.gxwebsoft.think.mapper.ThinkVipMapper;
import com.gxwebsoft.think.param.ThinkVipParam;
import com.gxwebsoft.think.service.ThinkSiteService;
import com.gxwebsoft.think.service.ThinkVipService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Service实现
@@ -19,12 +27,29 @@ import java.util.List;
*/
@Service
public class ThinkVipServiceImpl extends ServiceImpl<ThinkVipMapper, ThinkVip> implements ThinkVipService {
@Resource
private ThinkSiteService thinkSiteService;
@Override
@Override
public PageResult<ThinkVip> pageRel(ThinkVipParam param) {
PageParam<ThinkVip, ThinkVipParam> page = new PageParam<>(param);
page.setDefaultOrder("sort desc, create_time desc");
List<ThinkVip> list = baseMapper.selectPageRel(page, param);
final List<ThinkSite> sites = thinkSiteService.list(new LambdaQueryWrapper<ThinkSite>().select(ThinkSite::getId,ThinkSite::getName));
final Map<Integer, List<ThinkSite>> collect = sites.stream().collect(Collectors.groupingBy(ThinkSite::getId));
list.forEach(d -> {
final ArrayList<String> siteNames = new ArrayList<>();
final String sid = d.getSid();
final String[] split = sid.split(",");
for(String siteId : split){
final List<ThinkSite> thinkSites = collect.get(Integer.valueOf(siteId));
if (!CollectionUtils.isEmpty(thinkSites)) {
final String name = thinkSites.get(0).getName();
siteNames.add(name);
}
}
d.setSiteNames(String.join(",",siteNames));
});
return new PageResult<>(list, page.getTotal());
}