123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?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.liang.dao.StaScheduleDao">
- <resultMap type="com.liang.entity.StaSchedule" id="StaScheduleMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="zb" column="ZB" jdbcType="INTEGER"/>
- <result property="xh" column="XH" jdbcType="INTEGER"/>
- <result property="yjnr" column="YJNR" jdbcType="VARCHAR"/>
- <result property="qssj" column="QSSJ" jdbcType="TIMESTAMP"/>
- <result property="jssj" column="JSSJ" jdbcType="TIMESTAMP"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="StaScheduleMap">
- select
- ID, ZB, XH, YJNR, QSSJ, JSSJ
- from sta_Schedule
- where ID = #{id}
- </select>
- <!--通过主表id查询-->
- <select id="queryByZbId" resultMap="StaScheduleMap">
- select
- ID, ZB, XH, YJNR, QSSJ, JSSJ
- from sta_Schedule
- where ZB = #{zb} order by XH asc
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="StaScheduleMap">
- select
- ID, ZB, XH, YJNR, QSSJ, JSSJ
- from sta_Schedule
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="xh != null">
- and XH = #{xh}
- </if>
- <if test="yjnr != null and yjnr != ''">
- and YJNR = #{yjnr}
- </if>
- <if test="qssj != null">
- and QSSJ = #{qssj}
- </if>
- <if test="jssj != null">
- and JSSJ = #{jssj}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from sta_Schedule
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="zb != null">
- and ZB = #{zb}
- </if>
- <if test="xh != null">
- and XH = #{xh}
- </if>
- <if test="yjnr != null and yjnr != ''">
- and YJNR = #{yjnr}
- </if>
- <if test="qssj != null">
- and QSSJ = #{qssj}
- </if>
- <if test="jssj != null">
- and JSSJ = #{jssj}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Schedule(ZB, XH, YJNR, QSSJ, JSSJ)
- values (#{zb}, #{xh}, #{yjnr}, #{qssj}, #{jssj})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Schedule(ZB, XH, YJNR, QSSJ, JSSJ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.xh}, #{entity.yjnr}, #{entity.qssj}, #{entity.jssj})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into sta_Schedule(ZB, XH, YJNR, QSSJ, JSSJ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.zb}, #{entity.xh}, #{entity.yjnr}, #{entity.qssj}, #{entity.jssj})
- </foreach>
- on duplicate key update
- ZB = values(ZB),
- XH = values(XH),
- YJNR = values(YJNR),
- QSSJ = values(QSSJ),
- JSSJ = values(JSSJ)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update sta_Schedule
- <set>
- <if test="zb != null">
- ZB = #{zb},
- </if>
- <if test="xh != null">
- XH = #{xh},
- </if>
- <if test="yjnr != null and yjnr != ''">
- YJNR = #{yjnr},
- </if>
- <if test="qssj != null">
- QSSJ = #{qssj},
- </if>
- <if test="jssj != null">
- JSSJ = #{jssj},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete from sta_Schedule where ID = #{id}
- </delete>
- <!--通过主表Id删除-->
- <delete id="deleteByZbId">
- delete from sta_Schedule where ZB = #{zbId}
- </delete>
- </mapper>
|