gdg
2021-01-18 b02535c9a99324823812f6c2d08f066d8e1ba75f
src/main/java/com/nanometer/smartlab/dao/HazardousWasteMapper.xml
@@ -1,207 +1,441 @@
<?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.nanometer.smartlab.dao.HazardousWasteMapper" >
  <resultMap id="BaseResultMap" type="com.nanometer.smartlab.entity.HazardousWaste" >
<?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.nanometer.smartlab.dao.HazardousWasteMapper">
  <resultMap id="BaseResultMap" type="com.nanometer.smartlab.entity.HazardousWaste">
    <!--          -->
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="acid" property="acid" jdbcType="REAL" />
    <result column="alkali" property="alkali" jdbcType="REAL" />
    <result column="organic" property="organic" jdbcType="REAL" />
    <result column="solid" property="solid" jdbcType="REAL" />
    <result column="medical" property="medical" jdbcType="REAL" />
    <result column="apply_person" property="applyPerson" jdbcType="VARCHAR" />
    <result column="project" property="project" jdbcType="VARCHAR" />
    <result column="department" property="department" jdbcType="VARCHAR" />
    <result column="unit" property="unit" jdbcType="VARCHAR" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="acid" jdbcType="DECIMAL" property="acid" />
    <result column="alkali" jdbcType="DECIMAL" property="alkali" />
    <result column="organic" jdbcType="DECIMAL" property="organic" />
    <result column="solid" jdbcType="DECIMAL" property="solid" />
    <result column="medical" jdbcType="DECIMAL" property="medical" />
    <result column="apply_person" jdbcType="VARCHAR" property="applyPerson" />
    <result column="project" jdbcType="VARCHAR" property="project" />
    <result column="department" jdbcType="VARCHAR" property="department" />
    <result column="unit" jdbcType="VARCHAR" property="unit" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="tid" jdbcType="VARCHAR" property="tid" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="creator" jdbcType="VARCHAR" property="creator" />
    <result column="updator" jdbcType="VARCHAR" property="updator" />
    <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
  </resultMap>
  <sql id="Base_Column_List" >
  <sql id="Base_Column_List">
    <!--          -->
    id, acid, alkali, organic, solid, medical, apply_person, project, department, unit,
    create_time
    id, acid, alkali, organic, solid, medical, apply_person, project, department, unit,
    create_time, tid, status, creator, updator, updatetime
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    <!--          -->
    select
    select
    <include refid="Base_Column_List" />
    from sys_hazardous_waste
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    <!--          -->
    delete from sys_hazardous_waste
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.nanometer.smartlab.entity.HazardousWaste" >
  <insert id="insert" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
    <!--          -->
    insert into sys_hazardous_waste (id, acid, alkali, organic,
      solid, medical, apply_person,
      project, department, unit,
      create_time)
    values (#{id,jdbcType=BIGINT}, #{acid,jdbcType=REAL}, #{alkali,jdbcType=REAL}, #{organic,jdbcType=REAL},
      #{solid,jdbcType=REAL}, #{medical,jdbcType=REAL}, #{applyPerson,jdbcType=VARCHAR},
      #{project,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP})
    insert into sys_hazardous_waste (id, acid, alkali, organic,
      solid, medical, apply_person,
      project, department, unit,
      create_time, tid, status,
      creator,updator, updatetime)
    values (#{id,jdbcType=BIGINT}, #{acid,jdbcType=DECIMAL}, #{alkali,jdbcType=DECIMAL}, #{organic,jdbcType=DECIMAL},
      #{solid,jdbcType=DECIMAL}, #{medical,jdbcType=DECIMAL}, #{applyPerson,jdbcType=VARCHAR},
      #{project,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP}, #{tid,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
      #{creator,jdbcType=VARCHAR},#{updator,jdbcType=VARCHAR},#{updatetime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste" >
  <insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
    <!--          -->
    insert into sys_hazardous_waste
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="acid != null" >
      <if test="acid != null">
        acid,
      </if>
      <if test="alkali != null" >
      <if test="alkali != null">
        alkali,
      </if>
      <if test="organic != null" >
      <if test="organic != null">
        organic,
      </if>
      <if test="solid != null" >
      <if test="solid != null">
        solid,
      </if>
      <if test="medical != null" >
      <if test="medical != null">
        medical,
      </if>
      <if test="applyPerson != null" >
      <if test="applyPerson != null">
        apply_person,
      </if>
      <if test="project != null" >
      <if test="project != null">
        project,
      </if>
      <if test="department != null" >
      <if test="department != null">
        department,
      </if>
      <if test="unit != null" >
      <if test="unit != null">
        unit,
      </if>
      <if test="createTime != null" >
      <if test="createTime != null">
        create_time,
      </if>
      <if test="tid != null">
        tid,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="creator != null">
        creator,
      </if>
      <if test="updator != null">
        creator,
      </if>
      <if test="updatetime != null">
        updatetime,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="acid != null" >
        #{acid,jdbcType=REAL},
      <if test="acid != null">
        #{acid,jdbcType=DECIMAL},
      </if>
      <if test="alkali != null" >
        #{alkali,jdbcType=REAL},
      <if test="alkali != null">
        #{alkali,jdbcType=DECIMAL},
      </if>
      <if test="organic != null" >
        #{organic,jdbcType=REAL},
      <if test="organic != null">
        #{organic,jdbcType=DECIMAL},
      </if>
      <if test="solid != null" >
        #{solid,jdbcType=REAL},
      <if test="solid != null">
        #{solid,jdbcType=DECIMAL},
      </if>
      <if test="medical != null" >
        #{medical,jdbcType=REAL},
      <if test="medical != null">
        #{medical,jdbcType=DECIMAL},
      </if>
      <if test="applyPerson != null" >
      <if test="applyPerson != null">
        #{applyPerson,jdbcType=VARCHAR},
      </if>
      <if test="project != null" >
      <if test="project != null">
        #{project,jdbcType=VARCHAR},
      </if>
      <if test="department != null" >
      <if test="department != null">
        #{department,jdbcType=VARCHAR},
      </if>
      <if test="unit != null" >
      <if test="unit != null">
        #{unit,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tid != null">
        #{tid,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="creator != null">
        #{creator,jdbcType=VARCHAR},
      </if>
      <if test="updator != null">
        #{updator,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste" >
  <update id="updateByPrimaryKeySelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
    <!--          -->
    update sys_hazardous_waste
    <set >
      <if test="acid != null" >
        acid = #{acid,jdbcType=REAL},
    <set>
      <if test="acid != null">
        acid = #{acid,jdbcType=DECIMAL},
      </if>
      <if test="alkali != null" >
        alkali = #{alkali,jdbcType=REAL},
      <if test="alkali != null">
        alkali = #{alkali,jdbcType=DECIMAL},
      </if>
      <if test="organic != null" >
        organic = #{organic,jdbcType=REAL},
      <if test="organic != null">
        organic = #{organic,jdbcType=DECIMAL},
      </if>
      <if test="solid != null" >
        solid = #{solid,jdbcType=REAL},
      <if test="solid != null">
        solid = #{solid,jdbcType=DECIMAL},
      </if>
      <if test="medical != null" >
        medical = #{medical,jdbcType=REAL},
      <if test="medical != null">
        medical = #{medical,jdbcType=DECIMAL},
      </if>
      <if test="applyPerson != null" >
      <if test="applyPerson != null">
        apply_person = #{applyPerson,jdbcType=VARCHAR},
      </if>
      <if test="project != null" >
      <if test="project != null">
        project = #{project,jdbcType=VARCHAR},
      </if>
      <if test="department != null" >
      <if test="department != null">
        department = #{department,jdbcType=VARCHAR},
      </if>
      <if test="unit != null" >
      <if test="unit != null">
        unit = #{unit,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null" >
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="tid != null">
        tid = #{tid,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=VARCHAR},
      </if>
      <if test="creator != null">
        creator = #{creator,jdbcType=VARCHAR},
      </if>
      <if test="updator != null">
        updator = #{updator,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null">
        updatetime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.nanometer.smartlab.entity.HazardousWaste" >
  <update id="updateByPrimaryKey" parameterType="com.nanometer.smartlab.entity.HazardousWaste">
    <!--          -->
    update sys_hazardous_waste
    set acid = #{acid,jdbcType=REAL},
      alkali = #{alkali,jdbcType=REAL},
      organic = #{organic,jdbcType=REAL},
      solid = #{solid,jdbcType=REAL},
      medical = #{medical,jdbcType=REAL},
    set acid = #{acid,jdbcType=DECIMAL},
      alkali = #{alkali,jdbcType=DECIMAL},
      organic = #{organic,jdbcType=DECIMAL},
      solid = #{solid,jdbcType=DECIMAL},
      medical = #{medical,jdbcType=DECIMAL},
      apply_person = #{applyPerson,jdbcType=VARCHAR},
      project = #{project,jdbcType=VARCHAR},
      department = #{department,jdbcType=VARCHAR},
      unit = #{unit,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
      create_time = #{createTime,jdbcType=TIMESTAMP},
      tid = #{tid,jdbcType=VARCHAR},
      status = #{status,jdbcType=VARCHAR},
      creator = #{creator,jdbcType=VARCHAR},
      updator = #{updator,jdbcType=VARCHAR},
      updatetime = #{updatetime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <select id="selectAll" resultMap="BaseResultMap" parameterType="java.util.Map" >
  <select id="setAllWasters" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="starttime != null and starttime != ''">
        and create_time &gt; #{starttime}
      </if>
      <if test="endtime != null and endtime != ''">
        and create_time &lt; #{endtime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
    </where>
    order by create_time desc
  </select>
  <select id="selectAll" parameterType="java.util.Map" resultMap="BaseResultMap">
    <!--          -->
    select
    <include refid="Base_Column_List" />
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''" >
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''" >
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
      <if test="tid != null and tid != ''">
        and tid = #{tid}
      </if>
    </where>
    <if test="first != null and pageSize != null" >
    order by create_time desc
    <if test="first != null and pageSize != null">
      limit #{first},#{pageSize}
    </if>
    order by create_time
  </select>
  <select id="countAll"  resultType="java.lang.Integer" >
  <select id="countAll" resultType="java.lang.Integer">
    <!--          -->
    select count(0)
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''" >
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''" >
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
      <if test="tid != null and tid != ''">
        and tid = #{tid}
      </if>
    </where>
  </select>
</mapper>
  <select id="selectExportList" resultType="java.util.Map">
    select
    id, acid, alkali, organic, solid, medical, apply_person as applyPerson, project, department, unit,
    create_time as createTime, tid, status, creator
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
      <if test="tid != null and tid != ''">
        and tid = #{tid}
      </if>
    </where>
    order by create_time desc
  </select>
  <select id="countStatistics" resultType="java.lang.Integer">
    select count(0)
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
      group by project,department,unit
    </where>
  </select>
  <select id="selectStatistics" resultType="com.nanometer.smartlab.entity.HazardousWaste">
    select
    id, sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical,
    apply_person as applyPerson, project, department, unit,create_time as createTime, tid, status, creator
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
    </where>
    group by project,department,unit
    order by create_time desc
    <if test="first != null and pageSize != null">
      limit #{first},#{pageSize}
    </if>
  </select>
  <select id="selectStatisticsExportList" resultType="java.util.Map">
    select
    id, sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical,
    apply_person as applyPerson, project, department, unit,create_time as createTime, tid, status, creator
    from sys_hazardous_waste
    <where>
      1 = 1
      <if test="startTime != null and startTime != ''">
        and create_time &gt; #{startTime}
      </if>
      <if test="endTime != null and endTime != ''">
        and create_time &lt; #{endTime}
      </if>
      <if test="status != null and status != ''">
        and status = #{status}
      </if>
      <if test="applyPerson != null and applyPerson != ''">
        and apply_person = #{applyPerson}
      </if>
      <if test="project != null and project != ''">
        and project = #{project}
      </if>
      <if test="department != null and department != ''">
        and department = #{department}
      </if>
    </where>
    group by project,department,unit
    order by create_time desc
  </select>
  <select id="selectByTid" resultType="com.nanometer.smartlab.entity.HazardousWaste">
    select
    <include refid="Base_Column_List" />
    from sys_hazardous_waste
    <where>
      1 = 1
    and tid = #{tid}
    </where>
  </select>
</mapper>