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.
102 lines
4.3 KiB
102 lines
4.3 KiB
package com.example.demo.mapper;
|
|
|
|
|
|
import com.example.demo.domain.entity.*;
|
|
import com.example.demo.domain.vo.ConsumeDetail;
|
|
import com.example.demo.domain.vo.SumConsume;
|
|
import org.apache.ibatis.annotations.*;
|
|
|
|
import java.util.List;
|
|
|
|
@Mapper
|
|
public interface ConsumeMapper {
|
|
|
|
SumConsume getSumConsume(SumConsume sumConsume);
|
|
List<String> getConsume();
|
|
|
|
//通过id查询user全部信息
|
|
@Select({
|
|
"select * from user where user_id=#{userId}"
|
|
})
|
|
User getByUserId(Integer userId);
|
|
|
|
//通过id查询admin全部信息
|
|
@Select({
|
|
"select * from admin where admin_id=#{adminId}"
|
|
})
|
|
Admin getByadminId(@Param("adminId") Integer adminId);
|
|
//新增消费记录
|
|
@Insert({
|
|
// "insert into detail",
|
|
// "(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,refund_flag,order_code)",
|
|
// "values",
|
|
// "(#{jwcode},#{activityId},#{rechargeWay},#{productId},'金币系统','购买商品',#{refundType},#{refundGoods},#{contactId},#{remark},#{rechargeCoin},#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),1,#{orderCode})"
|
|
"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,refund_flag,create_time,first_recharge,`name`,username,area,product_name)",
|
|
"values ",
|
|
"(#{jwcode},#{orderCode},#{activityId},#{rechargeWay},#{productId},'4','购买商品',#{refundType}" +
|
|
",#{refundGoods},#{contactId},#{remark},#{rechargeCoin}" +
|
|
",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,1,now(),#{firstRecharge},#{name},#{username},#{area},#{productName})"
|
|
})
|
|
// 获取自增主键
|
|
@Options(useGeneratedKeys = true,keyColumn = "detaily_id",keyProperty = "detailyId")
|
|
int insert(DetailY detailY);
|
|
|
|
|
|
|
|
//userName
|
|
//模糊分页查询,查询消费明细
|
|
// @Select({
|
|
// "<script>",
|
|
// "select detail_y.*,admin.name as adminName,product.name as productName from detail_y ",
|
|
// "left join `admin` on detail_y.admin_id=admin.admin_id ",
|
|
// "left join `user` on detail_y.jwcode= user.jwcode ",
|
|
// "left join product on detail_y.product_id= product.product_id ",
|
|
// "<where>",
|
|
//// "`detail_flag`=1 AND update_type = '1'",
|
|
// "update_type=1",
|
|
// "<if test='jwcode!=null'>and detail_y.jwcode =#{jwcode}</if>",
|
|
// "<if test='productName!=null and productName.length>0'>and product.name = #{productName}</if>",
|
|
// "<if test='consumePlatform!=null and consumePlatform.length>0'>and detail_y.consume_platform=#{consumePlatform}</if>",
|
|
// "<if test='consumeType!=null and consumeType.length>0'>and detail_y.consume_type= #{consumeType}</if>",
|
|
// "<if test='startDate != null and endDate != null'>AND detail_y.create_time BETWEEN #{startDate} AND #{endDate}</if>",
|
|
// "<if test='area!=null and area.length>0'>and area=#{area}</if>",
|
|
// "</where>",
|
|
//
|
|
// "<choose>",
|
|
// " <!-- 优先使用前端传入的排序参数 -->",
|
|
// " <when test='sortField != null or sortOrder != null'>",
|
|
// " ORDER BY ${sortField} ${sortOrder}",
|
|
// " </when>",
|
|
// " <!-- 默认排序 -->",
|
|
// " <otherwise>",
|
|
// "ORDER BY detail_y.create_time DESC",
|
|
// " </otherwise>",
|
|
// "</choose>",
|
|
// "</script>"
|
|
// })
|
|
List<ConsumeDetail> select(ConsumeDetail consumeDetail);
|
|
|
|
|
|
//查询消费信息
|
|
@Select({
|
|
"select * from detail_y " ,
|
|
// "inner join product on detail_y.product_id= product.product_id ",
|
|
"where `detail_flag`=1 AND update_type = '1' and jwcode=#{jwcode} AND refund_flag=1"
|
|
})
|
|
List<Detail> getDeatil(String jwcode);
|
|
|
|
|
|
//查询消费信息
|
|
@Select({
|
|
"select * from product",
|
|
" where product_flag=1 and name=#{name}",
|
|
"GROUP BY name"
|
|
})
|
|
List<Product> getProduct(String name);
|
|
|
|
|
|
|
|
|
|
}
|