Drug administration system/src/com/hqyj/dao/User.xml
(完整代码) 1KB<?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.hqyj.dao.UserDao">
<!-- namespace必须与对应接口全类名一致 ;id必须与对应接口的某个方法名一致-->
<select id="queryAll" resultType="com.hqyj.bean.User">
select * from user
</select>
<select id="add" resultType="com.hqyj.bean.User">
insert into user(username,password,usertype) values(#{username},#{password},#{usertype})
</select>
<delete id="delete" parameterType="int">
delete from user where id=#{id}
</delete>
<select id="queryById" parameterType="int" resultType="com.hqyj.bean.User">
select * from user where id=#{id}
</select>
<select id="update" resultType="com.hqyj.bean.User">
update user set username=#{username},password=#{password},usertype=#{usertype} where id=#{id}
</select>
<sql id="user_where">
<!-- where标签的作用:会自动向sql语句中添加where关键字; 会去掉第一个条件的and关键字-->
<where>
<if test="username!=null and username!=''">
and username=#{username}
</if>
<if test="usertype!=3">
and usertype=#{usertype}
</if>
</where>
</sql>
<select id="queryByUsernameUserType" resultType="com.hqyj.bean.User">
select * from user
<include refid="user_where"></include>
</select>
<select id="queryByName" resultType="com.hqyj.bean.User">
select * from user where username=#{username}
</select>
</mapper>
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。