|
@@ -7,7 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<resultMap type="com.project.zcustom.domain.unit.LargeProject" id="LargeProjectResult">
|
|
|
<result property="id" column="id" />
|
|
|
<result property="projectName" column="project_name" />
|
|
|
- <result property="unitId" column="unit_id" />
|
|
|
+ <result property="unitCode" column="unit_code" />
|
|
|
<result property="connectFlag" column="connect_flag" />
|
|
|
<result property="delFlag" column="del_flag" />
|
|
|
<result property="createBy" column="create_by" />
|
|
@@ -17,14 +17,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectLargeProjectVo">
|
|
|
- select id, project_name, unit_id, connect_flag, del_flag, create_by, create_time, update_by, update_time from large_project
|
|
|
+ select id, project_name, unit_code, connect_flag, del_flag, create_by, create_time, update_by, update_time from large_project
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectLargeProjectList" parameterType="LargeProject" resultMap="LargeProjectResult">
|
|
|
<include refid="selectLargeProjectVo"/>
|
|
|
<where>
|
|
|
<if test="projectName != null and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
|
|
|
- <if test="unitId != null "> and unit_id = #{unitId}</if>
|
|
|
+ <if test="unitCode != null "> and unit_code = #{unitCode}</if>
|
|
|
<if test="connectFlag != null and connectFlag != ''"> and connect_flag = #{connectFlag}</if>
|
|
|
</where>
|
|
|
</select>
|
|
@@ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
insert into large_project
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
<if test="projectName != null">project_name,</if>
|
|
|
- <if test="unitId != null">unit_id,</if>
|
|
|
+ <if test="unitCode != null">unit_code,</if>
|
|
|
<if test="connectFlag != null">connect_flag,</if>
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
<if test="createBy != null">create_by,</if>
|
|
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="projectName != null">#{projectName},</if>
|
|
|
- <if test="unitId != null">#{unitId},</if>
|
|
|
+ <if test="unitCode != null">#{unitCode},</if>
|
|
|
<if test="connectFlag != null">#{connectFlag},</if>
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
@@ -57,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
update large_project
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
<if test="projectName != null">project_name = #{projectName},</if>
|
|
|
- <if test="unitId != null">unit_id = #{unitId},</if>
|
|
|
+ <if test="unitCode != null">unit_code = #{unitCode},</if>
|
|
|
<if test="connectFlag != null">connect_flag = #{connectFlag},</if>
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
@@ -82,18 +82,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
DELETE FROM large_project ${ew.customSqlSegment}
|
|
|
</delete>
|
|
|
|
|
|
- <select id="getProjectNum" resultType="int">
|
|
|
+ <select id="getProjectNumX" parameterType="String" resultType="int">
|
|
|
select count(*) from large_project
|
|
|
- where del_flag = '0'
|
|
|
+ where del_flag = '0' and type = '0' and subdivision = #{subdivision}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getConnectProjectNum" resultType="int">
|
|
|
+ <select id="getProjectNumY" parameterType="String" resultType="int">
|
|
|
select count(*) from large_project
|
|
|
- where connect_flag = '0' and del_flag = '0'
|
|
|
+ where del_flag = '0' and type = '2' and subdivision = #{subdivision}
|
|
|
</select>
|
|
|
|
|
|
- <select id="getConnectProjectByUnit" parameterType="String" resultMap="LargeProjectResult">
|
|
|
- <include refid="selectLargeProjectVo"/>
|
|
|
- where connect_flag = '0' and del_flag = '0' and unit_id = #{appOrg}
|
|
|
+ <select id="getCameraNumList" parameterType="String" resultMap="LargeProjectResult">
|
|
|
+ SELECT
|
|
|
+ a.project_name,
|
|
|
+ COUNT(
|
|
|
+ IF
|
|
|
+ ( a.del_flag = 0 AND b.del_flag = 0, 1, NULL )) AS cameraNum
|
|
|
+ FROM
|
|
|
+ large_project a
|
|
|
+ LEFT JOIN large_camera b ON a.id = b.project_id
|
|
|
+ WHERE a.del_flag = 0 AND a.unit_code = #{unitCode}
|
|
|
+ GROUP BY a.id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getProjectNumThisWeek" resultType="int">
|
|
|
+ SELECT
|
|
|
+ COUNT(*)
|
|
|
+ FROM
|
|
|
+ large_plan a
|
|
|
+ LEFT JOIN large_project b ON a.project_id = b.id
|
|
|
+ WHERE
|
|
|
+ a.del_flag = '0'
|
|
|
+ AND b.del_flag = '0'
|
|
|
+ AND a.type = '0'
|
|
|
+ AND DATE(a.start_time) BETWEEN DATE_SUB( CURDATE(), INTERVAL ( DAYOFWEEK( CURDATE()) - 2 ) DAY )
|
|
|
+ AND DATE_ADD( CURDATE(), INTERVAL ( 8 - DAYOFWEEK( CURDATE())) DAY )
|
|
|
+ OR DATE(a.end_time) BETWEEN DATE_SUB( CURDATE(), INTERVAL ( DAYOFWEEK( CURDATE()) - 2 ) DAY )
|
|
|
+ AND DATE_ADD(
|
|
|
+ CURDATE(),
|
|
|
+ INTERVAL (
|
|
|
+ 8 - DAYOFWEEK(
|
|
|
+ CURDATE())) DAY)
|
|
|
</select>
|
|
|
</mapper>
|