47 lines
2.0 KiB
47 lines
2.0 KiB
package com.example.demo.mapper;
|
|
|
|
|
|
import com.example.demo.domain.entity.Detail;
|
|
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 DetailMapper {
|
|
|
|
@Insert({
|
|
"insert into detail",
|
|
"(jwcode,order_code,activity_id,recharge_way,product_id,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},#{consumeType},#{refundType}" +
|
|
",#{refundGoods},#{contactId},#{remark},#{rechargeCoin}" +
|
|
",#{freeCoin},#{taskCoin},#{adminId},#{updateType},1,now(),#{firstRecharge})"
|
|
})
|
|
@Options(useGeneratedKeys = true,keyColumn = "detail_id",keyProperty = "detailId")
|
|
int add(Detail detail);
|
|
@Select({
|
|
"SELECT * from detail where detail_id =#{detailId}"
|
|
})
|
|
Detail selectByDetailId(Integer detail_id);
|
|
|
|
@Select({
|
|
"<script>",
|
|
"select detail.jwcode,detail.admin_id,detail.detail_id,detail.recharge_coin,detail.free_coin,detail.task_coin," +
|
|
"detail.update_type,detail.create_time, detail.create_admin as adminName ,user.area,user.name as username,audit.status from detail",
|
|
"left join `user` on detail.jwcode = `user`.jwcode",
|
|
"left join audit on detail.detail_id=audit.detail_id",
|
|
"<where>",
|
|
"(status is null or status='1')",
|
|
"<if test='jwcode!=null and jwcode.length>0'>and detail.jwcode=#{jwcode}</if>",
|
|
"<if test='updateType!=null'>and update_type=#{updateType}</if>",
|
|
"<if test='startDate != null and endDate != null'>AND detail.create_time BETWEEN #{startDate} AND #{endDate}</if>",
|
|
"</where>",
|
|
"</script>"
|
|
|
|
})
|
|
List<Detail> select(Detail detail);
|
|
}
|