<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="cn.timer.api.dao.insure.InsurePayMapper"> <!-- 可根据自己的需求,是否要使用 --> <resultMap type="cn.timer.api.bean.insure.InsurePay" id="insurePayMap"> <result property="id" column="id"/> <result property="payStatus" column="pay_status"/> <result property="amount" column="amount"/> <result property="payTime" column="pay_time"/> <result property="endTime" column="end_time"/> <result property="paySerialNo" column="pay_serial_no"/> <result property="payType" column="pay_type"/> <result property="policyId" column="policy_id"/> <result property="serialNumber" column="serial_number"/> <result property="payUrl" column="pay_url"/> </resultMap> <select id="queryObject" resultType="cn.timer.api.bean.insure.InsurePay"> select * from insure_pay where id = #{value} </select> <select id="queryList" resultType="cn.timer.api.bean.insure.InsurePay"> select * from insure_pay <where> <if test="id != null and id != ''">AND `id` = #{id}</if> <if test="payStatus != null and payStatus != ''">AND `pay_status` = #{payStatus}</if> <if test="amount != null and amount != ''">AND `amount` = #{amount}</if> <if test="payTime != null and payTime != ''">AND `pay_time` = #{payTime}</if> <if test="endTime != null and endTime != ''">AND `end_time` = #{endTime}</if> <if test="paySerialNo != null and paySerialNo != ''">AND `pay_serial_no` = #{paySerialNo}</if> <if test="payType != null and payType != ''">AND `pay_type` = #{payType}</if> </where> <choose> <when test="sidx != null and sidx.trim() != ''"> order by ${sidx} ${order} </when> <otherwise> order by id desc </otherwise> </choose> <if test="offset != null and limit != null"> limit #{offset}, #{limit} </if> </select> <select id="queryTotal" resultType="int"> select count(*) from insure_pay <where> <if test="id != null and id != ''">AND `id` = #{id}</if> <if test="payStatus != null and payStatus != ''">AND `pay_status` = #{payStatus}</if> <if test="amount != null and amount != ''">AND `amount` = #{amount}</if> <if test="payTime != null and payTime != ''">AND `pay_time` = #{payTime}</if> <if test="endTime != null and endTime != ''">AND `end_time` = #{endTime}</if> <if test="paySerialNo != null and paySerialNo != ''">AND `pay_serial_no` = #{paySerialNo}</if> <if test="payType != null and payType != ''">AND `pay_type` = #{payType}</if> </where> </select> <insert id="save" parameterType="cn.timer.api.bean.insure.InsurePay"> insert into insure_pay (`id`, `pay_status`, `amount`, `pay_time`, `end_time`, `pay_serial_no`, `pay_type`) values (#{id}, #{payStatus}, #{amount}, #{payTime}, #{endTime}, #{paySerialNo}, #{payType}) </insert> <insert id="saveSelective" parameterType="cn.timer.api.bean.insure.InsurePay"> insert into insure_pay ( <if test="id != null">`id`</if> <if test="payStatus != null">,`pay_status`</if> <if test="amount != null">,`amount`</if> <if test="payTime != null">,`pay_time`</if> <if test="endTime != null">,`end_time`</if> <if test="paySerialNo != null">,`pay_serial_no`</if> <if test="payType != null">,`pay_type`</if> ) values ( <if test="id != null">#{id}</if> <if test="payStatus != null">,#{payStatus}</if> <if test="amount != null">,#{amount}</if> <if test="payTime != null">,#{payTime}</if> <if test="endTime != null">,#{endTime}</if> <if test="paySerialNo != null">,#{paySerialNo}</if> <if test="payType != null">,#{payType}</if> ) </insert> <insert id="saveList" parameterType="cn.timer.api.bean.insure.InsurePay"> insert into insure_pay ( `id`, `pay_status`, `amount`, `pay_time`, `end_time`, `pay_serial_no`, `pay_type` ) values <foreach collection="list" item="item" index="index" separator=","> ( #{item.id}, #{item.payStatus}, #{item.amount}, #{item.payTime}, #{item.endTime}, #{item.paySerialNo}, #{item.payType} ) </foreach> </insert> <update id="update" parameterType="cn.timer.api.bean.insure.InsurePay"> update insure_pay <set> <if test="payStatus != null">`pay_status` = #{payStatus},</if> <if test="amount != null">`amount` = #{amount},</if> <if test="payTime != null">`pay_time` = #{payTime},</if> <if test="endTime != null">`end_time` = #{endTime},</if> <if test="paySerialNo != null">`pay_serial_no` = #{paySerialNo},</if> <if test="payType != null">`pay_type` = #{payType}</if> </set> where id = #{id} </update> <delete id="delete"> delete from insure_pay where id = #{value} </delete> <delete id="deleteBatch"> delete from insure_pay where id in <foreach item="id" collection="array" open="(" separator="," close=")"> #{id} </foreach> </delete> </mapper>