Browse Source

4.18 完成需求接口

Huang
huangqizhen 2 months ago
parent
commit
904f96170b
  1. 16
      src/main/java/com/example/demo/controller/DouController.java
  2. 3
      src/main/java/com/example/demo/domain/dou/Pay.java
  3. 5
      src/main/java/com/example/demo/domain/dou/Spend.java
  4. 3
      src/main/java/com/example/demo/mapperLink/DouMapper.java
  5. 28
      src/main/java/com/example/demo/serviceImpl/DouServiceImpl.java
  6. 5
      src/main/java/com/example/demo/sevice/DouService.java
  7. 135
      src/main/resources/mapperLink/DouMapper.xml

16
src/main/java/com/example/demo/controller/DouController.java

@ -94,4 +94,20 @@ public class DouController {
public Result getRechargeTotal(@RequestBody RechargeTotal rechargeTotal){
return Result.success(douService.getRechargeTotal(rechargeTotal));
}
@RequestMapping("/SearchPay")
public Result SearchPay(@RequestBody Page page){
if (ObjectUtils.isEmpty(page.getPageNum())) {
return Result.success(douService.SearchPay(page.getPay()));
} else {
return Result.success(douService.SearchPay(page.getPageNum(), page.getPageSize(), page.getPay()));
}
}
@RequestMapping("/SearchStyle")
public Result SearchStyle(){
return Result.success(douService.SearchStyle());
}
@RequestMapping("/SearchPayIp")
public Result SearchPayIp(){
return Result.success(douService.SearchPayIp());
}
}

3
src/main/java/com/example/demo/domain/dou/Pay.java

@ -27,6 +27,9 @@ public class Pay {
private String name;
private String deptName;
private String shopName;
private Integer money;
private Integer moneyFree;
private Integer moneyBuy;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;

5
src/main/java/com/example/demo/domain/dou/Spend.java

@ -28,12 +28,13 @@ public class Spend implements Serializable {
private String sourceName;
private String content;
private Integer payType;
private Integer sourceType;
private Integer time;
private Integer good;
private Integer createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
private String room;
}

3
src/main/java/com/example/demo/mapperLink/DouMapper.java

@ -16,5 +16,8 @@ public interface DouMapper {
List<String> getIp();
List<Spend> getSpend(Spend spend);
Integer getSpendTotal(SpendTotal spendTotal);
List<Pay> getPay(Pay pay);
List<String> getPayIp();
RechargeTotal getRechargeTotal(RechargeTotal rechargeTotal);
}

28
src/main/java/com/example/demo/serviceImpl/DouServiceImpl.java

@ -127,18 +127,18 @@ public class DouServiceImpl implements DouService {
@Override
public List<String> getPayIp() {
return payMapper.getPayIp();
return douMapper.getPayIp();
}
@Override
public List<Pay> getPay(Pay pay) {
return payMapper.getPay(pay);
return douMapper.getPay(pay);
}
@Override
public Object searchPay(Integer pageNum, Integer pageSize, Pay pay) {
PageHelper.startPage(pageNum, pageSize);
List<Pay> list= payMapper.getPay(pay);
List<Pay> list= douMapper.getPay(pay);
return new PageInfo<>(list);
}
@ -163,4 +163,26 @@ public class DouServiceImpl implements DouService {
public RechargeTotal getRechargeTotal(RechargeTotal rechargeTotal) {
return payMapper.getRechargeTotal(rechargeTotal);
}
@Override
public List<Pay> SearchPay(Pay pay) {
return payMapper.getPay(pay);
}
@Override
public List<String> SearchStyle() {
return payMapper.getStyle();
}
@Override
public List<String> SearchPayIp() {
return payMapper.getPayIp();
}
@Override
public Object SearchPay(Integer pageNum, Integer pageSize, Pay pay) {
PageHelper.startPage(pageNum, pageSize);
List<Pay> list= payMapper.getPay(pay);
return new PageInfo<>(list);
}
}

5
src/main/java/com/example/demo/sevice/DouService.java

@ -23,4 +23,9 @@ public interface DouService {
Object searchSpend(Integer pageNum, Integer pageSize, Spend spend);
Integer getSpendTotal(SpendTotal spendTotal);
RechargeTotal getRechargeTotal(RechargeTotal rechargeTotal);
List<Pay> SearchPay(Pay pay);
List<String> SearchStyle();
List<String> SearchPayIp();
Object SearchPay(Integer pageNum, Integer pageSize, Pay pay);
}

135
src/main/resources/mapperLink/DouMapper.xml

@ -75,20 +75,63 @@
SELECT DISTINCT ip_address FROM fx_member WHERE ip_address is not null
</select>
<select id="getSpend" resultType="com.example.demo.domain.dou.Spend">
SELECT *
FROM (
SELECT
fm.nickname,
fy.content,
fy.pay_type,
fm.jwcode,
fm.ip_address ,
fy.money_free ,
fy.money_buy ,
fy.money ,
fy.source_name,
fy.`time`
fm.nickname,
fy.content,
fy.pay_type,
fy.source_type AS good,
fm.jwcode,
fm.ip_address,
fy.money_free,
fy.money_buy,
fy.money AS jinbiCostTotal,
fy.source_name,
fy.`time` AS createTime,
CASE
WHEN LOCATE('直播间', content) > 0 AND LOCATE('送礼物', content) > 0 THEN
SUBSTRING_INDEX(SUBSTRING(content, LOCATE('直播间', content) + CHAR_LENGTH('直播间')), '送礼物', 1)
ELSE
NULL
END AS room
FROM fx_yaoqing_records fy
LEFT JOIN fx_member fm ON fm.id = fy.uid
WHERE 1=1
<if test="jwcode != null and jwcode.length > 0">
AND fm.jwcode = #{jwcode}
</if>
<if test="ipAddress != null and ipAddress.length > 0">
AND fm.ip_address = #{ipAddress}
</if>
<if test="sourceName != null and sourceName.length > 0">
AND fy.source_name = #{sourceName}
</if>
<if test="payType != null and payType.length > 0">
AND fy.pay_type = #{payType}
</if>
<if test="good != null and good.length > 0">
AND fy.source_type = #{good}
</if>
<if test="startTime != null and endTime != null">
AND FROM_UNIXTIME(fy.`time`) BETWEEN #{startTime} AND #{endTime}
</if>
) AS subquery
WHERE 1=1
<if test="room != null and room.length > 0">
AND room LIKE CONCAT('%', #{room}, '%')
</if>
<choose>
<when test="sortField != null and sortField.length > 0 or sortOrder != null and sortOrder.length > 0">
ORDER BY ${sortField} ${sortOrder}
</when>
</choose>
</select>
<select id="getSpendTotal" resultType="java.lang.Integer">
SELECT
sum(fy.money) as SpendTotal
FROM fx_member fm
LEFT JOIN fx_yaoqing_records fy ON fm.id = fy.uid
LEFT JOIN fx_yaoqing_records fy ON fm.id = fy.uid
<where>
<if test="jwcode != null and jwcode.length > 0">
AND fm.jwcode = #{jwcode}
@ -102,6 +145,41 @@
<if test="payType != null and payType.length > 0">
AND fy.pay_type = #{payType}
</if>
<if test="sourceType != null and sourceType.length > 0">
AND fy.source_type = #{sourceType}
</if>
<if test="startTime != null and endTime != null">
and FROM_UNIXTIME(fy.`time`) BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
<select id="getPay" resultType="com.example.demo.domain.dou.Pay">
SELECT fm.nickname,
fm.jwcode,
fm.ip_address,
fy.content as type,
fy.order_no,
fy.money,
fy.money_free,
fy.money_buy,
fy.money/50,
fy.`time`
from fx_yaoqing_records as fy
LEFT JOIN fx_member as fm on fy.uid = fm.id
<where>
`data`=0
<if test="jwcode != null">
and fm.jwcode = #{jwcode}
</if>
<if test="orderNo != null and orderNo.length > 0">
and fy.order_no = #{orderNo}
</if>
<if test="type != null and type.length > 0">
and type LIKE CONCAT('%', #{type}, '%')
</if>
<if test="ipAddress != null and ipAddress.length > 0">
and fm.ip_address = #{ipAddress}
</if>
<if test="startTime != null and endTime != null">
and FROM_UNIXTIME(fy.`time`) BETWEEN #{startTime} AND #{endTime}
</if>
@ -112,26 +190,28 @@
</when>
</choose>
</select>
<select id="getSpendTotal" resultType="java.lang.Integer">
<select id="getPayIp" resultType="java.lang.String">
select DISTINCT ip_address from fx_member WHERE ip_address is not null
</select>
<select id="getRechargeTotal" resultType="com.example.demo.domain.dou.RechargeTotal">
SELECT
sum(fy.money) as SpendTotal
FROM fx_member fm
LEFT JOIN fx_yaoqing_records fy ON fm.id = fy.uid
sum(money)/50 as priceTotal,
sum(money) as countTotal
from fx_yaoqing_records as fy
LEFT JOIN fx_member as fm on fy.uid = fm.id
<where>
<if test="jwcode != null and jwcode.length > 0">
AND fm.jwcode = #{jwcode}
</if>
<if test="ipAddress != null and ipAddress.length > 0">
AND fm.ip_address = #{ipAddress}
`data`=0
<if test="jwcode != null">
and fm.jwcode = #{jwcode}
</if>
<if test="sourceName != null and sourceName.length > 0">
AND fy.source_name = #{sourceName}
<if test="orderNo != null and orderNo.length > 0">
and fy.order_no = #{orderNo}
</if>
<if test="payType != null and payType.length > 0">
AND fy.pay_type = #{payType}
<if test="type != null and type.length > 0">
and type LIKE CONCAT('%', #{type}, '%')
</if>
<if test="sourceType != null and sourceType.length > 0">
AND fy.source_type = #{sourceType}
<if test="ipAddress != null and ipAddress.length > 0">
and fm.ip_address = #{ipAddress}
</if>
<if test="startTime != null and endTime != null">
and FROM_UNIXTIME(fy.`time`) BETWEEN #{startTime} AND #{endTime}
@ -139,5 +219,4 @@
</where>
</select>
</mapper>
Loading…
Cancel
Save