28 changed files with 810 additions and 14 deletions
-
23demo/commons/src/main/java/com/example/commons/domain/entity/Activity.java
-
2demo/commons/src/main/java/com/example/commons/domain/entity/Audit.java
-
11demo/commons/src/main/java/com/example/commons/domain/entity/Page.java
-
19demo/commons/src/main/java/com/example/commons/domain/entity/Rate.java
-
10demo/commons/src/main/java/com/example/commons/domain/entity/RateSearchRequest.java
-
3demo/commons/src/main/java/com/example/commons/domain/entity/Recharge.java
-
1demo/commons/src/main/java/com/example/commons/domain/entity/User.java
-
17demo/commons/src/main/java/com/example/commons/sevice/ActivityService.java
-
14demo/commons/src/main/java/com/example/commons/sevice/AuditService.java
-
16demo/commons/src/main/java/com/example/commons/sevice/RateService.java
-
4demo/commons/src/main/java/com/example/commons/sevice/RechargeService.java
-
7demo/commons/src/main/java/com/example/commons/sevice/UserSevice.java
-
5demo/pom.xml
-
68demo/recharge/src/main/java/com/example/recharge/controller/ActivityController.java
-
41demo/recharge/src/main/java/com/example/recharge/controller/AuditController.java
-
101demo/recharge/src/main/java/com/example/recharge/controller/RateController.java
-
52demo/recharge/src/main/java/com/example/recharge/controller/RechargeController.java
-
64demo/recharge/src/main/java/com/example/recharge/mapper/ActivityMapper.java
-
36demo/recharge/src/main/java/com/example/recharge/mapper/AuditMapper.java
-
65demo/recharge/src/main/java/com/example/recharge/mapper/RateMapper.java
-
47demo/recharge/src/main/java/com/example/recharge/mapper/RechargeMapper.java
-
47demo/recharge/src/main/java/com/example/recharge/service/ActivityServiceImpl.java
-
35demo/recharge/src/main/java/com/example/recharge/service/AuditServiceImpl.java
-
54demo/recharge/src/main/java/com/example/recharge/service/RateServiceImpl.java
-
44demo/recharge/src/main/java/com/example/recharge/service/RechargeServiceImpl.java
-
13demo/user/src/main/java/com/example/user/controller/UserController.java
-
8demo/user/src/main/java/com/example/user/mapper/UserMapper.java
-
17demo/user/src/main/java/com/example/user/service/UserServiceImpl.java
@ -0,0 +1,23 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDate; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
@Data |
||||
|
|
||||
|
public class Activity { |
||||
|
private int activityId ; |
||||
|
private int adminId; |
||||
|
private String dept; |
||||
|
private LocalDate startTime; |
||||
|
private LocalDate endTime; |
||||
|
private String activityName; |
||||
|
private BigDecimal rechargeRatio; |
||||
|
private LocalDateTime createTime; |
||||
|
private int flag; |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class Page { |
||||
|
private Integer pageNum; |
||||
|
private Integer pageSize; |
||||
|
|
||||
|
private Activity activity; |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
|
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class Rate { |
||||
|
private Integer rateId; |
||||
|
private Date startTime; |
||||
|
private Date endTime; |
||||
|
private String currency; |
||||
|
private String exchangeRate; |
||||
|
private Date createTime; |
||||
|
private Date updateTime; |
||||
|
private String updateName; |
||||
|
} |
@ -0,0 +1,10 @@ |
|||||
|
package com.example.commons.domain.entity; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class RateSearchRequest { |
||||
|
private Integer pageNum; |
||||
|
private Integer pageSize; |
||||
|
private Rate rate; |
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Activity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface ActivityService { |
||||
|
|
||||
|
int add(Activity activity); |
||||
|
|
||||
|
int edit(Activity activity); |
||||
|
|
||||
|
List<Activity> search(Activity activity); |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface AuditService { |
||||
|
int add (Audit audit); |
||||
|
List<Audit> search(Audit audit) ; |
||||
|
PageInfo<Audit> searchForPage(Integer pageNum, Integer pageSize, Audit audit); |
||||
|
} |
||||
|
|
@ -0,0 +1,16 @@ |
|||||
|
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface RateService { |
||||
|
int add(Rate rate) throws Exception; |
||||
|
int edit(Rate rate) throws Exception; |
||||
|
void delete(Integer rateId) throws Exception; |
||||
|
Rate getById(Integer rateId); |
||||
|
List<Rate> search(Rate rate); |
||||
|
PageInfo<Rate> searchForPage(Integer pageNum, Integer pageSize,Rate rate); |
||||
|
} |
@ -1,8 +1,13 @@ |
|||||
package com.example.commons.sevice; |
package com.example.commons.sevice; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
import com.example.commons.domain.entity.User; |
import com.example.commons.domain.entity.User; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
public interface UserSevice { |
public interface UserSevice { |
||||
User getByHomilyId(String homilyId); |
|
||||
|
List<User> search(User user) ; |
||||
|
PageInfo<User> searchForPage(Integer pageNum, Integer pageSize, User User); |
||||
|
|
||||
} |
} |
@ -0,0 +1,68 @@ |
|||||
|
package com.example.recharge.controller; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Activity; |
||||
|
import com.example.commons.domain.entity.Page; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.recharge.service.ActivityServiceImpl; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/recharge/activity") |
||||
|
//SpringMVC的,为当前类的所有处理器方法,添加路径映射的前缀 |
||||
|
@RequiredArgsConstructor |
||||
|
// lombok的,添加一个包含所有final属性的构造器 |
||||
|
@Slf4j //lombok的,自动添加log的对象,用于日志打印 |
||||
|
|
||||
|
public class ActivityController { |
||||
|
|
||||
|
@Autowired |
||||
|
ActivityServiceImpl activityService; |
||||
|
|
||||
|
//添加活动管理信息 |
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody Activity activity) { |
||||
|
// try { |
||||
|
System.out.println("------6---"); |
||||
|
int result=activityService.add(activity); |
||||
|
System.out.println(result); |
||||
|
return Result.success(); |
||||
|
// } catch (Exception e) { |
||||
|
// log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
// return Result.error(e.getMessage()); |
||||
|
// } |
||||
|
|
||||
|
} |
||||
|
|
||||
|
//修改活动管理信息 |
||||
|
@PostMapping("/edit") |
||||
|
public Result edit(@RequestBody Activity activity){ |
||||
|
|
||||
|
// try { |
||||
|
Integer num =activityService.edit(activity); |
||||
|
return Result.success(num); |
||||
|
// } catch (Exception e) { |
||||
|
//// log.error(""+e); |
||||
|
//// return Result.error(e.getMessage()); |
||||
|
//// } |
||||
|
} |
||||
|
//查询活动管理信息--模糊+分页查询 |
||||
|
@PostMapping("/select") |
||||
|
public Result search(@RequestBody Page page){ |
||||
|
Integer pageNum = page.getPageNum(); |
||||
|
Integer pageSize=page.getPageSize(); |
||||
|
Activity activity= page.getActivity(); |
||||
|
if (ObjectUtils.isEmpty(pageNum)){ |
||||
|
return Result.success(activityService.search(page.getActivity())); |
||||
|
} |
||||
|
return Result.success(activityService.searchForPage(pageNum,pageSize,activity)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
package com.example.recharge.controller; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.commons.sevice.AuditService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/recharge/audit") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class AuditController { |
||||
|
|
||||
|
private final AuditService auditService; |
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody Audit audit){ |
||||
|
try { |
||||
|
auditService.add(audit); |
||||
|
return Result.success(); |
||||
|
}catch (Exception e){ |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping |
||||
|
public Result search(Integer pageNum,Integer pageSize,@RequestBody Audit audit){ |
||||
|
if(ObjectUtils.isEmpty(pageNum)){ |
||||
|
return Result.success(auditService.search(audit)); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(auditService.searchForPage(pageNum,pageSize,audit)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
@ -0,0 +1,101 @@ |
|||||
|
package com.example.recharge.controller; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import com.example.commons.domain.entity.RateSearchRequest; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.commons.sevice.RateService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
|
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/rates") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class RateController { |
||||
|
private final RateService rateService; |
||||
|
|
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody Rate rate) { |
||||
|
try { |
||||
|
rateService.add(rate); |
||||
|
return Result.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping("/update") // 将 PUT 改为 POST |
||||
|
public Result update(@RequestBody Rate rate) { |
||||
|
try { |
||||
|
rateService.edit(rate); |
||||
|
return Result.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
// @PutMapping("/update") |
||||
|
// public Result update(@RequestBody Rate rate) { |
||||
|
// try { |
||||
|
// rateService.edit(rate); |
||||
|
// return Result.success(); |
||||
|
// } catch (Exception e) { |
||||
|
// log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
// return Result.error(e.getMessage()); |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
@PostMapping("/delete/{rateId}") // 将 DELETE 改为 POST |
||||
|
public Result delete(@PathVariable("rateId") Integer rateId) { |
||||
|
try { |
||||
|
rateService.delete(rateId); |
||||
|
return Result.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
// @DeleteMapping("/{rateId}") |
||||
|
// public Result delete(@PathVariable("rateId") Integer rateId) { |
||||
|
// try { |
||||
|
// rateService.delete(rateId); |
||||
|
// return Result.success(); |
||||
|
// } catch (Exception e) { |
||||
|
// log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
// return Result.error(e.getMessage()); |
||||
|
// } |
||||
|
// } |
||||
|
|
||||
|
// @GetMapping("/{rateId}") |
||||
|
// public Result get(@PathVariable Integer rateId) { |
||||
|
// return Result.success(rateService.getById(rateId)); |
||||
|
// } |
||||
|
// |
||||
|
// @GetMapping |
||||
|
// public Result search(Integer pageNum, Integer pageSize,Rate rate) { |
||||
|
// if(ObjectUtils.isEmpty(pageNum)){ |
||||
|
// return Result.success(rateService.search(rate)); |
||||
|
// }else{ |
||||
|
// return Result.success(rateService.searchForPage(pageNum,pageSize,rate)); |
||||
|
// } |
||||
|
// } |
||||
|
@PostMapping("/search") // 改为 POST 请求 |
||||
|
public Result search(@RequestBody RateSearchRequest searchRequest) { |
||||
|
Integer pageNum = searchRequest.getPageNum(); |
||||
|
Integer pageSize = searchRequest.getPageSize(); |
||||
|
Rate rate = searchRequest.getRate(); |
||||
|
|
||||
|
if (ObjectUtils.isEmpty(pageNum)) { |
||||
|
return Result.success(rateService.search(rate)); |
||||
|
} else { |
||||
|
return Result.success(rateService.searchForPage(pageNum, pageSize, rate)); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
package com.example.recharge.controller; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.domain.vo.Result; |
||||
|
import com.example.commons.sevice.RechargeService; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.util.ObjectUtils; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import java.util.Arrays; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("/recharge/recharge") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class RechargeController { |
||||
|
|
||||
|
private final RechargeService rechargeService; |
||||
|
|
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody Recharge recharge) { |
||||
|
try { |
||||
|
rechargeService.add(recharge); |
||||
|
return Result.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping("/edit") |
||||
|
public Result edit(@RequestBody Recharge recharge) { |
||||
|
try { |
||||
|
rechargeService.edit(recharge); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
return Result.success(); |
||||
|
} |
||||
|
@PostMapping |
||||
|
public Result search(Integer pageNum, Integer pageSize,@RequestBody Recharge recharge) { |
||||
|
if(ObjectUtils.isEmpty(pageNum)){ |
||||
|
return Result.success(rechargeService.search(recharge)); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(rechargeService.searchForPage(pageNum,pageSize,recharge)); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
package com.example.recharge.mapper; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Activity; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface ActivityMapper { |
||||
|
|
||||
|
//增加活动信息 |
||||
|
@Insert({"insert into activity", |
||||
|
"(admin_id,dept,start_time,end_time,recharge_ratio,activity_name,flag,create_time) " , |
||||
|
"values", |
||||
|
"(#{adminId},#{dept},#{startTime},#{endTime},#{rechargeRatio},#{activityName},1,now())" |
||||
|
}) |
||||
|
@Options(useGeneratedKeys = true,keyColumn = "activity_id",keyProperty = "activityId") |
||||
|
int add(Activity activity); |
||||
|
|
||||
|
|
||||
|
// 修改活动信息 |
||||
|
@Update({ |
||||
|
"<script>", |
||||
|
"update activity", |
||||
|
"<set>", |
||||
|
"<if test='adminId != null'> admin_id = #{adminId}, </if>", |
||||
|
"<if test='dept != null '> dept= #{dept}, </if>", |
||||
|
"<if test='startTime != null '> start_time = #{startTime}, </if>", |
||||
|
"<if test='endTime != null '> end_time = #{endTime}, </if>", |
||||
|
"<if test='rechargeRatio != null '> recharge_ratio = #{rechargeRatio}, </if>", |
||||
|
"<if test='activityName != null and activityName.length>0'> activity_name = #{activityName}, </if>", |
||||
|
"<if test='flag != null'> `flag` = #{flag}, </if>", |
||||
|
"</set>", |
||||
|
"where activity_id=#{activityId}", |
||||
|
"</script>" |
||||
|
}) |
||||
|
int edit(Activity activity); |
||||
|
|
||||
|
|
||||
|
//查询--根据活动id查询活动信息 |
||||
|
@Select({ |
||||
|
"select activity_id from activity where activity_id=#{activityId}" |
||||
|
}) |
||||
|
Activity selectById(Integer activityId); |
||||
|
|
||||
|
//模糊查询--根据活动id查询活动信息 |
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select * from activity", |
||||
|
"<where>", |
||||
|
"<if test='startTime!=null'>start_time=#{startTime}</if>", |
||||
|
"<if test='endTime!=null'>and end_time=#{endTime}</if>", |
||||
|
"<if test='activityName!=null'>and activity_name like concat('%','#{activityName}','%')</if>", |
||||
|
"<if test='flag!=null'>and flag=1)</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
|
||||
|
}) |
||||
|
List<Activity> select(Activity activity); |
||||
|
// |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.example.recharge.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.sevice.AuditService; |
||||
|
import org.apache.ibatis.annotations.Insert; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface AuditMapper { |
||||
|
|
||||
|
@Insert({ |
||||
|
"INSERT INTO audit", |
||||
|
"(homily_id,recharge_id,refund_id,name,status,flag)", |
||||
|
"values", |
||||
|
"(#{homilyId},#{rechargeId},#{refundId},#{name},#{status},#{flag})" |
||||
|
}) |
||||
|
int insert(Audit audit); |
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select * from audit", |
||||
|
"<where>", |
||||
|
|
||||
|
"<if test='homilyId!=null'>and homily_id=#{homilyId}</if>", |
||||
|
"<if test='startDate != null and endDate != null'>AND create_time BETWEEN #{startDate} AND #{endDate}</if>", |
||||
|
"<if test='rechargeId!=null'>and refund_id=#{fefundId}</if>", |
||||
|
"<if test='refundId!=null'>and refund_id=#{fefundId}</if>", |
||||
|
"<if test='status!=null'>and status=#{status}</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<Audit> select(Audit Audit); |
||||
|
} |
@ -0,0 +1,65 @@ |
|||||
|
package com.example.recharge.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import org.apache.ibatis.annotations.*; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface RateMapper { |
||||
|
|
||||
|
@Insert({ |
||||
|
"insert into rate", |
||||
|
"(start_time,end_time,currency,exchange_rate,create_time,update_time,update_name)", |
||||
|
"values", |
||||
|
"(#{startTime},#{endTime},#{currency},#{exchangeRate},#{createTime},#{updateTime},#{updateName})" |
||||
|
}) |
||||
|
// 获取自增主键 |
||||
|
@Options(useGeneratedKeys = true,keyColumn = "rate_id",keyProperty = "rateId") |
||||
|
int insert(Rate rate); |
||||
|
|
||||
|
@Delete({ |
||||
|
"delete from rate where rate_id=#{rateId}" |
||||
|
}) |
||||
|
int deleteById(Integer rateId); |
||||
|
|
||||
|
@Update({ |
||||
|
"<script>", |
||||
|
"update rate", |
||||
|
"<set>", |
||||
|
"<if test='startTime!=null'>start_time=#{startTime},</if>", |
||||
|
"<if test='endTime!=null'>end_time=#{endTime},</if>", |
||||
|
"<if test='currency!=null and currency.length>0'>currency=#{currency},</if>", |
||||
|
"<if test='exchangeRate!=null'>exchange_rate=#{exchangeRate},</if>", |
||||
|
"<if test='updateTime!=null'>update_time=#{updateTime},</if>", |
||||
|
"<if test='updateName!=null and updateName.length>0'>update_name=#{updateName},</if>", |
||||
|
"</set>", |
||||
|
"where rate_id = #{rateId}", |
||||
|
"</script>" |
||||
|
}) |
||||
|
int update(Rate rate); |
||||
|
|
||||
|
@Select({ |
||||
|
"select rate_id from rate where rate_id=#{rateId}" |
||||
|
}) |
||||
|
Rate selectById(Integer rateId); |
||||
|
|
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select * from rate", |
||||
|
"<where>", |
||||
|
"<if test='rateId!=null'>rate_id =#{rateId}</if>", |
||||
|
"<if test='startTime!=null'>start_time >=#{startTime}</if>", |
||||
|
"<if test='endTime!=null'>and end_time <=#{endTime}</if>", |
||||
|
"<if test='currency!=null and currency.length>0'>and currency like concat('%','#{currency}','%')</if>", |
||||
|
"<if test='exchangeRate!=null'>and exchange_rate like concat('%','#{exchangeRate}','%')</if>", |
||||
|
"<if test='updateTime!=null'>and update_time like concat('%','#{updateTime}','%')</if>", |
||||
|
"<if test='updateName!=null and updateName.length>0'>and update_name like concat('%','#{updateName}','%')</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
|
||||
|
}) |
||||
|
List<Rate> select(Rate rate); |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.example.recharge.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import org.apache.ibatis.annotations.Insert; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
import org.apache.ibatis.annotations.Update; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface RechargeMapper { |
||||
|
|
||||
|
@Insert({ |
||||
|
"INSERT INTO recharge", |
||||
|
"(homily_id,activity_id,paid_gold,free_gold,recharge_gold,pay_way,recharge_way,recharge_time,recharge_voucher,admin_id,area,status,remark,flag)", |
||||
|
"values ", |
||||
|
"(#{homilyId},#{activityId},#{paidGold},#{freeGold},#{rechargeGold},#{payWay},#{rechargeWay},#{rechargeTime},#{rechargeVoucher},#{adminId},#{area},#{status},#{remark},#{flag})" |
||||
|
}) |
||||
|
int insert(Recharge recharge); |
||||
|
|
||||
|
@Update({ |
||||
|
"<script>", |
||||
|
"UPDATE recharge", |
||||
|
"<set>", |
||||
|
"<if test= 'flag!=null '>flag=#{flag},</if>", |
||||
|
"</set>", |
||||
|
"where recharge_id=#{rechargeId}", |
||||
|
"</script>" |
||||
|
}) |
||||
|
int update(Recharge recharge); |
||||
|
|
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select * from recharge", |
||||
|
"<where>", |
||||
|
"flag='1'", |
||||
|
"<if test='activityId!=null'>and activity_id=#{activityId}</if>", |
||||
|
"<if test='startDate != null and endDate != null'>AND create_time BETWEEN #{startDate} AND #{endDate}</if>", |
||||
|
"<if test='rechargeWay!=null and rechargeWay.length>0 '>and recharge_way like concat('%',#{rechargeWay},'%')</if>", |
||||
|
"<if test='area!=null and area.length>0'>and area like concat('%',#{area},'%')</if>", |
||||
|
"<if test='status!=null'>and status=#{status}</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
}) |
||||
|
List<Recharge> select(Recharge recharge); |
||||
|
} |
@ -0,0 +1,47 @@ |
|||||
|
package com.example.recharge.service; |
||||
|
|
||||
|
|
||||
|
import com.example.commons.domain.entity.Activity; |
||||
|
import com.example.commons.domain.entity.Page; |
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import com.example.commons.sevice.ActivityService; |
||||
|
import com.example.recharge.mapper.ActivityMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@Transactional |
||||
|
@RequiredArgsConstructor |
||||
|
public class ActivityServiceImpl implements ActivityService { |
||||
|
|
||||
|
@Autowired |
||||
|
ActivityMapper activityMapper; |
||||
|
@Override |
||||
|
public int add(Activity activity) { |
||||
|
return activityMapper.add(activity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int edit(Activity activity) { |
||||
|
return activityMapper.edit(activity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Activity> search(Activity activity) { |
||||
|
return activityMapper.select(activity); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
public PageInfo<Activity> searchForPage(Integer pageNum, Integer pageSize, Activity activity) { |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
List<Activity> list = activityMapper.select(activity); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
package com.example.recharge.service; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.sevice.AuditService; |
||||
|
import com.example.recharge.mapper.AuditMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class AuditServiceImpl implements AuditService { |
||||
|
private final AuditMapper auditMapper; |
||||
|
|
||||
|
@Override |
||||
|
public int add(Audit audit) { |
||||
|
return auditMapper.insert(audit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Audit> search(Audit audit) { |
||||
|
return auditMapper.select(audit); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<Audit> searchForPage(Integer pageNum, Integer pageSize, Audit audit) { |
||||
|
PageHelper.startPage(pageNum,pageSize); |
||||
|
List<Audit> list= auditMapper.select(audit); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,54 @@ |
|||||
|
package com.example.recharge.service; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Rate; |
||||
|
import com.example.commons.sevice.RateService; |
||||
|
import com.example.recharge.mapper.RateMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
|
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class RateServiceImpl implements RateService { |
||||
|
private final RateMapper rateMapper; |
||||
|
@Override |
||||
|
public int add(Rate rate) { |
||||
|
return rateMapper.insert(rate); |
||||
|
} |
||||
|
|
||||
|
@Transactional |
||||
|
@Override |
||||
|
public int edit(Rate rate) { |
||||
|
return rateMapper.update(rate); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void delete(Integer rateId) throws Exception { |
||||
|
int result = rateMapper.deleteById(rateId); |
||||
|
if(result == 0){ |
||||
|
throw new Exception("未找到对应的记录,删除失败"); |
||||
|
}; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Rate getById(Integer rateId) { |
||||
|
return rateMapper.selectById(rateId); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Rate> search(Rate rate) { |
||||
|
return rateMapper.select(rate); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<Rate> searchForPage(Integer pageNum, Integer pageSize, Rate rate) { |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
List<Rate> list = rateMapper.select(rate); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.example.recharge.service; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
|
import com.example.commons.sevice.RechargeService; |
||||
|
import com.example.recharge.mapper.RechargeMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@RequiredArgsConstructor |
||||
|
public class RechargeServiceImpl implements RechargeService { |
||||
|
|
||||
|
private final RechargeMapper rechargeMapper; |
||||
|
@Override |
||||
|
public int add(Recharge recharge) throws Exception { |
||||
|
return rechargeMapper.insert(recharge); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public int edit(Recharge recharge) throws Exception { |
||||
|
return rechargeMapper.update(recharge); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Recharge findById(int id) throws Exception { |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<Recharge> search(Recharge recharge) { |
||||
|
return rechargeMapper.select(recharge); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<Recharge> searchForPage(Integer pageNum, Integer pageSize, Recharge recharge) { |
||||
|
PageHelper.startPage(pageNum,pageSize); |
||||
|
List<Recharge> list= rechargeMapper.select(recharge); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
} |
@ -1,22 +1,21 @@ |
|||||
package com.example.user.controller; |
package com.example.user.controller; |
||||
|
|
||||
|
import com.example.commons.domain.entity.User; |
||||
import com.example.commons.domain.vo.Result; |
import com.example.commons.domain.vo.Result; |
||||
import com.example.commons.sevice.UserSevice; |
import com.example.commons.sevice.UserSevice; |
||||
import lombok.RequiredArgsConstructor; |
import lombok.RequiredArgsConstructor; |
||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.web.bind.annotation.PathVariable; |
|
||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
|
||||
import org.springframework.web.bind.annotation.RestController; |
|
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
@RestController |
@RestController |
||||
@RequestMapping("/recharge/user") |
@RequestMapping("/recharge/user") |
||||
@RequiredArgsConstructor |
@RequiredArgsConstructor |
||||
@Slf4j |
@Slf4j |
||||
|
@CrossOrigin |
||||
public class UserController { |
public class UserController { |
||||
private final UserSevice userSevice; |
private final UserSevice userSevice; |
||||
@PostMapping("/{id}") |
|
||||
public Result getUser(@PathVariable String id) { |
|
||||
return Result.success(userSevice.getByHomilyId(id)); |
|
||||
|
@PostMapping |
||||
|
public Result User(@RequestBody User user) { |
||||
|
return Result.success(userSevice.search(user)); |
||||
} |
} |
||||
} |
} |
@ -1,14 +1,16 @@ |
|||||
package com.example.user.mapper; |
package com.example.user.mapper; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Audit; |
||||
import com.example.commons.domain.entity.User; |
import com.example.commons.domain.entity.User; |
||||
import org.apache.ibatis.annotations.Mapper; |
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
@Mapper |
@Mapper |
||||
public interface UserMapper { |
public interface UserMapper { |
||||
@Select({ |
@Select({ |
||||
"select * from user", |
|
||||
"where homilyId=#{homily_id}" |
|
||||
|
"select * from user where homily_id=#{homilyId}" |
||||
}) |
}) |
||||
User getByHomilyId(String homilyId); |
|
||||
|
List<User> select(User user); |
||||
} |
} |
@ -1,20 +1,33 @@ |
|||||
package com.example.user.service; |
package com.example.user.service; |
||||
|
|
||||
|
import com.example.commons.domain.entity.Recharge; |
||||
import com.example.commons.domain.entity.User; |
import com.example.commons.domain.entity.User; |
||||
import com.example.commons.sevice.UserSevice; |
import com.example.commons.sevice.UserSevice; |
||||
import com.example.user.mapper.UserMapper; |
import com.example.user.mapper.UserMapper; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
import lombok.RequiredArgsConstructor; |
import lombok.RequiredArgsConstructor; |
||||
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.web.bind.annotation.RequestMapping; |
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
@Service |
@Service |
||||
@RequiredArgsConstructor |
@RequiredArgsConstructor |
||||
public class UserServiceImpl implements UserSevice { |
public class UserServiceImpl implements UserSevice { |
||||
|
|
||||
private final UserMapper userMapper; |
private final UserMapper userMapper; |
||||
|
|
||||
|
@Override |
||||
|
public List<User> search(User user) { |
||||
|
return userMapper.select(user); |
||||
|
} |
||||
|
|
||||
@Override |
@Override |
||||
public User getByHomilyId(String homilyId) { |
|
||||
return userMapper.getByHomilyId(homilyId); |
|
||||
|
public PageInfo<User> searchForPage(Integer pageNum, Integer pageSize, User user) { |
||||
|
PageHelper.startPage(pageNum,pageSize); |
||||
|
List<User> list= userMapper.select(user); |
||||
|
return new PageInfo<>(list); |
||||
} |
} |
||||
} |
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue