You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
119 lines
4.0 KiB
119 lines
4.0 KiB
<?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">
|
|
<!-- 配置Mabatis映射文件 -->
|
|
<mapper namespace="com.dao.BrokenDAO">
|
|
<resultMap type="broken" id="brokenMap">
|
|
<id property="brokenid" column="brokenid" />
|
|
<result property="bno" column="bno" />
|
|
<result property="usersid" column="usersid" />
|
|
<result property="roomsid" column="roomsid" />
|
|
<result property="reason" column="reason" />
|
|
<result property="addtime" column="addtime" />
|
|
<result property="status" column="status" />
|
|
<result property="memo" column="memo" />
|
|
<result property="username" column="username" />
|
|
<result property="roomsname" column="roomsname" />
|
|
</resultMap>
|
|
<!-- 插入语句 DAO通过id调用此配置 -->
|
|
<insert id="insertBroken" parameterType="broken">
|
|
insert into broken(brokenid , bno , usersid , roomsid , reason , addtime , status , memo ) values(#{brokenid} , #{bno} , #{usersid} , #{roomsid} , #{reason} , #{addtime} , #{status} , #{memo} )
|
|
</insert>
|
|
<!-- 更新语句 DAO通过id调用此配置 -->
|
|
<update id="updateBroken" parameterType="broken">
|
|
update broken set bno=#{bno} , usersid=#{usersid} , roomsid=#{roomsid} , reason=#{reason} , addtime=#{addtime} , status=#{status} , memo=#{memo} where brokenid=#{brokenid}
|
|
</update>
|
|
<!-- 按主键删除 DAO通过id调用此配置 -->
|
|
<delete id="deleteBroken" parameterType="String">
|
|
delete from broken where brokenid = #{brokenid}
|
|
</delete>
|
|
<!-- 查询全部信息 DAO通过id调用此配置 -->
|
|
<select id="getAllBroken" resultMap="brokenMap">
|
|
select a.* , b.username , c.roomsname from broken a , users b , rooms c where 1=1 and a.usersid = b.usersid and a.roomsid = c.roomsid order by brokenid desc
|
|
</select>
|
|
|
|
<!-- 按主键查询 DAO通过id调用此配置 -->
|
|
<select id="getBrokenById" parameterType="String" resultMap="brokenMap">
|
|
select a.* , b.username , c.roomsname from broken a , users b , rooms c where 1=1 and a.usersid = b.usersid and a.roomsid = c.roomsid and brokenid=#{brokenid} order by brokenid desc
|
|
</select>
|
|
<!-- 按条件精确查询 DAO通过id调用此配置 -->
|
|
<select id="getBrokenByCond" parameterType="broken" resultMap="brokenMap">
|
|
select a.* , b.username , c.roomsname from broken a , users b , rooms c where 1=1 and a.usersid = b.usersid and a.roomsid = c.roomsid
|
|
<if test="bno != null and '' != bno">
|
|
and a.bno = #{bno}
|
|
</if>
|
|
<if test="usersid != null and '' != usersid">
|
|
and a.usersid = #{usersid}
|
|
</if>
|
|
<if test="roomsid != null and '' != roomsid">
|
|
and a.roomsid = #{roomsid}
|
|
</if>
|
|
<if test="reason != null and '' != reason">
|
|
and a.reason = #{reason}
|
|
</if>
|
|
<if test="addtime != null and '' != addtime">
|
|
and a.addtime = #{addtime}
|
|
</if>
|
|
<if test="status != null and '' != status">
|
|
and a.status = #{status}
|
|
</if>
|
|
<if test="memo != null and '' != memo">
|
|
and a.memo = #{memo}
|
|
</if>
|
|
</select>
|
|
<!-- 按条件模糊查询 DAO通过id调用此配置 -->
|
|
<select id="getBrokenByLike" parameterType="broken" resultMap="brokenMap">
|
|
select a.* , b.username , c.roomsname from broken a , users b , rooms c where 1=1 and a.usersid = b.usersid and a.roomsid = c.roomsid
|
|
<if test="bno != null and '' != bno">
|
|
and a.bno like CONCAT('%', CONCAT(#{bno}, '%'))
|
|
</if>
|
|
<if test="usersid != null and '' != usersid">
|
|
and b.username like CONCAT('%', CONCAT(#{usersid}, '%'))
|
|
</if>
|
|
<if test="roomsid != null and '' != roomsid">
|
|
and c.roomsname like CONCAT('%', CONCAT(#{roomsid}, '%'))
|
|
</if>
|
|
<if test="reason != null and '' != reason">
|
|
and a.reason like CONCAT('%', CONCAT(#{reason}, '%'))
|
|
</if>
|
|
<if test="addtime != null and '' != addtime">
|
|
and a.addtime like CONCAT('%', CONCAT(#{addtime}, '%'))
|
|
</if>
|
|
<if test="status != null and '' != status">
|
|
and a.status like CONCAT('%', CONCAT(#{status}, '%'))
|
|
</if>
|
|
<if test="memo != null and '' != memo">
|
|
and a.memo like CONCAT('%', CONCAT(#{memo}, '%'))
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|