|
|
@ -1,9 +1,6 @@ |
|
|
|
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 org.apache.ibatis.annotations.*; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -15,10 +12,10 @@ import java.util.List; |
|
|
|
public interface ConsumeMapper { |
|
|
|
|
|
|
|
//通过id查询user全部信息 |
|
|
|
@Select({ |
|
|
|
@Select({ |
|
|
|
"select * from user where user_id=#{userId}" |
|
|
|
}) |
|
|
|
User getByUserId(Integer userId); |
|
|
|
}) |
|
|
|
User getByUserId(Integer userId); |
|
|
|
|
|
|
|
//通过id查询admin全部信息 |
|
|
|
@Select({ |
|
|
@ -28,9 +25,9 @@ User getByUserId(Integer userId); |
|
|
|
//新增消费记录 |
|
|
|
@Insert({ |
|
|
|
"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", |
|
|
|
"(#{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") |
|
|
@ -38,22 +35,46 @@ User getByUserId(Integer userId); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//userName |
|
|
|
//模糊分页查询,查询消费明细 |
|
|
|
@Select({ |
|
|
|
"<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 user on detail.jwcode= user.jwcode ", |
|
|
|
"inner join product on detail.product_id= product.product_id ", |
|
|
|
"<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'>", |
|
|
|
"and create_time between #{searchStartTime} and #{searchEndTime}", |
|
|
|
"and detail.create_time between #{searchStartTime} and #{searchEndTime}", |
|
|
|
"</if>", |
|
|
|
"</where>", |
|
|
|
"</script>" |
|
|
|
}) |
|
|
|
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); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |