Browse Source

4.16 完成金豆的三个页面的编写

Huang
huangqizhen 1 month ago
parent
commit
274f6ecf99
  1. 1
      src/main/java/com/example/demo/DemoApplication.java
  2. 100
      src/main/java/com/example/demo/Util/BaseDES2.java
  3. 10
      src/main/java/com/example/demo/config/Mysql1DataSourceConfig.java
  4. 10
      src/main/java/com/example/demo/config/Mysql2DataSourceConfig.java
  5. 46
      src/main/java/com/example/demo/config/Mysql3DataSourceConfig.java
  6. 35
      src/main/java/com/example/demo/controller/DouController.java
  7. 2
      src/main/java/com/example/demo/domain/dou/Member.java
  8. 31
      src/main/java/com/example/demo/domain/dou/Pay.java
  9. 2
      src/main/java/com/example/demo/domain/vo/Page.java
  10. 2
      src/main/java/com/example/demo/domain/vo/RechargeVo.java
  11. 2
      src/main/java/com/example/demo/mapperLink/DouMapper.java
  12. 13
      src/main/java/com/example/demo/mapperPay/PayMapper.java
  13. 93
      src/main/java/com/example/demo/serviceImpl/DouServiceImpl.java
  14. 8
      src/main/java/com/example/demo/sevice/DouService.java
  15. 19
      src/main/resources/application.yml
  16. 6
      src/main/resources/mapper/RechargeMapper.xml
  17. 24
      src/main/resources/mapperLink/DouMapper.xml
  18. 37
      src/main/resources/mapperPay/PayMapper.xml

1
src/main/java/com/example/demo/DemoApplication.java

@ -12,6 +12,7 @@ import org.springframework.cache.annotation.EnableCaching;
@SpringBootApplication @SpringBootApplication
@MapperScan(basePackages = "com.example.demo.mapper", sqlSessionTemplateRef = "mysql1SqlSessionTemplate") @MapperScan(basePackages = "com.example.demo.mapper", sqlSessionTemplateRef = "mysql1SqlSessionTemplate")
@MapperScan(basePackages = "com.example.demo.mapperLink", sqlSessionTemplateRef = "mysql2SqlSessionTemplate") @MapperScan(basePackages = "com.example.demo.mapperLink", sqlSessionTemplateRef = "mysql2SqlSessionTemplate")
@MapperScan(basePackages = "com.example.demo.mapperPay", sqlSessionTemplateRef = "mysql3SqlSessionTemplate")
public class DemoApplication { public class DemoApplication {
public static void main(String[] args) { public static void main(String[] args) {

100
src/main/java/com/example/demo/Util/BaseDES2.java

@ -0,0 +1,100 @@
package com.example.demo.Util;
import javax.crypto.Cipher;
import java.security.Key;
public class BaseDES2 {
private static String strDefaultKey = "gold20@)";
private Cipher encryptCipher = null;
private Cipher decryptCipher = null;
public static String byteArr2HexStr(byte[] arrB) throws Exception {
int iLen = arrB.length;
StringBuffer sb = new StringBuffer(iLen * 2);
for (int i = 0; i < iLen; i++) {
int intTmp = arrB[i];
while (intTmp < 0) {
intTmp = intTmp + 256;
}
if (intTmp < 16) {
sb.append("0");
}
sb.append(Integer.toString(intTmp, 16));
}
return sb.toString();
}
public static byte[] hexStr2ByteArr(String strIn) {
byte[] arrB = strIn.getBytes();
int iLen = arrB.length;
byte[] arrOut = new byte[iLen / 2];
for (int i = 0; i < iLen; i = i + 2) {
String strTmp = new String(arrB, i, 2);
arrOut[i / 2] = (byte) Integer.parseInt(strTmp, 16);
}
return arrOut;
}
public BaseDES2() throws Exception {
this(strDefaultKey);
}
public BaseDES2(String strKey) throws Exception {
Key key = getKey(strKey.getBytes());
encryptCipher = Cipher.getInstance("DES");
encryptCipher.init(Cipher.ENCRYPT_MODE, key);
decryptCipher = Cipher.getInstance("DES");
decryptCipher.init(Cipher.DECRYPT_MODE, key);
}
public byte[] encrypt(byte[] arrB) throws Exception {
return encryptCipher.doFinal(arrB);
}
public String encrypt(String strIn) throws Exception {
return byteArr2HexStr(encrypt(strIn.getBytes()));
}
public byte[] decrypt(byte[] arrB) throws Exception {
return decryptCipher.doFinal(arrB);
}
public String decrypt(String strIn) throws Exception {
return new String(decrypt(hexStr2ByteArr(strIn)));
}
private Key getKey(byte[] arrBTmp) {
byte[] arrB = new byte[8];
for (int i = 0; i < arrBTmp.length && i < arrB.length; i++) {
arrB[i] = arrBTmp[i];
}
Key key = new javax.crypto.spec.SecretKeySpec(arrB, "DES");
return key;
}
public static void main(String args[]) {
try {
BaseDES2 d = new BaseDES2();
String encryptedText = d.encrypt("30003761");
System.out.println("加密结果:" + encryptedText);
} catch (Exception e) {
e.printStackTrace();
}
}
}

10
src/main/java/com/example/demo/config/Mysql1DataSourceConfig.java

@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Primary;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@ -35,10 +36,12 @@ public class Mysql1DataSourceConfig {
@Bean(name = "mysql1SqlSessionFactory") @Bean(name = "mysql1SqlSessionFactory")
// @Primary // @Primary
public SqlSessionFactory mysql1SqlSessionFactory(@Qualifier("mysql1DataSource") DataSource dataSource) throws Exception {
public SqlSessionFactory mysql1SqlSessionFactory(@Qualifier("mysql1DataSource") DataSource dataSource,
@Qualifier("globalConfiguration1") org.apache.ibatis.session.Configuration globalConfiguration1) throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); sessionFactory.setDataSource(dataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml")); sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));
sessionFactory.setConfiguration(globalConfiguration1);
return sessionFactory.getObject(); return sessionFactory.getObject();
} }
@ -47,4 +50,9 @@ public class Mysql1DataSourceConfig {
public SqlSessionTemplate mysql1SqlSessionTemplate(@Qualifier("mysql1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { public SqlSessionTemplate mysql1SqlSessionTemplate(@Qualifier("mysql1SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory); return new SqlSessionTemplate(sqlSessionFactory);
} }
@Bean
@ConfigurationProperties(prefix = "mybatis.configuration.mysql1")
public org.apache.ibatis.session.Configuration globalConfiguration1() {
return new org.apache.ibatis.session.Configuration();
}
} }

10
src/main/java/com/example/demo/config/Mysql2DataSourceConfig.java

@ -38,10 +38,12 @@ public class Mysql2DataSourceConfig {
return DataSourceBuilder.create().type(HikariDataSource.class).build(); return DataSourceBuilder.create().type(HikariDataSource.class).build();
} }
@Bean(name = "mysql2SqlSessionFactory") @Bean(name = "mysql2SqlSessionFactory")
public SqlSessionFactory mysql2SqlSessionFactory(@Qualifier("mysql2DataSource") DataSource dataSource) throws Exception {
public SqlSessionFactory mysql2SqlSessionFactory(@Qualifier("mysql2DataSource") DataSource dataSource,
@Qualifier("globalConfiguration2") org.apache.ibatis.session.Configuration globalConfiguration2) throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean(); SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource); sessionFactory.setDataSource(dataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapperLink/*.xml")); sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapperLink/*.xml"));
sessionFactory.setConfiguration(globalConfiguration2);
return sessionFactory.getObject(); return sessionFactory.getObject();
} }
@ -49,4 +51,10 @@ public class Mysql2DataSourceConfig {
public SqlSessionTemplate mysql2SqlSessionTemplate(@Qualifier("mysql2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) { public SqlSessionTemplate mysql2SqlSessionTemplate(@Qualifier("mysql2SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory); return new SqlSessionTemplate(sqlSessionFactory);
} }
@Bean
@ConfigurationProperties(prefix = "mybatis.configuration.mysql2")
public org.apache.ibatis.session.Configuration globalConfiguration2() {
return new org.apache.ibatis.session.Configuration();
}
} }

46
src/main/java/com/example/demo/config/Mysql3DataSourceConfig.java

@ -0,0 +1,46 @@
package com.example.demo.config;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.jdbc.DataSourceBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.sql.DataSource;
@Slf4j
@Configuration
public class Mysql3DataSourceConfig {
@Bean(name = "mysql3DataSource")
@ConfigurationProperties(prefix = "spring.datasource.mysql3")
public DataSource mysql3DataSource() {
return DataSourceBuilder.create().type(HikariDataSource.class).build();
}
@Bean(name = "mysql3SqlSessionFactory")
public SqlSessionFactory mysql3SqlSessionFactory(@Qualifier("mysql3DataSource") DataSource dataSource,
@Qualifier("globalConfiguration3") org.apache.ibatis.session.Configuration globalConfiguration3) throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapperPay/*.xml"));
sessionFactory.setConfiguration(globalConfiguration3);
return sessionFactory.getObject();
}
@Bean(name = "mysql3SqlSessionTemplate")
public SqlSessionTemplate mysql3SqlSessionTemplate(@Qualifier("mysql3SqlSessionFactory") SqlSessionFactory sqlSessionFactory) {
return new SqlSessionTemplate(sqlSessionFactory);
}
@Bean
@ConfigurationProperties(prefix = "mybatis.configuration.mysql3")
public org.apache.ibatis.session.Configuration globalConfiguration3() {
return new org.apache.ibatis.session.Configuration();
}
}

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

@ -16,6 +16,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
@RestController @RestController
@RequestMapping("/dou") @RequestMapping("/dou")
@RequiredArgsConstructor @RequiredArgsConstructor
@ -24,12 +26,22 @@ import org.springframework.web.bind.annotation.RestController;
public class DouController { public class DouController {
private final DouService douService; private final DouService douService;
@RequestMapping("/search") @RequestMapping("/search")
public Result search(@RequestBody Searchinfo jwcode){
return Result.success(douService.searchinfo(jwcode));
public Result search(@RequestBody Searchinfo jwcode) throws Exception{
try {
return Result.success(douService.searchinfo(jwcode));
}catch (Exception e) {
log.error(Arrays.toString(e.getStackTrace()));
return Result.error(e.getMessage());
}
} }
@RequestMapping("/add") @RequestMapping("/add")
public Result add(@RequestBody Records records){
public Result add(@RequestBody Records records) throws Exception{
try {
return Result.success(douService.add(records)); return Result.success(douService.add(records));
}catch (Exception e) {
log.error(Arrays.toString(e.getStackTrace()));
return Result.error(e.getMessage());
}
} }
@RequestMapping("/getYve") @RequestMapping("/getYve")
@ -51,4 +63,21 @@ public class DouController {
public Result getIp(){ public Result getIp(){
return Result.success(douService.getIp()); return Result.success(douService.getIp());
} }
@RequestMapping("/getStyle")
public Result getStyle(){
return Result.success(douService.getStyle());
}
@RequestMapping("/getPayIp")
public Result getPayIp(){
return Result.success(douService.getPayIp());
}
@RequestMapping("/getPay")
public Result getPay(@RequestBody Page page){
if (ObjectUtils.isEmpty(page.getPageNum())) {
return Result.success(douService.getPay(page.getPay()));
} else {
return Result.success(douService.searchPay(page.getPageNum(), page.getPageSize(), page.getPay()));
}
}
} }

2
src/main/java/com/example/demo/domain/dou/Member.java

@ -19,5 +19,7 @@ public class Member implements Serializable {
private Integer jinbiBuy; private Integer jinbiBuy;
private Integer jinbiFree; private Integer jinbiFree;
private Integer number; private Integer number;
private String masterNickname;
private String masterShop;
} }

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

@ -0,0 +1,31 @@
package com.example.demo.domain.dou;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Pay {
private String token;
private Integer jwcode;
private String OrderNo;
private String type;
private String merchantId;
private BigDecimal price;
private Integer count;
private Integer payStyle;
private Integer state;
private Integer platfrom;
private Integer successTime;
private String name;
private String deptName;
private String shopName;
private Date startTime;
private Date endTime;
}

2
src/main/java/com/example/demo/domain/vo/Page.java

@ -1,6 +1,7 @@
package com.example.demo.domain.vo; package com.example.demo.domain.vo;
import com.example.demo.domain.dou.Pay;
import com.example.demo.domain.dou.Yve; import com.example.demo.domain.dou.Yve;
import com.example.demo.domain.entity.*; import com.example.demo.domain.entity.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@ -30,6 +31,7 @@ public class Page implements Serializable {
private DetailYVo detailYVo; private DetailYVo detailYVo;
private DetailYgold detailYgold; private DetailYgold detailYgold;
private Yve yve; private Yve yve;
private Pay pay;
} }

2
src/main/java/com/example/demo/domain/vo/RechargeVo.java

@ -36,7 +36,7 @@ public class RechargeVo implements Serializable { // 实现 Serializable 接口
private Date createTime; private Date createTime;
private Date startDate; private Date startDate;
private Date endDate; private Date endDate;
private String username;
private String userName;
private String activityName; private String activityName;
private Integer status; private Integer status;
private String reson; private String reson;

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

@ -10,7 +10,7 @@ import java.util.List;
public interface DouMapper { public interface DouMapper {
int add(Records Records); int add(Records Records);
Member searchinfo(Searchinfo jwcode); Member searchinfo(Searchinfo jwcode);
int searchId(@Param("jwcode")String jwcode);
Integer searchId(@Param("jwcode")String jwcode);
List<Yve> getYve(Yve yve); List<Yve> getYve(Yve yve);
YveTotal getYveTotal(YveTotal yveTotal); YveTotal getYveTotal(YveTotal yveTotal);
List<String> getIp(); List<String> getIp();

13
src/main/java/com/example/demo/mapperPay/PayMapper.java

@ -0,0 +1,13 @@
package com.example.demo.mapperPay;
import com.example.demo.domain.dou.Pay;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PayMapper {
List<Pay> getPay(Pay pay);
List<String> getPayIp();
List<String> getStyle();
}

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

@ -1,17 +1,24 @@
package com.example.demo.serviceImpl; package com.example.demo.serviceImpl;
import com.example.demo.Util.BaseDES;
import com.example.demo.Util.BaseDES2;
import com.example.demo.domain.dou.*; import com.example.demo.domain.dou.*;
import com.example.demo.domain.vo.RechargeVo; import com.example.demo.domain.vo.RechargeVo;
import com.example.demo.mapperLink.DouMapper; import com.example.demo.mapperLink.DouMapper;
import com.example.demo.mapperPay.PayMapper;
import com.example.demo.sevice.DouService; import com.example.demo.sevice.DouService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.cache.annotation.CacheConfig; import org.springframework.cache.annotation.CacheConfig;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import java.util.List; import java.util.List;
import java.util.UUID;
@Service @Service
@Transactional @Transactional
@ -19,22 +26,74 @@ import java.util.List;
@CacheConfig(cacheNames = "dou") @CacheConfig(cacheNames = "dou")
public class DouServiceImpl implements DouService { public class DouServiceImpl implements DouService {
private final DouMapper douMapper; private final DouMapper douMapper;
private final PayMapper payMapper;
private final RestTemplate restTemplate;
@Override @Override
public int add(Records records) {
public int add(Records records) throws Exception {
Integer uid = douMapper.searchId(records.getJwcode()); Integer uid = douMapper.searchId(records.getJwcode());
if(uid == null){ if(uid == null){
throw new RuntimeException("用户不存在");
throw new Exception("用户不存在");
} }
Integer moneyFree = records.getMoneyFree() != null ? records.getMoneyFree() : 0; Integer moneyFree = records.getMoneyFree() != null ? records.getMoneyFree() : 0;
Integer moneyBuy = records.getMoneyBuy() != null ? records.getMoneyBuy() : 0; Integer moneyBuy = records.getMoneyBuy() != null ? records.getMoneyBuy() : 0;
records.setMoney(moneyFree + moneyBuy);
records.setUid(uid);
return douMapper.add(records);
// 3. 构造请求 URL 和参数
String baseUrl = "http://39.101.133.168:8828/hljw/api/user/gold";
String jwcode1 = records.getJwcode();
BaseDES2 des = new BaseDES2();
String jwcode= des.encrypt(jwcode1);
String op = ""; // 初始化操作类型
String url = ""; // 初始化 URL
// 假设 jwcode 已经加密
if(records.getData()==0){
op = "recharge";
}
else if(records.getData()==1){
op = "cost";
}
// 根据业务逻辑设置操作类型
// 假设 records 中有 gold 字段
String content = records.getContent(); // 假设 records 中有 content 字段
if(moneyBuy!=0){
UUID orderNo = UUID.randomUUID();
Integer gold = moneyBuy;
url = baseUrl + "?jwcode=" + jwcode + "&op=" + op + "&gold=" + gold + "&content=" + content +"&order_no=" + orderNo;
}
if(moneyFree!=0){
Integer gold = moneyFree;
url = baseUrl + "?jwcode=" + jwcode + "&op=" + op + "&gold=" + gold + "&content=" + content;
}
// 构造完整 URL
System.out.println(url);
// 4. 调用接口
ResponseEntity<String> response = restTemplate.getForEntity(url, String.class);
// 5. 处理响应
if (response.getStatusCode().is2xxSuccessful()) {
// 解析响应内容假设返回 JSON
String responseBody = response.getBody();
// 进一步处理响应数据
System.out.println("Response: " + responseBody);
} else {
throw new RuntimeException("接口调用失败,HTTP 状态码:" + response.getStatusCode());
}
// 返回结果根据业务逻辑决定返回值
return 1; // 示例返回值
} }
@Override @Override
public Member searchinfo(Searchinfo jwcode) {
public Member searchinfo(Searchinfo jwcode) throws Exception {
Integer uid = douMapper.searchId(jwcode.getJwcode());
if(uid == null){
throw new Exception("用户不存在");
}
return douMapper.searchinfo(jwcode); return douMapper.searchinfo(jwcode);
} }
@ -60,4 +119,26 @@ public class DouServiceImpl implements DouService {
List<Yve> list= douMapper.getYve(yve); List<Yve> list= douMapper.getYve(yve);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
@Override
public List<String> getStyle() {
return payMapper.getStyle();
}
@Override
public List<String> getPayIp() {
return payMapper.getPayIp();
}
@Override
public List<Pay> getPay(Pay pay) {
return payMapper.getPay(pay);
}
@Override
public Object searchPay(Integer pageNum, Integer pageSize, Pay pay) {
PageHelper.startPage(pageNum, pageSize);
List<Pay> list= payMapper.getPay(pay);
return new PageInfo<>(list);
}
} }

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

@ -8,11 +8,15 @@ import java.util.List;
public interface DouService { public interface DouService {
int add(Records records);
Member searchinfo(Searchinfo jwcode);
int add(Records records) throws Exception;
Member searchinfo(Searchinfo jwcode) throws Exception;
List<Yve> getYve(Yve yve); List<Yve> getYve(Yve yve);
YveTotal getYveTotal(YveTotal yveTotal); YveTotal getYveTotal(YveTotal yveTotal);
List<String> getIp(); List<String> getIp();
Object searchForPage(Integer pageNum, Integer pageSize, Yve yve); Object searchForPage(Integer pageNum, Integer pageSize, Yve yve);
List<String> getStyle();
List<String> getPayIp();
List<Pay> getPay(Pay pay);
Object searchPay(Integer pageNum, Integer pageSize, Pay pay);
} }

19
src/main/resources/application.yml

@ -19,6 +19,14 @@ spring:
hikari: hikari:
pool-name: mysql2HikariCP pool-name: mysql2HikariCP
maximum-pool-size: 10 maximum-pool-size: 10
mysql3:
jdbc-url: jdbc:mysql://121.89.234.155:3306/pay_xxcg_com?serverTimezone=Asia/Shanghai
username: pay_xxcg_com
password: 4hHmzxZH4rF4c5xr
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
pool-name: mysql2HikariCP
maximum-pool-size: 10
application: application:
name: demo name: demo
@ -50,8 +58,15 @@ spring:
mybatis: mybatis:
configuration: configuration:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mysql1:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mysql2:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mysql3:
map-underscore-to-camel-case: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
upload: upload:
path: /home/java/haiwaiyanfa/gold1 path: /home/java/haiwaiyanfa/gold1

6
src/main/resources/mapper/RechargeMapper.xml

@ -14,9 +14,9 @@
ELSE '其他状态' ELSE '其他状态'
END AS auditStatus, END AS auditStatus,
COUNT(*) AS Raudit, COUNT(*) AS Raudit,
SUM(paid_gold) AS SumRaudit1,
SUM(free_gold) AS SumRaudit2,
(SUM(paid_gold) + SUM(free_gold)) AS SumRaudit
SUM(paid_gold)/100 AS SumRaudit1,
SUM(free_gold)/100 AS SumRaudit2,
(SUM(paid_gold) + SUM(free_gold))/100 AS SumRaudit
FROM FROM
recharge recharge
LEFT JOIN `user` ON recharge.jwcode = `user`.jwcode LEFT JOIN `user` ON recharge.jwcode = `user`.jwcode

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

@ -14,10 +14,14 @@
fm.jwcode, fm.jwcode,
fy.jinbi_free, fy.jinbi_free,
fy.jinbi_buy, fy.jinbi_buy,
COUNT(CASE WHEN fmr.data = 1 THEN 1 END) AS number
fy.s1,
COUNT(CASE WHEN fmr.data = 1 THEN 1 END) AS data_1_count,
fm2.nickname AS master_nickname, -- 师傅的昵称
fm2.shop AS master_shop -- 师傅的店铺
FROM fx_member fm FROM fx_member fm
LEFT JOIN fx_yaoqing fy ON fm.id = fy.uid LEFT JOIN fx_yaoqing fy ON fm.id = fy.uid
LEFT JOIN fx_yaoqing_records fmr ON fmr.uid = fm.id LEFT JOIN fx_yaoqing_records fmr ON fmr.uid = fm.id
LEFT JOIN fx_member fm2 ON fm2.id = fy.s1 -- 自连接,查找师傅信息
WHERE fm.jwcode =#{jwcode}; WHERE fm.jwcode =#{jwcode};
</select> </select>
@ -28,10 +32,10 @@
SELECT SELECT
fm.nickname, fm.nickname,
fm.jwcode, fm.jwcode,
fm.ip_address,
fy.jinbi_free,
fy.jinbi_buy,
fy.jinbi_cost_total,
fm.ip_address as ipAddress,
fy.jinbi_free as jinbiFree,
fy.jinbi_buy as jinbiBuy,
fy.jinbi_cost_total as jinbiCostTotal,
fy.jinbi fy.jinbi
FROM fx_member fm FROM fx_member fm
LEFT JOIN fx_yaoqing fy ON fm.id = fy.uid LEFT JOIN fx_yaoqing fy ON fm.id = fy.uid
@ -57,13 +61,13 @@
SUM(jinbi_cost_total) as jinbiCostTotal SUM(jinbi_cost_total) as jinbiCostTotal
FROM fx_yaoqing fy FROM fx_yaoqing fy
LEFT JOIN fx_member fm ON fm.id = fy.uid LEFT JOIN fx_member fm ON fm.id = fy.uid
WHERE employee!=1
<where> <where>
<if test="jwcode != null and jwcode.length>0">
and fm.jwcode = #{jwcode}
employee != 1
<if test="jwcode != null and jwcode.length > 0">
AND fm.jwcode = #{jwcode}
</if> </if>
<if test="ipAddress != null and ipAddress.length>0">
and fm.ip_address = #{ipAddress}
<if test="ipAddress != null and ipAddress.length > 0">
AND fm.ip_address = #{ipAddress}
</if> </if>
</where> </where>
</select> </select>

37
src/main/resources/mapperPay/PayMapper.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.demo.mapperPay.PayMapper">
<select id="getPay" resultType="com.example.demo.domain.dou.Pay">
SELECT go.jwcode,mi.name,mi.deptName,mi.shopName,go.type,go.order_no,go.price,go.count,gps.`name`,go.success_time from g_order as go
LEFT JOIN member_info as mi on go.jwcode = mi.jwcode
LEFT JOIN g_pay_style gps on go.pay_style=gps.id
<where>
<if test="jwcode != null and jwcode.length > 0">
go.jwcode = #{jwcode}
</if>
<if test="orderNo != null and orderNo.length > 0">
go.order_no = #{orderNo}
</if>
<if test="type != null and type.length > 0">
go.type = #{type}
</if>
<if test="payStyle != null and payStyle.length > 0">
go.pay_style = #{payStyle}
</if>
<if test="deptName !=null and deptName.length > 0">
mi.deptName = #{deptName}
</if>
<if test="startTime != null and endTime != null">
and go.success_time BETWEEN #{startTime} AND #{endTime}
</if>
</where>
</select>
<select id="getPayIp" resultType="java.lang.String">
SELECT DISTINCT deptName FROM member_info
</select>
<select id="getStyle" resultType="java.lang.String">
SELECT DISTINCT `name` FROM g_pay_style
</select>
</mapper>
Loading…
Cancel
Save