12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?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.fdkankan.agent.mapper.ICameraMapper">
- <select id="pageList" resultType="com.fdkankan.agent.response.CameraDetailVo">
- select c.id ,c.sn_code,c.activated_time ,d.create_time as outTime ,d.type,d.own as outType ,u.user_name, c.wifi_name,
- d.order_sn,ui.is_expired as incrementStatus,ui.increment_type_id ,ui.increment_end_time
- from t_camera c
- left join t_camera_detail d on c.id = d.camera_id
- left join t_user u on d.user_id = u.id and u.rec_status = 'A'
- left join t_user_increment ui on d.camera_id = ui.camera_id and ui.rec_status = 'A'
- where c.rec_status = 'A'
- <if test="param.userId !=null ">
- and d.user_id = #{param.userId}
- </if>
- <if test="param.type !=null ">
- and d.type = #{param.type}
- </if>
- <if test="param.snCode !=null and param.snCode != '' ">
- and c.sn_code like concat ('%',#{param.snCode},'%')
- </if>
- <if test="param.userName !=null and param.userName != '' ">
- and u.user_name like concat('%',#{param.userName},'%')
- </if>
- <if test="param.bindStatus !=null and param.bindStatus == 0">
- and d.user_id is null
- </if>
- <if test="param.bindStatus !=null and param.bindStatus == 1">
- and d.user_id is not null
- </if>
- <if test="param.incrementStatus !=null ">
- and ui.is_expired = #{param.incrementStatus}
- </if>
- <if test="param.incrementTypeId !=null ">
- and ui.increment_type_id = #{param.incrementTypeId}
- </if>
- <if test="param.cameraIds != null and param.cameraIds.size >0">
- and d.camera_id in
- <foreach collection="param.cameraIds" item="cameraIds" open="(" separator="," close=")">
- #{cameraIds}
- </foreach>
- </if>
- order by d.out_time desc,d.id desc
- </select>
- <select id="getBySnCodeAndAgentId" resultType="com.fdkankan.agent.entity.Camera">
- select c.* from t_camera c left join t_camera_detail d on c.id = d.camera_id
- where c.sn_code = #{snCode} and d.agent_id = #{agentId}
- </select>
- </mapper>
|