Newer
Older
huludao / src / main / resources / mapper / RiverManage / ProcessProblemDao.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.newfiber.api.mobile.dao.ProcessProblemDao">
	
	<!-- 可根据自己的需求,是否要使用 -->
    <resultMap type="com.newfiber.api.mobile.model.domain.ProcessProblem" id="processProblemMap">
            <result property="processNo" column="Process_No"/>
            <result property="userNo" column="User_No"/>
            <result property="processPicsNo" column="Process_Pics_No"/>
            <result property="processOption" column="Process_Option"/>
            <result property="processNextUserno" column="Process_Next_UserNo"/>
            <result property="processTime" column="Process_Time"/>
        </resultMap>
    
	<!-- 通用查询结果列 -->
	<sql id="Base_Column_List">
			p.Process_No,
			p.User_No,
			p.Process_Pics_No,
			p.Process_Option,
			p.Process_Next_UserNo,
			p.Process_Time,
			p.Process_Next_Org,
			p.User_Org,
		</sql>
	
	<!-- 获取问题处理流程表列表 -->
	<select id="queryList" resultType="com.newfiber.api.mobile.model.domain.ProcessProblem">
		select <include refid="Base_Column_List" /> 
		from process_problem
        <choose>
            <when test="sidx != null and sidx.trim() != ''">
                order by ${sidx} ${order}
            </when>
			<otherwise>
                order by Process_No desc
			</otherwise>
        </choose>
	</select>

	<!-- 获取问题处理流程表列表 -->
	<select id="queryListByProcessNo" resultType="com.newfiber.api.mobile.model.domain.ProcessProblem">
		select <include refid="Base_Column_List" />
		o.Org_Name userOrgName,
		z.Org_Name processUserOrgName,
		i.user_name userName,
		t.user_name nextUserName
		from process_problem p
		left join huludao_main.sys_user_info i
		on i.User_No = p.User_No
		left join huludao_main.sys_user_info t
		on t.User_No = p.Process_Next_UserNo
		left join huludao_main.sys_user_org s
		on i.User_No = s.User_No
		left join huludao_main.sys_organization o
		on p.User_Org = o.Org_No
		left join huludao_main.sys_organization z
		on p.Process_Next_Org = z.Org_No
		where p.Process_No = #{processNo,jdbcType=VARCHAR}
		order by p.Process_Time asc
	</select>

	<!--根据用户编号查询待处理的问题进程编号-->
	<select id="selectProcessNoByUserNo" resultType="com.newfiber.api.mobile.model.domain.ProcessProblem">
		SELECT b.Process_No from process_problem b,(
			SELECT
				max(id) id,
				Process_No,
				User_No,
				Process_Pics_No,
				Process_Option,
				Process_Next_UserNo
				FROM
				process_problem
				GROUP BY
				Process_No,
				User_No,
				Process_Pics_No,
				Process_Option,
				Process_Next_UserNo
				) a
				WHERE a.id = b.id
			and (b.Process_Next_Org in (select Org_No from huludao_main.sys_user_org where User_No = '${userNo}') or b.User_No = '${userNo}')
	</select>
</mapper>