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

mapper.AdminRoleMapperPlus.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.AdminRoleMapper">
  <select id="page" parameterType="cn.ipokerface.common.model.query.PaginationSortableSearchQueryModel"
          resultType="cn.ipokerface.admin.entity.AdminRole">
    SELECT
    ID AS id,
    NAME AS name,
    REMARK AS remark,
    VERSION AS version,
    STATE AS state,
    CREATED_ID AS createdId,
    UPDATED_ID AS updatedId,
    CREATED_TIME AS createdTime,
    UPDATED_TIME AS updatedTime
    FROM ADMIN_ROLE
    <where>
      <if test="query != null and query != ''">
        AND  NAME LIKE CONCAT('%',#{query},'%')
      </if>
    </where>
    ORDER BY
    <choose>
      <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_ROLE
    <where>
      <if test="query != null and query != ''">
        AND NAME LIKE CONCAT('%',#{query},'%')
      </if>
    </where>
  </select>


  <select id="selectAll" resultType="cn.ipokerface.admin.entity.AdminRole">
    SELECT
      ID AS id,
      NAME AS name,
      REMARK AS remark,
      VERSION AS version,
      STATE AS state,
      CREATED_ID AS createdId,
      UPDATED_ID AS updatedId,
      CREATED_TIME AS createdTime,
      UPDATED_TIME AS updatedTime
    FROM ADMIN_ROLE
  </select>

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

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

  <update id="updateRole">
    UPDATE ADMIN_ROLE SET
                          NAME = #{name},
                          REMARK = #{remark},
                          VERSION = #{version},
                          UPDATED_TIME = #{updatedTime}
    WHERE ID = #{id}
  </update>
</mapper>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy