|
@@ -29,5 +29,78 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <select id="selectUserByConfidence" resultType="org.starter.myBatis.pojo.User">
|
|
|
+ select *
|
|
|
+ from tb_user
|
|
|
+ <where>
|
|
|
+ <choose>
|
|
|
+ <when test="username != null and user != ''">
|
|
|
+ username like #{userName}
|
|
|
+ </when>
|
|
|
+ <when test="gender != null and gender != ''">
|
|
|
+ gender = #{gender}
|
|
|
+ </when>
|
|
|
+ <when test="province != null and province != ''">
|
|
|
+ province like #{province}
|
|
|
+ </when>
|
|
|
+ <when test="city != null and city != ''">
|
|
|
+ city like #{city}
|
|
|
+ </when>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <select id="selectUserByConfidences" resultType="org.starter.myBatis.pojo.User">
|
|
|
+ select *
|
|
|
+ from tb_user
|
|
|
+ <where>
|
|
|
+ <if test="username != null and username != ''">
|
|
|
+ username like #{userName}
|
|
|
+ </if>
|
|
|
+ <if test="gender != null and gender != ''">
|
|
|
+ and gender like #{gender}
|
|
|
+ </if>
|
|
|
+ <if test="province != null and province != ''">
|
|
|
+ and province like #{province}
|
|
|
+ </if>
|
|
|
+ <if test="city != null and province != ''">
|
|
|
+ and city like #{city}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <insert id="addUser" useGeneratedKeys="true" keyProperty="id">
|
|
|
+ insert into tb_user (username, password, gender, province, city)
|
|
|
+ values (#{username}, #{password}, #{gender}, #{province}, #{city});
|
|
|
+ </insert>
|
|
|
+ <update id="updateUser">
|
|
|
+ update tb_user
|
|
|
+ set
|
|
|
+ username = #{username},
|
|
|
+ password = #{password},
|
|
|
+ gender = #{gender},
|
|
|
+ province = #{province},
|
|
|
+ city = #{city}
|
|
|
+ where id = #{id};
|
|
|
+ </update>
|
|
|
+ <update id="updateUserInfo">
|
|
|
+ update tb_user
|
|
|
+ <set>
|
|
|
+ <if test="username != null and user != ''">
|
|
|
+ username = #{username}
|
|
|
+ </if>
|
|
|
+ <if test="password != null and password != ''">
|
|
|
+ password = #{password}
|
|
|
+ </if>
|
|
|
+ <if test="gender != null and gender != ''">
|
|
|
+ gender = #{gender}
|
|
|
+ </if>
|
|
|
+ <if test="province != null and province != ''">
|
|
|
+ province = #{province}
|
|
|
+ </if>
|
|
|
+ <if test="city != null and province != ''">
|
|
|
+ city = #{city}
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ </update>
|
|
|
+
|
|
|
|
|
|
</mapper>
|