<?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.javaweb.geo.mapper.CollectStatisticsMapper">
|
|
<resultMap type="CollectStatistics" id="CollectStatisticsResult">
|
<result property="ids" column="ids" />
|
<result property="companyId" column="company_id" />
|
<result property="companyName" column="company_name" />
|
<result property="projectId" column="project_id" />
|
<result property="projectNum" column="project_num" />
|
<result property="holeNum" column="hole_num" />
|
<result property="exceptionProject" column="exception_project" />
|
<result property="exceptionNum" column="exception_num" />
|
<result property="jinchiNum" column="jinchi_num" />
|
<result property="province" column="province" />
|
<result property="district" column="district" />
|
<result property="createTime" column="create_time" />
|
<result property="endTime" column="end_time" />
|
<result property="dataResouce" column="data_resouce" />
|
<result property="isDeleted" column="is_deleted" />
|
</resultMap>
|
|
<sql id="selectCollectStatisticsVo">
|
select ids, company_id, company_name, project_num, hole_num, exception_project, exception_num, jinchi_num, province, district, create_time, end_time, data_resouce, is_deleted from js_collect_statistics
|
</sql>
|
|
<select id="selectCollectStatisticsList" parameterType="CollectStatistics" resultMap="CollectStatisticsResult">
|
<include refid="selectCollectStatisticsVo"/>
|
<where>
|
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
|
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
|
<if test="projectNum != null "> and project_num = #{projectNum}</if>
|
<if test="holeNum != null "> and hole_num = #{holeNum}</if>
|
<if test="exceptionProject != null "> and exception_project = #{exceptionProject}</if>
|
<if test="exceptionNum != null "> and exception_num = #{exceptionNum}</if>
|
<if test="jinchiNum != null "> and jinchi_num = #{jinchiNum}</if>
|
<if test="province != null and province != ''"> and province = #{province}</if>
|
<if test="district != null and district != ''"> and district = #{district}</if>
|
<if test="endTime != null "> and end_time = #{endTime}</if>
|
<if test="dataResouce != null and dataResouce != ''"> and data_resouce = #{dataResouce}</if>
|
<if test="isDeleted != null and isDeleted != ''"> and is_deleted = #{isDeleted}</if>
|
|
<if test="params.beginEndTime != null and params.beginEndTime != ''"><!-- 开始时间检索 -->
|
and date_format(create_time,'%y%m%d') >= date_format(#{params.beginEndTime},'%y%m%d')
|
</if>
|
<if test="params.endEndTime != null and params.endEndTime != ''"><!-- 结束时间检索 -->
|
and date_format(create_time,'%y%m%d') <= date_format(#{params.endEndTime},'%y%m%d')
|
</if>
|
|
</where>
|
</select>
|
|
<select id="selectCollectStatisticsById" parameterType="String" resultMap="CollectStatisticsResult">
|
<include refid="selectCollectStatisticsVo"/>
|
where ids = #{ids}
|
</select>
|
|
<!-- 同步统计汇总数据 -->
|
<select id="selectCollectStatistic" resultMap="CollectStatisticsResult">
|
SELECT
|
a.company_id,
|
b.full_name as 'company_name',
|
a.ids as 'project_id',
|
COUNT(company_id) as 'project_num',
|
a.province,
|
a.district,
|
a.create_time,
|
a.end_time
|
FROM
|
js_project a,
|
js_company b
|
WHERE
|
a.company_id = b.ids and a.create_time <= NOW() and a.create_time >= (SELECT DATE_SUB(CURDATE(),INTERVAL dayofyear(now())-1 DAY))
|
GROUP BY
|
a.company_id
|
</select>
|
|
<insert id="insertCollectStatistics" parameterType="CollectStatistics">
|
insert into js_collect_statistics
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">ids,</if>
|
<if test="companyId != null and companyId != ''">company_id,</if>
|
<if test="companyName != null and companyName != ''">company_name,</if>
|
<if test="projectNum != null ">project_num,</if>
|
<if test="holeNum != null ">hole_num,</if>
|
<if test="exceptionProject != null ">exception_project,</if>
|
<if test="exceptionNum != null ">exception_num,</if>
|
<if test="jinchiNum != null ">jinchi_num,</if>
|
<if test="province != null and province != ''">province,</if>
|
<if test="district != null and district != ''">district,</if>
|
<if test="createTime != null ">create_time,</if>
|
<if test="endTime != null ">end_time,</if>
|
<if test="dataResouce != null and dataResouce != ''">data_resouce,</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted,</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="ids != null and ids != ''">#{ids},</if>
|
<if test="companyId != null and companyId != ''">#{companyId},</if>
|
<if test="companyName != null and companyName != ''">#{companyName},</if>
|
<if test="projectNum != null ">#{projectNum},</if>
|
<if test="holeNum != null ">#{holeNum},</if>
|
<if test="exceptionProject != null ">#{exceptionProject},</if>
|
<if test="exceptionNum != null ">#{exceptionNum},</if>
|
<if test="jinchiNum != null ">#{jinchiNum},</if>
|
<if test="province != null and province != ''">#{province},</if>
|
<if test="district != null and district != ''">#{district},</if>
|
<if test="createTime != null ">#{createTime},</if>
|
<if test="endTime != null ">#{endTime},</if>
|
<if test="dataResouce != null and dataResouce != ''">#{dataResouce},</if>
|
<if test="isDeleted != null and isDeleted != ''">#{isDeleted},</if>
|
</trim>
|
</insert>
|
|
<update id="updateCollectStatistics" parameterType="CollectStatistics">
|
update js_collect_statistics
|
<trim prefix="SET" suffixOverrides=",">
|
<if test="companyId != null and companyId != ''">company_id = #{companyId},</if>
|
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
|
<if test="projectNum != null ">project_num = #{projectNum},</if>
|
<if test="holeNum != null ">hole_num = #{holeNum},</if>
|
<if test="exceptionProject != null ">exception_project = #{exceptionProject},</if>
|
<if test="exceptionNum != null ">exception_num = #{exceptionNum},</if>
|
<if test="jinchiNum != null ">jinchi_num = #{jinchiNum},</if>
|
<if test="province != null and province != ''">province = #{province},</if>
|
<if test="district != null and district != ''">district = #{district},</if>
|
<if test="createTime != null ">create_time = #{createTime},</if>
|
<if test="endTime != null ">end_time = #{endTime},</if>
|
<if test="dataResouce != null and dataResouce != ''">data_resouce = #{dataResouce},</if>
|
<if test="isDeleted != null and isDeleted != ''">is_deleted = #{isDeleted},</if>
|
</trim>
|
where ids = #{ids}
|
</update>
|
|
<delete id="deleteCollectStatisticsById" parameterType="String">
|
delete from js_collect_statistics where ids = #{ids}
|
</delete>
|
|
<delete id="deleteCollectStatisticsByIds" parameterType="String">
|
delete from js_collect_statistics where ids in
|
<foreach item="ids" collection="array" open="(" separator="," close=")">
|
#{ids}
|
</foreach>
|
</delete>
|
|
<delete id="emptyTable">
|
delete from js_collect_statistics
|
</delete>
|
|
</mapper>
|