|
@@ -0,0 +1,108 @@
|
|
|
+<?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.ruoyi.system.mapper.StuTextBookMapper">
|
|
|
+
|
|
|
+ <resultMap type="StuTextBook" id="StuTextBookResult">
|
|
|
+ <result property="id" column="id" />
|
|
|
+ <result property="name" column="name" />
|
|
|
+ <result property="price" column="price" />
|
|
|
+ <result property="discountPrice" column="discount_price" />
|
|
|
+ <result property="amount" column="amount" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="delFlag" column="del_flag" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectStuTextBookVo">
|
|
|
+ select id, name, price, discount_price, amount, remark, del_flag, create_by, create_time, update_by, update_time from stu_text_book
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="selectStuTextBookList" parameterType="StuTextBook" resultMap="StuTextBookResult">
|
|
|
+ <include refid="selectStuTextBookVo"/>
|
|
|
+ <where>
|
|
|
+ del_flag = 0
|
|
|
+ <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
|
|
|
+ <if test="price != null "> and price = #{price}</if>
|
|
|
+ <if test="discountPrice != null "> and discount_price = #{discountPrice}</if>
|
|
|
+ <if test="amount != null "> and amount = #{amount}</if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectStuTextBookById" parameterType="String" resultMap="StuTextBookResult">
|
|
|
+ <include refid="selectStuTextBookVo"/>
|
|
|
+ where id = #{id}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <insert id="insertStuTextBook" parameterType="StuTextBook">
|
|
|
+ insert into stu_text_book
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">id,</if>
|
|
|
+ <if test="name != null">name,</if>
|
|
|
+ <if test="price != null">price,</if>
|
|
|
+ <if test="discountPrice != null">discount_price,</if>
|
|
|
+ <if test="amount != null">amount,</if>
|
|
|
+ <if test="remark != null">remark,</if>
|
|
|
+ <if test="delFlag != null">del_flag,</if>
|
|
|
+ <if test="createBy != null">create_by,</if>
|
|
|
+ <if test="createTime != null">create_time,</if>
|
|
|
+ <if test="updateBy != null">update_by,</if>
|
|
|
+ <if test="updateTime != null">update_time,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="name != null">#{name},</if>
|
|
|
+ <if test="price != null">#{price},</if>
|
|
|
+ <if test="discountPrice != null">#{discountPrice},</if>
|
|
|
+ <if test="amount != null">#{amount},</if>
|
|
|
+ <if test="remark != null">#{remark},</if>
|
|
|
+ <if test="delFlag != null">#{delFlag},</if>
|
|
|
+ <if test="createBy != null">#{createBy},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="updateBy != null">#{updateBy},</if>
|
|
|
+ <if test="updateTime != null">#{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateStuTextBook" parameterType="StuTextBook">
|
|
|
+ update stu_text_book
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="name != null">name = #{name},</if>
|
|
|
+ <if test="price != null">price = #{price},</if>
|
|
|
+ <if test="discountPrice != null">discount_price = #{discountPrice},</if>
|
|
|
+ <if test="amount != null">amount = #{amount},</if>
|
|
|
+ <if test="remark != null">remark = #{remark},</if>
|
|
|
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
+ <if test="createBy != null">create_by = #{createBy},</if>
|
|
|
+ <if test="createTime != null">create_time = #{createTime},</if>
|
|
|
+ <if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
+ <if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteStuTextBookById" parameterType="String">
|
|
|
+ UPDATE stu_text_book SET del_flag = 1 where id = #{id}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteStuTextBookByIds" parameterType="String">
|
|
|
+ UPDATE stu_text_book SET del_flag = 1 where id in
|
|
|
+ <foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectClassBookList" resultType="com.ruoyi.system.domain.vo.BookConfigVo">
|
|
|
+ SELECT id,name FROM stu_text_book WHERE del_flag = 0
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectTextBookByClassId" resultMap="StuTextBookResult" parameterType="Long">
|
|
|
+ SELECT b.id, b.name, b.price, b.discount_price, b.amount, b.remark, b.del_flag, b.create_by, b.create_time, b.update_by, b.update_time
|
|
|
+ FROM stu_class_book_config c JOIN stu_text_book b ON c.text_book_id = b.id WHERE c.class_id=#{classId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|