Merge remote-tracking branch 'origin/master'
| | |
| | | ) b |
| | | on |
| | | a.click_date = b.datetime |
| | | order by a.click_date asc |
| | | </select> |
| | | |
| | | |
| | |
| | | ) b |
| | | on |
| | | a.click_date = b.datetime |
| | | order by a.click_date asc |
| | | </select> |
| | | </mapper> |
| | |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.jfpt.equipment.wrapper.EqWrapper; |
| | | import org.springblade.system.user.entity.User; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 自定义分页(部门挂接) |
| | | */ |
| | | @GetMapping("/pageDept") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入equipment") |
| | | public R<IPage<EquipmentVO>> pageDept(EquipmentVO equipment, Query query, String pid, HttpServletResponse response) throws ParseException { |
| | | response.setHeader("Access-Control-Allow-Origin", "*"); |
| | | response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); |
| | | response.setHeader("Access-Control-Allow-Credentials", "true"); |
| | | |
| | | IPage<EquipmentVO> page = equipmentService.selectDeptPages(Condition.getPage(query), equipment, pid); |
| | | |
| | | for (int j = 0; j < page.getRecords().size(); j++) { |
| | | String expireTime = page.getRecords().get(j).getExpireTime(); |
| | | //1.获取当前时间 |
| | | Date dd = new Date(); |
| | | SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | String end = sim.format(dd); |
| | | //把string类型转换为long类型的 |
| | | |
| | | if (expireTime != null){ |
| | | long st = sim.parse(expireTime).getTime(); |
| | | long en = sim.parse(end).getTime(); |
| | | //计算天数 |
| | | int day = (int) ((st - en) / 86400000); |
| | | if (day <= 30) { |
| | | page.getRecords().get(j).setType(1); |
| | | } else { |
| | | page.getRecords().get(j).setType(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return R.data(page); |
| | | } |
| | | |
| | | |
| | | //子节点 |
| | | private static List childMenu = new ArrayList(); |
| | | |
| | |
| | | equipment.setHeartbeat(null); |
| | | } |
| | | |
| | | String deviceName = equipment.getDeviceName(); |
| | | String deviceNumber = equipment.getDeviceNumber(); |
| | | String pId = equipment.getPid(); |
| | | if (equipment.getId() == null){ |
| | | catalogService.addCatalog(deviceName,deviceNumber,pId); |
| | | }else{ |
| | | catalogService.updateCatalog(deviceName,deviceNumber,pId); |
| | | } |
| | | // String deviceName = equipment.getDeviceName(); |
| | | // String deviceNumber = equipment.getDeviceNumber(); |
| | | // String pId = equipment.getPid(); |
| | | // if (equipment.getId() == null){ |
| | | // catalogService.addCatalog(deviceName,deviceNumber,pId); |
| | | // }else{ |
| | | // catalogService.updateCatalog(deviceName,deviceNumber,pId); |
| | | // } |
| | | |
| | | |
| | | System.out.println(equipment.getDeptId()); |
| | | return R.status(equipmentService.saveOrUpdate(equipment)); |
| | | } |
| | | |
| | |
| | | private String state; |
| | | private String reason; |
| | | |
| | | @TableField("deptId") |
| | | private String deptId; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | List<EquipmentVO> selectEquipmentPage(IPage page, EquipmentVO equipment,List childList); |
| | | |
| | | List<EquipmentVO> selectDeptPages(IPage page, EquipmentVO equipment,List childList); |
| | | |
| | | void s(Equipment equipment); |
| | | void updateOne(Equipment equipment); |
| | | void updataType(String arr); |
| | |
| | | |
| | | </select> |
| | | |
| | | <select id="selectDeptPages" resultMap="equipmentResultMap"> |
| | | select equipment.id,equipment.deviceName,equipment.deviceNumber,equipment.deviceType,equipment.ownership |
| | | ,equipment.ownerId,equipment.devicestate,equipment.stime,equipment.dtype,equipment.heartbeat,equipment.expireTime, |
| | | equipment.parent_id,equipment.district,equipment.province,equipment.city,equipment.serialNumber,equipment.channelNumber, |
| | | equipment.jd , |
| | | equipment.wd , |
| | | equipment.state,equipment.reason, |
| | | equipment.street,catalog.pid, |
| | | equipment.oneContacts,equipment.onePhone,equipment.oneId, |
| | | equipment.twoContacts,equipment.twoPhone,equipment.twoId, |
| | | equipment.ThreeContacts,equipment.ThreePhone,equipment.threeId, |
| | | equipment.deptId, |
| | | equipment.addvcd,equipment.pay,equipment.expireTime from sys_equipment equipment |
| | | left join sys_catalog catalog on catalog.eqid = equipment.deviceNumber |
| | | |
| | | where 1=1 |
| | | |
| | | <if test="equipment.deviceName!=null"> |
| | | and (deviceName like concat('%',#{equipment.deviceName},'%') or deviceNumber like |
| | | concat('%',#{equipment.deviceName},'%')) |
| | | </if> |
| | | |
| | | <if test="equipment.beginTime!=null and equipment.beginTime!=''"> |
| | | and expireTime>=#{equipment.beginTime} |
| | | </if> |
| | | <if test="equipment.endTime!=null and equipment.endTime!=''"> |
| | | and expireTime<=#{equipment.endTime} |
| | | </if> |
| | | |
| | | <if test="equipment.district!=null"> |
| | | and district like concat('%',#{equipment.district},'%') |
| | | </if> |
| | | <if test="equipment.province!=null"> |
| | | and province like concat('%',#{equipment.province},'%') |
| | | </if> |
| | | <if test="equipment.city!=null"> |
| | | and city like concat('%',#{equipment.city},'%') |
| | | </if> |
| | | |
| | | <if test="equipment.devicestate!=null"> |
| | | and devicestate =#{equipment.devicestate} |
| | | </if> |
| | | |
| | | <if test="equipment.dtype!=null"> |
| | | and dtype=#{equipment.dtype} |
| | | </if> |
| | | |
| | | <if test="childList!=null and childList.size>0"> |
| | | and deptId in |
| | | <foreach collection="childList" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | <!--新增--> |
| | | <insert id="s" parameterType="org.springblade.jfpt.equipment.entity.Equipment"> |
| | | INSERT INTO sys_equipment (deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,coordinate,parent_id,jd,wd,addvcd,street,dtype) VALUES (#{deviceName},#{deviceNumber},#{deviceType},#{ownership},#{yname},#{devicestate},#{stime},POINT(#{jd},#{wd}),#{parentId},#{jd},#{wd},#{addvcd},#{streeName},#{dtype}) |
| | |
| | | update sys_equipment SET devicestate = 0 where id in (${arr}) |
| | | </update> |
| | | |
| | | <update id="updateOnes" parameterType="org.springblade.jfpt.equipment.entity.Equipment"> |
| | | update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType}, |
| | | ownership=#{ownership},ownerId=#{yname},devicestate=#{devicestate},stime=#{stime}, |
| | | coordinate=POINT(#{jd},#{wd}),parent_id=#{parentId},jd=#{jd},wd=#{wd},addvcd=#{addvnm},street=#{streeName},dtype=#{dtype} where id=#{id} |
| | | </update> |
| | | |
| | | |
| | | <select id="selectInfo" resultMap="deptVOResultMap" |
| | | parameterType="org.springblade.jfpt.equipment.entity.Equipment"> |
| | | SELECT |
| | | dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership, |
| | | dept.deptId,dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership, |
| | | dept.ownerId,dept.devicestate,dept.stime,dept.district,dept.province,dept.city, |
| | | ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,dept.expireTime,dept.heartbeat, dept.state,dept.reason, |
| | | dept.parent_id,dept.jd,dept.wd,dept.street,u.yname,d.addvnm,dept.addvcd,dept.serialNumber,dept.channelNumber, |
| | | dept.oneContacts,dept.onePhone,dept.oneId, |
| | | dept.twoContacts,dept.twoPhone,dept.twoId, |
| | | dept.ThreeContacts,dept.ThreePhone,dept.threeId, |
| | | ( |
| | | SELECT |
| | | CASE WHEN count(1) > 0 THEN 1 ELSE 0 END |
| | |
| | | |
| | | IPage<EquipmentVO> selectEquipmentPage(IPage<EquipmentVO> page, EquipmentVO equipment,List childList); |
| | | IPage<EquipmentVO> selectPage(IPage<EquipmentVO> page, EquipmentVO equipment,String pid); |
| | | |
| | | |
| | | IPage<EquipmentVO> selectDeptPages(IPage<EquipmentVO> page, EquipmentVO equipment,String pid); |
| | | |
| | | /** |
| | | * 树形结构 |
| | | * |
| | |
| | | import org.springblade.jfpt.equipment.service.IEquipmentService; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVO; |
| | | import org.springblade.jfpt.equipment.vo.EquipmentVOS; |
| | | import org.springblade.system.cache.SysCache; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | return page.setRecords(baseMapper.selectEquipmentPage(page,equipment,null)); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public IPage<EquipmentVO> selectDeptPages(IPage<EquipmentVO> page, EquipmentVO equipment,String pid) { |
| | | |
| | | List deptIdList; |
| | | if (!pid.equals("")){ |
| | | deptIdList = SysCache.getDeptChildIds(Long.valueOf(pid)); |
| | | }else{ |
| | | deptIdList = SysCache.getDeptChildIds(null); |
| | | } |
| | | return page.setRecords(baseMapper.selectDeptPages(page,equipment,deptIdList)); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public List<EquipmentVOS> tree() { |
| | | return ForestNodeMerger.merge(baseMapper.tree()); |
| | |
| | | private String oneId; |
| | | private String twoId; |
| | | private String threeId; |
| | | private String deptId; |
| | | |
| | | } |
| | |
| | | ) b |
| | | on |
| | | a.click_date = b.datetime |
| | | order by a.click_date asc |
| | | </select> |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树形结构 |
| | | * |
| | | * @return |
| | | */ |
| | | @GetMapping("/trees") |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "树形结构", notes = "树形结构") |
| | | public R<List<DeptVO>> trees(String tenantId, BladeUser bladeUser) { |
| | | List<DeptVO> tree = deptService.trees(); |
| | | return R.data(tree); |
| | | } |
| | | |
| | | /** |
| | | * 懒加载获取部门树形结构 |
| | | */ |
| | | @GetMapping("/lazy-tree") |
| | |
| | | List<DeptVO> tree(String tenantId); |
| | | |
| | | /** |
| | | * 获取树形节点 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<DeptVO> trees(); |
| | | |
| | | /** |
| | | * 懒加载获取树形节点 |
| | | * |
| | | * @param tenantId |
| | |
| | | ORDER BY sort |
| | | </select> |
| | | |
| | | <select id="trees" resultMap="treeNodeResultMap"> |
| | | select id, parent_id, dept_name as title, id as "value", id as "key" from blade_dept where is_deleted = 0 |
| | | ORDER BY sort |
| | | </select> |
| | | |
| | | <select id="lazyTree" resultMap="treeNodeResultMap" > |
| | | SELECT |
| | | dept.id, |
| | |
| | | List<DeptVO> tree(String tenantId); |
| | | |
| | | /** |
| | | * 树形结构 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<DeptVO> trees(); |
| | | |
| | | |
| | | /** |
| | | * 懒加载树形结构 |
| | | * |
| | | * @param tenantId |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> trees() { |
| | | return ForestNodeMerger.merge(baseMapper.trees()); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeptVO> lazyTree(String tenantId, Long parentId) { |
| | | if (AuthUtil.isAdministrator()) { |
| | | tenantId = StringPool.EMPTY; |
| | |
| | | @ApiOperation(value = "列表", notes = "传入account和realName") |
| | | //@PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | public R<IPage<UserVO>> pages(@ApiIgnore User user, Query query, Long deptId, BladeUser bladeUser) { |
| | | IPage<User> pages = userService.selectUserPages(Condition.getPage(query), user, deptId, (bladeUser.getTenantId().equals(BladeConstant.ADMIN_TENANT_ID) ? StringPool.EMPTY : bladeUser.getTenantId())); |
| | | IPage<User> pages = userService.selectUserPages(Condition.getPage(query), user, deptId); |
| | | return R.data(UserWrapper.build().pageVO(pages)); |
| | | } |
| | | |
| | |
| | | * @param page |
| | | * @param user |
| | | * @param deptIdList |
| | | * @param tenantId |
| | | * @param |
| | | * @return |
| | | */ |
| | | List<User> selectUserPages(IPage<User> page, @Param("user") User user, @Param("deptIdList") List<Long> deptIdList, @Param("tenantId") String tenantId); |
| | | List<User> selectUserPages(IPage<User> page, @Param("user") User user, @Param("deptIdList") List<Long> deptIdList); |
| | | |
| | | /** |
| | | * 获取用户 |
| | |
| | | LEFT JOIN jfpt.sys_position p ON p.snumber = s.CODE |
| | | LEFT JOIN jfpt.sys_enclosure e ON e.anumber = s.CODE |
| | | |
| | | where is_deleted = 0 |
| | | <if test="tenantId!=null and tenantId != ''"> |
| | | and tenant_id = #{tenantId} |
| | | </if> |
| | | <if test="user.tenantId!=null and user.tenantId != ''"> |
| | | and tenant_id = #{user.tenantId} |
| | | </if> |
| | | where s.is_deleted = 0 |
| | | <if test="user.account!=null and user.account != ''"> |
| | | and account = #{user.account} |
| | | and s.account = #{user.account} |
| | | </if> |
| | | <if test="user.realName!=null and user.realName != ''"> |
| | | and real_name = #{user.realName} |
| | | and s.real_name = #{user.realName} |
| | | </if> |
| | | <if test="user.userType!=null and user.userType != ''"> |
| | | and user_type = #{user.userType} |
| | | and s.user_type = #{user.userType} |
| | | </if> |
| | | <if test="deptIdList!=null and deptIdList.size>0"> |
| | | and id in ( |
| | | and s.id in ( |
| | | SELECT |
| | | user_id |
| | | FROM |
| | |
| | | * @param page |
| | | * @param user |
| | | * @param deptId |
| | | * @param tenantId |
| | | * @param |
| | | * @return |
| | | */ |
| | | IPage<User> selectUserPages(IPage<User> page, User user, Long deptId, String tenantId); |
| | | IPage<User> selectUserPages(IPage<User> page, User user, Long deptId); |
| | | |
| | | /** |
| | | * 用户信息 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<User> selectUserPages(IPage<User> page, User user, Long deptId, String tenantId) { |
| | | public IPage<User> selectUserPages(IPage<User> page, User user, Long deptId) { |
| | | List<Long> deptIdList = SysCache.getDeptChildIds(deptId); |
| | | return page.setRecords(baseMapper.selectUserPages(page, user, deptIdList, tenantId)); |
| | | return page.setRecords(baseMapper.selectUserPages(page, user, deptIdList)); |
| | | } |
| | | |
| | | @Override |