<?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" 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_id" property="projectId" />
|
<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" />
|
<result column="project_name" property="projectName" />
|
<result column="apply_person_name" property="applyPersonName" />
|
<result column="unit_name" property="unitName" />
|
</resultMap>
|
<sql id="Base_Column_List">
|
<!-- -->
|
id, acid, alkali, organic, solid, medical, apply_person, project_id, department, unit,
|
create_time, tid, status, creator, updator, updatetime
|
</sql>
|
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
|
<!-- -->
|
select
|
<include refid="Base_Column_List" />
|
from sys_hazardous_waste
|
where id = #{id,jdbcType=BIGINT}
|
</select>
|
<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" useGeneratedKeys = "true" keyProperty = "id">
|
<!-- -->
|
insert into sys_hazardous_waste ( acid, alkali, organic,
|
solid, medical, apply_person,
|
project_id, department, unit,tid, status,
|
creator,updator)
|
values (#{acid,jdbcType=DECIMAL}, #{alkali,jdbcType=DECIMAL}, #{organic,jdbcType=DECIMAL},
|
#{solid,jdbcType=DECIMAL}, #{medical,jdbcType=DECIMAL}, #{applyPerson},
|
#{projectId}, #{department,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR},
|
#{tid,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
|
#{creator,jdbcType=VARCHAR},#{updator,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.nanometer.smartlab.entity.HazardousWaste" useGeneratedKeys = "true" keyProperty = "id">
|
<!-- -->
|
insert into sys_hazardous_waste
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="acid != null">
|
acid,
|
</if>
|
<if test="alkali != null">
|
alkali,
|
</if>
|
<if test="organic != null">
|
organic,
|
</if>
|
<if test="solid != null">
|
solid,
|
</if>
|
<if test="medical != null">
|
medical,
|
</if>
|
<if test="applyPerson != null">
|
apply_person,
|
</if>
|
<if test="projectId != null">
|
project_id,
|
</if>
|
<if test="department != null">
|
department,
|
</if>
|
<if test="unit != null">
|
unit,
|
</if>
|
<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="acid != null">
|
#{acid,jdbcType=DECIMAL},
|
</if>
|
<if test="alkali != null">
|
#{alkali,jdbcType=DECIMAL},
|
</if>
|
<if test="organic != null">
|
#{organic,jdbcType=DECIMAL},
|
</if>
|
<if test="solid != null">
|
#{solid,jdbcType=DECIMAL},
|
</if>
|
<if test="medical != null">
|
#{medical,jdbcType=DECIMAL},
|
</if>
|
<if test="applyPerson != null">
|
#{applyPerson,jdbcType=VARCHAR},
|
</if>
|
<if test="projectId != null">
|
#{projectId},
|
</if>
|
<if test="department != null">
|
#{department,jdbcType=VARCHAR},
|
</if>
|
<if test="unit != null">
|
#{unit,jdbcType=VARCHAR},
|
</if>
|
<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 sys_hazardous_waste
|
<set>
|
<if test="acid != null">
|
acid = #{acid,jdbcType=DECIMAL},
|
</if>
|
<if test="alkali != null">
|
alkali = #{alkali,jdbcType=DECIMAL},
|
</if>
|
<if test="organic != null">
|
organic = #{organic,jdbcType=DECIMAL},
|
</if>
|
<if test="solid != null">
|
solid = #{solid,jdbcType=DECIMAL},
|
</if>
|
<if test="medical != null">
|
medical = #{medical,jdbcType=DECIMAL},
|
</if>
|
<if test="applyPerson != null">
|
apply_person = #{applyPerson,jdbcType=VARCHAR},
|
</if>
|
<if test="projectId != null">
|
project_id = #{projectId},
|
</if>
|
<if test="department != null">
|
department = #{department,jdbcType=VARCHAR},
|
</if>
|
<if test="unit != null">
|
unit = #{unit,jdbcType=VARCHAR},
|
</if>
|
<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 sys_hazardous_waste
|
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_id = #{projectId},
|
department = #{department,jdbcType=VARCHAR},
|
unit = #{unit,jdbcType=VARCHAR},
|
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="setAllWasterCount" resultType="com.nanometer.smartlab.entity.HazardousWaste">
|
select
|
sum(acid) as acid,sum(alkali) as alkali, sum(organic) as organic,sum(solid) as solid,sum(medical) as medical
|
from sys_hazardous_waste
|
<where>
|
1 = 1
|
<if test="starttime != null and starttime != ''">
|
and create_time >= #{starttime}
|
</if>
|
<if test="endtime != null and endtime != ''">
|
and create_time <= #{endtime}
|
</if>
|
<if test="status != null and status != ''">
|
and status = #{status}
|
</if>
|
<if test="applyPerson != null and applyPerson != ''">
|
and apply_person = #{applyPerson}
|
</if>
|
</where>
|
</select>
|
<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 >= #{starttime}
|
</if>
|
<if test="endtime != null and endtime != ''">
|
and create_time <= #{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
|
hw.id, hw.acid, hw.alkali, hw.organic, hw.solid, hw.medical, hw.apply_person, hw.project_id, hw.department, hw.unit,
|
hw.create_time, hw.tid, hw.status, hw.creator, hw.updator, hw.updatetime,sp.project_name,su.name as apply_person_name,bm.meta_value as unit_name
|
from sys_hazardous_waste hw
|
left join sys_project sp on sp.id=hw.project_id
|
left join sys_user su on su.id=hw.apply_person
|
left join base_meta bm on bm.id=hw.unit
|
<where>
|
1 = 1
|
<if test="startTime != null and startTime != ''">
|
and hw.create_time >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and hw.create_time <= #{endTime}
|
</if>
|
<if test="status != null and status != ''">
|
and hw.status = #{status}
|
</if>
|
<if test="applyPerson != null and applyPerson != ''">
|
and hw.apply_person = #{applyPerson}
|
</if>
|
<if test="projectId != null and projectId != ''">
|
and hw.project_id = #{projectId}
|
</if>
|
<if test="department != null and department != ''">
|
and hw.department = #{department}
|
</if>
|
<if test="tid != null and tid != ''">
|
and hw.tid = #{tid}
|
</if>
|
</where>
|
order by create_time desc
|
<if test="first != null and pageSize != null">
|
limit #{first},#{pageSize}
|
</if>
|
</select>
|
|
<select id="countAll" resultType="java.lang.Integer">
|
<!-- -->
|
select count(0)
|
from sys_hazardous_waste
|
<where>
|
1 = 1
|
<if test="startTime != null and startTime != ''">
|
and create_time >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and create_time <= #{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="projectId != null and projectId != ''">
|
and project_id = #{projectId}
|
</if>
|
<if test="department != null and department != ''">
|
and department = #{department}
|
</if>
|
<if test="tid != null and tid != ''">
|
and tid = #{tid}
|
</if>
|
</where>
|
</select>
|
<select id="selectExportList" resultType="java.util.Map">
|
select
|
id, acid, alkali, organic, solid, medical, apply_person as applyPerson, project_id, 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 >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and create_time <= #{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="projectId != null and projectId != ''">
|
and project_id = #{projectId}
|
</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(
|
select count(0)
|
from sys_hazardous_waste
|
<where>
|
1 = 1
|
<if test="startTime != null and startTime != ''">
|
and create_time >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and create_time <= #{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="projectId != null and projectId != ''">
|
and project_id = #{projectId}
|
</if>
|
<if test="department != null and department != ''">
|
and department = #{department}
|
</if>
|
group by project_id,department,unit
|
</where>
|
) shw
|
</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_id, 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 >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and create_time <= #{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="projectId != null and projectId != ''">
|
and project_id = #{projectId}
|
</if>
|
<if test="department != null and department != ''">
|
and department = #{department}
|
</if>
|
</where>
|
group by project_id,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_id, 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 >= #{startTime}
|
</if>
|
<if test="endTime != null and endTime != ''">
|
and create_time <= #{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="projectId != null and projectId != ''">
|
and project_id = #{projectId}
|
</if>
|
<if test="department != null and department != ''">
|
and department = #{department}
|
</if>
|
</where>
|
group by project_id,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>
|