Idea新建一个springBoot项目
<mapper namespace="">
<!--<insert parameterType="">-->
<!--INSERT INTO person-->
<!--<trim prefix="(" suffix=")" suffixOverrides=",">-->
<!--<if test="age != null">-->
<!--age,-->
<!--</if>-->
<!--<if test="name != null and name != ''">-->
<!--name,-->
<!--</if>-->
<!--</trim>-->
<!--<trim prefix="VALUES (" suffix=")" suffixOverrides=",">-->
<!--<if test="age != null">-->
<!--#{age},-->
<!--</if>-->
<!--<if test="name != null and name != ''">-->
<!--#{name},-->
<!--</if>-->
<!--</trim>-->
<!--</insert>-->
<insert id="insertNormal" parameterType="" >
INSERT INTO admin
<trim prefix="(" suffix=")" suffixOverrides=",">
phone,password,
<if test="name != null">
name,
</if>
<if test="state != null">
state,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{phone},#{password},
<if test="name != null">
#{name},
</if>
<if test="state != null">
#{state}
</if>
</trim>
</insert>
<select id="isExist" resultType="" parameterType="">
SELECT *
FROM admin
<trim prefix="WHERE">
<if test="phone != null">
phone = #{phone}
</if>
<if test="password != null and ()>0">
AND password = #{password}
</if>
</trim>
</select>
<update id="update" parameterType="">
UPDATE admin
<trim prefix="SET" suffixOverrides=",">
<if test="phone != null and () == 11">
phone = #{phone}
</if>
<if test="password != null and () >0">
password = #{password}
</if>
<if test="name != null and () > 0">
name = #{name}
</if>
</trim>
</update>
<select id="selectAll" resultType="">
SELECT *
FROM admin
WHERE state != 404
</select>
<!--<select resultType="">-->
<!---->
<!--</select>-->
</mapper>