| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 | <?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.kmall.admin.dao.UserDao">    <resultMap type="com.kmall.admin.entity.UserEntity" id="userMap">        <result property="id" column="id"/>        <result property="username" column="username"/>        <result property="password" column="password"/>        <result property="gender" column="gender"/>        <result property="birthday" column="birthday"/>        <result property="registerTime" column="register_time"/>        <result property="lastLoginTime" column="last_login_time"/>        <result property="lastLoginIp" column="last_login_ip"/>        <result property="userLevelId" column="user_level_id"/>        <result property="nickname" column="nickname"/>        <result property="mobile" column="mobile"/>        <result property="registerIp" column="register_ip"/>        <result property="avatar" column="avatar"/>        <result property="weixinOpenid" column="weixin_openid"/>        <result property="idNo" column="id_no"/>        <result property="lastFaceTime" column="last_face_time"/>    </resultMap>    <select id="queryObject" resultType="com.kmall.admin.entity.UserEntity">		select *		from mall_user		where id = #{id}	</select>    <select id="queryList" resultType="com.kmall.admin.entity.UserEntity">        SELECT DISTINCT        mall_user.*        ,mall_user_level.NAME levelName        FROM        mall_user        LEFT JOIN mall_user_level ON mall_user.user_level_id = mall_user_level.id        LEFT JOIN mall_merch_user mu ON mall_user.id = mu.user_id        LEFT JOIN mall_store s on mu.store_id = s.id        WHERE 1=1        <if test="storeId != null and storeId != ''">            and mu.store_id = #{storeId}        </if>        <if test="merchSn != null and merchSn.trim() != ''">            and mu.merch_sn = #{merchSn}        </if>        <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">            AND s.third_party_merch_code = #{thirdPartyMerchCode}        </if>        <if test="username != null and username.trim() != ''">            and mall_user.username like concat('%',#{username},'%')        </if>        <if test="mobile != null and mobile.trim() != ''">            and mall_user.mobile like concat('%',#{mobile},'%')        </if>        <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(distinct mall_user.id)        FROM        mall_store s        LEFT JOIN mall_merch_user mu ON mu.store_id = s.id        left join mall_user on mall_user.id = mu.user_id        LEFT JOIN mall_user_level ON mall_user.user_level_id = mall_user_level.id        WHERE 1=1        <if test="storeId != null and storeId != ''">            and mu.store_id = #{storeId}        </if>        <if test="merchSn != null and merchSn.trim() != ''">            and mu.merch_sn = #{merchSn}        </if>        <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">            AND s.third_party_merch_code = #{thirdPartyMerchCode}        </if>        <if test="username != null and username.trim() != ''">            and username like concat('%',#{username},'%')        </if>        <if test="mobile != null and mobile.trim() != ''">            and mobile like concat('%',#{mobile},'%')        </if>    </select>    <insert id="save" parameterType="com.kmall.admin.entity.UserEntity" useGeneratedKeys="true" keyProperty="id">		insert into mall_user(			`username`,			`password`,			`id_no`,			`gender`,			`birthday`,			`register_time`,			`last_login_time`,			`last_login_ip`,			`user_level_id`,			`nickname`,			`mobile`,			`register_ip`,			`avatar`,			`weixin_openid`,			last_face_time)		values(			#{username},			#{password},			#{idNo},			#{gender},			#{birthday},			#{registerTime},			#{lastLoginTime},			#{lastLoginIp},			#{userLevelId},			#{nickname},			#{mobile},			#{registerIp},			#{avatar},			#{weixinOpenid},			#{lastFaceTime})	</insert>    <update id="update" parameterType="com.kmall.admin.entity.UserEntity">        update mall_user        <set>            <if test="username != null">`username` = #{username},</if>            <if test="password != null">`password` = #{password},</if>            <if test="gender != null">`gender` = #{gender},</if>            <if test="birthday != null">`birthday` = #{birthday},</if>            <if test="registerTime != null">`register_time` = #{registerTime},</if>            <if test="lastLoginTime != null">`last_login_time` = #{lastLoginTime},</if>            <if test="lastLoginIp != null">`last_login_ip` = #{lastLoginIp},</if>            <if test="userLevelId != null">`user_level_id` = #{userLevelId},</if>            <if test="nickname != null">`nickname` = #{nickname},</if>            <if test="mobile != null">`mobile` = #{mobile},</if>            <if test="registerIp != null">`register_ip` = #{registerIp},</if>            <if test="avatar != null">`avatar` = #{avatar},</if>            <if test="weixinOpenid != null">`weixin_openid` = #{weixinOpenid}</if>            <if test="lastFaceTime != null">`last_face_time` = #{lastFaceTime}</if>        </set>        where id = #{id}    </update>    <delete id="delete">		delete from mall_user where id = #{value}	</delete>    <delete id="deleteBatch">        delete from mall_user where id in        <foreach item="id" collection="array" open="(" separator="," close=")">            #{id}        </foreach>    </delete>    <select id="queryByMobile" resultType="com.kmall.admin.entity.UserEntity">		select *		from mall_user		where mobile = #{mobile}	</select></mapper>
 |