| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?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.ym.mec.biz.dal.dao.StudentGoodsSellDao">
-
- <resultMap type="com.ym.mec.biz.dal.entity.StudentGoodsSell" id="StudentGoodsSell">
- <result column="id_" property="id" />
- <result column="user_id_" property="userId" />
- <result column="teacher_id_" property="teacherId" />
- <result column="goods_json_" property="goodsJson" />
- <result column="total_amount_" property="totalAmount" />
- <result column="market_amount_" property="marketAmount" />
- <result column="order_no_" property="orderNo" />
- <result column="organ_id_" property="organId" />
- <result column="create_time_" property="createTime" />
- <result column="update_time_" property="updateTime" />
- </resultMap>
-
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="StudentGoodsSell" >
- SELECT * FROM student_goods_sell WHERE id_ = #{id}
- </select>
-
- <!-- 全查询 -->
- <select id="findAll" resultMap="StudentGoodsSell">
- SELECT * FROM student_goods_sell ORDER BY id_
- </select>
-
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.StudentGoodsSell" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
- INSERT INTO student_goods_sell (id_,user_id_,teacher_id_,goods_json_,total_amount_,market_amount_,create_time_,update_time_,order_no_,organ_id_)
- VALUES(#{id},#{userId},#{teacherId},#{goodsJson},#{totalAmount},#{marketAmount},NOW(),NOW(),#{orderNo},#{organId})
- </insert>
-
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentGoodsSell">
- UPDATE student_goods_sell <set>
- <if test="organId != null">
- organ_id_ = #{organId},
- </if>
- <if test="orderNo != null">
- order_no_ = #{orderNo},
- </if>
- <if test="userId != null">
- user_id_ = #{userId},
- </if>
- <if test="totalAmount != null">
- total_amount_ = #{totalAmount},
- </if>
- <if test="marketAmount != null">
- market_amount_ = #{marketAmount},
- </if>
- <if test="teacherId != null">
- teacher_id_ = #{teacherId},
- </if>
- <if test="goodsJson != null">
- goods_json_ = #{goodsJson},
- </if>
- update_time_ = NOW()
- </set> WHERE id_ = #{id}
- </update>
-
- <!-- 根据主键删除一条记录 -->
- <delete id="delete" >
- DELETE FROM student_goods_sell WHERE id_ = #{id}
- </delete>
-
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="StudentGoodsSell" parameterType="map">
- SELECT * FROM student_goods_sell ORDER BY id_ <include refid="global.limit"/>
- </select>
-
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM student_goods_sell
- </select>
- <select id="countStudentGoodsOrders" resultType="java.lang.Integer">
- SELECT COUNT(spo.id_) FROM student_payment_order spo
- LEFT JOIN student_goods_sell sgs ON spo.order_no_ = sgs.order_no_
- LEFT JOIN sys_user su ON sgs.user_id_ = su.id_
- <include refid="queryStudentGoodsOrdersSql"/>
- </select>
- <resultMap type="com.ym.mec.biz.dal.dto.StudentGoodsSellDto" id="StudentGoodsSellDto" extends="com.ym.mec.biz.dal.dao.StudentPaymentOrderDao.StudentPaymentOrder">
- <result column="goods_json_" property="goodsJson" />
- <result column="total_amount_" property="totalAmount" />
- <result column="market_amount_" property="marketAmount" />
- <result column="user_name_" property="userName" />
- </resultMap>
- <sql id="queryStudentGoodsOrdersSql">
- <where>
- <if test="teacherId != null">
- sgs.teacher_id_ = #{teacherId}
- </if>
- <if test="studentId != null">
- AND sgs.user_id_ = #{studentId}
- </if>
- <if test="status != null">
- AND spo.status_ = #{status}
- </if>
- <if test="search != null and search != ''">
- AND (su.user_name_ LIKE CONCAT('%',#{search},'%') OR su.phone_ LIKE CONCAT('%',#{search},'%'))
- </if>
- </where>
- </sql>
- <select id="queryStudentGoodsOrders" resultMap="StudentGoodsSellDto">
- SELECT spo.*,sgs.goods_json_,sgs.total_amount_,sgs.market_amount_,su.user_name_ FROM student_payment_order spo
- LEFT JOIN student_goods_sell sgs ON spo.order_no_ = sgs.order_no_
- LEFT JOIN sys_user su ON sgs.user_id_ = su.id_
- <include refid="queryStudentGoodsOrdersSql"/>
- ORDER BY spo.create_time_ DESC
- <include refid="global.limit"/>
- </select>
- <select id="findByOrderNo" resultMap="StudentGoodsSell">
- SELECT * FROM student_goods_sell WHERE order_no_ = #{orderNo} LIMIT 1
- </select>
- <select id="getStudentGoodsSellDto" resultMap="StudentGoodsSellDto">
- SELECT spo.*,sgs.goods_json_,sgs.total_amount_,sgs.market_amount_ FROM student_payment_order spo
- LEFT JOIN student_goods_sell sgs ON spo.order_no_ = sgs.order_no_
- WHERE spo.order_no_ = #{orderNo} LIMIT 1
- </select>
- </mapper>
|