oestest/ExamSystem-master/out/artifacts/unnamed_jar/mapper/UserMapper.xml

72 lines
2.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!--suppress ALL-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ledao.mapper.UserMapper">
<resultMap id="UserResult" type="User">
<result property="id" column="id"/>
<result property="userName" column="userName"/>
<result property="password" column="password"/>
<result property="type" column="type"/>
</resultMap>
<select id="findByUserName" parameterType="string" resultType="com.ledao.entity.User">
select *
from t_user
where userName = #{userName}
</select>
<update id="update" parameterType="User">
update t_user
<set>
<if test="password != null and password != ''">
password=#{password},
</if>
</set>
where id = #{id}
</update>
<select id="findById" parameterType="integer" resultType="com.ledao.entity.User">
select *
from t_user
where id = #{id}
</select>
<insert id="add" parameterType="User">
insert into t_user (userName, password, type)
values (#{userName}, #{password}, #{type});
</insert>
<select id="list" parameterType="map" resultMap="UserResult">
select *
from t_user
<where>
<if test="userName != null and userName != ''">
and userName like #{userName}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="typeManager != null and typeManager != ''">
and type !='管理员'
</if>
</where>
<if test="start != null and size != null">
limit #{start},#{size}
</if>
</select>
<select id="getCount" parameterType="map" resultType="java.lang.Long">
select count(*)
from t_user
<where>
<if test="userName != null and userName != ''">
and userName like #{userName}
</if>
<if test="type != null and type != ''">
and type = #{type}
</if>
<if test="typeManager != null and typeManager != ''">
and type !='管理员'
</if>
</where>
</select>
</mapper>