| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- <?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.goafanti.common.dao.TaskAnnualReportMapper">
- <resultMap type="com.goafanti.common.model.TaskAnnualReport" id="TaskAnnualReportMap">
- <result property="id" column="id" jdbcType="INTEGER"/>
- <result property="uid" column="uid" jdbcType="VARCHAR"/>
- <result property="tid" column="tid" jdbcType="INTEGER"/>
- <result property="year" column="year" jdbcType="INTEGER"/>
- <result property="salesAmount" column="sales_amount" jdbcType="VARCHAR"/>
- <result property="researchAmount" column="research_amount" jdbcType="VARCHAR"/>
- <result property="aid" column="aid" jdbcType="VARCHAR"/>
- <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
- </resultMap>
- <sql id="TaskAnnualReportAllSql">
- id, uid, tid, year, sales_amount, research_amount, aid, create_time
- </sql>
- <!--查询单个-->
- <select id="queryById" resultMap="TaskAnnualReportMap">
- select
- <include refid="TaskAnnualReportAllSql"/>
- from task_annual_report
- where id = #{id}
- </select>
- <!--查询指定行数据-->
- <select id="findTaskAnnualReportList" resultMap="TaskAnnualReportMap">
- select
- <include refid="TaskAnnualReportAllSql"/>
- from task_annual_report
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="uid != null and uid != ''">
- and uid = #{uid}
- </if>
- <if test="tid != null">
- and tid = #{tid}
- </if>
- <if test="year != null">
- and year = #{year}
- </if>
- <if test="salesAmount != null">
- and sales_amount = #{salesAmount}
- </if>
- <if test="researchAmount != null">
- and research_amount = #{researchAmount}
- </if>
- <if test="aid != null and aid != ''">
- and aid = #{aid}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- </where>
- <if test="page_sql != null">
- ${page_sql}
- </if>
- </select>
- <!--统计总行数-->
- <select id="findTaskAnnualReportCount" resultType="java.lang.Integer">
- select count(1)
- from task_annual_report
- <where>
- <if test="id != null">
- and id = #{id}
- </if>
- <if test="uid != null and uid != ''">
- and uid = #{uid}
- </if>
- <if test="tid != null">
- and tid = #{tid}
- </if>
- <if test="year != null">
- and year = #{year}
- </if>
- <if test="salesAmount != null">
- and sales_amount = #{salesAmount}
- </if>
- <if test="researchAmount != null">
- and research_amount = #{researchAmount}
- </if>
- <if test="aid != null and aid != ''">
- and aid = #{aid}
- </if>
- <if test="createTime != null">
- and create_time = #{createTime}
- </if>
- </where>
- </select>
- <!--新增所有列-->
- <insert id="insert" keyProperty="id" useGeneratedKeys="true">
- insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
- values (#{uid}, #{tid}, #{year}, #{salesAmount}, #{researchAmount}, #{aid}, #{createTime})
- </insert>
- <insert id="insertBatch">
- insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.uid}, #{entity.tid}, #{entity.year}, #{entity.salesAmount}, #{entity.researchAmount},
- #{entity.aid}, #{entity.createTime})
- </foreach>
- </insert>
- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
- insert into task_annual_report(uid, tid, year, sales_amount, research_amount, aid, create_time)
- values
- <foreach collection="entities" item="entity" separator=",">
- (#{entity.uid}, #{entity.tid}, #{entity.year}, #{entity.salesAmount}, #{entity.researchAmount},
- #{entity.aid}, #{entity.createTime})
- </foreach>
- on duplicate key update
- uid = values(uid),
- tid = values(tid),
- year = values(year),
- sales_amount = values(sales_amount),
- research_amount = values(research_amount),
- aid = values(aid),
- create_time = values(create_time)
- </insert>
- <!--通过主键修改数据-->
- <update id="update">
- update task_annual_report
- <set>
- <if test="uid != null and uid != ''">
- uid = #{uid},
- </if>
- <if test="tid != null">
- tid = #{tid},
- </if>
- <if test="year != null">
- year = #{year},
- </if>
- <if test="salesAmount != null">
- sales_amount = #{salesAmount},
- </if>
- <if test="researchAmount != null">
- research_amount = #{researchAmount},
- </if>
- <if test="aid != null and aid != ''">
- aid = #{aid},
- </if>
- <if test="createTime != null">
- create_time = #{createTime},
- </if>
- </set>
- where id = #{id}
- </update>
- <!--通过主键删除-->
- <delete id="deleteById">
- delete
- from task_annual_report
- where id = #{id}
- </delete>
- <select id="selectByTidAndYear" resultMap="TaskAnnualReportMap">
- select
- <include refid="TaskAnnualReportAllSql"/>
- from task_annual_report
- where tid = #{tid} and year = #{year}
- </select>
- <select id="selectThreeYear" resultMap="TaskAnnualReportMap">
- select
- <include refid="TaskAnnualReportAllSql"/>
- from task_annual_report
- where tid = #{tid} and year in (#{year}-1,#{year}-2)
- </select>
- </mapper>
|