| | |
| | | <result column="inspector_id" jdbcType="BIGINT" property="inspectorId" /> |
| | | <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> |
| | | <result column="stop_time" jdbcType="TIMESTAMP" property="stopTime" /> |
| | | <result column="inspect_distance" jdbcType="FLOAT" property="inspectDistance" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!--@mbg.generated--> |
| | | id, inspector_id, start_time, stop_time |
| | | id, inspector_id, start_time, stop_time, inspect_distance |
| | | </sql> |
| | | <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
| | | <!--@mbg.generated--> |
| | |
| | | <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> |
| | | <!--@mbg.generated--> |
| | | insert into ope_inspect (id, inspector_id, start_time, |
| | | stop_time) |
| | | stop_time, inspect_distance) |
| | | values (#{id,jdbcType=BIGINT}, #{inspectorId,jdbcType=BIGINT}, #{startTime,jdbcType=TIMESTAMP}, |
| | | #{stopTime,jdbcType=TIMESTAMP}) |
| | | #{stopTime,jdbcType=TIMESTAMP}, #{inspectDistance,jdbcType=FLOAT}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoOp.OpeInspect"> |
| | | <!--@mbg.generated--> |
| | |
| | | <if test="stopTime != null"> |
| | | stop_time, |
| | | </if> |
| | | <if test="inspectDistance != null"> |
| | | inspect_distance, |
| | | </if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null"> |
| | |
| | | </if> |
| | | <if test="stopTime != null"> |
| | | #{stopTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="inspectDistance != null"> |
| | | #{inspectDistance,jdbcType=FLOAT}, |
| | | </if> |
| | | </trim> |
| | | </insert> |
| | |
| | | <if test="stopTime != null"> |
| | | stop_time = #{stopTime,jdbcType=TIMESTAMP}, |
| | | </if> |
| | | <if test="inspectDistance != null"> |
| | | inspect_distance = #{inspectDistance,jdbcType=FLOAT}, |
| | | </if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | update ope_inspect |
| | | set inspector_id = #{inspectorId,jdbcType=BIGINT}, |
| | | start_time = #{startTime,jdbcType=TIMESTAMP}, |
| | | stop_time = #{stopTime,jdbcType=TIMESTAMP} |
| | | stop_time = #{stopTime,jdbcType=TIMESTAMP}, |
| | | inspect_distance = #{inspectDistance,jdbcType=FLOAT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!-- 查询总数 --> |
| | | <select id="getInspectsCount" resultType="java.lang.Long"> |
| | | SELECT |
| | | count(*) |
| | | FROM `ope_inspect` oi |
| | | INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id |
| | | <where> |
| | | ba_user.deleted = 0 |
| | | <if test="inspectorId != null"> |
| | | AND oi.inspector_id = #{inspectorId} |
| | | </if> |
| | | <if test="inspectId != null"> |
| | | AND oi.id = #{inspectId} |
| | | </if> |
| | | <if test="inspectorName != null"> |
| | | AND ba_user.`name` LIKE CONCAT('%',#{inspectorName},'%') |
| | | </if> |
| | | <if test="timeStart != null and timeStop != null"> |
| | | AND oi.start_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- 查询列表 --> |
| | | <select id="getInspects" resultType="com.dy.pipIrrGlobal.voOp.VoInspect"> |
| | | SELECT |
| | | oi.inspector_id AS inspectorId, |
| | | ba_user.`name` AS inspectorName, |
| | | oi.id AS inspectId, |
| | | oi.start_time AS startTime, |
| | | oi.stop_time AS stopTime, |
| | | oi.inspect_distance AS inspectDistance |
| | | FROM `ope_inspect` oi |
| | | INNER JOIN `ba_user` ON oi.inspector_id = ba_user.id |
| | | <where> |
| | | ba_user.deleted = 0 |
| | | <if test="inspectorId != null"> |
| | | AND oi.inspector_id = #{inspectorId} |
| | | </if> |
| | | <if test="inspectId != null"> |
| | | AND oi.id = #{inspectId} |
| | | </if> |
| | | <if test="inspectorName != null"> |
| | | AND ba_user.`name` LIKE CONCAT('%',#{inspectorName},'%') |
| | | </if> |
| | | <if test="timeStart != null and timeStop != null"> |
| | | AND oi.start_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | | </where> |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | |
| | | <!--更新指定巡检记录的巡检距离--> |
| | | <update id="updateInspectDistance"> |
| | | UPDATE ope_inspect |
| | | SET inspect_distance = #{distance} |
| | | WHERE id = #{inspectId} |
| | | </update> |
| | | |
| | | <!--根据巡检员ID获取巡检记录数量--> |
| | | <select id="getInstectsCountByInspectorId" resultType="java.lang.Long"> |
| | | SELECT |
| | | count(*) |
| | | FROM ope_inspect ins |
| | | LEFT JOIN ba_user user ON user.id = ins.inspector_id |
| | | WHERE ins.inspector_id = #{inspectorId} |
| | | </select> |
| | | |
| | | <!--根据巡检员ID获取巡检列表--> |
| | | <select id="getInstectsByInspectorId" resultType="com.dy.pipIrrGlobal.voOp.VoInspect"> |
| | | SELECT |
| | | user.id AS inspectorId, |
| | | user.name AS inspectorName, |
| | | ins.id AS inspectId, |
| | | ins.start_time AS startTime, |
| | | ins.stop_time AS stopTime, |
| | | ins.inspect_distance AS inspectDistance |
| | | FROM ope_inspect ins |
| | | LEFT JOIN ba_user user ON user.id = ins.inspector_id |
| | | WHERE ins.inspector_id = #{inspectorId} |
| | | ORDER BY ins.start_time DESC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | | </if> |
| | | </trim> |
| | | </select> |
| | | </mapper> |