| | |
| | | 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> pages = equipmentService.selectDeptPages(Condition.getPage(query), equipment, pid); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | //子节点 |
| | | 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); |
| | | // } |
| | | |
| | | |
| | | return R.status(equipmentService.saveOrUpdate(equipment)); |
| | |
| | | |
| | | 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}) |
| | |
| | | |
| | | 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()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取部门树形结构 |
| | | * |
| | | * @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; |