SupervisionThreestepMapper.xml 17.5 KB
<?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.trash.business.mapper.SupervisionThreestepMapper">

	<resultMap type="SupervisionThreestep" id="SupervisionThreestepResult">
		<result property="id" column="id" />
		<result property="name" column="name" />
		<result property="type" column="type" />
		<result property="place" column="place" />
		<result property="selfCheckTime" column="self_check_time" />
		<result property="objectId" column="object_id" />
		<result property="earthsitesId" column="earthsites_id" />
		<result property="createTime" column="create_time" />
		<result property="checkTime" column="check_time" />
		<result property="checkEndTime" column="check_end_time" />
		<result property="earthsitesName" column="earthsites_name" />
		<result property="contract" column="contract" />
		<result property="contractId" column="contract_id" />
		<result property="companys" column="companys" />
		<result property="companyTrucks" column="company_trucks" />
		<result property="img0" column="img0" />
		<result property="img1" column="img1" />
		<result property="img2" column="img2" />
		<result property="img3" column="img3" />
		<result property="img4" column="img4" />
		<result property="img5" column="img5" />
		<result property="img6" column="img6" />
		<result property="img7" column="img7" />
		<result property="img8" column="img8" />
		<result property="img9" column="img9" />
		<result property="img10" column="img10" />
		<result property="img11" column="img11" />
		<result property="img12" column="img12" />
		<result property="sub_img0" column="sub_img0" />
		<result property="sub_img1" column="sub_img1" />
		<result property="sub_img2" column="sub_img2" />
		<result property="sub_img3" column="sub_img3" />
		<result property="sub_img4" column="sub_img4" />
		<result property="sub_img5" column="sub_img5" />
		<result property="sub_img6" column="sub_img6" />
		<result property="sub_img7" column="sub_img7" />
		<result property="sub_img8" column="sub_img8" />
		<result property="sub_img9" column="sub_img9" />
		<result property="sub_img10" column="sub_img10" />
		<result property="sub_img11" column="sub_img11" />
		<result property="sub_img12" column="sub_img12" />

		<result property="subReason" column="sub_reason" />
		<result property="earthPipPerson" column="earth_pip_person" />
		<result property="enforcePerson" column="enforce_person" />
		<result property="subSubReason" column="sub_sub_reason" />
		<result property="attchItem1" column="attch_item1" />
		<result property="attchItem2" column="attch_item2" />
		<result property="attchItem3" column="attch_item3" />

		<result property="person" column="person" />
		<result property="phone" column="phone" />
		<result property="status" column="status" />
		<result property="createBy" column="create_by" />


	</resultMap>

	<sql id="selectSupervisionThreestepVo">
		select id, name, type, place, self_check_time, object_id, earthsites_id,
		create_time, check_time, earthsites_name,check_end_time,
		contract,contract_id,
		companys, company_trucks, img0, img1, img2, img3, img4, img5, img6, img7, img8,
		img9, img10, img11, img12, sub_img0, sub_img1,
		sub_img2, sub_img3, sub_img4, sub_img5, sub_img6, sub_img7, sub_img8, sub_img9,
		sub_img10, sub_img11, sub_img12,
		person,
		phone,status,create_by,sub_reason,earth_pip_person,enforce_person,sub_sub_reason,attch_item1,attch_item2,attch_item3
		from supervision_threestep
	</sql>

	<select id="selectSupervisionThreestepList" parameterType="SupervisionThreestep"
		resultMap="SupervisionThreestepResult">
		<include refid="selectSupervisionThreestepVo" />
		<where>
			<if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
			<if test="type != null "> and type = #{type}</if>
			<if test="place != null  and place != ''"> and place = #{place}</if>
			<if test="objectId != null  and objectId != ''"> and object_id = #{objectId}</if>
			<if test="earthsitesId != null  and earthsitesId != ''"> and earthsites_id = #{earthsitesId}</if>
			<if test="checkTime != null "> and check_time = #{checkTime}</if>
			<if test="earthsitesName != null  and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},
				'%')</if>
			<if test="contract != null  and contract != ''"> and contract = #{contract}</if>
			<if test="companys != null  and companys != ''"> and companys = #{companys}</if>
			<if test="companyTrucks != null  and companyTrucks != ''"> and company_trucks = #{companyTrucks}</if>
			<if test="img0 != null  and img0 != ''"> and img0 = #{img0}</if>
			<if test="img1 != null  and img1 != ''"> and img1 = #{img1}</if>
			<if test="img2 != null  and img2 != ''"> and img2 = #{img2}</if>
			<if test="img3 != null  and img3 != ''"> and img3 = #{img3}</if>
			<if test="img4 != null  and img4 != ''"> and img4 = #{img4}</if>
			<if test="img5 != null  and img5 != ''"> and img5 = #{img5}</if>
			<if test="img6 != null  and img6 != ''"> and img6 = #{img6}</if>
			<if test="img7 != null  and img7 != ''"> and img7 = #{img7}</if>
			<if test="img8 != null  and img8 != ''"> and img8 = #{img8}</if>
			<if test="img9 != null  and img9 != ''"> and img9 = #{img9}</if>
			<if test="img10 != null  and img10 != ''"> and img10 = #{img10}</if>
			<if test="img11 != null  and img11 != ''"> and img11 = #{img11}</if>
			<if test="img12 != null  and img12 != ''"> and img12 = #{img12}</if>
			<if test="person != null  and person != ''"> and person = #{person}</if>
			<if test="phone != null  and phone != ''"> and phone = #{phone}</if>
			<if test="status != null  and status != ''"> and status = #{status}</if>
			<if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
			<if test="workStartTime != null"> and self_check_time BETWEEN #{workStartTime} and
				#{workEndTime}</if>
		</where>
		ORDER BY create_time desc
	</select>

	<select id="getNames" parameterType="TruckCredit" resultType="String">
		select DISTINCT name from supervision_threestep
		<where>
			<if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
			<if test="type != null "> and type = #{type}</if>
			<if test="place != null  and place != ''"> and place = #{place}</if>
			<if test="objectId != null  and objectId != ''"> and object_id = #{objectId}</if>
			<if test="earthsitesId != null  and earthsitesId != ''"> and earthsites_id = #{earthsitesId}</if>
			<if test="checkTime != null "> and check_time = #{checkTime}</if>
			<if test="earthsitesName != null  and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},
				'%')</if>
			<if test="contract != null  and contract != ''"> and contract = #{contract}</if>
			<if test="companys != null  and companys != ''"> and companys = #{companys}</if>
			<if test="companyTrucks != null  and companyTrucks != ''"> and company_trucks = #{companyTrucks}</if>
			<if test="img0 != null  and img0 != ''"> and img0 = #{img0}</if>
			<if test="img1 != null  and img1 != ''"> and img1 = #{img1}</if>
			<if test="img2 != null  and img2 != ''"> and img2 = #{img2}</if>
			<if test="img3 != null  and img3 != ''"> and img3 = #{img3}</if>
			<if test="img4 != null  and img4 != ''"> and img4 = #{img4}</if>
			<if test="img5 != null  and img5 != ''"> and img5 = #{img5}</if>
			<if test="img6 != null  and img6 != ''"> and img6 = #{img6}</if>
			<if test="img7 != null  and img7 != ''"> and img7 = #{img7}</if>
			<if test="img8 != null  and img8 != ''"> and img8 = #{img8}</if>
			<if test="img9 != null  and img9 != ''"> and img9 = #{img9}</if>
			<if test="img10 != null  and img10 != ''"> and img10 = #{img10}</if>
			<if test="img11 != null  and img11 != ''"> and img11 = #{img11}</if>
			<if test="img12 != null  and img12 != ''"> and img12 = #{img12}</if>
			<if test="person != null  and person != ''"> and person = #{person}</if>
			<if test="phone != null  and phone != ''"> and phone = #{phone}</if>
			<if test="status != null  and status != ''"> and status = #{status}</if>
			<if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
			<if test="workStartTime != null"> and self_check_time BETWEEN #{workStartTime} and
				#{workEndTime}</if>
		</where>
		ORDER BY create_time desc
	</select>


	<!-- <select id="selectDayWorkList" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
		select a.*,b.* from( select x.* from (select * from supervision_threestep a
		<where>
			type = 0
			and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
			<if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
			<if test="place != null  and place != ''"> and place = #{place}</if>
			<if test="earthsitesName != null  and earthsitesName != ''"> and earthsites_name like concat('%', #{earthsitesName},'%')</if>
		</where> 
		
		ORDER BY self_check_time DESC) x GROUP BY object_id) a
		LEFT JOIN
		(select name ename,object_id eobject_id,sub_reason esub_reason,place
		eplace,status estatus,self_check_time eself_check_time from
		supervision_threestep where type = 1) b
		on a.earthsites_id = b.eobject_id
		and DATE_FORMAT(a.self_check_time,("%y%m%d")) =
		DATE_FORMAT(b.eself_check_time,("%y%m%d"))
		ORDER BY a.create_time DESC
		
		
		
	</select> -->

	<select id="selectDayWorkList" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
		select * from supervision_threestep
		<where>
			and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
			
		</where> 
		ORDER BY create_time DESC
		
	</select>
	




	<select id="selectDayWorkListByType" parameterType="SupervisionThreestep"
		resultType="java.util.HashMap">
		select object_id id,name,earthsites_id relationSiteId,company_trucks
		from supervision_threestep
		<where>
			<if test="type != null"> and type = #{type} </if>
			<if test="objectId != null  and objectId != ''"> and object_id = #{objectId} </if>
			and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
			and status = 1
		</where>
		ORDER BY self_check_time DESC
	</select>

	<select id="selectThreestepByTruckDate" parameterType="SupervisionThreestep" resultMap="SupervisionThreestepResult">
		select * from supervision_threestep
		where name = #{name}
		and earthsites_name = #{earthsitesName}
		<if test="companyTrucks != null">
			and company_trucks like concat('%', #{companyTrucks}, '%')
		</if>
		and type = 0
		and status = 1
		and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
		ORDER BY self_check_time DESC
	</select>
	



	<select id="selectSupervisionThreestepById" parameterType="Long"
		resultMap="SupervisionThreestepResult">
		<include refid="selectSupervisionThreestepVo" />
		where id = #{id}
	</select>


	<select id="selectTodayData" parameterType="SupervisionThreestep"
		resultMap="SupervisionThreestepResult">
		<include refid="selectSupervisionThreestepVo" />
		<where>
			and object_id = #{objectId}
			and type = #{type}
			and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
		</where>
	</select>

	<select id="selectTodayDataList" parameterType="SupervisionThreestep"
		resultMap="SupervisionThreestepResult">
		<include refid="selectSupervisionThreestepVo" />
		<where>
			<if test="status != null"> status = #{status}</if>
			and type = #{type}
			and self_check_time BETWEEN #{workStartTime} and #{workEndTime}
		</where>
	</select>

	<insert id="insertSupervisionThreestep" parameterType="SupervisionThreestep"
		useGeneratedKeys="true" keyProperty="id">
		insert into supervision_threestep
		<trim prefix="(" suffix=")" suffixOverrides=",">
			<if test="name != null">name,</if>
			<if test="type != null">type,</if>
			<if test="place != null">place,</if>
			<if test="selfCheckTime != null">self_check_time,</if>
			<if test="objectId != null">object_id,</if>
			<if test="earthsitesId != null">earthsites_id,</if>
			<if test="createTime != null">create_time,</if>
			<if test="earthsitesName != null">earthsites_name,</if>
			<if test="contract != null">contract,</if>
			<if test="contractId != null">contract_id,</if>
			<if test="companys != null">companys,</if>
			<if test="companyTrucks != null">company_trucks,</if>
			<if test="img0 != null">img0,</if>
			<if test="img1 != null">img1,</if>
			<if test="img2 != null">img2,</if>
			<if test="img3 != null">img3,</if>
			<if test="img4 != null">img4,</if>
			<if test="img5 != null">img5,</if>
			<if test="img6 != null">img6,</if>
			<if test="img7 != null">img7,</if>
			<if test="img8 != null">img8,</if>
			<if test="img9 != null">img9,</if>
			<if test="img10 != null">img10,</if>
			<if test="img11 != null">img11,</if>
			<if test="img12 != null">img12,</if>
			<if test="person != null">person,</if>
			<if test="phone != null">phone,</if>
			<if test="status != null">status,</if>
			<if test="createBy != null">create_by,</if>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
			<if test="name != null">#{name},</if>
			<if test="type != null">#{type},</if>
			<if test="place != null">#{place},</if>
			<if test="selfCheckTime != null">#{selfCheckTime},</if>
			<if test="objectId != null">#{objectId},</if>
			<if test="earthsitesId != null">#{earthsitesId},</if>
			<if test="createTime != null">#{createTime},</if>
			<if test="earthsitesName != null">#{earthsitesName},</if>
			<if test="contract != null">#{contract},</if>
			<if test="contractId != null">#{contractId},</if>
			<if test="companys != null">#{companys},</if>
			<if test="companyTrucks != null">#{companyTrucks},</if>
			<if test="img0 != null">#{img0},</if>
			<if test="img1 != null">#{img1},</if>
			<if test="img2 != null">#{img2},</if>
			<if test="img3 != null">#{img3},</if>
			<if test="img4 != null">#{img4},</if>
			<if test="img5 != null">#{img5},</if>
			<if test="img6 != null">#{img6},</if>
			<if test="img7 != null">#{img7},</if>
			<if test="img8 != null">#{img8},</if>
			<if test="img9 != null">#{img9},</if>
			<if test="img10 != null">#{img10},</if>
			<if test="img11 != null">#{img11},</if>
			<if test="img12 != null">#{img12},</if>
			<if test="person != null">#{person},</if>
			<if test="phone != null">#{phone},</if>
			<if test="status != null">#{status},</if>
			<if test="createBy != null"> #{createBy},</if>
		</trim>
	</insert>

	<update id="updateSupervisionThreestep" parameterType="SupervisionThreestep">
		update supervision_threestep
		<trim prefix="SET" suffixOverrides=",">
			<if test="name != null">name = #{name},</if>
			<if test="type != null">type = #{type},</if>
			<if test="place != null">place = #{place},</if>
			<if test="selfCheckTime != null">self_check_time = #{selfCheckTime},</if>
			<if test="objectId != null">object_id = #{objectId},</if>
			<if test="earthsitesId != null">earthsites_id = #{earthsitesId},</if>
			<if test="createTime != null">create_time = #{createTime},</if>
			<if test="checkTime != null">check_time = #{checkTime},</if>
			<if test="earthsitesName != null">earthsites_name = #{earthsitesName},</if>
			<if test="contract != null">contract = #{contract},</if>
			<if test="contractId != null">contract_id = #{contractId},</if>
			<if test="companys != null">companys = #{companys},</if>
			<if test="companyTrucks != null">company_trucks = #{companyTrucks},</if>
			<if test="img0 != null">img0 = #{img0},</if>
			<if test="img1 != null">img1 = #{img1},</if>
			<if test="img2 != null">img2 = #{img2},</if>
			<if test="img3 != null">img3 = #{img3},</if>
			<if test="img4 != null">img4 = #{img4},</if>
			<if test="img5 != null">img5 = #{img5},</if>
			<if test="img6 != null">img6 = #{img6},</if>
			<if test="img7 != null">img7 = #{img7},</if>
			<if test="img8 != null">img8 = #{img8},</if>
			<if test="img9 != null">img9 = #{img9},</if>
			<if test="img10 != null">img10 = #{img10},</if>
			<if test="img11 != null">img11 = #{img11},</if>
			<if test="img12 != null">img12 = #{img12},</if>
			<if test="sub_img0 != null">sub_img0 = #{sub_img0},</if>
			<if test="sub_img1 != null">sub_img1 = #{sub_img1},</if>
			<if test="sub_img2 != null">sub_img2 = #{sub_img2},</if>
			<if test="sub_img3 != null">sub_img3 = #{sub_img3},</if>
			<if test="sub_img4 != null">sub_img4 = #{sub_img4},</if>
			<if test="sub_img5 != null">sub_img5 = #{sub_img5},</if>
			<if test="sub_img6 != null">sub_img6 = #{sub_img6},</if>
			<if test="sub_img7 != null">sub_img7 = #{sub_img7},</if>
			<if test="sub_img8 != null">sub_img8 = #{sub_img8},</if>
			<if test="sub_img9 != null">sub_img9 = #{sub_img9},</if>
			<if test="sub_img10 != null">sub_img10 = #{sub_img10},</if>
			<if test="sub_img11 != null">sub_img11 = #{sub_img11},</if>
			<if test="sub_img12 != null">sub_img12 = #{sub_img12},</if>
			<if test="subReason != null">sub_reason = #{subReason},</if>
			<if test="earthPipPerson != null">earth_pip_person = #{earthPipPerson},</if>
			<if test="enforcePerson != null">enforce_person = #{enforcePerson},</if>
			<if test="subSubReason != null">sub_sub_reason = #{subSubReason},</if>
			<if test="attchItem1 != null">attch_item1 = #{attchItem1},</if>
			<if test="attchItem2 != null">attch_item2 = #{attchItem2},</if>
			<if test="attchItem3 != null">attch_item3 = #{attchItem3},</if>
			<if test="person != null">person = #{person},</if>
			<if test="phone != null">phone = #{phone},</if>
			<if test="status != null">status = #{status},</if>
			<if test="checkEndTime != null">check_end_time = #{checkEndTime},</if>
		</trim>
		where id = #{id}
	</update>

	<delete id="deleteSupervisionThreestepById" parameterType="Long">
		delete from supervision_threestep where id = #{id}
	</delete>

	<delete id="deleteSupervisionThreestepByIds" parameterType="String">
		delete from supervision_threestep where id in
		<foreach item="id" collection="array" open="(" separator=","
			close=")">
			#{id}
		</foreach>
	</delete>



</mapper>