123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?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="com.example.mapper.CertificationMapper">
- <sql id="Base_Column_List">
- id,user_id,name,avatar,phone,card_no,card1,card2,address,status,reason
- </sql>
- <select id="selectAll" resultType="com.example.entity.Certification">
- select
- <include refid="Base_Column_List" />
- from certification
- <where>
- <if test="id != null"> and id = #{id}</if>
- <if test="userId != null"> and user_id = #{userId}</if>
- <if test="name != null"> and name like concat('%', #{name}, '%')</if>
- <if test="avatar != null"> and avatar like concat('%', #{avatar}, '%')</if>
- <if test="phone != null"> and phone like concat('%', #{phone}, '%')</if>
- <if test="cardNo != null"> and card_no like concat('%', #{cardNo}, '%')</if>
- <if test="card1 != null"> and card1 like concat('%', #{card1}, '%')</if>
- <if test="card2 != null"> and card2 like concat('%', #{card2}, '%')</if>
- <if test="address != null"> and address like concat('%', #{address}, '%')</if>
- <if test="status != null"> and status like concat('%', #{status}, '%')</if>
- <if test="reason != null"> and reason like concat('%', #{reason}, '%')</if>
- </where>
- order by id desc
- </select>
- <select id="selectById" resultType="com.example.entity.Certification">
- select
- <include refid="Base_Column_List" />
- from certification
- where id = #{id}
- </select>
- <select id="selectByUserId" resultType="com.example.entity.Certification">
- select
- <include refid="Base_Column_List" />
- from certification
- where user_id = #{userId}
- </select>
- <delete id="deleteById">
- delete from certification
- where id = #{id}
- </delete>
- <insert id="insert" parameterType="com.example.entity.Certification" useGeneratedKeys="true">
- insert into certification
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,</if>
- <if test="userId != null">user_id,</if>
- <if test="name != null">name,</if>
- <if test="avatar != null">avatar,</if>
- <if test="phone != null">phone,</if>
- <if test="cardNo != null">card_no,</if>
- <if test="card1 != null">card1,</if>
- <if test="card2 != null">card2,</if>
- <if test="address != null">address,</if>
- <if test="status != null">status,</if>
- <if test="reason != null">reason,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},</if>
- <if test="userId != null">#{userId},</if>
- <if test="name != null">#{name},</if>
- <if test="avatar != null">#{avatar},</if>
- <if test="phone != null">#{phone},</if>
- <if test="cardNo != null">#{cardNo},</if>
- <if test="card1 != null">#{card1},</if>
- <if test="card2 != null">#{card2},</if>
- <if test="address != null">#{address},</if>
- <if test="status != null">#{status},</if>
- <if test="reason != null">#{reason},</if>
- </trim>
- </insert>
- <update id="updateById" parameterType="com.example.entity.Certification">
- update certification
- <set>
- <if test="userId != null">
- user_id = #{userId},
- </if>
- <if test="name != null">
- name = #{name},
- </if>
- <if test="avatar != null">
- avatar = #{avatar},
- </if>
- <if test="phone != null">
- phone = #{phone},
- </if>
- <if test="cardNo != null">
- card_no = #{cardNo},
- </if>
- <if test="card1 != null">
- card1 = #{card1},
- </if>
- <if test="card2 != null">
- card2 = #{card2},
- </if>
- <if test="address != null">
- address = #{address},
- </if>
- <if test="status != null">
- status = #{status},
- </if>
- <if test="reason != null">
- reason = #{reason},
- </if>
- </set>
- where id = #{id}
- </update>
- </mapper>
|