You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
2.0 KiB

  1. package com.example.demo.mapper;
  2. import com.example.demo.domain.entity.Detail;
  3. import org.apache.ibatis.annotations.Insert;
  4. import org.apache.ibatis.annotations.Mapper;
  5. import org.apache.ibatis.annotations.Options;
  6. import org.apache.ibatis.annotations.Select;
  7. import java.util.List;
  8. @Mapper
  9. public interface DetailMapper {
  10. @Insert({
  11. "insert into detail",
  12. "(jwcode,activity_id,recharge_way,product_id,consume_platform,consume_type,refund_type,refund_goods," +
  13. "contact_id,remark,recharge_coin,free_coin,task_coin,admin_id,update_type,detail_flag,create_time,first_recharge)",
  14. "values ",
  15. "(#{jwcode},#{activityId},#{rechargeWay},#{productId},#{consumePlatform},#{consumeType},#{refundType}" +
  16. ",#{refundGoods},#{contactId},#{remark},#{rechargeCoin}" +
  17. ",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),#{firstRecharge})"
  18. })
  19. @Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId")
  20. int add(Detail detail);
  21. @Select({
  22. "SELECT * from detail where detail =#{detail}"
  23. })
  24. Detail selectById(Integer id);
  25. @Select({
  26. "<script>",
  27. "select detail.*,admin.name,admin.area,user.name as uname,audit.status from detail",
  28. "inner join `admin` on detail.admin_id = `admin`.admin_id",
  29. "inner join `user` on detail.jwcode = `user`.jwcode",
  30. "left join audit on detail.detail_id=audit.detail_id",
  31. "<where>",
  32. "(status is null or status='1')",
  33. "<if test='jwcode!=null and jwcode.length>0'>and detail.jwcode=#{jwcode}</if>",
  34. "<if test='updateType!=null and updateType.length>0'>and update_type=#{updateType}</if>",
  35. "<if test='startDate != null and endDate != null'>AND detail.create_time BETWEEN #{startDate} AND #{endDate}</if>",
  36. "</where>",
  37. "</script>"
  38. })
  39. List<Detail> select(Detail detail);
  40. }