Newer
Older
huludao / src / main / resources / mapper / project / ProjectPatrolMapper.xml
<?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.xf.huludao.project.dao.ProjectPatrolMapper">

	<resultMap id="projectPatrolMap" type="com.xf.huludao.project.entity.ProjectPatrol">
		<id property="patrolId" column="patrol_id"/>
		<result property="projectNo" column="project_no"/>
		<result property="patrolTime" column="patrol_time"/>
		<result property="problems" column="problems"/>
		<result property="filePaths" column="file_paths"/>
		<result property="createUserNo" column="user_name"/>
		<result property="projectName" column="project_name"/>
		<result property="projectTypeName" column="project_type"/>
		<result property="lon" column="lon"/>
		<result property="lat" column="lat"/>
		<result property="address" column="address"/>
		<result property="remark" column="remark"/>
	</resultMap>

<!--	<resultMap id="oneMapStatistiss" type="com.xf.huludao.project.entity.OneMapPatrolIStatistis">-->
<!--		<result column="project_name" property="projectName" />-->
<!--		<result column="count" property="patrolCount"/>-->
<!--	</resultMap>-->


<!--	<resultMap id="patrolAnalyseVOMap" type="com.xf.huludao.vo.PatrolAnalyseVO">-->
<!--		<id property="id" column="id"/>-->
<!--		<result property="createUserNo" column="create_user_no"/>-->
<!--		<result property="bindNo" column="bind_no"/>-->
<!--		<result property="patrolType" column="patrol_type"/>-->
<!--		<collection property="problemVOList" ofType="com.xf.huludao.vo.PatrolAnalyseProblemVO">-->
<!--			<result property="patrolNo" column="patrol_no"/>-->
<!--			<result property="projectMainName" column="project_main_name"/>-->
<!--			<result property="state" column="state"/>-->
<!--			<result property="description" column="description"/>-->
<!--			<result property="problemTypeName" column="problem_type_name"/>-->
<!--		</collection>-->
<!--	</resultMap>-->

<!--	<select id="selectPatrolList" resultMap="projectPatrolMap">-->
<!--		SELECT-->
<!--		pp.*,p.project_name-->
<!--		FROM-->
<!--		project_patrol pp-->
<!--		LEFT JOIN-->
<!--		project p-->
<!--	  	ON  pp.project_no = p.project_no-->
<!--	  	WHERE 1=1-->
<!--	  	<if test="projectName != null and projectName != ''">-->
<!--			AND p.project_name like concat('%',#{projectName},'%')-->
<!--		</if>-->
<!--		<if test="serchTime != null and serchTime != ''">-->
<!--			${serchTime}-->
<!--		</if>-->
<!--		order by pp.patrol_time DESC LIMIT #{current},#{size}-->
<!--	</select>-->

	<select id="selectPatrolListNew" resultType="com.xf.huludao.project.entity.ProjectPatrol">
		SELECT
		pp.*,p.project_name,p.project_type,bu.real_name as createUserName,p.duty_person,p.duty_dept,p.principal_phone
		FROM
		project_patrol pp
		LEFT JOIN
		project p
		ON  pp.project_no = p.project_no
		left join
		bladex_siping.blade_user bu
		on pp.create_user_no = bu.account
		WHERE 1=1
		and pp.project_no = #{dto.projectNo}
        <if test="dto.startDate != null and dto.startDate != ''">
            and pp.patrol_time &gt;= #{dto.startDate}
        </if>
        <if test="dto.endDate != null and dto.endDate != ''">
            and pp.patrol_time &lt;= #{dto.endDate}
        </if>
		order by pp.patrol_time DESC LIMIT #{current},#{size}
	</select>


	<select id="selectPatrolListCountNew" resultType="int">
		select count(patrol_id) from project_patrol where  project_no = #{projectNo}
	</select>


    <select id="selectCountByProjectNo" resultType="java.util.Map">
		select project_no,count(patrol_id) from project_patrol where  project_no in
        <foreach collection="collect" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
	</select>



<!--	<select id="selectPatrolListCount" resultType="integer">-->
<!--		SELECT-->
<!--		count(patrol_id)-->
<!--		FROM-->
<!--		project_patrol pp-->
<!--		LEFT JOIN-->
<!--		project p-->
<!--		ON  pp.project_no = p.project_no-->
<!--		WHERE 1=1-->
<!--		<if test="projectName != null and projectName != ''">-->
<!--			AND p.project_name like concat('%',#{projectName},'%')-->
<!--		</if>-->
<!--		<if test="serchTime != null and serchTime != ''">-->
<!--			${serchTime}-->
<!--		</if>-->
<!--	</select>-->


<!--	<select id="selectProjectPatrolList" resultMap="projectPatrolMap">-->
<!--		SELECT-->
<!--			pp.*,p.project_name,p.project_type-->
<!--		FROM-->
<!--			project_patrol pp-->
<!--				LEFT JOIN-->
<!--			project p-->
<!--			ON  pp.project_no = p.project_no-->
<!--		order by patrol_time desc LIMIT 1-->
<!--	</select>-->

<!--	<select id="selectPatrolStatistis" resultMap="oneMapStatistiss">-->
<!--		select p.project_name, pp.count from (select project_no,count(patrol_id) as count from project_patrol GROUP BY project_no) pp  left join  project p on pp.project_no = p.project_no-->
<!--	</select>-->


<!--	<select id="selectByTimes" resultMap="patrolAnalyseVOMap">-->
<!--		select  pmr.id,pmr.patrol_type,pmr.bind_no,pmr.create_user_no,pmp.patrol_name,pmp.patrol_no,pmp.project_main_name,pmp.state,pmp.description,pmp.problem_type_name from-->
<!--		xinyang_river.patrol_manage_record pmr-->
<!--		left join-->
<!--		xinyang_river.patrol_manage_problem pmp-->
<!--		ON-->
<!--		pmr.id = pmp.patrol_no-->
<!--		where-->
<!--		<choose>-->
<!--			<when test="startTime != null and startTime != '' and endTime != null and endTime != ''">-->
<!--				pmr.start_time BETWEEN #{startTime} and   ADDDATE(#{endTime},INTERVAL +1 DAY)-->
<!--			</when>-->
<!--			<otherwise>-->
<!--				TO_DAYS(pmr.start_time) = TO_DAYS(now())-->
<!--			</otherwise>-->
<!--		</choose>-->
<!--	</select>-->


<!--	<select id="countByPatrolRealStaff" resultType="com.xf.huludao.vo.SimplePatrolManageRecord">-->
<!--		select-->
<!--		pmr.id as id,pmr.patrol_type as patrolType,pmr.create_user_no as createUserNo-->
<!--		from xinyang_river.patrol_manage_record pmr-->
<!--		where 1=1-->
<!--		<if test="patrolType != null">-->
<!--			and pmr.patrol_type = #{patrolType}-->
<!--		</if>-->
<!--		<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">-->
<!--			and pmr.start_time BETWEEN #{startTime} and   ADDDATE(#{endTime},INTERVAL +1 DAY)-->
<!--		</if>-->
<!--	</select>-->


<!--	<select id="selectProblemList" resultType="com.xf.huludao.vo.PatrolAnalyseProblemVO">-->
<!--		select-->
<!--		patrol_no as patrolNo,-->
<!--		project_main_name as projectMainName,-->
<!--		`state`,-->
<!--		address,-->
<!--		description,-->
<!--		problem_type_name as problemTypeName,-->
<!--		patrol_type as patrolType,-->
<!--		sub_source as subSource-->
<!--		from-->
<!--		xinyang_river.patrol_manage_problem-->
<!--		where 1 = 1 and patrol_type in(1,2)-->
<!--		<choose>-->
<!--			<when test="startTime != null and startTime != '' and endTime != null and endTime != ''">-->
<!--				and create_time BETWEEN #{startTime} and   ADDDATE(#{endTime},INTERVAL +1 DAY)-->
<!--			</when>-->
<!--			<otherwise>-->
<!--				and TO_DAYS(pmr.start_time) = TO_DAYS(now())-->
<!--			</otherwise>-->
<!--		</choose>-->
<!--	</select>-->


</mapper>