1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
| <?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.course.dao.BookInfoMapper"> <resultMap id="BaseResultMap" type="com.course.entity.BookInfo"> <id column="bookid" jdbcType="INTEGER" property="bookid" /> <result column="bookname" jdbcType="VARCHAR" property="bookname" /> <result column="booktype" jdbcType="VARCHAR" property="booktype" /> <result column="bookauthor" jdbcType="VARCHAR" property="bookauthor" /> <result column="publishpress" jdbcType="VARCHAR" property="publishpress" /> <result column="publishdate" jdbcType="TIMESTAMP" property="publishdate" /> <result column="borrow_status" jdbcType="INTEGER" property="borrowStatus" /> <result column="created_user" jdbcType="VARCHAR" property="createdUser" /> <result column="created_time" jdbcType="TIMESTAMP" property="createdTime" /> <result column="last_update_time" jdbcType="TIMESTAMP" property="lastUpdateTime" /> </resultMap> <sql id="Base_Column_List"> bookid, bookname, booktype, bookauthor, publishpress, publishdate, borrow_status, created_user, created_time, last_update_time </sql> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from bookinfo where bookid = #{bookid,jdbcType=INTEGER} </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> delete from bookinfo where bookid = #{bookid,jdbcType=INTEGER} </delete> <insert id="insert" parameterType="com.course.entity.BookInfo"> insert into bookinfo (bookid, bookname, booktype, bookauthor, publishpress, publishdate, borrow_status, created_user, created_time, last_update_time) values (#{bookid,jdbcType=INTEGER}, #{bookname,jdbcType=VARCHAR}, #{booktype,jdbcType=VARCHAR}, #{bookauthor,jdbcType=VARCHAR}, #{publishpress,jdbcType=VARCHAR}, #{publishdate,jdbcType=TIMESTAMP}, #{borrowStatus,jdbcType=INTEGER}, #{createdUser,jdbcType=VARCHAR}, #{createdTime,jdbcType=TIMESTAMP}, #{lastUpdateTime,jdbcType=TIMESTAMP}) </insert> <insert id="insertSelective" parameterType="com.course.entity.BookInfo"> insert into bookinfo <trim prefix="(" suffix=")" suffixOverrides=","> <if test="bookid != null"> bookid, </if> <if test="bookname != null"> bookname, </if> <if test="booktype != null"> booktype, </if> <if test="bookauthor != null"> bookauthor, </if> <if test="publishpress != null"> publishpress, </if> <if test="publishdate != null"> publishdate, </if> <if test="borrowStatus != null"> borrow_status, </if> <if test="createdUser != null"> created_user, </if> <if test="createdTime != null"> created_time, </if> <if test="lastUpdateTime != null"> last_update_time, </if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="bookid != null"> #{bookid,jdbcType=INTEGER}, </if> <if test="bookname != null"> #{bookname,jdbcType=VARCHAR}, </if> <if test="booktype != null"> #{booktype,jdbcType=VARCHAR}, </if> <if test="bookauthor != null"> #{bookauthor,jdbcType=VARCHAR}, </if> <if test="publishpress != null"> #{publishpress,jdbcType=VARCHAR}, </if> <if test="publishdate != null"> #{publishdate,jdbcType=TIMESTAMP}, </if> <if test="borrowStatus != null"> #{borrowStatus,jdbcType=INTEGER}, </if> <if test="createdUser != null"> #{createdUser,jdbcType=VARCHAR}, </if> <if test="createdTime != null"> #{createdTime,jdbcType=TIMESTAMP}, </if> <if test="lastUpdateTime != null"> #{lastUpdateTime,jdbcType=TIMESTAMP}, </if> </trim> </insert> <update id="updateByPrimaryKeySelective" parameterType="com.course.entity.BookInfo"> update bookinfo <set> <if test="bookname != null"> bookname = #{bookname,jdbcType=VARCHAR}, </if> <if test="booktype != null"> booktype = #{booktype,jdbcType=VARCHAR}, </if> <if test="bookauthor != null"> bookauthor = #{bookauthor,jdbcType=VARCHAR}, </if> <if test="publishpress != null"> publishpress = #{publishpress,jdbcType=VARCHAR}, </if> <if test="publishdate != null"> publishdate = #{publishdate,jdbcType=TIMESTAMP}, </if> <if test="borrowStatus != null"> borrow_status = #{borrowStatus,jdbcType=INTEGER}, </if> <if test="createdUser != null"> created_user = #{createdUser,jdbcType=VARCHAR}, </if> <if test="createdTime != null"> created_time = #{createdTime,jdbcType=TIMESTAMP}, </if> <if test="lastUpdateTime != null"> last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP}, </if> </set> where bookid = #{bookid,jdbcType=INTEGER} </update> <update id="updateByPrimaryKey" parameterType="com.course.entity.BookInfo"> update bookinfo set bookname = #{bookname,jdbcType=VARCHAR}, booktype = #{booktype,jdbcType=VARCHAR}, bookauthor = #{bookauthor,jdbcType=VARCHAR}, publishpress = #{publishpress,jdbcType=VARCHAR}, publishdate = #{publishdate,jdbcType=TIMESTAMP}, borrow_status = #{borrowStatus,jdbcType=INTEGER}, created_user = #{createdUser,jdbcType=VARCHAR}, created_time = #{createdTime,jdbcType=TIMESTAMP}, last_update_time = #{lastUpdateTime,jdbcType=TIMESTAMP} where bookid = #{bookid,jdbcType=INTEGER} </update> <select id="queryBookList" parameterType="com.course.entity.BookInfo" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from bookinfo <where> <if test="booktype != null and booktype != 0">booktype = #{booktype}</if> <if test="bookname != null and bookname != ''">and bookname like "%"#{bookname}"%"</if> <if test="borrowStatus != null and borrowStatus != 0">and borrow_status = #{borrowStatus}</if> </where> </select> </mapper>
|