All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapper.AdminAccountMapperPlus.xml Maven / Gradle / Ivy

<?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.ipokerface.admin.mapper.AdminAccountMapper">

  <select id="page" parameterType="cn.ipokerface.common.model.query.PaginationSortableSearchQueryModel"
          resultType="cn.ipokerface.admin.entity.AccountEntity">
    SELECT
        ID AS id,
        USERNAME AS username,
        NAME AS name,
        STATUS AS status,
        MOBILE AS mobile,
        REMARK AS remark,
        UNIX_TIMESTAMP(CREATED_TIME)*1000 AS createdTimestamp
    FROM ADMIN_ACCOUNT
    <where>
      <if test="query != null and query != ''">
        AND ( USERNAME LIKE CONCAT('%',#{query},'%') OR NAME LIKE CONCAT('%',#{query},'%'))
      </if>
    </where>
    ORDER BY
    <choose>
      <when test="prop == 'username'">
        USERNAME 
      </when>
      <when test="prop == 'name'">
        NAME
      </when>
      <otherwise>
        CREATED_TIME
      </otherwise>
    </choose>
    <choose>
      <when test="sort != null">
        ${sort.desc}
      </when>
      <otherwise>
        DESC
      </otherwise>
    </choose>
    LIMIT #{start},#{size}
  </select>

  <select id="total" parameterType="cn.ipokerface.common.model.query.PaginationSortableSearchQueryModel"
          resultType="long">
    SELECT
    COUNT(ID)
    FROM ADMIN_ACCOUNT
    <where>
      <if test="query != null and query != ''">
        AND ( USERNAME LIKE CONCAT('%',#{query},'%') OR NAME LIKE CONCAT('%',#{query},'%'))
      </if>
    </where>
  </select>

  <select id="selectByUsername" parameterType="string" resultMap="BaseResultMap">

    select 
    <include refid="Base_Column_List" />
    from ADMIN_ACCOUNT
    where USERNAME = #{username}
    LIMIT 1
  </select>

  <update id="updatePassword">
    UPDATE ADMIN_ACCOUNT SET PASSWORD = #{password}
    WHERE ID = #{accountId}
  </update>

  <update id="updateAccount">
    UPDATE ADMIN_ACCOUNT SET
                             NAME = #{name},
                             MOBILE = #{mobile},
                             REMARK = #{remark},
                             VERSION = #{version},
                             UPDATED_TIME = #{updatedTime}
    WHERE ID = #{id}
  </update>

  <delete id="delete" parameterType="list">

    DELETE FROM ADMIN_ACCOUNT
    where ID IN
    <foreach collection="list" item="item" open="(" close=")" separator=",">
      #{item}
    </foreach>
  </delete>

</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy