Browse Source

后端框架第二版接口

Houduan1
huangqizhen 6 months ago
parent
commit
5a2ac2d930
  1. 6
      demo/commons/src/main/java/com/example/commons/sevice/RefundService.java
  2. 56
      demo/consume/src/main/java/com/example/consume/controller/ConsumeController.java
  3. 57
      demo/consume/src/main/java/com/example/consume/mapper/ConsumeMapper.java
  4. 19
      demo/consume/src/main/java/com/example/consume/service/ConsumeServiceImpl.java
  5. 17
      demo/recharge/src/main/java/com/example/recharge/controller/RateController.java
  6. 1
      demo/recharge/src/main/java/com/example/recharge/mapper/RateMapper.java
  7. 1
      demo/recharge/src/main/java/com/example/recharge/service/RateServiceImpl.java
  8. 29
      demo/refund/src/main/java/com/example/fefund/controller/RefundController.java
  9. 34
      demo/refund/src/main/java/com/example/fefund/mapper/RefundMapper.java
  10. 28
      demo/refund/src/main/java/com/example/fefund/service/RefundServiceImpl.java

6
demo/commons/src/main/java/com/example/commons/sevice/RefundService.java

@ -8,8 +8,10 @@ import java.util.List;
@Service @Service
public interface RefundService { public interface RefundService {
int add(Detail detail) throws Exception;
void edit(Detail newDetail) throws Exception;
int add(Detail detail) ;
int addAudit(Detail detail);
void edit(Detail newDetail) ;
int softDelete(Integer detailId) ;
Detail selectByDetailId(Integer detailId); Detail selectByDetailId(Integer detailId);
List<Detail> search(Detail detail); List<Detail> search(Detail detail);
PageInfo<Detail> searchForPage(Integer pageNum, Integer pageSize, Detail detail); PageInfo<Detail> searchForPage(Integer pageNum, Integer pageSize, Detail detail);

56
demo/consume/src/main/java/com/example/consume/controller/ConsumeController.java

@ -1,50 +1,55 @@
package com.example.consume.controller; package com.example.consume.controller;
import com.example.commons.domain.entity.*;
import com.example.commons.domain.entity.Admin;
import com.example.commons.domain.entity.Detail;
import com.example.commons.domain.entity.User;
import com.example.commons.domain.vo.DetailVo; import com.example.commons.domain.vo.DetailVo;
import com.example.commons.domain.vo.Page; import com.example.commons.domain.vo.Page;
import com.example.commons.domain.vo.Result; import com.example.commons.domain.vo.Result;
import com.example.consume.service.ConsumeServiceImpl; import com.example.consume.service.ConsumeServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController @RestController
@RequestMapping("/consume") @RequestMapping("/consume")
//SpringMVC的为当前类的所有处理器方法添加路径映射的前缀
@RequiredArgsConstructor
// lombok的添加一个包含所有final属性的构造器
@Slf4j //lombok的自动添加log的对象用于日志打印
@CrossOrigin
public class ConsumeController { public class ConsumeController {
@Autowired @Autowired
ConsumeServiceImpl consumeService; ConsumeServiceImpl consumeService;
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestParam("userId") Integer userId, @RequestBody Detail detail){
// public Result add(@RequestParam("userId") Integer userId, @RequestBody Detail detail){
public Result add(@RequestBody Detail detail){
// try { // try {
System.out.println(userId+"-----------");
// System.out.println(userId+"-----------");
//通过userid获取username插入到detail //通过userid获取username插入到detail
User user=consumeService.getByUserId(userId);
detail.setName(user.getName());
//添加所属地区
Admin admin=consumeService.getByadminId(detail.getAdminId());
detail.setArea(admin.getArea());
consumeService.insert(detail);
return Result.success();
// User user=consumeService.getByUserId(userId);
// detail.setName(user.getName());
// //添加所属地区
// Admin admin=consumeService.getByadminId(detail.getAdminId());
// detail.setArea(admin.getArea());
Integer result= consumeService.insert(detail);
return Result.success(result);
// } catch (Exception e) { // } catch (Exception e) {
// log.warn(Arrays.toString(e.getStackTrace())); // log.warn(Arrays.toString(e.getStackTrace()));
// return Result.error(e.getMessage()); // return Result.error(e.getMessage());
// } // }
}
}
@PostMapping("/select") @PostMapping("/select")
public Result search(@RequestBody Page detailpage){
Integer pageNum = detailpage.getPageNum();
Integer pageSize = detailpage.getPageSize();
DetailVo detailVo = detailpage.getDetailVo();
public Result search(@RequestBody Page page){
Integer pageNum = page.getPageNum();
Integer pageSize = page.getPageSize();
DetailVo detailVo = page.getDetailVo();
if(ObjectUtils.isEmpty(pageNum)){ if(ObjectUtils.isEmpty(pageNum)){
return Result.success(consumeService.search(detailVo)); return Result.success(consumeService.search(detailVo));
} }
@ -52,4 +57,17 @@ public class ConsumeController {
return Result.success(consumeService.searchForPage(pageNum,pageSize,detailVo)); return Result.success(consumeService.searchForPage(pageNum,pageSize,detailVo));
} }
} }
@PostMapping("/getDeatil/{jwcode}")
public Result getDeatil(@PathVariable("jwcode") Integer jwcode){
return Result.success(consumeService.getDeatil(jwcode));
}
@PostMapping("/getProduct")
public Result getProduct(@RequestParam("name") String name){
System.out.println(name+"name");
return Result.success( consumeService.getProduct(name));
}
} }

57
demo/consume/src/main/java/com/example/consume/mapper/ConsumeMapper.java

@ -1,9 +1,6 @@
package com.example.consume.mapper; package com.example.consume.mapper;
import com.example.commons.domain.entity.Admin;
import com.example.commons.domain.entity.Detail;
import com.example.commons.domain.entity.User;
import com.example.commons.domain.entity.*;
import com.example.commons.domain.vo.DetailVo; import com.example.commons.domain.vo.DetailVo;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -14,11 +11,11 @@ import java.util.List;
@Mapper @Mapper
public interface ConsumeMapper { public interface ConsumeMapper {
//通过id查询user全部信息
@Select({
"select * from user where user_id=#{userId}"
})
User getByUserId(Integer userId);
//通过id查询user全部信息
@Select({
"select * from user where user_id=#{userId}"
})
User getByUserId(Integer userId);
//通过id查询admin全部信息 //通过id查询admin全部信息
@Select({ @Select({
@ -28,9 +25,9 @@ User getByUserId(Integer userId);
//新增消费记录 //新增消费记录
@Insert({ @Insert({
"insert into detail", "insert into detail",
"(jwcode,name,area,goods,consume_platform,consume_type,remark,recharge_coin,free_coin,task_coin,admin_id,create_time,detail_flag)",
"(jwcode,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)",
"values", "values",
"(#{jwcode},#{name},#{area},#{goods},'海外金币管理系统','购买商品',#{remark},#{rechargeCoin},#{freeCoin},#{taskCoin},#{adminId},now(),1)"
"(#{jwcode},#{activityId},#{rechargeWay},#{productId},'金币系统','购买商品',#{refundType},#{refundGoods},#{contactId},#{remark},#{rechargeCoin},#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now())"
}) })
// 获取自增主键 // 获取自增主键
@Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId") @Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId")
@ -38,22 +35,46 @@ User getByUserId(Integer userId);
//userName
//模糊分页查询查询消费明细 //模糊分页查询查询消费明细
@Select({ @Select({
"<script>", "<script>",
"select detail.*,admin.name as adminName from detail ",
"select detail.*,admin.name as adminName ,admin.area as area ,user.name as userName,product.name as productName from detail ",
"inner join admin on detail.admin_id=admin.admin_id ", "inner join admin on detail.admin_id=admin.admin_id ",
"inner join user on detail.jwcode= user.jwcode ",
"inner join product on detail.product_id= product.product_id ",
"<where>", "<where>",
"`detail_flag`=1",
"<if test='goods!=null'>and goods like concat('%','#{goods}','%')</if>",
"<if test='consumePlatform!=null'>and consume_platform like concat('%','#{consumePlatform}','%')</if>",
"<if test='consumeType!=null'>and consume_type like concat('%','#{consumeType}','%')</if>",
"`detail_flag`=1 AND update_type = '消费'",
"<if test='jwcode!=null'>and detail.jwcode =#{jwcode}</if>",
"<if test='productName!=null'>and product.name like concat('%',#{productName},'%')</if>",
"<if test='consumePlatform!=null'>and detail.consume_platform like concat('%',#{consumePlatform},'%')</if>",
"<if test='consumeType!=null'>and detail.consume_type like concat('%',#{consumeType},'%')</if>",
"<if test='searchStartTime != null and searchEndTime != null'>", "<if test='searchStartTime != null and searchEndTime != null'>",
"and create_time between #{searchStartTime} and #{searchEndTime}",
"and detail.create_time between #{searchStartTime} and #{searchEndTime}",
"</if>", "</if>",
"</where>", "</where>",
"</script>" "</script>"
}) })
List<DetailVo> select(DetailVo detailVo); List<DetailVo> select(DetailVo detailVo);
//查询消费信息
@Select({
"select * ,product.name as productName from detail " ,
"inner join product on detail.product_id= product.product_id ",
"where `detail_flag`=1 AND update_type = '消费' and jwcode=#{jwcode}"
})
List<Detail> getDeatil(Integer jwcode);
//查询消费信息
@Select({
"select * from product",
" where product_flag=1 and name=#{name}",
"GROUP BY name"
})
List<Product> getProduct(String name);
} }

19
demo/consume/src/main/java/com/example/consume/service/ConsumeServiceImpl.java

@ -1,21 +1,24 @@
package com.example.consume.service; package com.example.consume.service;
import com.example.commons.domain.entity.Admin; import com.example.commons.domain.entity.Admin;
import com.example.commons.domain.entity.Detail; import com.example.commons.domain.entity.Detail;
import com.example.commons.domain.entity.Product;
import com.example.commons.domain.entity.User; import com.example.commons.domain.entity.User;
import com.example.commons.domain.vo.DetailVo; import com.example.commons.domain.vo.DetailVo;
import com.example.commons.sevice.ConsumeService; import com.example.commons.sevice.ConsumeService;
import com.example.consume.mapper.ConsumeMapper; import com.example.consume.mapper.ConsumeMapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
@Service @Service
@Transactional
@RequiredArgsConstructor
public class ConsumeServiceImpl implements ConsumeService { public class ConsumeServiceImpl implements ConsumeService {
@Autowired @Autowired
ConsumeMapper consumeMapper; ConsumeMapper consumeMapper;
@ -25,11 +28,11 @@ public class ConsumeServiceImpl implements ConsumeService {
public int insert(Detail detail) { public int insert(Detail detail) {
//添加表单数据 //添加表单数据
return consumeMapper.insert(detail);
return consumeMapper.insert(detail);
} }
@Override @Override
public User getByUserId(Integer userId) { public User getByUserId(Integer userId) {
return consumeMapper.getByUserId(userId);
return consumeMapper.getByUserId(userId);
} }
@Override @Override
public Admin getByadminId(Integer adminId) { public Admin getByadminId(Integer adminId) {
@ -49,4 +52,12 @@ public class ConsumeServiceImpl implements ConsumeService {
List<DetailVo> list = consumeMapper.select(detailVo); List<DetailVo> list = consumeMapper.select(detailVo);
return new PageInfo<>(list); return new PageInfo<>(list);
} }
public List<Detail> getDeatil(Integer jwcode){
return consumeMapper.getDeatil(jwcode);
}
public List<Product> getProduct(String name){
return consumeMapper.getProduct(name);
}
} }

17
demo/recharge/src/main/java/com/example/recharge/controller/RateController.java

@ -1,5 +1,6 @@
package com.example.recharge.controller; package com.example.recharge.controller;
import com.example.commons.domain.entity.Rate; import com.example.commons.domain.entity.Rate;
import com.example.commons.domain.vo.Page; import com.example.commons.domain.vo.Page;
@ -33,14 +34,14 @@ public class RateController {
} }
} }
@PostMapping("/update") // PUT 改为 POST @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());
}
public Result update(@RequestBody Rate rate) throws Exception {
// try {
rateService.edit(rate);
return Result.success();
// } catch (Exception e) {
// log.warn(Arrays.toString(e.getStackTrace()));
// return Result.error(e.getMessage());
// }
} }
// @PutMapping("/update") // @PutMapping("/update")
// public Result update(@RequestBody Rate rate) { // public Result update(@RequestBody Rate rate) {

1
demo/recharge/src/main/java/com/example/recharge/mapper/RateMapper.java

@ -33,6 +33,7 @@ public interface RateMapper {
"<if test='endTime!=null'>end_time=#{endTime},</if>", "<if test='endTime!=null'>end_time=#{endTime},</if>",
"<if test='currency!=null and currency.length>0'>currency=#{currency},</if>", "<if test='currency!=null and currency.length>0'>currency=#{currency},</if>",
"<if test='exchangeRate!=null'>exchange_rate=#{exchangeRate},</if>", "<if test='exchangeRate!=null'>exchange_rate=#{exchangeRate},</if>",
"<if test='updateTime!=null'>update_time=#{updateTime},</if>",
"<if test='adminId!=null'>admin_id=#{adminId},</if>", "<if test='adminId!=null'>admin_id=#{adminId},</if>",
"</set>", "</set>",
"where rate_id = #{rateId}", "where rate_id = #{rateId}",

1
demo/recharge/src/main/java/com/example/recharge/service/RateServiceImpl.java

@ -14,6 +14,7 @@ import java.util.List;
@Service @Service
@RequiredArgsConstructor @RequiredArgsConstructor
public class RateServiceImpl implements RateService { public class RateServiceImpl implements RateService {
private final RateMapper rateMapper; private final RateMapper rateMapper;
@Override @Override

29
demo/refund/src/main/java/com/example/fefund/controller/RefundController.java

@ -1,4 +1,4 @@
package com.example.fefund.controller;
package org.example.refund.controller;
import com.example.commons.domain.entity.Detail; import com.example.commons.domain.entity.Detail;
@ -7,6 +7,7 @@ import com.example.commons.domain.vo.Result;
import com.example.commons.sevice.RefundService; import com.example.commons.sevice.RefundService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -22,13 +23,25 @@ public class RefundController {
@PostMapping("/add") @PostMapping("/add")
public Result add(@RequestBody Detail detail) { public Result add(@RequestBody Detail detail) {
try {
refundService.add(detail);
return Result.success();
} catch (Exception e) {
log.warn(Arrays.toString(e.getStackTrace()));
return Result.error(e.getMessage());
}
// try {
refundService.add(detail);
refundService.addAudit(detail);
return Result.success();
// } catch (Exception e) {
// log.warn(Arrays.toString(e.getStackTrace()));
// return Result.error(e.getMessage());
//// }
}
@PostMapping("/softDelete")
public Result softDelete(@RequestParam Integer detailId) {
// try {
refundService.softDelete(detailId);
return Result.success();
// } catch (Exception e) {
// log.warn(Arrays.toString(e.getStackTrace()));
// return Result.error(e.getMessage());
// }
} }
@PostMapping("/update") @PostMapping("/update")

34
demo/refund/src/main/java/com/example/fefund/mapper/RefundMapper.java

@ -1,4 +1,4 @@
package com.example.fefund.mapper;
package com.example.fefund.mapper ;
import com.example.commons.domain.entity.Detail; import com.example.commons.domain.entity.Detail;
import org.apache.ibatis.annotations.*; import org.apache.ibatis.annotations.*;
@ -10,15 +10,23 @@ public interface RefundMapper {
@Insert({ @Insert({
"insert into detail", "insert into detail",
"(jwcord_id,refund_type,refund_goods,recharge_coin,free_coin,task_coin,remark,admin_id,creat_time)",
"(jwcode,refund_type,refund_goods,recharge_coin,free_coin,task_coin,remark,admin_id,create_time,update_type)",
"values", "values",
"(#{jwcode},#{refundType},#{refundGoods},#{rechargeCoin},#{freeCoin},#{taskCoin},#{remark},#{adminId},now())"
"(#{jwcode},#{refundType},#{refundGoods},#{rechargeCoin},#{freeCoin},#{taskCoin},#{remark},#{adminId},now(),#{updateType})"
}) })
@Options(useGeneratedKeys = true, keyColumn = "detail_id", keyProperty = "detailId") @Options(useGeneratedKeys = true, keyColumn = "detail_id", keyProperty = "detailId")
int insert(Detail detail); int insert(Detail detail);
@Select({
"insert into audit",
"(jwcode,refund_id,admin_id,create_time,detail_id)",
"values",
"(,#{jwcode},#{refundId},#{adminId},now(),#{detailId})"
})
int insertAudit(Detail detail);
@Update("update detail set detail_flag = 0 where detail_id = #{detailId}") @Update("update detail set detail_flag = 0 where detail_id = #{detailId}")
int update(Integer detailId);
int update(@Param("detailId") Integer detailId);
@Select("select * from detail where detail_id = #{detailId} and detail_flag = 1") @Select("select * from detail where detail_id = #{detailId} and detail_flag = 1")
Detail selectByDetailId(Integer detailId); Detail selectByDetailId(Integer detailId);
@ -26,20 +34,28 @@ public interface RefundMapper {
@Select({ @Select({
"<script>", "<script>",
"SELECT d.*, a.area AS adminArea",
"SELECT d.*,",
" a.area AS adminArea, a.name AS adminName,",
" u.name AS userName,",
" au.status AS auditStatus, au.reson AS auditReson",
"FROM detail d", "FROM detail d",
"LEFT JOIN admin a ON d.admin_id = a.admin_id", "LEFT JOIN admin a ON d.admin_id = a.admin_id",
"WHERE d.detail_flag = 1",
"<where>",
"LEFT JOIN user u ON d.jwcode = u.jwcode",
"LEFT JOIN audit au ON d.detail_id = au.refund_id",
"WHERE d.detail_flag = 1 and update_type ='退款'",
"<if test='jwcode != null'>AND d.jwcode = #{jwcode}</if>", "<if test='jwcode != null'>AND d.jwcode = #{jwcode}</if>",
"<if test='refundType != null'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if>", "<if test='refundType != null'>AND d.refund_type LIKE CONCAT('%', #{refundType}, '%')</if>",
"<if test='refundGoods != null'>AND d.refund_goods = #{refundGoods}</if>",
"<if test='refundGoods != null'>AND d.refund_goods LIKE CONCAT('%', #{refundGoods}, '%')</if>",
"<if test='rechargeCoin != null'>AND d.recharge_coin = #{rechargeCoin}</if>", "<if test='rechargeCoin != null'>AND d.recharge_coin = #{rechargeCoin}</if>",
"<if test='freeCoin != null'>AND d.free_coin = #{freeCoin}</if>", "<if test='freeCoin != null'>AND d.free_coin = #{freeCoin}</if>",
"<if test='taskCoin != null'>AND d.task_coin = #{taskCoin}</if>", "<if test='taskCoin != null'>AND d.task_coin = #{taskCoin}</if>",
"<if test='remark != null'>AND d.remark LIKE CONCAT('%', #{remark}, '%')</if>", "<if test='remark != null'>AND d.remark LIKE CONCAT('%', #{remark}, '%')</if>",
"<if test='adminId != null'>AND d.admin_id = #{adminId}</if>", "<if test='adminId != null'>AND d.admin_id = #{adminId}</if>",
"</where>",
"<if test='adminArea != null'>AND a.area LIKE CONCAT('%', #{adminArea}, '%')</if>", // admin表字段过滤
"<if test='adminName != null'>AND a.name LIKE CONCAT('%', #{adminName}, '%')</if>", // admin表字段过滤
"<if test='userName != null'>AND u.name LIKE CONCAT('%', #{userName}, '%')</if>", // user表字段过滤
"<if test='auditStatus != null'>AND au.status = #{auditStatus}</if>", // audit 表字段过滤
"<if test='auditReson != null'>AND au.reson LIKE CONCAT('%', #{auditReson}, '%')</if>", // audit表字段过滤
"</script>" "</script>"
}) })
List<Detail> select(Detail detail); List<Detail> select(Detail detail);

28
demo/refund/src/main/java/com/example/fefund/service/RefundServiceImpl.java

@ -1,6 +1,5 @@
package com.example.fefund.service; package com.example.fefund.service;
import com.example.commons.domain.entity.Detail; import com.example.commons.domain.entity.Detail;
import com.example.commons.sevice.RefundService; import com.example.commons.sevice.RefundService;
import com.example.fefund.mapper.RefundMapper; import com.example.fefund.mapper.RefundMapper;
@ -20,12 +19,18 @@ import java.util.List;
public class RefundServiceImpl implements RefundService { public class RefundServiceImpl implements RefundService {
private final RefundMapper refundMapper; private final RefundMapper refundMapper;
@Override @Override
public int add(Detail detail) throws Exception {
public int add(Detail detail) {
return refundMapper.insert(detail); return refundMapper.insert(detail);
} }
@Override @Override
public void edit(Detail newDetail) throws Exception {
public int addAudit(Detail detail) {
return refundMapper.insertAudit(detail);
}
//自动软删除数据加更新数据
@Override
public void edit(Detail newDetail) {
// 获取旧的明细记录 // 获取旧的明细记录
Detail oldDetail = refundMapper.selectByDetailId(newDetail.getDetailId()); Detail oldDetail = refundMapper.selectByDetailId(newDetail.getDetailId());
@ -36,6 +41,16 @@ public class RefundServiceImpl implements RefundService {
// 软删除旧记录 // 软删除旧记录
refundMapper.update(oldDetail.getDetailId()); refundMapper.update(oldDetail.getDetailId());
// 将新的字段值复制到旧记录中未修改的字段保持旧值
if (newDetail.getJwcode() == null) newDetail.setJwcode(oldDetail.getJwcode());
if (newDetail.getRefundType() == null) newDetail.setRefundType(oldDetail.getRefundType());
if (newDetail.getRefundGoods() == null) newDetail.setRefundGoods(oldDetail.getRefundGoods());
if (newDetail.getRechargeCoin() == null) newDetail.setRechargeCoin(oldDetail.getRechargeCoin());
if (newDetail.getFreeCoin() == null) newDetail.setFreeCoin(oldDetail.getFreeCoin());
if (newDetail.getTaskCoin() == null) newDetail.setTaskCoin(oldDetail.getTaskCoin());
if (newDetail.getRemark() == null) newDetail.setRemark(oldDetail.getRemark());
if (newDetail.getAdminId() == null) newDetail.setAdminId(oldDetail.getAdminId());
// 插入新记录 // 插入新记录
newDetail.setDetailId(null); // 清空 ID让其自动生成 newDetail.setDetailId(null); // 清空 ID让其自动生成
newDetail.setDetailFlag(1); // 确保新记录未被删除 newDetail.setDetailFlag(1); // 确保新记录未被删除
@ -43,8 +58,13 @@ public class RefundServiceImpl implements RefundService {
} }
@Override @Override
public int softDelete(Integer detailId) {
return refundMapper.update(detailId);
}
@Override
public Detail selectByDetailId(Integer detailId) { public Detail selectByDetailId(Integer detailId) {
return null;
return refundMapper.selectByDetailId(detailId);
} }
@Override @Override

Loading…
Cancel
Save