| | |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.hx.common.BaseController; |
| | | import com.hx.mybatisTool.SqlSentence; |
| | | import com.hx.phiappt.model.Appointment; |
| | | import com.hx.phiappt.model.BaseEntity; |
| | | import com.hx.phip.dao.mapper.EmployeeMapper; |
| | | import com.hx.phip.entity.UserList; |
| | |
| | | Map<String,Object> values = new HashMap<>(); |
| | | values.put("isDel", BaseEntity.NO); |
| | | StringBuilder sql = new StringBuilder(); |
| | | sql.append("SELECT u.id,u.name,u.CIQ,u.tel,u.apiId,u.imgUrl,u.gender,DATE_FORMAT(u.createTime,'%Y-%m-%d %H:%i:%S') AS createTim" + |
| | | sql.append("SELECT u.id,u.name,u.CIQ,u.tel,u.apiId,u.imgUrl,u.gender,DATE_FORMAT(u.createTime,'%Y-%m-%d %H:%i:%S') AS createTime" + |
| | | ",(SELECT un.unionId FROM user_union_his un WHERE un.isDel = #{m.isDel} AND un.userId = u.id LIMIT 1) AS unionId" + |
| | | " FROM user u WHERE u.isDel = #{m.isDel}"); |
| | | if (StringUtils.noNull(userList.getTel())){ |
| | |
| | | if (StringUtils.noNull(userList.getProjectName())){ |
| | | //用户做过的项目 |
| | | values.put("projectName","%"+userList.getProjectName()+"%"); |
| | | sql.append(" AND (SELECT * FROM project p WHERE p.isDel = #{m.isDel} AND p.name LIKE #{m.projectName})"); |
| | | values.put("isArrive",Appointment.YES); |
| | | sql.append(" AND (SELECT COUNT(*) FROM appointment_project pp JOIN appointment ap ON ap.isDel = #{m.isDel} AND ap.status = #{m.status}" + |
| | | " AND ap.isArrive = #{m.isArrive} JOIN project p ON p.id = pp.projectId AND p.name LIKE #{m.projectName} WHERE pp.isDel = #{m.isDel} AND ap.userId = u.id) > 0"); |
| | | //sql.append(" AND (SELECT COUNT(*) FROM appointment ap WHERE ap.isDel = #{m.isDel} AND ap.userId = u.id AND ap.status = #{m.status} AND ap.isArrive = #{m.isArrive})"); |
| | | } |
| | | if (StringUtils.noNull(userList.getConsumeStartTime())){ |
| | | DateHandleTool.timeCheck(userList.getConsumeStartTime(),"yyyy-MM-dd HH:mm:dd"); |
| | | //消费时间段 |
| | | values.put("userLevel","%"+userList.getConsumeStartTime()+"%"); |
| | | sql.append(" AND u.userLevel = #{m.userLevel}"); |
| | | } |
| | | if (StringUtils.noNull(userList.getConsumeEndTime())){ |
| | | //消费时间段 |
| | | values.put("userLevel","%"+userList.getConsumeEndTime()+"%"); |
| | | sql.append(" AND u.userLevel = #{m.userLevel}"); |
| | | values.put("status", Appointment.STATUS_SUC); |
| | | values.put("consumeStartTime", userList.getConsumeStartTime()); |
| | | sql.append(" AND (SELECT COUNT(*) FROM appointment ap WHERE ap.isDel = #{m.isDel} AND ap.userId = u.id AND ap.status = #{m.status} AND #{m.consumeStartTime} <= ap.createTime"); |
| | | if (StringUtils.noNull(userList.getConsumeEndTime())){ |
| | | DateHandleTool.timeCheck(userList.getConsumeEndTime(),"yyyy-MM-dd HH:mm:dd"); |
| | | //消费时间段 |
| | | values.put("consumeEndTime",userList.getConsumeEndTime()); |
| | | sql.append(" AND ap.createTime <= #{m.consumeEndTime}) > 0"); |
| | | }else{ |
| | | sql.append(") > 0"); |
| | | } |
| | | }else{ |
| | | if (StringUtils.noNull(userList.getConsumeEndTime())){ |
| | | //消费时间段 |
| | | values.put("status", Appointment.STATUS_SUC); |
| | | values.put("consumeEndTime", userList.getConsumeEndTime()); |
| | | sql.append(" AND (SELECT * FROM appointment ap WHERE ap.isDel = #{m.isDel} AND ap.status = #{m.status} AND #{m.consumeEndTime} >= ap.createTime) > 0"); |
| | | } |
| | | } |
| | | |
| | | if (StringUtils.noNull(userList.getCreateStartTime())){ |