|
|
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,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,first_recharge)", "values ", "(#{jwcode},#{activityId},#{rechargeWay},#{productId},#{consumePlatform},#{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 =#{detail}" }) Detail selectById(Integer id); @Select({ "<script>", "select detail.*,admin.name,admin.area,user.name as uname,audit.status from detail", "inner join `admin` on detail.admin_id = `admin`.admin_id", "inner 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 updateType.length>0'>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); }
|