123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?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="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>
- <sql id="Base_Column_List">
- <!--@mbg.generated-->
- id_,student_id_,organ_id_, goods_id_,goods_name_,goods_brand_,specification_,goods_img_, status_, start_time_, end_time_, create_time_, update_time
- </sql>
- <select id="get" parameterType="java.lang.Integer" resultMap="StudentInstrument">
- <!--@mbg.generated-->
- select
- <include refid="Base_Column_List" />
- 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_name_,goods_brand_,specification_,goods_img_, status_, start_time_, end_time_, create_time_, update_time
- )
- values (#{studentId},#{organId},#{goodsId},#{goodsName},#{goodsBrand},#{specification},#{goodsImg}, #{status}, #{startTime}, #{endTime}, #{createTime}, #{updateTime}
- )
- </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="findAll" resultMap="StudentInstrument">
- SELECT *
- FROM student
- </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>
- <!-- 查询当前表的总记录数 -->
- <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>
- <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="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_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.goodsName},#{item.goodsBrand},#{item.specification},#{item.goodsImg}, #{item.status}, #{item.startTime},
- #{item.endTime}, NOW(), NOW())
- </foreach>
- </insert>
- </mapper>
|