| | |
| | | <result column="monitor_point_id" jdbcType="INTEGER" property="monitorPointId" /> |
| | | <result column="device_version_id" jdbcType="INTEGER" property="deviceVersionId" /> |
| | | <association property="operateUser" javaType="com.moral.entity.OperateUser"> |
| | | <result column="operate_user_id" property="id" jdbcType="INTEGER" /> |
| | | <result column="operate_user_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="id" property="id" jdbcType="INTEGER" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | </association> |
| | | <association property="deviceVersion" javaType="com.moral.entity.DeviceVersion"> |
| | | <result column="device_version_id" property="id" jdbcType="INTEGER" /> |
| | | <result column="device_version_value" property="version" jdbcType="INTEGER" /> |
| | | <result column="device_version_name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="id" property="id" jdbcType="INTEGER" /> |
| | | <result column="version" property="version" jdbcType="INTEGER" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | </association> |
| | | <association property="monitorPoint" javaType="com.moral.entity.MonitorPoint"> |
| | | <result column="monitor_point_id" property="id" jdbcType="INTEGER" /> |
| | | <result column="monitor_point_name" property="name" jdbcType="VARCHAR" /> |
| | | <association property="monitorpointDetail" javaType="com.moral.entity.MonitorPoint"> |
| | | <result column="id" property="id" jdbcType="INTEGER" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | </association> |
| | | </resultMap> |
| | | <sql id="Example_Where_Clause"> |
| | |
| | | id, name, address, longitude, latitude, mac, operate_user_id, state, is_delete, create_time, |
| | | install_time, monitor_point_id, device_version_id |
| | | </sql> |
| | | <select id="countByTimes" resultType="java.util.Map"> |
| | | select DATE_FORMAT(create_time,#{format}) as time, COUNT(*) as count from device |
| | | where create_time >= #{start} |
| | | and create_time |
| | | <![CDATA[ |
| | | <= |
| | | ]]> #{end} |
| | | and is_delete <![CDATA[ |
| | | <> |
| | | ]]> 1 |
| | | GROUP BY DATE_FORMAT(create_time,#{format}) ; |
| | | </select> |
| | | <select id="selectWithRelationData" parameterType="tk.mybatis.mapper.entity.Example" resultMap="BaseResultMap"> |
| | | select |
| | | dev.*, |
| | |
| | | <collection property="organizationIds" column="id" select="selectOrganizationIds"></collection> |
| | | </resultMap> |
| | | <!-- resultMap引用 --> |
| | | <select id="selectOrganizationIds" resultType="INTEGER"> |
| | | call proc_organization_id_select(#{id,jdbcType=INTEGER}); |
| | | <select id="selectOrganizationIds" resultType="java.lang.Integer"> |
| | | call proc_organizationIds_GetByDeviceId(#{id,jdbcType=INTEGER}); |
| | | </select> |
| | | <select id="selectWithOrgIdsByMac" parameterType="java.lang.String" resultMap="BaseResultWithOrgIdsMap"> |
| | | select |
| | |
| | | from device |
| | | where mac = #{mac,jdbcType=VARCHAR} |
| | | </select> |
| | | |
| | | <select id="getDeviceCountByRegion" resultType="java.lang.Integer"> |
| | | SELECT |
| | | COUNT( * ) |
| | | FROM |
| | | device d |
| | | WHERE |
| | | d.is_delete = 0 |
| | | AND d.monitor_point_id IN ( |
| | | SELECT |
| | | mp.id |
| | | FROM |
| | | monitor_point mp |
| | | WHERE |
| | | mp.is_delete = 0 |
| | | <if test="provinceCode != null"> |
| | | AND mp.province_code = #{provinceCode} |
| | | </if> |
| | | <if test="cityCode != null"> |
| | | AND mp.city_code = #{cityCode} |
| | | </if> |
| | | <if test="areaCode != null"> |
| | | AND mp.area_code = #{areaCode} |
| | | </if> |
| | | ) |
| | | </select> |
| | | </mapper> |