|
@@ -1,144 +1,160 @@
|
|
|
<?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.StudentInstrumentDao">
|
|
|
- <resultMap id="StudentInstrument" type="com.ym.mec.biz.dal.entity.StudentInstrument">
|
|
|
- <!--@mbg.generated-->
|
|
|
- <!--@Table student_instrument-->
|
|
|
- <id column="id_" property="id" />
|
|
|
- <result column="student_id_" property="studentId" />
|
|
|
- <result column="organ_id_" property="organId" />
|
|
|
- <result column="goods_id_" property="goodsId" />
|
|
|
- <result column="goods_category_id_" property="goodsCategoryId" />
|
|
|
- <result column="goods_category_name_" property="goodsCategoryName" />
|
|
|
- <result column="status_" property="status" />
|
|
|
- <result column="start_time_" property="startTime" />
|
|
|
- <result column="end_time_" property="endTime" />
|
|
|
- <result column="create_time_" property="createTime" />
|
|
|
- <result column="update_time" property="updateTime" />
|
|
|
- <result column="goods_name_" property="goodsName" />
|
|
|
- <result column="specification_" property="specification" />
|
|
|
- <result column="goods_brand_" property="goodsBrand" />
|
|
|
- <result column="goods_img_" property="goodsImg" />
|
|
|
- </resultMap>
|
|
|
+ <resultMap id="StudentInstrument" type="com.ym.mec.biz.dal.entity.StudentInstrument">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table student_instrument-->
|
|
|
+ <id column="id_" property="id"/>
|
|
|
+ <result column="student_id_" property="studentId"/>
|
|
|
+ <result column="organ_id_" property="organId"/>
|
|
|
+ <result column="goods_id_" property="goodsId"/>
|
|
|
+ <result column="goods_category_id_" property="goodsCategoryId"/>
|
|
|
+ <result column="goods_category_name_" property="goodsCategoryName"/>
|
|
|
+ <result column="status_" property="status"/>
|
|
|
+ <result column="start_time_" property="startTime"/>
|
|
|
+ <result column="end_time_" property="endTime"/>
|
|
|
+ <result column="create_time_" property="createTime"/>
|
|
|
+ <result column="update_time" property="updateTime"/>
|
|
|
+ <result column="goods_name_" property="goodsName"/>
|
|
|
+ <result column="specification_" property="specification"/>
|
|
|
+ <result column="goods_brand_" property="goodsBrand"/>
|
|
|
+ <result column="goods_img_" property="goodsImg"/>
|
|
|
+ </resultMap>
|
|
|
|
|
|
- <select id="get" parameterType="java.lang.Integer" resultMap="StudentInstrument">
|
|
|
- <!--@mbg.generated-->
|
|
|
- SELECT * FROM student_instrument
|
|
|
- where id_ = #{id}
|
|
|
- </select>
|
|
|
- <delete id="delete" parameterType="java.lang.Integer">
|
|
|
- <!--@mbg.generated-->
|
|
|
- delete from student_instrument
|
|
|
- where id_ = #{id}
|
|
|
- </delete>
|
|
|
-
|
|
|
- <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument" useGeneratedKeys="true">
|
|
|
- <!--@mbg.generated-->
|
|
|
- insert into student_instrument (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_, status_, start_time_, end_time_, create_time_, update_time
|
|
|
- )
|
|
|
- values (#{studentId},#{organId},#{goodsId},#{goodsCategoryId},#{goodsCategoryName},#{goodsName},#{goodsBrand},#{specification},#{goodsImg}, #{status}, #{startTime}, #{endTime}, NOW(), NOW()
|
|
|
- )
|
|
|
- </insert>
|
|
|
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument">
|
|
|
- <!--@mbg.generated-->
|
|
|
- update student_instrument
|
|
|
- <set>
|
|
|
- <if test="studentId != null">
|
|
|
- student_id_ = #{studentId},
|
|
|
- </if>
|
|
|
- <if test="organId != null">
|
|
|
- organ_id_ = #{organId},
|
|
|
- </if>
|
|
|
- <if test="goodsId != null">
|
|
|
- goods_id_ = #{goodsId},
|
|
|
- </if>
|
|
|
- <if test="goodsName != null">
|
|
|
- goods_name_ = #{goodsName},
|
|
|
- </if>
|
|
|
- <if test="goodsBrand != null">
|
|
|
- goods_brand_ = #{goodsBrand},
|
|
|
- </if>
|
|
|
- <if test="specification != null">
|
|
|
- specification_ = #{specification},
|
|
|
- </if>
|
|
|
- <if test="goodsImg != null">
|
|
|
- goods_img_ = #{goodsImg},
|
|
|
- </if>
|
|
|
- <if test="status != null">
|
|
|
- status_ = #{status},
|
|
|
- </if>
|
|
|
- <if test="startTime != null">
|
|
|
- start_time_ = #{startTime},
|
|
|
- </if>
|
|
|
- <if test="endTime != null">
|
|
|
- end_time_ = #{endTime},
|
|
|
- </if>
|
|
|
- <if test="createTime != null">
|
|
|
- create_time_ = #{createTime},
|
|
|
- </if>
|
|
|
- <if test="updateTime != null">
|
|
|
- update_time = #{updateTime},
|
|
|
- </if>
|
|
|
- </set>
|
|
|
- where id_ = #{id}
|
|
|
- </update>
|
|
|
+ <select id="get" parameterType="java.lang.Integer" resultMap="StudentInstrument">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ SELECT * FROM student_instrument
|
|
|
+ where id_ = #{id}
|
|
|
+ </select>
|
|
|
+ <delete id="delete" parameterType="java.lang.Integer">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ delete from student_instrument
|
|
|
+ where id_ = #{id}
|
|
|
+ </delete>
|
|
|
|
|
|
- <!-- 全查询 -->
|
|
|
- <select id="findAll" resultMap="StudentInstrument">
|
|
|
- SELECT *
|
|
|
- FROM student
|
|
|
- </select>
|
|
|
+ <insert id="insert" keyColumn="id_" keyProperty="id" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument"
|
|
|
+ useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into student_instrument
|
|
|
+ (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
|
|
|
+ status_, start_time_, end_time_, create_time_, update_time
|
|
|
+ )
|
|
|
+ values
|
|
|
+ (#{studentId},#{organId},#{goodsId},#{goodsCategoryId},#{goodsCategoryName},#{goodsName},#{goodsBrand},#{specification},#{goodsImg},
|
|
|
+ #{status}, #{startTime}, #{endTime}, NOW(), NOW()
|
|
|
+ )
|
|
|
+ </insert>
|
|
|
+ <update id="update" parameterType="com.ym.mec.biz.dal.entity.StudentInstrument">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update student_instrument
|
|
|
+ <set>
|
|
|
+ <if test="studentId != null">
|
|
|
+ student_id_ = #{studentId},
|
|
|
+ </if>
|
|
|
+ <if test="organId != null">
|
|
|
+ organ_id_ = #{organId},
|
|
|
+ </if>
|
|
|
+ <if test="goodsId != null">
|
|
|
+ goods_id_ = #{goodsId},
|
|
|
+ </if>
|
|
|
+ <if test="goodsName != null">
|
|
|
+ goods_name_ = #{goodsName},
|
|
|
+ </if>
|
|
|
+ <if test="goodsBrand != null">
|
|
|
+ goods_brand_ = #{goodsBrand},
|
|
|
+ </if>
|
|
|
+ <if test="specification != null">
|
|
|
+ specification_ = #{specification},
|
|
|
+ </if>
|
|
|
+ <if test="goodsImg != null">
|
|
|
+ goods_img_ = #{goodsImg},
|
|
|
+ </if>
|
|
|
+ <if test="status != null">
|
|
|
+ status_ = #{status},
|
|
|
+ </if>
|
|
|
+ <if test="startTime != null">
|
|
|
+ start_time_ = #{startTime},
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null">
|
|
|
+ end_time_ = #{endTime},
|
|
|
+ </if>
|
|
|
+ <if test="createTime != null">
|
|
|
+ create_time_ = #{createTime},
|
|
|
+ </if>
|
|
|
+ <if test="updateTime != null">
|
|
|
+ update_time = #{updateTime},
|
|
|
+ </if>
|
|
|
+ </set>
|
|
|
+ where id_ = #{id}
|
|
|
+ </update>
|
|
|
|
|
|
- <!-- 分页查询 -->
|
|
|
- <select id="queryPage" resultMap="StudentInstrument" parameterType="map">
|
|
|
- SELECT si.*,su.username_ studentName,su.phone_ phone,o.name_ organName FROM student_instrument si
|
|
|
- LEFT JOIN sys_user su ON su.id_ = si.student_id_
|
|
|
- LEFT JOIN organization o ON o.id_ = si.organ_id_
|
|
|
- <include refid="queryPageSql"/>
|
|
|
- <include refid="global.limit"/>
|
|
|
- </select>
|
|
|
+ <!-- 全查询 -->
|
|
|
+ <select id="findAll" resultMap="StudentInstrument">
|
|
|
+ SELECT *
|
|
|
+ FROM student
|
|
|
+ </select>
|
|
|
|
|
|
- <!-- 查询当前表的总记录数 -->
|
|
|
- <select id="queryCount" resultType="int">
|
|
|
- SELECT COUNT(*)
|
|
|
- FROM student_instrument si
|
|
|
- LEFT JOIN sys_user su ON su.id_ = si.student_id_
|
|
|
- <include refid="queryPageSql"/>
|
|
|
- </select>
|
|
|
+ <!-- 分页查询 -->
|
|
|
+ <select id="queryPage" resultMap="StudentInstrument" parameterType="map">
|
|
|
+ SELECT si.*,su.username_ studentName,su.phone_ phone,o.name_ organName FROM student_instrument si
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = si.student_id_
|
|
|
+ LEFT JOIN organization o ON o.id_ = si.organ_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ <include refid="global.limit"/>
|
|
|
+ </select>
|
|
|
|
|
|
- <sql id="queryPageSql">
|
|
|
- <where>
|
|
|
- <if test="studentId != null">
|
|
|
- AND si.student_id_ = #{studentId}
|
|
|
- </if>
|
|
|
- <if test="organId != null">
|
|
|
- AND FIND_IN_SET(si.organ_id_,#{organId})
|
|
|
- </if>
|
|
|
- <if test="goodsId != null">
|
|
|
- AND si.goods_id_ = #{goodsId}
|
|
|
- </if>
|
|
|
- <if test="goodsCategoryId != null">
|
|
|
- AND si.goods_category_id_ = #{goodsCategoryId}
|
|
|
- </if>
|
|
|
- <if test="goodsBrand != null">
|
|
|
- AND si.goods_brand_ LIKE CONCAT('%',#{goodsBrand},'%')
|
|
|
- </if>
|
|
|
- <if test="specification != null">
|
|
|
- AND si.specification_ LIKE CONCAT('%',#{specification},'%')
|
|
|
- </if>
|
|
|
- <if test="search != null">
|
|
|
- AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- </sql>
|
|
|
+ <!-- 查询当前表的总记录数 -->
|
|
|
+ <select id="queryCount" resultType="int">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM student_instrument si
|
|
|
+ LEFT JOIN sys_user su ON su.id_ = si.student_id_
|
|
|
+ <include refid="queryPageSql"/>
|
|
|
+ </select>
|
|
|
|
|
|
- <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
- insert into student_instrument (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_, status_, start_time_, end_time_, create_time_, update_time)
|
|
|
- VALUE
|
|
|
- <foreach collection="studentInstruments" item="item" separator=",">
|
|
|
- (#{item.studentId},#{item.organId},#{item.goodsId},#{item.goodsCategoryId},#{item.goodsCategoryName},#{item.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg}, #{item.status}, #{item.startTime},
|
|
|
- #{item.endTime}, NOW(), NOW())
|
|
|
- </foreach>
|
|
|
- </insert>
|
|
|
+ <sql id="queryPageSql">
|
|
|
+ <where>
|
|
|
+ <if test="studentId != null">
|
|
|
+ AND si.student_id_ = #{studentId}
|
|
|
+ </if>
|
|
|
+ <if test="organId != null">
|
|
|
+ AND FIND_IN_SET(si.organ_id_,#{organId})
|
|
|
+ </if>
|
|
|
+ <if test="goodsId != null">
|
|
|
+ AND si.goods_id_ = #{goodsId}
|
|
|
+ </if>
|
|
|
+ <if test="goodsCategoryId != null">
|
|
|
+ AND si.goods_category_id_ = #{goodsCategoryId}
|
|
|
+ </if>
|
|
|
+ <if test="goodsBrand != null">
|
|
|
+ AND si.goods_brand_ LIKE CONCAT('%',#{goodsBrand},'%')
|
|
|
+ </if>
|
|
|
+ <if test="specification != null">
|
|
|
+ AND si.specification_ LIKE CONCAT('%',#{specification},'%')
|
|
|
+ </if>
|
|
|
+ <if test="search != null">
|
|
|
+ AND (si.student_id_ = #{search} OR su.phone_ = #{search} OR su.username_ LIKE CONCAT('%',#{search},'%'))
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <insert id="batchAdd" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
|
|
+ insert into student_instrument
|
|
|
+ (student_id_,organ_id_,goods_id_,goods_category_id_,goods_category_name_,goods_name_,goods_brand_,specification_,goods_img_,
|
|
|
+ status_, start_time_, end_time_, create_time_, update_time)
|
|
|
+ VALUE
|
|
|
+ <foreach collection="studentInstruments" item="item" separator=",">
|
|
|
+ (#{item.studentId},#{item.organId},#{item.goodsId},#{item.goodsCategoryId},#{item.goodsCategoryName},#{item.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg},
|
|
|
+ #{item.status}, #{item.startTime},
|
|
|
+ #{item.endTime}, NOW(), NOW())
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="batchUpdate">
|
|
|
+ <![CDATA[
|
|
|
+ UPDATE student_instrument
|
|
|
+ SET status_ = 0
|
|
|
+ WHERE end_time_ <= NOW()
|
|
|
+ ]]>
|
|
|
+ </update>
|
|
|
|
|
|
</mapper>
|