66 lines
1.8 KiB
XML
66 lines
1.8 KiB
XML
<?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.iocoder.mall.admin.dao.AdminMapper">
|
|
|
|
<sql id="FIELDS">
|
|
id, username, nickname, password, status,
|
|
create_time
|
|
</sql>
|
|
|
|
<select id="selectListByNicknameLike" resultType="AdminDO">
|
|
SELECT
|
|
<include refid="FIELDS" />
|
|
FROM admin
|
|
<where>
|
|
<if test="nickname != null">
|
|
nickname LIKE "%"#{nickname}"%"
|
|
</if>
|
|
AND deleted = 0
|
|
</where>
|
|
LIMIT #{offset}, #{limit}
|
|
</select>
|
|
|
|
<select id="selectCountByNicknameLike" resultType="Integer">
|
|
SELECT
|
|
COUNT(1)
|
|
FROM admin
|
|
<where>
|
|
<if test="nickname != null">
|
|
nickname LIKE "%"#{nickname}"%"
|
|
</if>
|
|
AND deleted = 0
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectById" parameterType="Integer" resultType="AdminDO">
|
|
SELECT
|
|
<include refid="FIELDS" />
|
|
FROM admin
|
|
WHERE id = #{id}
|
|
AND deleted = 0
|
|
</select>
|
|
|
|
<update id="update" parameterType="RoleDO">
|
|
UPDATE admin
|
|
<set>
|
|
<if test="username != null">
|
|
, username = #{username}
|
|
</if>
|
|
<if test="nickname != null">
|
|
, nickname = #{nickname}
|
|
</if>
|
|
<if test="password != null">
|
|
, password = #{password}
|
|
</if>
|
|
<if test="status != null">
|
|
, status = #{status}
|
|
</if>
|
|
<if test="deleted != null">
|
|
, deleted = #{deleted}
|
|
</if>
|
|
</set>
|
|
WHERE id = #{id}
|
|
</update>
|
|
|
|
</mapper>
|