<?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.wisenergy.mapper.AccountMapper"> <resultMap id="AccountMap" type="cn.wisenergy.model.app.AccountInfo"> <id column="id" property="id"/> <result column="user_name" property="userName"/> <result column="password" property="password"/> <result column="head_image" property="headImage"/> <result column="is_delete" property="isDelete"/> <result column="create_time" property="createTime"/> <result column="update_time" property="updateTime"/> </resultMap> <sql id="table"> account </sql> <sql id="cols_all"> id, <include refid="cols_exclude_id"/> </sql> <sql id="cols_exclude_id"> user_name,password,head_image,is_delete,create_time,update_time </sql> <sql id="vals"> #{userName},#{password},#{headImage}, #{isDelete},now(),now() </sql> <sql id="updateCondition"> <if test="userName != null">user_name = #{userName},</if> <if test="password != null">password =#{password},</if> <if test="headImage != null">head_image =#{headImage},</if> <if test="isDelete != null">is_delete = #{isDelete},</if> update_time =now() </sql> <sql id="criteria"> <if test="id != null">id = #{id}</if> <if test="userName != null">and user_name = #{userName}</if> <if test="password != null">and password =#{password}</if> <if test="headImage != null">and head_image =#{headImage}</if> <if test="isDelete != null">and is_delete = #{isDelete}</if> <if test="createTime != null">and create_time >= #{createTime}</if> <if test="updateTime != null">and #{updateTime} >= update_time</if> </sql> <select id="getAccountInfo" resultMap="AccountMap" parameterType="map"> select <include refid="cols_all"/> from <include refid="table"/> <where> user_name = #{userName} and is_delete=0 </where> </select> </mapper>