9 changed files with 259 additions and 81 deletions
-
11pom.xml
-
44src/main/java/com/example/demo/controller/DetailYController.java
-
2src/main/java/com/example/demo/domain/entity/Audit.java
-
67src/main/java/com/example/demo/domain/entity/DetailY.java
-
81src/main/java/com/example/demo/domain/vo/Page.java
-
46src/main/java/com/example/demo/mapper/DetailYMapper.java
-
30src/main/java/com/example/demo/serviceImpl/AuditServiceImpl.java
-
44src/main/java/com/example/demo/serviceImpl/DetailYServiceImpl.java
-
13src/main/java/com/example/demo/sevice/DetailYService.java
@ -0,0 +1,44 @@ |
|||||
|
package com.example.demo.controller; |
||||
|
|
||||
|
|
||||
|
import com.example.demo.domain.entity.Detail; |
||||
|
import com.example.demo.domain.entity.DetailY; |
||||
|
import com.example.demo.domain.vo.Page; |
||||
|
import com.example.demo.domain.vo.Result; |
||||
|
import com.example.demo.sevice.DetailService; |
||||
|
import com.example.demo.sevice.DetailYService; |
||||
|
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("/detailY") |
||||
|
@RequiredArgsConstructor |
||||
|
@Slf4j |
||||
|
@CrossOrigin |
||||
|
public class DetailYController { |
||||
|
private final DetailYService detailYService; |
||||
|
@PostMapping("/add") |
||||
|
public Result add(@RequestBody DetailY detailY) { |
||||
|
try { |
||||
|
detailYService.add(detailY); |
||||
|
return Result.success(); |
||||
|
} catch (Exception e) { |
||||
|
log.warn(Arrays.toString(e.getStackTrace())); |
||||
|
return Result.error(e.getMessage()); |
||||
|
} |
||||
|
} |
||||
|
@PostMapping |
||||
|
public Result search(@RequestBody Page page) { |
||||
|
if(ObjectUtils.isEmpty(page.getPageNum())){ |
||||
|
return Result.success(detailYService.getAllDetail(page.getDetailY())); |
||||
|
} |
||||
|
else { |
||||
|
return Result.success(detailYService.getDetailByPage(page.getPageNum(), page.getPageSize(), page.getDetailY())); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,67 @@ |
|||||
|
package com.example.demo.domain.entity; |
||||
|
|
||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
|
import lombok.Data; |
||||
|
import lombok.NoArgsConstructor; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.Date; |
||||
|
|
||||
|
@Data |
||||
|
@NoArgsConstructor |
||||
|
public class DetailY implements Serializable { |
||||
|
private Integer detailyId; |
||||
|
private String name; |
||||
|
private String jwcode; |
||||
|
private String area; |
||||
|
private Integer activityId; |
||||
|
private String rechargeWay; |
||||
|
private Integer productId; |
||||
|
private String consumePlatform; |
||||
|
private String consumeType; |
||||
|
private String refundType; |
||||
|
private String refundGoods; |
||||
|
private Integer contactId; |
||||
|
private String remark; |
||||
|
private BigDecimal rechargeCoin; |
||||
|
private BigDecimal freeCoin; |
||||
|
private BigDecimal taskCoin; |
||||
|
|
||||
|
private Integer adminId; |
||||
|
private Integer status; |
||||
|
private Integer updateType; |
||||
|
private Integer detailFlag; |
||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
private Date createTime; |
||||
|
|
||||
|
private Date endDate; |
||||
|
private Date startDate; |
||||
|
private String uname; |
||||
|
private Integer firstRecharge; |
||||
|
|
||||
|
private String adminArea; |
||||
|
private String adminName; |
||||
|
private String userName; |
||||
|
private String auditStatus; |
||||
|
private String auditReson; |
||||
|
private String orderCode; |
||||
|
private Integer refundFlag; |
||||
|
|
||||
|
|
||||
|
// @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") |
||||
|
// @DateTimeFormat(pattern = "yyyy-MM-dd") |
||||
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss") |
||||
|
private String productName; |
||||
|
private Integer refundId; |
||||
|
|
||||
|
private BigDecimal allCoin; |
||||
|
private String token; |
||||
|
|
||||
|
private BigDecimal free6; |
||||
|
private BigDecimal free12; |
||||
|
|
||||
|
private BigDecimal allGold; |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
package com.example.demo.mapper; |
||||
|
|
||||
|
import com.example.demo.domain.entity.Detail; |
||||
|
import com.example.demo.domain.entity.DetailY; |
||||
|
import org.apache.ibatis.annotations.Insert; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
import org.apache.ibatis.annotations.Options; |
||||
|
import org.apache.ibatis.annotations.Select; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface DetailYMapper { |
||||
|
@Insert({ |
||||
|
"insert into detail_y", |
||||
|
"(jwcode,order_code,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods," + |
||||
|
"contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,create_time,first_recharge)", |
||||
|
"values ", |
||||
|
"(#{jwcode},#{orderCode},#{activityId},#{rechargeWay},#{productId},#{consumePlatform},#{consumeType},#{refundType}" + |
||||
|
",#{refundGoods},#{contactId},#{remark},#{rechargeCoin}" + |
||||
|
",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),#{firstRecharge})" |
||||
|
}) |
||||
|
@Options(useGeneratedKeys = true,keyColumn = "detaily_id",keyProperty = "detailyId") |
||||
|
int add(DetailY detaily); |
||||
|
@Select({ |
||||
|
"SELECT * from detail_y where detaily_id =#{detailyId}" |
||||
|
}) |
||||
|
Detail selectByDetailId(Integer detaily_id); |
||||
|
|
||||
|
@Select({ |
||||
|
"<script>", |
||||
|
"select detail_y.*,admin.name,admin.area,user.name as uname,audit.status from detail", |
||||
|
"inner join `admin` on detail_y.admin_id = `admin`.admin_id", |
||||
|
"inner join `user` on detail_y.jwcode = `user`.jwcode", |
||||
|
"left join audit on detail_y.detail_id=audit.detail_id", |
||||
|
"<where>", |
||||
|
"(status is null or status='1')", |
||||
|
"<if test='jwcode!=null and jwcode.length>0'>and detail_y.jwcode=#{jwcode}</if>", |
||||
|
"<if test='updateType!=null'>and update_type=#{updateType}</if>", |
||||
|
"<if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>", |
||||
|
"</where>", |
||||
|
"</script>" |
||||
|
|
||||
|
}) |
||||
|
List<DetailY> select(DetailY detailY); |
||||
|
} |
@ -0,0 +1,44 @@ |
|||||
|
package com.example.demo.serviceImpl; |
||||
|
|
||||
|
import com.example.demo.domain.entity.Detail; |
||||
|
import com.example.demo.domain.entity.DetailY; |
||||
|
import com.example.demo.mapper.DetailMapper; |
||||
|
import com.example.demo.mapper.DetailYMapper; |
||||
|
import com.example.demo.sevice.DetailYService; |
||||
|
import com.github.pagehelper.PageHelper; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
import lombok.RequiredArgsConstructor; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.cache.annotation.CacheConfig; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
@Transactional |
||||
|
@RequiredArgsConstructor |
||||
|
@CacheConfig(cacheNames = "detailY") |
||||
|
public class DetailYServiceImpl implements DetailYService { |
||||
|
@Autowired |
||||
|
|
||||
|
private DetailYMapper detailYMapper; |
||||
|
@Override |
||||
|
public int add(DetailY detailY) { |
||||
|
return detailYMapper.add(detailY); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<DetailY> getAllDetail(DetailY detailY) { |
||||
|
return detailYMapper.select(detailY); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageInfo<DetailY> getDetailByPage(int pageNum, int pageSize, DetailY detailY) { |
||||
|
PageHelper.startPage(pageNum, pageSize); |
||||
|
List<DetailY> list= detailYMapper.select(detailY); |
||||
|
return new PageInfo<>(list); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.example.demo.sevice; |
||||
|
|
||||
|
import com.example.demo.domain.entity.Detail; |
||||
|
import com.example.demo.domain.entity.DetailY; |
||||
|
import com.github.pagehelper.PageInfo; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface DetailYService { |
||||
|
int add(DetailY detailY); |
||||
|
List<DetailY> getAllDetail(DetailY detailY); |
||||
|
PageInfo<DetailY> getDetailByPage(int pageNum, int pageSize, DetailY detailY); |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue