123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.PrjGwtaskDao">
- <resultMap type="com.liang.entity.PrjGwtask" id="PrjGwtaskMap">
- <result property="id" column="ID" jdbcType="INTEGER"/>
- <result property="wjm" column="WJM" jdbcType="VARCHAR"/>
- <result property="scr" column="SCR" jdbcType="VARCHAR"/>
- <result property="scrq" column="SCRQ" jdbcType="TIMESTAMP"/>
- <result property="weburl" column="WebUrl" jdbcType="VARCHAR"/>
- <result property="bz" column="BZ" jdbcType="VARCHAR"/>
- </resultMap>
- <!--查询单个-->
- <select id="queryById" resultMap="PrjGwtaskMap">
- select *
- from prj_GwTask
- where ID = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="queryAllByLimit" resultMap="PrjGwtaskMap">
- select *
- from prj_GwTask
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="wjm != null and wjm != ''">
- and WJM = #{wjm}
- </if>
- <if test="scr != null and scr != ''">
- and SCR = #{scr}
- </if>
- <if test="scrq != null">
- and SCRQ = #{scrq}
- </if>
- <if test="weburl != null and weburl != ''">
- and WebUrl = #{weburl}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- limit #{pageable.offset}, #{pageable.pageSize}
- </select>
- <!--统计总行数-->
- <select id="count" resultType="java.lang.Long">
- select count(1)
- from prj_GwTask
- <where>
- <if test="id != null">
- and ID = #{id}
- </if>
- <if test="wjm != null and wjm != ''">
- and WJM = #{wjm}
- </if>
- <if test="scr != null and scr != ''">
- and SCR = #{scr}
- </if>
- <if test="scrq != null">
- and SCRQ = #{scrq}
- </if>
- <if test="weburl != null and weburl != ''">
- and WebUrl = #{weburl}
- </if>
- <if test="bz != null and bz != ''">
- and BZ = #{bz}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
- values (#{wjm}, #{scr}, GETDATE(), #{weburl}, #{bz})
- </insert>
- <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.wjm}, #{entity.scr}, #{entity.scrq}, #{entity.weburl}, #{entity.bz})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into prj_GwTask(WJM, SCR, SCRQ, WebUrl, BZ)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.wjm}, #{entity.scr}, #{entity.scrq}, #{entity.weburl}, #{entity.bz})
- </foreach>
- on duplicate key update
- WJM = values(WJM),
- SCR = values(SCR),
- SCRQ = values(SCRQ),
- WebUrl = values(WebUrl),
- BZ = values(BZ)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update prj_GwTask
- <set>
- <if test="wjm != null and wjm != ''">
- WJM = #{wjm},
- </if>
- <if test="scr != null and scr != ''">
- SCR = #{scr},
- </if>
- <if test="scrq != null">
- SCRQ = #{scrq},
- </if>
- <if test="weburl != null and weburl != ''">
- WebUrl = #{weburl},
- </if>
- <if test="bz != null and bz != ''">
- BZ = #{bz},
- </if>
- </set>
- where ID = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from prj_GwTask
- where ID = #{id}
- </delete>
- <!--国网任务书列表-->
- <select id="getGwTaslList" resultMap="PrjGwtaskMap" parameterType="map">
- select *
- from prj_GwTask p
- <if test="scr != null and scr != ''">
- where p.SCR = #{scr}
- </if>
- <choose>
- <when test="sortName != null and sortName != '' and sortOrder != null and sortOrder != ''">
- order by ${sortName} ${sortOrder}
- </when>
- <otherwise>
- order by ID desc
- </otherwise>
- </choose>
- </select>
- </mapper>
|